SWDEV-280089 - nullptr was getting added into MemObj

Change-Id: Ica56126156198140a143182de3d93d86730cadf1
Cette révision appartient à :
Sarbojit Sarkar
2021-04-05 05:14:13 -07:00
Parent 21ea81d5b9
révision d8d6c4e55d
+6 -4
Voir le fichier
@@ -1889,13 +1889,13 @@ void* Device::hostAlloc(size_t size, size_t alignment, MemorySegment mem_seg) co
hsa_status_t stat = hsa_amd_memory_pool_allocate(segment, size, 0, &ptr);
ClPrint(amd::LOG_DEBUG, amd::LOG_MEM, "Allocate hsa host memory %p, size 0x%zx", ptr, size);
if (stat != HSA_STATUS_SUCCESS) {
LogError("Fail allocation host memory");
LogPrintfError("Fail allocation host memory with err %d", stat);
return nullptr;
}
stat = hsa_amd_agents_allow_access(gpu_agents_.size(), &gpu_agents_[0], nullptr, ptr);
if (stat != HSA_STATUS_SUCCESS) {
LogError("Fail hsa_amd_agents_allow_access");
LogPrintfError("Fail hsa_amd_agents_alloc_access with err %d", stat);
hostFree(ptr, size);
return nullptr;
}
@@ -2218,8 +2218,10 @@ void* Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_
// if the device supports SVM FGS, return the committed CPU address directly.
Memory* gpuMem = getRocMemory(mem);
// add the information to context so that we can use it later.
amd::MemObjMap::AddMemObj(mem->getSvmPtr(), mem);
if (mem->getSvmPtr() != nullptr) {
// add the information to context so that we can use it later.
amd::MemObjMap::AddMemObj(mem->getSvmPtr(), mem);
}
svmPtr = mem->getSvmPtr();
} else {
// Find the existing amd::mem object