From 5e3a29078d78a78b06f3e9ca3795faa5bc1442e6 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Mon, 23 Dec 2024 11:47:23 +0000 Subject: [PATCH 1/2] SWDEV-505503 - Use internal device synchronize function in __hipUnregisterFatBinary This is to avoid calling the HIP_INIT macro during the shutdown process. Change-Id: I2e65f6e10491918a17445ee1e8ddd08286070358 --- hipamd/src/hip_platform.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hipamd/src/hip_platform.cpp b/hipamd/src/hip_platform.cpp index 40de044b10..fcb3540e5e 100644 --- a/hipamd/src/hip_platform.cpp +++ b/hipamd/src/hip_platform.cpp @@ -185,10 +185,14 @@ void __hipRegisterTexture( } void __hipUnregisterFatBinary(hip::FatBinaryInfo** modules) { - // By calling hipDeviceSynchronize ensure that all HSA signal handlers - // complete before removeFatBinary static std::once_flag unregister_device_sync; - std::call_once(unregister_device_sync, hipDeviceSynchronize); + std::call_once(unregister_device_sync, [](){ + for (auto& hipDevice : g_devices) { + // By synchronizing devices ensure that all HSA signal handlers + // complete before removeFatBinary + hipDevice->SyncAllStreams(true); + } + }); hipError_t err = PlatformState::instance().removeFatBinary(modules); guarantee((err == hipSuccess), "Cannot Unregister Fat Binary, error:%d", err); } From 21d764518363d74187deaef2e66c1a127bc5aa64 Mon Sep 17 00:00:00 2001 From: Sourabh Betigeri Date: Mon, 13 Jan 2025 15:21:28 -0800 Subject: [PATCH 2/2] SWDEV-507104 - Removes alignment requirement for Semaphore class to resolve runtime misaligned memory issues Change-Id: I1be3eb6e9fdcf12e995c8fe8ee30592c94f7f97a --- rocclr/thread/semaphore.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rocclr/thread/semaphore.hpp b/rocclr/thread/semaphore.hpp index f2fa81e1f5..0615af0f83 100644 --- a/rocclr/thread/semaphore.hpp +++ b/rocclr/thread/semaphore.hpp @@ -42,7 +42,7 @@ namespace amd { class Thread; //! \brief Counting semaphore -class alignas(64) Semaphore : public HeapObject { +class Semaphore : public HeapObject { private: std::atomic_int state_; //!< This semaphore's value. @@ -67,9 +67,6 @@ class alignas(64) Semaphore : public HeapObject { void reset() { state_.store(0, std::memory_order_release); } }; -static_assert(sizeof(Semaphore) == 64 , - "unexpected total size of Semaphore"); - /*! @} * @} */