SWDEV-466747 - call device sync once while unregistering

Basically embed hipDeviceSync in std::call_once.

Change-Id: I29ca926d61ed80e21acba5c388a8256d913487e4
Этот коммит содержится в:
Jatin Chaudhary
2024-07-25 15:10:23 +01:00
коммит произвёл Rakesh Roy
родитель 29cc678d8d
Коммит f8beeede22
+5 -5
Просмотреть файл
@@ -26,6 +26,8 @@
#include "platform/runtime.hpp"
#include <unordered_map>
#include <mutex>
namespace hip {
constexpr unsigned __hipFatMAGIC2 = 0x48495046; // "HIPF"
@@ -177,11 +179,9 @@ void __hipRegisterTexture(
void __hipUnregisterFatBinary(hip::FatBinaryInfo** 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);
static std::once_flag unregister_device_sync;
std::call_once(unregister_device_sync, hipDeviceSynchronize);
hipError_t err = PlatformState::instance().removeFatBinary(modules);
guarantee((err == hipSuccess), "Cannot Unregister Fat Binary, error:%d", err);
}