diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index 2b3dec2b0c..88456f4466 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -994,7 +994,10 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) // Since the amd::Memory object is shared between all devices // it's fine to have multiple addresses mapped to it const device::Memory* devMem = mem->getDeviceMemory(*device->devices()[0]); - amd::MemObjMap::AddMemObj(reinterpret_cast(devMem->virtualAddress()), mem); + void* vAddr = reinterpret_cast(devMem->virtualAddress()); + if (amd::MemObjMap::FindMemObj(vAddr) == nullptr) { + amd::MemObjMap::AddMemObj(vAddr, mem); + } } amd::MemObjMap::AddMemObj(hostPtr, mem);