Create getGmmHelper function in MemoryManager

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-05-09 12:51:13 +00:00
committed by Compute-Runtime-Automation
parent 518595dd97
commit 4f1e01d279
12 changed files with 37 additions and 33 deletions

View File

@@ -1072,7 +1072,7 @@ TEST(MemoryManagerTest, givenEnabledLocalMemoryWhenAllocatingSharedResourceCopyT
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[allocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager.getGmmHelper(allocation->getRootDeviceIndex());
EXPECT_LT(gmmHelper->canonize(memoryManager.getGfxPartition(allocation->getRootDeviceIndex())->getHeapBase(HeapIndex::HEAP_STANDARD64KB)), allocation->getGpuAddress());
EXPECT_GT(gmmHelper->canonize(memoryManager.getGfxPartition(allocation->getRootDeviceIndex())->getHeapLimit(HeapIndex::HEAP_STANDARD64KB)), allocation->getGpuAddress());
EXPECT_EQ(0llu, allocation->getGpuBaseAddress());

View File

@@ -1308,7 +1308,7 @@ TEST(OsAgnosticMemoryManager, givenDebugModuleAreaTypeWhenCreatingAllocationThen
EXPECT_LT(address64bit, MemoryConstants::max32BitAddress);
EXPECT_TRUE(moduleDebugArea->is32BitAllocation());
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[moduleDebugArea->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager.getGmmHelper(moduleDebugArea->getRootDeviceIndex());
auto frontWindowBase = gmmHelper->canonize(memoryManager.getGfxPartition(moduleDebugArea->getRootDeviceIndex())->getHeapBase(memoryManager.selectInternalHeap(moduleDebugArea->isAllocatedInLocalMemoryPool())));
EXPECT_EQ(frontWindowBase, moduleDebugArea->getGpuBaseAddress());
EXPECT_EQ(frontWindowBase, moduleDebugArea->getGpuAddress());
@@ -1346,7 +1346,7 @@ TEST(OsAgnosticMemoryManager, givenLocalMemoryAndDebugModuleAreaTypeWhenCreating
EXPECT_LT(address64bit, MemoryConstants::max32BitAddress);
EXPECT_TRUE(moduleDebugArea->is32BitAllocation());
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[moduleDebugArea->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager.getGmmHelper(moduleDebugArea->getRootDeviceIndex());
auto frontWindowBase = gmmHelper->canonize(memoryManager.getGfxPartition(moduleDebugArea->getRootDeviceIndex())->getHeapBase(memoryManager.selectInternalHeap(moduleDebugArea->isAllocatedInLocalMemoryPool())));
EXPECT_EQ(frontWindowBase, moduleDebugArea->getGpuBaseAddress());
EXPECT_EQ(frontWindowBase, moduleDebugArea->getGpuAddress());

View File

@@ -1362,10 +1362,11 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSipKernelTypeWhenAllocatingTh
auto sipAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
auto gpuAddress = sipAllocation->getGpuAddress();
EXPECT_LE(device->getGmmHelper()->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), gpuAddress);
EXPECT_GT(device->getGmmHelper()->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), gpuAddress);
EXPECT_EQ(device->getGmmHelper()->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), sipAllocation->getGpuBaseAddress());
EXPECT_EQ(device->getGmmHelper()->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)), sipAllocation->getGpuBaseAddress());
auto gmmHelper = device->getGmmHelper();
EXPECT_LE(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), gpuAddress);
EXPECT_GT(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), gpuAddress);
EXPECT_EQ(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_FRONT_WINDOW)), sipAllocation->getGpuBaseAddress());
EXPECT_EQ(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)), sipAllocation->getGpuBaseAddress());
EXPECT_EQ(MemoryPool::LocalMemory, sipAllocation->getMemoryPool());
memoryManager->freeGraphicsMemory(sipAllocation);

View File

