mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Refactor: Change canonize method accessing point
Accessing canonize method as a member of GmmHelper class object Related-To: NEO-6523 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b42a49eb4b
commit
1c366d1ec0
@@ -115,8 +115,9 @@ void WddmDirectSubmission<GfxFamily, Dispatcher>::handleCompletionRingBuffer(uin
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void WddmDirectSubmission<GfxFamily, Dispatcher>::getTagAddressValue(TagData &tagData) {
|
||||
MonitoredFence ¤tFence = osContextWin->getResidencyController().getMonitoredFence();
|
||||
auto gmmHelper = wddm->getRootDeviceEnvironment().getGmmHelper();
|
||||
|
||||
tagData.tagAddress = GmmHelper::canonize(currentFence.gpuAddress);
|
||||
tagData.tagAddress = gmmHelper->canonize(currentFence.gpuAddress);
|
||||
tagData.tagValue = currentFence.currentFenceValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ GmmHelper::GmmHelper(OSInterface *osInterface, const HardwareInfo *pHwInfo) : hw
|
||||
|
||||
bool GmmHelper::isValidCanonicalGpuAddress(uint64_t address) {
|
||||
auto decanonizedAddress = NEO::GmmHelper::decanonize(address);
|
||||
auto canonizedAddress = NEO::GmmHelper::canonize(decanonizedAddress);
|
||||
auto canonizedAddress = this->canonize(decanonizedAddress);
|
||||
|
||||
if (address == canonizedAddress) {
|
||||
return true;
|
||||
|
||||
@@ -177,6 +177,8 @@ 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();
|
||||
|
||||
if (allocationData.hostPtr) {
|
||||
auto allocationSize = alignSizeWholePage(allocationData.hostPtr, allocationData.size);
|
||||
auto gpuVirtualAddress = gfxPartition->heapAllocate(heap, allocationSize);
|
||||
@@ -186,11 +188,11 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
|
||||
uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(allocationData.hostPtr) & MemoryConstants::pageMask);
|
||||
MemoryAllocation *memAlloc = new MemoryAllocation(
|
||||
allocationData.rootDeviceIndex, allocationData.type, nullptr, const_cast<void *>(allocationData.hostPtr),
|
||||
GmmHelper::canonize(gpuVirtualAddress + offset), allocationData.size,
|
||||
gmmHelper->canonize(gpuVirtualAddress + offset), allocationData.size,
|
||||
counter, MemoryPool::System4KBPagesWith32BitGpuAddressing, false, false, maxOsContextCount);
|
||||
|
||||
memAlloc->set32BitAllocation(true);
|
||||
memAlloc->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
memAlloc->setGpuBaseAddress(gmmHelper->canonize(gfxPartition->getHeapBase(heap)));
|
||||
memAlloc->sizeToFree = allocationSize;
|
||||
|
||||
counter++;
|
||||
@@ -211,12 +213,13 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(con
|
||||
|
||||
MemoryAllocation *memoryAllocation = nullptr;
|
||||
if (ptrAlloc != nullptr) {
|
||||
memoryAllocation = new MemoryAllocation(allocationData.rootDeviceIndex, allocationData.type, ptrAlloc, ptrAlloc, GmmHelper::canonize(gpuAddress),
|
||||
memoryAllocation = new MemoryAllocation(allocationData.rootDeviceIndex, allocationData.type, ptrAlloc, ptrAlloc,
|
||||
gmmHelper->canonize(gpuAddress),
|
||||
allocationData.size, counter, MemoryPool::System4KBPagesWith32BitGpuAddressing,
|
||||
false, allocationData.flags.flushL3, maxOsContextCount);
|
||||
|
||||
memoryAllocation->set32BitAllocation(true);
|
||||
memoryAllocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
memoryAllocation->setGpuBaseAddress(gmmHelper->canonize(gfxPartition->getHeapBase(heap)));
|
||||
memoryAllocation->sizeToFree = allocationSize;
|
||||
}
|
||||
counter++;
|
||||
@@ -429,12 +432,12 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(AllocationType
|
||||
|
||||
auto gfxPartition = getGfxPartition(rootDeviceIndex);
|
||||
uint64_t limitedGpuAddress = gfxPartition->heapAllocate(heap, alignedSize);
|
||||
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper();
|
||||
auto memoryAllocation = new MemoryAllocation(rootDeviceIndex, allocationType, driverAllocatedCpuPointer, pMem, limitedGpuAddress, memSize,
|
||||
count, pool, uncacheable, flushL3Required, maxOsContextCount);
|
||||
|
||||
if (heap == HeapIndex::HEAP_EXTERNAL) {
|
||||
memoryAllocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(heap)));
|
||||
memoryAllocation->setGpuBaseAddress(gmmHelper->canonize(gfxPartition->getHeapBase(heap)));
|
||||
}
|
||||
memoryAllocation->sizeToFree = alignedSize;
|
||||
|
||||
@@ -443,7 +446,8 @@ MemoryAllocation *OsAgnosticMemoryManager::createMemoryAllocation(AllocationType
|
||||
|
||||
AddressRange OsAgnosticMemoryManager::reserveGpuAddress(size_t size, uint32_t rootDeviceIndex) {
|
||||
auto gfxPartition = getGfxPartition(rootDeviceIndex);
|
||||
auto gpuVa = GmmHelper::canonize(gfxPartition->heapAllocate(HeapIndex::HEAP_STANDARD, size));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper();
|
||||
auto gpuVa = gmmHelper->canonize(gfxPartition->heapAllocate(HeapIndex::HEAP_STANDARD, size));
|
||||
return AddressRange{gpuVa, size};
|
||||
}
|
||||
|
||||
@@ -514,7 +518,8 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
|
||||
memset(systemMemory, 0, sizeAligned64k);
|
||||
}
|
||||
auto sizeOfHeapChunk = sizeAligned64k;
|
||||
auto gpuAddress = GmmHelper::canonize(gfxPartition->heapAllocate(heapIndex, sizeOfHeapChunk));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
|
||||
auto gpuAddress = gmmHelper->canonize(gfxPartition->heapAllocate(heapIndex, sizeOfHeapChunk));
|
||||
allocation = new MemoryAllocation(allocationData.rootDeviceIndex, numHandles, allocationData.type, systemMemory, systemMemory,
|
||||
gpuAddress, sizeAligned64k, counter,
|
||||
MemoryPool::LocalMemory, false, allocationData.flags.flushL3, maxOsContextCount);
|
||||
|
||||
@@ -203,7 +203,8 @@ 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);
|
||||
return GmmHelper::canonize(gfxPartition->heapAllocate(heapIndex, size));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()->gmmHelper.get();
|
||||
return gmmHelper->canonize(gfxPartition->heapAllocate(heapIndex, size));
|
||||
}
|
||||
|
||||
void DrmMemoryManager::releaseGpuRange(void *address, size_t unmapSize, uint32_t rootDeviceIndex) {
|
||||
@@ -595,10 +596,12 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
|
||||
}
|
||||
|
||||
bo->setAddress(gpuVirtualAddress);
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), const_cast<void *>(allocationData.hostPtr), GmmHelper::canonize(ptrOffset(gpuVirtualAddress, inputPointerOffset)),
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), const_cast<void *>(allocationData.hostPtr),
|
||||
gmmHelper->canonize(ptrOffset(gpuVirtualAddress, inputPointerOffset)),
|
||||
allocationSize, MemoryPool::System4KBPagesWith32BitGpuAddressing);
|
||||
allocation->set32BitAllocation(true);
|
||||
allocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(allocatorToUse)));
|
||||
allocation->setGpuBaseAddress(gmmHelper->canonize(gfxPartition->getHeapBase(allocatorToUse)));
|
||||
allocation->setReservedAddressRange(reinterpret_cast<void *>(gpuVirtualAddress), realAllocationSize);
|
||||
bo.release();
|
||||
return allocation;
|
||||
@@ -629,13 +632,15 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
|
||||
}
|
||||
|
||||
bo->setAddress(gpuVA);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
|
||||
|
||||
// softpin to the GPU address, res if it uses limitedRange Allocation
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), ptrAlloc, GmmHelper::canonize(gpuVA), alignedAllocationSize,
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), ptrAlloc,
|
||||
gmmHelper->canonize(gpuVA), alignedAllocationSize,
|
||||
MemoryPool::System4KBPagesWith32BitGpuAddressing);
|
||||
|
||||
allocation->set32BitAllocation(true);
|
||||
allocation->setGpuBaseAddress(GmmHelper::canonize(gfxPartition->getHeapBase(allocatorToUse)));
|
||||
allocation->setGpuBaseAddress(gmmHelper->canonize(gfxPartition->getHeapBase(allocatorToUse)));
|
||||
allocation->setDriverAllocatedCpuPtr(ptrAlloc);
|
||||
allocation->setReservedAddressRange(reinterpret_cast<void *>(gpuVA), allocationSize);
|
||||
bo.release();
|
||||
@@ -805,7 +810,8 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
||||
|
||||
if (requireSpecificBitness && this->force32bitAllocations) {
|
||||
drmAllocation->set32BitAllocation(true);
|
||||
drmAllocation->setGpuBaseAddress(GmmHelper::canonize(getExternalHeapBaseAddress(properties.rootDeviceIndex, drmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex].get()->gmmHelper.get();
|
||||
drmAllocation->setGpuBaseAddress(gmmHelper->canonize(getExternalHeapBaseAddress(properties.rootDeviceIndex, drmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
}
|
||||
|
||||
if (properties.imgInfo) {
|
||||
@@ -868,7 +874,9 @@ GraphicsAllocation *DrmMemoryManager::createPaddedAllocation(GraphicsAllocation
|
||||
return nullptr;
|
||||
}
|
||||
bo->setAddress(gpuRange);
|
||||
auto allocation = new DrmAllocation(rootDeviceIndex, inputGraphicsAllocation->getAllocationType(), bo.get(), srcPtr, GmmHelper::canonize(ptrOffset(gpuRange, offset)), sizeWithPadding,
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get()->gmmHelper.get();
|
||||
auto allocation = new DrmAllocation(rootDeviceIndex, inputGraphicsAllocation->getAllocationType(), bo.get(), srcPtr,
|
||||
gmmHelper->canonize(ptrOffset(gpuRange, offset)), sizeWithPadding,
|
||||
inputGraphicsAllocation->getMemoryPool());
|
||||
|
||||
allocation->setReservedAddressRange(reinterpret_cast<void *>(gpuRange), sizeWithPadding);
|
||||
@@ -1512,7 +1520,8 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
|
||||
allocation->setCpuPtrAndGpuAddress(cpuAddress, gpuAddress);
|
||||
}
|
||||
if (heapAssigner.useInternal32BitHeap(allocationData.type)) {
|
||||
allocation->setGpuBaseAddress(GmmHelper::canonize(getInternalHeapBaseAddress(allocationData.rootDeviceIndex, true)));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get()->gmmHelper.get();
|
||||
allocation->setGpuBaseAddress(gmmHelper->canonize(getInternalHeapBaseAddress(allocationData.rootDeviceIndex, true)));
|
||||
}
|
||||
if (!allocation->setCacheRegion(&getDrm(allocationData.rootDeviceIndex), static_cast<CacheRegion>(allocationData.cacheRegion))) {
|
||||
cleanupBeforeReturn(allocationData, gfxPartition, drmAllocation, graphicsAllocation, gpuAddress, sizeAllocated);
|
||||
|
||||
@@ -441,7 +441,9 @@ bool Wddm::mapGpuVirtualAddress(Gmm *gmm, D3DKMT_HANDLE handle, D3DGPU_VIRTUAL_A
|
||||
applyAdditionalMapGPUVAFields(MapGPUVA, gmm);
|
||||
|
||||
NTSTATUS status = getGdi()->mapGpuVirtualAddress(&MapGPUVA);
|
||||
gpuPtr = GmmHelper::canonize(MapGPUVA.VirtualAddress);
|
||||
|
||||
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
|
||||
gpuPtr = gmmHelper->canonize(MapGPUVA.VirtualAddress);
|
||||
|
||||
if (status == STATUS_PENDING) {
|
||||
updatePagingFenceValue(MapGPUVA.PagingFenceValue);
|
||||
|
||||
@@ -395,7 +395,8 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
|
||||
return nullptr;
|
||||
}
|
||||
auto baseAddress = getGfxPartition(allocationData.rootDeviceIndex)->getHeapBase(heapAssigner.get32BitHeapIndex(allocationData.type, useLocalMemory, *hwInfo, allocationData.flags.use32BitFrontWindow));
|
||||
wddmAllocation->setGpuBaseAddress(GmmHelper::canonize(baseAddress));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper();
|
||||
wddmAllocation->setGpuBaseAddress(gmmHelper->canonize(baseAddress));
|
||||
|
||||
if (preferredAllocationMethod != GfxMemoryAllocationMethod::UseUmdSystemPtr) {
|
||||
auto lockedPtr = lockResource(wddmAllocation.get());
|
||||
@@ -438,7 +439,8 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
|
||||
allocation->setReservedAddressRange(ptr, size);
|
||||
} else if (requireSpecificBitness && this->force32bitAllocations) {
|
||||
allocation->set32BitAllocation(true);
|
||||
allocation->setGpuBaseAddress(GmmHelper::canonize(getExternalHeapBaseAddress(allocation->getRootDeviceIndex(), false)));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getGmmHelper();
|
||||
allocation->setGpuBaseAddress(gmmHelper->canonize(getExternalHeapBaseAddress(allocation->getRootDeviceIndex(), false)));
|
||||
}
|
||||
status = mapGpuVirtualAddress(allocation.get(), allocation->getReservedAddressPtr());
|
||||
DEBUG_BREAK_IF(!status);
|
||||
@@ -773,7 +775,8 @@ bool WddmMemoryManager::mapMultiHandleAllocationWithRetry(WddmAllocation *alloca
|
||||
allocation->reservedSizeForGpuVirtualAddress = alignUp(alignedSize, MemoryConstants::pageSize64k);
|
||||
allocation->reservedGpuVirtualAddress = wddm.reserveGpuVirtualAddress(gfxPartition->getHeapMinimalAddress(heapIndex), gfxPartition->getHeapLimit(heapIndex),
|
||||
allocation->reservedSizeForGpuVirtualAddress);
|
||||
allocation->getGpuAddressToModify() = GmmHelper::canonize(allocation->reservedGpuVirtualAddress);
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getGmmHelper();
|
||||
allocation->getGpuAddressToModify() = gmmHelper->canonize(allocation->reservedGpuVirtualAddress);
|
||||
addressToMap = allocation->reservedGpuVirtualAddress;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1093,8 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
|
||||
wddmAllocation->setCpuAddress(lockResource(wddmAllocation.get()));
|
||||
}
|
||||
if (heapAssigner.useInternal32BitHeap(allocationData.type)) {
|
||||
wddmAllocation->setGpuBaseAddress(GmmHelper::canonize(getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), true)));
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[wddmAllocation->getRootDeviceIndex()]->getGmmHelper();
|
||||
wddmAllocation->setGpuBaseAddress(gmmHelper->canonize(getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), true)));
|
||||
}
|
||||
|
||||
status = AllocationStatus::Success;
|
||||
|
||||
@@ -240,7 +240,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferStartedThenEx
|
||||
hwParse.parseCommands<FamilyType>(tmpCmdBuffer, usedSpace);
|
||||
MI_BATCH_BUFFER_START *bbStart = hwParse.getCommand<MI_BATCH_BUFFER_START>();
|
||||
ASSERT_NE(nullptr, bbStart);
|
||||
uint64_t actualGpuVa = GmmHelper::canonize(bbStart->getBatchBufferStartAddress());
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
uint64_t actualGpuVa = gmmHelper->canonize(bbStart->getBatchBufferStartAddress());
|
||||
EXPECT_EQ(wddmDirectSubmission.ringBuffer2->getGpuAddress(), actualGpuVa);
|
||||
}
|
||||
|
||||
@@ -293,7 +294,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferStartedAndWai
|
||||
hwParse.parseCommands<FamilyType>(tmpCmdBuffer, usedSpace);
|
||||
MI_BATCH_BUFFER_START *bbStart = hwParse.getCommand<MI_BATCH_BUFFER_START>();
|
||||
ASSERT_NE(nullptr, bbStart);
|
||||
uint64_t actualGpuVa = GmmHelper::canonize(bbStart->getBatchBufferStartAddress());
|
||||
auto gmmHelper = device->getGmmHelper();
|
||||
uint64_t actualGpuVa = gmmHelper->canonize(bbStart->getBatchBufferStartAddress());
|
||||
EXPECT_EQ(wddmDirectSubmission.ringBuffer2->getGpuAddress(), actualGpuVa);
|
||||
|
||||
EXPECT_EQ(1u, wddm->waitFromCpuResult.called);
|
||||
|
||||
@@ -272,10 +272,12 @@ HWTEST_F(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocatingDebugAreaThenH
|
||||
}
|
||||
auto moduleDebugArea = osAgnosticMemoryManager.allocateGraphicsMemoryWithProperties(properties);
|
||||
auto gpuAddress = moduleDebugArea->getGpuAddress();
|
||||
EXPECT_LE(GmmHelper::canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(expectedHeap)), gpuAddress);
|
||||
EXPECT_GT(GmmHelper::canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapLimit(expectedHeap)), gpuAddress);
|
||||
EXPECT_EQ(GmmHelper::canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(expectedHeap)), moduleDebugArea->getGpuBaseAddress());
|
||||
EXPECT_EQ(GmmHelper::canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(baseHeap)), moduleDebugArea->getGpuBaseAddress());
|
||||
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[moduleDebugArea->getRootDeviceIndex()].get()->getGmmHelper();
|
||||
|
||||
EXPECT_LE(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(expectedHeap)), gpuAddress);
|
||||
EXPECT_GT(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapLimit(expectedHeap)), gpuAddress);
|
||||
EXPECT_EQ(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(expectedHeap)), moduleDebugArea->getGpuBaseAddress());
|
||||
EXPECT_EQ(gmmHelper->canonize(osAgnosticMemoryManager.getGfxPartition(0)->getHeapBase(baseHeap)), moduleDebugArea->getGpuBaseAddress());
|
||||
|
||||
osAgnosticMemoryManager.freeGraphicsMemory(moduleDebugArea);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,11 @@ TEST_F(FrontWindowAllocatorTests, givenAllocateInFrontWindowPoolFlagWhenAllocate
|
||||
allocData.size = MemoryConstants::kiloByte;
|
||||
auto allocation(memManager->allocate32BitGraphicsMemoryImpl(allocData, false));
|
||||
auto heap = memManager->heapAssigner.get32BitHeapIndex(allocData.type, false, *defaultHwInfo, true);
|
||||
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)));
|
||||
auto gmmHelper = memManager.get()->peekExecutionEnvironment().rootDeviceEnvironments[allocation->getRootDeviceIndex()].get()->getGmmHelper();
|
||||
|
||||
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)));
|
||||
|
||||
memManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@@ -75,4 +78,4 @@ TEST_F(FrontWindowAllocatorTests, givenLinearStreamAllocWhenSelectingHeapWithFro
|
||||
EXPECT_EQ(HeapIndex::HEAP_EXTERNAL_FRONT_WINDOW, memManager->selectHeap(&allocation, true, true, true));
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -48,7 +48,8 @@ TEST_F(WddmFrontWindowPoolAllocatorTests, givenAllocateInFrontWindowPoolFlagWhen
|
||||
allocData.flags.use32BitFrontWindow = true;
|
||||
allocData.size = MemoryConstants::kiloByte;
|
||||
auto allocation = memManager->allocate32BitGraphicsMemoryImpl(allocData, false);
|
||||
EXPECT_EQ(allocation->getGpuBaseAddress(), GmmHelper::canonize(allocation->getGpuAddress()));
|
||||
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[allocData.rootDeviceIndex]->getGmmHelper();
|
||||
EXPECT_EQ(allocation->getGpuBaseAddress(), gmmHelper->canonize(allocation->getGpuAddress()));
|
||||
memManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user