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); } 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"); - /*! @} * @} */