SWDEV-301069 - save device id during hipHostRegister

Change-Id: I789b2252fa1a131ed1924b47718e355cb4fc9037
This commit is contained in:
Ajay
2021-09-27 16:38:30 -04:00
committed by Ajay GunaShekar
parent 4cd4d2d280
commit 361dec890c
2 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -226,12 +226,12 @@ hipError_t ihipMallocManaged(void** ptr, size_t size, unsigned int align) {
// allocation in the device driver
*ptr = amd::SvmBuffer::malloc(ctx, CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_ALLOC_HOST_PTR,
size, (align == 0) ? dev.info().memBaseAddrAlign_ : align);
size_t offset = 0; //this is ignored
amd::Memory* memObj = getMemoryObject(*ptr, offset);
if (*ptr == nullptr) {
return hipErrorMemoryAllocation;
}
size_t offset = 0; //this is ignored
amd::Memory* memObj = getMemoryObject(*ptr, offset);
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();