P4 to Git Change 1791519 by vsytchen@vsytchen-remote-ocl-win10 on 2019/06/04 10:06:43

SWDEV-189383 - [HIP CQE][HIPonPAL][WIN] hipDeviceMalloc, hip_test_ldg, hipHostRegister, hipModule, hipStreamSync2 tests failed on VEGA10.

	1. For pinned memory allocations add the host pointer and all of its respective device pointers to the memory object map.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#57 edit


[ROCm/clr commit: 9a301adffe]
Tento commit je obsažen v:
foreman
2019-06-04 10:24:11 -04:00
rodič 5067bf0fad
revize c10cebcf6f
+20
Zobrazit soubor
@@ -560,6 +560,22 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
mem->release();
HIP_RETURN(hipErrorMemoryAllocation);
}
std::vector<void*> devPtrs;
for (const auto& device: hip::getCurrentContext()->devices()) {
const device::Memory* devMem = mem->getDeviceMemory(*device);
if (devMem != nullptr) {
devPtrs.emplace_back(reinterpret_cast<void*>(devMem->virtualAddress()));
} else {
mem->release();
HIP_RETURN(hipErrorMemoryAllocation);
}
}
// Since the amd::Memory object is shared between all devices
// it's fine to have multiple addresses mapped to it
for (const auto& devPtr: devPtrs) {
amd::MemObjMap::AddMemObj(devPtr, mem);
}
amd::MemObjMap::AddMemObj(hostPtr, mem);
HIP_RETURN(hipSuccess);
} else {
@@ -582,6 +598,10 @@ hipError_t hipHostUnregister(void* hostPtr) {
if(mem) {
hip::syncStreams();
hip::getNullStream()->finish();
for (const auto& device: hip::getCurrentContext()->devices()) {
const device::Memory* devMem = mem->getDeviceMemory(*device);
amd::MemObjMap::RemoveMemObj(reinterpret_cast<void*>(devMem->virtualAddress()));
}
amd::MemObjMap::RemoveMemObj(hostPtr);
mem->release();
HIP_RETURN(hipSuccess);