From a3b6fd539fbf2b14a5dc9575e6cbe08833642282 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Wed, 20 Mar 2024 20:53:37 +0000 Subject: [PATCH] SWDEV-449146 - Call hipDeviceSynchronize before removeFatBinary Added call to hipDeviceSynchronize in __hipUnregisterFatBinary to ensure that all HSA async signal handlers complete before removeFatBinary Change-Id: I756fecca1c2a5eae092613d8079de266399e5685 [ROCm/clr commit: ad32e604c7f286a28d90e92d3936401c964d6de2] --- projects/clr/hipamd/src/hip_platform.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/src/hip_platform.cpp b/projects/clr/hipamd/src/hip_platform.cpp index e88458dc42..1d5e61dba3 100644 --- a/projects/clr/hipamd/src/hip_platform.cpp +++ b/projects/clr/hipamd/src/hip_platform.cpp @@ -175,7 +175,13 @@ void __hipRegisterTexture( } void __hipUnregisterFatBinary(hip::FatBinaryInfo** modules) { - hipError_t err = PlatformState::instance().removeFatBinary(modules); + // By calling hipDeviceSynchronize ensure that all HSA signal handlers + // complete before removeFatBinary + hipError_t err = hipDeviceSynchronize(); + if (err != hipSuccess) { + LogPrintfError("Error during hipDeviceSynchronize, error: %d", err); + } + err = PlatformState::instance().removeFatBinary(modules); guarantee((err == hipSuccess), "Cannot Unregister Fat Binary, error:%d", err); }