SWDEV-322620 - Virtual Memory Management

Implemented hipMemMap and hipMemUnmap

Change-Id: Idc75e3964d88e375e445733557cfa8e421688f1f


[ROCm/clr commit: 6d73282f25]
Tá an tiomantas seo le fáil i:
Christophe Paquot údaraithe agus Christophe Paquot tiomanta 2022-04-28 02:14:14 -04:00
1 tuismitheoir 558467643d
tiomantas c2b3dd7dc5
2 comhad athraithe
+22

Níor tháinig aon chomhaid le do chuardach

+21
Féach ar an gComhad
@@ -193,6 +193,18 @@ hipError_t hipMemMap(void* ptr, size_t size, size_t offset, hipMemGenericAllocat
HIP_RETURN(hipErrorInvalidValue);
}
hip::GenericAllocation* ga = reinterpret_cast<hip::GenericAllocation*>(handle);
auto& queue = *g_devices[ga->GetProperties().location.id]->NullStream();
amd::Command* cmd = new amd::VirtualMapCommand(queue, amd::Command::EventWaitList{}, ptr, size, &ga->asAmdMemory());
cmd->enqueue();
cmd->awaitCompletion();
cmd->release();
amd::Memory* va = amd::MemObjMap::FindMemObj(ptr);
va->getUserData().deviceId = ga->GetProperties().location.id;
HIP_RETURN(hipSuccess);
}
@@ -244,6 +256,15 @@ hipError_t hipMemUnmap(void* ptr, size_t size) {
if (ptr == nullptr) HIP_RETURN(hipErrorInvalidValue);
amd::Memory* va = amd::MemObjMap::FindMemObj(ptr);
auto& queue = *g_devices[va->getUserData().deviceId]->NullStream();
amd::Command* cmd = new amd::VirtualMapCommand(queue, amd::Command::EventWaitList{}, ptr, size, nullptr);
cmd->enqueue();
cmd->awaitCompletion();
cmd->release();
HIP_RETURN(hipSuccess);
}