SWDEV-301069 - current device id saved while allocating memory

Change-Id: I57045119e7adf915074c547cbe76349a4cfd72d9


[ROCm/clr commit: 29adfcd3c0]
This commit is contained in:
agunashe
2021-09-08 11:01:02 -07:00
committed by Ajay GunaShekar
parent e7a40bf6f6
commit 0cf25d1fd3
2 changed files with 16 additions and 13 deletions
+5
View File
@@ -226,6 +226,11 @@ 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);
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
if (*ptr == nullptr) {
return hipErrorMemoryAllocation;
}