Refactor: Change decanonize method accessing point

Accessing decanonize method as a member of GmmHelper class object

Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-04-25 19:34:32 +00:00
committed by Compute-Runtime-Automation
parent 7bb3bcbc05
commit 2fcda0a528
35 changed files with 147 additions and 91 deletions

View File

@@ -288,9 +288,9 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo
delete gfxAllocation;
return;
}
auto memoryAllocation = static_cast<MemoryAllocation *>(gfxAllocation);
auto sizeToFree = memoryAllocation->sizeToFree;
auto rootDeviceIndex = gfxAllocation->getRootDeviceIndex();
if (sizeToFree) {
auto gpuAddressToFree = GmmHelper::decanonize(memoryAllocation->getGpuAddress()) & ~MemoryConstants::pageMask;
@@ -303,8 +303,6 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo
releaseReservedCpuAddressRange(gfxAllocation->getReservedAddressPtr(), gfxAllocation->getReservedAddressSize(), gfxAllocation->getRootDeviceIndex());
}
auto rootDeviceIndex = gfxAllocation->getRootDeviceIndex();
if (executionEnvironment.rootDeviceEnvironments.size() > rootDeviceIndex) {
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
if (aubCenter && aubCenter->getAubManager() && DebugManager.flags.EnableFreeMemory.get()) {
@@ -453,7 +451,8 @@ AddressRange OsAgnosticMemoryManager::reserveGpuAddress(size_t size, uint32_t ro
void OsAgnosticMemoryManager::freeGpuAddress(AddressRange addressRange, uint32_t rootDeviceIndex) {
uint64_t graphicsAddress = addressRange.address;
graphicsAddress = GmmHelper::decanonize(graphicsAddress);
auto gmmHelper = getGmmHelper(rootDeviceIndex);
graphicsAddress = gmmHelper->decanonize(graphicsAddress);
auto gfxPartition = getGfxPartition(rootDeviceIndex);
gfxPartition->freeGpuAddressRange(graphicsAddress, addressRange.size);
}