SWDEV-322620 - Virtual Memory Management

Introducing a VirtualMemObj map as it is needed to differentiate
between virtual address ranges and actual physical memory
This is because a whole VA range can have several physical memories
as chunks.

Change-Id: Ie2a972b4faf3f7d552cfa53e77898f80ad75740a
Cette révision appartient à :
Christophe Paquot a révisé 2022-06-06 11:32:22 -07:00
1 Parent 58aaa8472e
révision 905088e4e7
4 fichiers modifiés
+60 -4

Aucun fichier ne correspond à votre recherche

+12 -1
Voir le fichier
@@ -2129,7 +2129,7 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
amd::ScopedLock lock(execution());
profilingBegin(vcmd);
amd::Memory* va = amd::MemObjMap::FindMemObj(vcmd.ptr());
amd::Memory* va = amd::MemObjMap::FindVirtualMemObj(vcmd.ptr());
if (va == nullptr || !(va->getMemFlags() & CL_MEM_VA_RANGE_AMD)) {
profilingEnd(vcmd);
return;
@@ -2145,6 +2145,17 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
Pal::VirtualGpuMemAccessMode::NoAccess
};
Pal::Result result = queue(MainEngine).iQueue_->RemapVirtualMemoryPages(1, &range, false, nullptr);
if (result == Pal::Result::Success) {
if (vcmd.memory() != nullptr) {
// assert the va wasn't mapped already
assert(amd::MemObjMap::FindMemObj(vcmd.ptr()) == nullptr);
amd::MemObjMap::AddMemObj(vcmd.ptr(), vcmd.memory());
} else {
// assert the va is mapped and needs to be removed
assert(amd::MemObjMap::FindMemObj(vcmd.ptr()) != nullptr);
amd::MemObjMap::RemoveMemObj(vcmd.ptr());
}
}
profilingEnd(vcmd);
}