SWDEV-353281 - Move VirtualMem map update to memobj

- The implementation in mempool graphs requires refcounting VA object.
That requires release() to update the map only on the actual destruction.
- Add GPU event tracking for paging operation. Otherwise, runtime
may not always flush IB.

Change-Id: Idf99ffb894321a38e04b490116a7ca435635918d
This commit is contained in:
German
2023-04-25 17:28:28 -04:00
committed by German Andryeyev
parent 22eae6ac9e
commit 7ef2da5aba
3 changed files with 30 additions and 21 deletions
+9 -4
View File
@@ -2190,8 +2190,7 @@ void VirtualGPU::submitStreamOperation(amd::StreamOperationCommand& cmd) {
profilingEnd(cmd);
}
// ================================================================================================
void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
// Make sure VirtualGPU has an exclusive access to the resources
amd::ScopedLock lock(execution());
@@ -2203,7 +2202,8 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
return;
}
pal::Memory* vaRange = dev().getGpuMemory(va);
Pal::IGpuMemory* memory = (vcmd.memory() == nullptr)? nullptr : dev().getGpuMemory(vcmd.memory())->iMem();
Pal::IGpuMemory* memory = (vcmd.memory() == nullptr) ?
nullptr : dev().getGpuMemory(vcmd.memory())->iMem();
Pal::VirtualMemoryRemapRange range{
vaRange->iMem(),
0,
@@ -2212,7 +2212,12 @@ void VirtualGPU::submitVirtualMap(amd::VirtualMapCommand& vcmd) {
vcmd.size(),
Pal::VirtualGpuMemAccessMode::NoAccess
};
Pal::Result result = queue(MainEngine).iQueue_->RemapVirtualMemoryPages(1, &range, false, nullptr);
eventBegin(MainEngine);
auto result = queue(MainEngine).iQueue_->RemapVirtualMemoryPages(1, &range, false, nullptr);
// Capture GPU event for the paging operation
GpuEvent event;
eventEnd(MainEngine, event);
setGpuEvent(event);
if (result == Pal::Result::Success) {
if (vcmd.memory() != nullptr) {
// assert the va wasn't mapped already