SWDEV-242337-Fix hipHostRegister test failure for MGPU

Change-Id: I748dac0c5a47fa00184f065d9ef716573aa70b12
This commit is contained in:
jujiang
2020-07-13 15:57:15 -04:00
committed by Julia Jiang
parent 3626372239
commit 3b7e1b928e
+8 -3
View File
@@ -725,9 +725,14 @@ hipError_t hipHostUnregister(void* hostPtr) {
amd::Memory* mem = getMemoryObject(hostPtr, offset);
if(mem) {
for (const auto& device: hip::getCurrentDevice()->devices()) {
const device::Memory* devMem = mem->getDeviceMemory(*device);
amd::MemObjMap::RemoveMemObj(reinterpret_cast<void*>(devMem->virtualAddress()));
for (const auto& device: g_devices) {
const device::Memory* devMem = mem->getDeviceMemory(*device->devices()[0]);
if (devMem != nullptr) {
void* vAddr = reinterpret_cast<void*>(devMem->virtualAddress());
if (amd::MemObjMap::FindMemObj(vAddr)) {
amd::MemObjMap::RemoveMemObj(vAddr);
}
}
}
amd::MemObjMap::RemoveMemObj(hostPtr);
mem->release();