@@ -235,7 +235,7 @@ HWTEST_F(WddmMemoryManagerSimpleTest, givenLinearStreamWhenItIsAllocatedThenItIs
auto &partition = wddm->getGfxPartition();
if (is64bit) {
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[graphicsAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(graphicsAllocation->getRootDeviceIndex());
if (executionEnvironment->rootDeviceEnvironments[graphicsAllocation->getRootDeviceIndex()]->isFullRangeSvm()) {
EXPECT_GE(gpuAddress, gmmHelper->canonize(partition.Standard64KB.Base));
EXPECT_LE(gpuAddressEnd, gmmHelper->canonize(partition.Standard64KB.Limit));

View File

@@ -730,7 +730,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
EXPECT_TRUE(gpuAllocation->is32BitAllocation());
uint64_t base = memoryManager->getExternalHeapBaseAddress(gpuAllocation->getRootDeviceIndex(), gpuAllocation->isAllocatedInLocalMemoryPool());
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[gpuAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(gpuAllocation->getRootDeviceIndex());
EXPECT_EQ(gmmHelper->canonize(base), gpuAllocation->getGpuBaseAddress());
}
@@ -1158,7 +1158,7 @@ TEST_F(WddmMemoryManagerTest, GivenNullptrWhenAllocating32BitMemoryThenAddressIs
ASSERT_NE(nullptr, gpuAllocation);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[gpuAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(gpuAllocation->getRootDeviceIndex());
EXPECT_LT(gmmHelper->canonize(memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress());
EXPECT_GT(gmmHelper->canonize(memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize());
@@ -1172,7 +1172,7 @@ TEST_F(WddmMemoryManagerTest, given32BitAllocationWhenItIsCreatedThenItHasNonZer
ASSERT_NE(nullptr, gpuAllocation);
EXPECT_NE(0llu, gpuAllocation->getGpuAddressToPatch());
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[gpuAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(gpuAllocation->getRootDeviceIndex());
EXPECT_LT(gmmHelper->canonize(memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress());
EXPECT_GT(gmmHelper->canonize(memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize());
memoryManager->freeGraphicsMemory(gpuAllocation);
@@ -1188,7 +1188,7 @@ TEST_F(WddmMemoryManagerTest, GivenMisalignedHostPtrWhenAllocating32BitMemoryThe
EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize());
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[gpuAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(gpuAllocation->getRootDeviceIndex());
EXPECT_LT(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress());
EXPECT_GT(gmmHelper->canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize());
@@ -1206,7 +1206,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocating32BitMemoryThenGpuBaseAddressIsCanno
ASSERT_NE(nullptr, gpuAllocation);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[gpuAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(gpuAllocation->getRootDeviceIndex());
uint64_t cannonizedAddress = gmmHelper->canonize(memoryManager->getGfxPartition(0)->getHeapBase(MemoryManager::selectExternalHeap(gpuAllocation->isAllocatedInLocalMemoryPool())));
EXPECT_EQ(cannonizedAddress, gpuAllocation->getGpuBaseAddress());
@@ -1332,7 +1332,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeapInternal) {
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, nullptr, AllocationType::INTERNAL_HEAP));
ASSERT_NE(nullptr, wddmAllocation);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[wddmAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(wddmAllocation->getRootDeviceIndex());
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), gmmHelper->canonize(memoryManager->getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), wddmAllocation->isAllocatedInLocalMemoryPool())));
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
@@ -1352,7 +1352,7 @@ TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhe
auto ptr = reinterpret_cast<void *>(0x1000000);
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, ptr, AllocationType::INTERNAL_HEAP));
ASSERT_NE(nullptr, wddmAllocation);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[wddmAllocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager->getGmmHelper(wddmAllocation->getRootDeviceIndex());
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), gmmHelper->canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, wddmAllocation->isAllocatedInLocalMemoryPool())));
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
@@ -1828,7 +1828,7 @@ TEST_F(MockWddmMemoryManagerTest, givenAllocateGraphicsMemoryForHostBufferAndReq
EXPECT_EQ(4, wddmAlloc->getNumGmms());
EXPECT_EQ(4, wddm->createAllocationResult.called);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[wddmAlloc->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memoryManager.getGmmHelper(wddmAlloc->getRootDeviceIndex());
EXPECT_EQ(wddmAlloc->getGpuAddressToModify(), gmmHelper->canonize(wddmAlloc->reservedGpuVirtualAddress));
memoryManager.freeGraphicsMemory(wddmAlloc);

View File

@@ -207,6 +207,9 @@ class MemoryManager {
virtual void releaseReservedCpuAddressRange(void *reserved, size_t size, uint32_t rootDeviceIndex){};
void *getReservedMemory(size_t size, size_t alignment);
GfxPartition *getGfxPartition(uint32_t rootDeviceIndex) { return gfxPartitions.at(rootDeviceIndex).get(); }
GmmHelper *getGmmHelper(uint32_t rootDeviceIndex) {
return executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()->getGmmHelper();
}
virtual AddressRange reserveGpuAddress(size_t size, uint32_t rootDeviceIndex) = 0;
virtual void freeGpuAddress(AddressRange addressRange, uint32_t rootDeviceIndex) = 0;
static HeapIndex selectInternalHeap(bool useLocalMemory) { return useLocalMemory ? HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY : HeapIndex::HEAP_INTERNAL; }

View File

@@ -177,7 +177,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo();
auto heap = heapAssigner.get32BitHeapIndex(allocationData.type, useLocalMemory, *hwInfo, allocationData.flags.use32BitFrontWindow);
auto gfxPartition = getGfxPartition(allocationData.rootDeviceIndex);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
if (allocationData.hostPtr) {
auto allocationSize = alignSizeWholePage(allocationData.hostPtr, allocationData.size);
@@ -432,7 +432,7 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(AllocationType
auto gfxPartition = getGfxPartition(rootDeviceIndex);
uint64_t limitedGpuAddress = gfxPartition->heapAllocate(heap, alignedSize);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper();
auto gmmHelper = getGmmHelper(rootDeviceIndex);
auto memoryAllocation = new MemoryAllocation(rootDeviceIndex, allocationType, driverAllocatedCpuPointer, pMem, limitedGpuAddress, memSize,
count, pool, uncacheable, flushL3Required, maxOsContextCount);
@@ -446,7 +446,7 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(AllocationType
AddressRange OsAgnosticMemoryManager::reserveGpuAddress(size_t size, uint32_t rootDeviceIndex) {
auto gfxPartition = getGfxPartition(rootDeviceIndex);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper();
auto gmmHelper = getGmmHelper(rootDeviceIndex);
auto gpuVa = gmmHelper->canonize(gfxPartition->heapAllocate(HeapIndex::HEAP_STANDARD, size));
return AddressRange{gpuVa, size};
}
@@ -518,7 +518,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
memset(systemMemory, 0, sizeAligned64k);
}
auto sizeOfHeapChunk = sizeAligned64k;
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
auto gpuAddress = gmmHelper->canonize(gfxPartition->heapAllocate(heapIndex, sizeOfHeapChunk));
allocation = new MemoryAllocation(allocationData.rootDeviceIndex, numHandles, allocationData.type, systemMemory, systemMemory,
gpuAddress, sizeAligned64k, counter,

View File

@@ -203,7 +203,7 @@ uint32_t DrmMemoryManager::unreference(NEO::BufferObject *bo, bool synchronousDe
uint64_t DrmMemoryManager::acquireGpuRange(size_t &size, uint32_t rootDeviceIndex, HeapIndex heapIndex) {
auto gfxPartition = getGfxPartition(rootDeviceIndex);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(rootDeviceIndex);
return gmmHelper->canonize(gfxPartition->heapAllocate(heapIndex, size));
}
@@ -596,7 +596,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
}
bo->setAddress(gpuVirtualAddress);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), const_cast<void *>(allocationData.hostPtr),
gmmHelper->canonize(ptrOffset(gpuVirtualAddress, inputPointerOffset)),
allocationSize, MemoryPool::System4KBPagesWith32BitGpuAddressing);
@@ -632,7 +632,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
}
bo->setAddress(gpuVA);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
// softpin to the GPU address, res if it uses limitedRange Allocation
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), ptrAlloc,
@@ -810,7 +810,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
if (requireSpecificBitness && this->force32bitAllocations) {
drmAllocation->set32BitAllocation(true);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(properties.rootDeviceIndex);
drmAllocation->setGpuBaseAddress(gmmHelper->canonize(getExternalHeapBaseAddress(properties.rootDeviceIndex, drmAllocation->isAllocatedInLocalMemoryPool())));
}
@@ -874,7 +874,7 @@ GraphicsAllocation *DrmMemoryManager::createPaddedAllocation(GraphicsAllocation
return nullptr;
}
bo->setAddress(gpuRange);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(rootDeviceIndex);
auto allocation = new DrmAllocation(rootDeviceIndex, inputGraphicsAllocation->getAllocationType(), bo.get(), srcPtr,
gmmHelper->canonize(ptrOffset(gpuRange, offset)), sizeWithPadding,
inputGraphicsAllocation->getMemoryPool());
@@ -1520,7 +1520,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
allocation->setCpuPtrAndGpuAddress(cpuAddress, gpuAddress);
}
if (heapAssigner.useInternal32BitHeap(allocationData.type)) {
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
allocation->setGpuBaseAddress(gmmHelper->canonize(getInternalHeapBaseAddress(allocationData.rootDeviceIndex, true)));
}
if (!allocation->setCacheRegion(&getDrm(allocationData.rootDeviceIndex), static_cast<CacheRegion>(allocationData.cacheRegion))) {

View File

@@ -395,7 +395,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
return nullptr;
}
auto baseAddress = getGfxPartition(allocationData.rootDeviceIndex)->getHeapBase(heapAssigner.get32BitHeapIndex(allocationData.type, useLocalMemory, *hwInfo, allocationData.flags.use32BitFrontWindow));
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
wddmAllocation->setGpuBaseAddress(gmmHelper->canonize(baseAddress));
if (preferredAllocationMethod != GfxMemoryAllocationMethod::UseUmdSystemPtr) {
@@ -439,7 +439,7 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
allocation->setReservedAddressRange(ptr, size);
} else if (requireSpecificBitness && this->force32bitAllocations) {
allocation->set32BitAllocation(true);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getGmmHelper();
auto gmmHelper = getGmmHelper(allocation->getRootDeviceIndex());
allocation->setGpuBaseAddress(gmmHelper->canonize(getExternalHeapBaseAddress(allocation->getRootDeviceIndex(), false)));
}
status = mapGpuVirtualAddress(allocation.get(), allocation->getReservedAddressPtr());
@@ -775,7 +775,7 @@ bool WddmMemoryManager::mapMultiHandleAllocationWithRetry(WddmAllocation *alloca
allocation->reservedSizeForGpuVirtualAddress = alignUp(alignedSize, MemoryConstants::pageSize64k);
allocation->reservedGpuVirtualAddress = wddm.reserveGpuVirtualAddress(gfxPartition->getHeapMinimalAddress(heapIndex), gfxPartition->getHeapLimit(heapIndex),
allocation->reservedSizeForGpuVirtualAddress);
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getGmmHelper();
auto gmmHelper = getGmmHelper(allocation->getRootDeviceIndex());
allocation->getGpuAddressToModify() = gmmHelper->canonize(allocation->reservedGpuVirtualAddress);
addressToMap = allocation->reservedGpuVirtualAddress;
}
@@ -1093,7 +1093,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
wddmAllocation->setCpuAddress(lockResource(wddmAllocation.get()));
}
if (heapAssigner.useInternal32BitHeap(allocationData.type)) {
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[wddmAllocation->getRootDeviceIndex()]->getGmmHelper();
auto gmmHelper = getGmmHelper(wddmAllocation->getRootDeviceIndex());
wddmAllocation->setGpuBaseAddress(gmmHelper->canonize(getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), true)));
}

View File

@@ -272,7 +272,7 @@ HWTEST_F(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocatingDebugAreaThenH
}
auto moduleDebugArea = osAgnosticMemoryManager.allocateGraphicsMemoryWithProperties(properties);
auto gpuAddress = moduleDebugArea->getGpuAddress();
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[moduleDebugArea->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = osAgnosticMemoryManager.getGmmHelper(moduleDebugArea->getRootDeviceIndex());
EXPECT_LE(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(expectedHeap)), gpuAddress);
EXPECT_GT(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapLimit(expectedHeap)), gpuAddress);

View File

@@ -30,7 +30,7 @@ TEST_F(FrontWindowAllocatorTests, givenAllocateInFrontWindowPoolFlagWhenAllocate
allocData.size = MemoryConstants::kiloByte;
auto allocation(memManager->allocate32BitGraphicsMemoryImpl(allocData, false));
auto heap = memManager->heapAssigner.get32BitHeapIndex(allocData.type, false, *defaultHwInfo, true);
auto gmmHelper = memManager.get()->peekExecutionEnvironment().rootDeviceEnvironments[allocation->getRootDeviceIndex()].get()->getGmmHelper();
auto gmmHelper = memManager.get()->getGmmHelper(allocData.rootDeviceIndex);
EXPECT_EQ(gmmHelper->canonize(memManager->getGfxPartition(0)->getHeapMinimalAddress(heap)), allocation->getGpuAddress());
EXPECT_LT(ptrOffset(allocation->getGpuAddress(), allocation->getUnderlyingBufferSize()), gmmHelper->canonize(memManager->getGfxPartition(0)->getHeapLimit(heap)));

View File

@@ -48,7 +48,7 @@ TEST_F(WddmFrontWindowPoolAllocatorTests, givenAllocateInFrontWindowPoolFlagWhen
allocData.flags.use32BitFrontWindow = true;
allocData.size = MemoryConstants::kiloByte;
auto allocation = memManager->allocate32BitGraphicsMemoryImpl(allocData, false);
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[allocData.rootDeviceIndex]->getGmmHelper();
auto gmmHelper = memManager->getGmmHelper(allocData.rootDeviceIndex);
EXPECT_EQ(allocation->getGpuBaseAddress(), gmmHelper->canonize(allocation->getGpuAddress()));
memManager->freeGraphicsMemory(allocation);
}