Revert "[1/n] Use GfxPartition for 32-bit allocations - WddmMemoryManager"

This reverts commit 2bb451e76d922861673e052f5f889658ac7db15f.

Change-Id: I1deada59a291a96ef88c8b9b4f2b28861ad27347
Signed-off-by: Venevtsev, Igor <igor.venevtsev@intel.com>
This commit is contained in:
Venevtsev, Igor 2019-04-12 15:21:42 +02:00 committed by sys_ocldev
parent 54c4678cb5
commit 3a008fafc6
10 changed files with 44 additions and 47 deletions

View File

@ -54,10 +54,6 @@ class GfxPartition {
return getHeap(heapIndex).getBase() + getHeap(heapIndex).getSize() - 1; return getHeap(heapIndex).getBase() + getHeap(heapIndex).getSize() - 1;
} }
uint64_t getHeapMinimalAddress(HeapIndex heapIndex) {
return getHeapBase(heapIndex) + heapGranularity;
}
static const uint64_t heapGranularity = MemoryConstants::pageSize64k; static const uint64_t heapGranularity = MemoryConstants::pageSize64k;
static const std::array<HeapIndex, 4> heap32Names; static const std::array<HeapIndex, 4> heap32Names;

View File

@ -106,13 +106,7 @@ class MemoryManager {
virtual uint64_t getMaxApplicationAddress() = 0; virtual uint64_t getMaxApplicationAddress() = 0;
virtual uint64_t getInternalHeapBaseAddress() { virtual uint64_t getInternalHeapBaseAddress() = 0;
return gfxPartition.getHeapBase(internalHeapIndex);
}
uint64_t getExternalHeapBaseAddress() {
return gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL);
}
bool peek64kbPagesEnabled() const { return enable64kbpages; } bool peek64kbPagesEnabled() const { return enable64kbpages; }
bool peekForce32BitAllocations() const { return force32bitAllocations; } bool peekForce32BitAllocations() const { return force32bitAllocations; }

View File

@ -769,7 +769,7 @@ void Wddm::initGfxPartition(GfxPartition &outGfxPartition) const {
outGfxPartition.heapInit(HeapIndex::HEAP_STANDARD64KB, gfxPartition.Standard64KB.Base, gfxPartition.Standard64KB.Limit - gfxPartition.Standard64KB.Base + 1); outGfxPartition.heapInit(HeapIndex::HEAP_STANDARD64KB, gfxPartition.Standard64KB.Base, gfxPartition.Standard64KB.Limit - gfxPartition.Standard64KB.Base + 1);
for (auto heap : GfxPartition::heap32Names) { for (auto heap : GfxPartition::heap32Names) {
outGfxPartition.heapInit(heap, gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base, outGfxPartition.heapInit(heap, gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base + MemoryConstants::pageSize,
gfxPartition.Heap32[static_cast<uint32_t>(heap)].Limit - gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base + 1); gfxPartition.Heap32[static_cast<uint32_t>(heap)].Limit - gfxPartition.Heap32[static_cast<uint32_t>(heap)].Base + 1);
} }
} }
@ -791,6 +791,14 @@ PFND3DKMT_ESCAPE Wddm::getEscapeHandle() const {
return gdi->escape; return gdi->escape;
} }
uint64_t Wddm::getExternalHeapBase() const {
return alignUp(gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Base, MemoryConstants::pageSize);
}
uint64_t Wddm::getExternalHeapSize() const {
return alignDown(gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Limit - gfxPartition.Heap32[static_cast<uint32_t>(HeapIndex::HEAP_EXTERNAL)].Base, MemoryConstants::pageSize);
}
VOID *Wddm::registerTrimCallback(PFND3DKMT_TRIMNOTIFICATIONCALLBACK callback, WddmResidencyController &residencyController) { VOID *Wddm::registerTrimCallback(PFND3DKMT_TRIMNOTIFICATIONCALLBACK callback, WddmResidencyController &residencyController) {
if (DebugManager.flags.DoNotRegisterTrimCallback.get()) { if (DebugManager.flags.DoNotRegisterTrimCallback.get()) {
return nullptr; return nullptr;

View File

@ -129,6 +129,9 @@ class Wddm {
return static_cast<uint32_t>(hwContextId); return static_cast<uint32_t>(hwContextId);
} }
uint64_t getExternalHeapBase() const;
uint64_t getExternalHeapSize() const;
std::unique_ptr<SettingsReader> registryReader; std::unique_ptr<SettingsReader> registryReader;
GmmPageTableMngr *getPageTableManager() const { return pageTableManager.get(); } GmmPageTableMngr *getPageTableManager() const { return pageTableManager.get(); }

View File

@ -39,6 +39,7 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment)
wddm(executionEnvironment.osInterface->get()->getWddm()) { wddm(executionEnvironment.osInterface->get()->getWddm()) {
DEBUG_BREAK_IF(wddm == nullptr); DEBUG_BREAK_IF(wddm == nullptr);
allocator32Bit = std::unique_ptr<Allocator32bit>(new Allocator32bit(wddm->getExternalHeapBase(), wddm->getExternalHeapSize()));
asyncDeleterEnabled = DebugManager.flags.EnableDeferredDeleter.get(); asyncDeleterEnabled = DebugManager.flags.EnableDeferredDeleter.get();
if (asyncDeleterEnabled) if (asyncDeleterEnabled)
deferredDeleter = createDeferredDeleter(); deferredDeleter = createDeferredDeleter();
@ -211,7 +212,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
return nullptr; return nullptr;
} }
auto baseAddress = useInternal32BitAllocator(allocationData.type) ? getInternalHeapBaseAddress() : getExternalHeapBaseAddress(); auto baseAddress = useInternal32BitAllocator(allocationData.type) ? getInternalHeapBaseAddress() : allocator32Bit->getBase();
wddmAllocation->setGpuBaseAddress(GmmHelper::canonize(baseAddress)); wddmAllocation->setGpuBaseAddress(GmmHelper::canonize(baseAddress));
DebugManager.logAllocation(wddmAllocation.get()); DebugManager.logAllocation(wddmAllocation.get());
@ -240,7 +241,7 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
allocation->setReservedAddressRange(ptr, size); allocation->setReservedAddressRange(ptr, size);
} else if (requireSpecificBitness && this->force32bitAllocations) { } else if (requireSpecificBitness && this->force32bitAllocations) {
allocation->set32BitAllocation(true); allocation->set32BitAllocation(true);
allocation->setGpuBaseAddress(GmmHelper::canonize(getExternalHeapBaseAddress())); allocation->setGpuBaseAddress(GmmHelper::canonize(allocator32Bit->getBase()));
} }
status = mapGpuVirtualAddressWithRetry(allocation.get(), allocation->getReservedAddressPtr()); status = mapGpuVirtualAddressWithRetry(allocation.get(), allocation->getReservedAddressPtr());
DEBUG_BREAK_IF(!status); DEBUG_BREAK_IF(!status);
@ -482,6 +483,10 @@ uint64_t WddmMemoryManager::getMaxApplicationAddress() {
return wddm->getMaxApplicationAddress(); return wddm->getMaxApplicationAddress();
} }
uint64_t WddmMemoryManager::getInternalHeapBaseAddress() {
return wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Base;
}
bool WddmMemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) { bool WddmMemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) {
return wddm->updateAuxTable(graphicsAllocation->getGpuAddress(), graphicsAllocation->getDefaultGmm(), true); return wddm->updateAuxTable(graphicsAllocation->getGpuAddress(), graphicsAllocation->getDefaultGmm(), true);
} }
@ -544,7 +549,7 @@ uint32_t WddmMemoryManager::mapGpuVirtualAddress(WddmAllocation *graphicsAllocat
for (auto handleId = startingIndex; handleId < graphicsAllocation->getNumHandles(); handleId++) { for (auto handleId = startingIndex; handleId < graphicsAllocation->getNumHandles(); handleId++) {
if (!wddm->mapGpuVirtualAddress(graphicsAllocation->getGmm(handleId), graphicsAllocation->getHandles()[handleId], if (!wddm->mapGpuVirtualAddress(graphicsAllocation->getGmm(handleId), graphicsAllocation->getHandles()[handleId],
gfxPartition.getHeapMinimalAddress(heapIndex), gfxPartition.getHeapLimit(heapIndex), gfxPartition.getHeapBase(heapIndex), gfxPartition.getHeapLimit(heapIndex),
addressToMap, graphicsAllocation->getGpuAddressToModify())) { addressToMap, graphicsAllocation->getGpuAddressToModify())) {
return numMappedAllocations; return numMappedAllocations;
} }
@ -556,8 +561,8 @@ uint32_t WddmMemoryManager::mapGpuVirtualAddress(WddmAllocation *graphicsAllocat
void WddmMemoryManager::obtainGpuAddressIfNeeded(WddmAllocation *allocation) { void WddmMemoryManager::obtainGpuAddressIfNeeded(WddmAllocation *allocation) {
if (allocation->getNumHandles() > 1u) { if (allocation->getNumHandles() > 1u) {
auto heapIndex = selectHeap(allocation, false, executionEnvironment.isFullRangeSvm()); auto heapIndex = selectHeap(allocation, false, executionEnvironment.isFullRangeSvm());
allocation->preferredGpuAddress = wddm->reserveGpuVirtualAddress(gfxPartition.getHeapMinimalAddress(heapIndex), allocation->preferredGpuAddress = wddm->reserveGpuVirtualAddress(gfxPartition.getHeapBase(heapIndex), gfxPartition.getHeapLimit(heapIndex),
gfxPartition.getHeapLimit(heapIndex), allocation->getAlignedSize()); allocation->getAlignedSize());
} }
} }

View File

@ -49,6 +49,7 @@ class WddmMemoryManager : public MemoryManager {
uint64_t getSystemSharedMemory() override; uint64_t getSystemSharedMemory() override;
uint64_t getMaxApplicationAddress() override; uint64_t getMaxApplicationAddress() override;
uint64_t getInternalHeapBaseAddress() override;
bool tryDeferDeletions(const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle); bool tryDeferDeletions(const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle);

View File

@ -69,9 +69,6 @@ void testGfxPartition(uint64_t gpuAddressSpace) {
continue; continue;
} }
EXPECT_GT(gfxPartition.getHeapMinimalAddress(heap), gfxPartition.getHeapBase(heap));
EXPECT_EQ(gfxPartition.getHeapMinimalAddress(heap), gfxPartition.getHeapBase(heap) + GfxPartition::heapGranularity);
auto ptrBig = gfxPartition.heapAllocate(heap, sizeBig); auto ptrBig = gfxPartition.heapAllocate(heap, sizeBig);
EXPECT_NE(ptrBig, 0ull); EXPECT_NE(ptrBig, 0ull);
EXPECT_LT(gfxPartition.getHeapBase(heap), ptrBig); EXPECT_LT(gfxPartition.getHeapBase(heap), ptrBig);

View File

@ -336,14 +336,6 @@ TEST_F(MemoryAllocatorTest, GivenPointerAndSizeWhenAskedToCreateGrahicsAllocatio
EXPECT_NE(&allocation->fragmentsStorage, &handleStorage); EXPECT_NE(&allocation->fragmentsStorage, &handleStorage);
} }
TEST_F(MemoryAllocatorTest, defaultInternalHeapBaseIsInitialized) {
EXPECT_LE(0ull, memoryManager->MemoryManager::getInternalHeapBaseAddress());
}
TEST_F(MemoryAllocatorTest, defaultExternalHeapBaseIsNotNull) {
EXPECT_LT(0ull, memoryManager->getExternalHeapBaseAddress());
}
TEST_F(MemoryAllocatorTest, givenMemoryManagerWhensetForce32BitAllocationsIsCalledWithTrueMutlipleTimesThenAllocatorIsReused) { TEST_F(MemoryAllocatorTest, givenMemoryManagerWhensetForce32BitAllocationsIsCalledWithTrueMutlipleTimesThenAllocatorIsReused) {
memoryManager->setForce32BitAllocations(true); memoryManager->setForce32BitAllocations(true);
EXPECT_NE(nullptr, memoryManager->allocator32Bit.get()); EXPECT_NE(nullptr, memoryManager->allocator32Bit.get());

View File

@ -22,7 +22,6 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
using BaseClass::allocateGraphicsMemoryWithProperties; using BaseClass::allocateGraphicsMemoryWithProperties;
using BaseClass::createGraphicsAllocation; using BaseClass::createGraphicsAllocation;
using BaseClass::createWddmAllocation; using BaseClass::createWddmAllocation;
using BaseClass::gfxPartition;
using BaseClass::localMemorySupported; using BaseClass::localMemorySupported;
using MemoryManagerCreate<WddmMemoryManager>::MemoryManagerCreate; using MemoryManagerCreate<WddmMemoryManager>::MemoryManagerCreate;

View File

@ -105,7 +105,7 @@ TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThe
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool()); EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool());
} }
TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) { TEST(WddmMemoryManagerAllocator32BitTest, allocator32BitIsCreatedWithCorrectBase) {
HardwareInfo *hwInfo; HardwareInfo *hwInfo;
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo); auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm())); std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm()));
@ -116,7 +116,9 @@ TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) {
std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager(*executionEnvironment)); std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager(*executionEnvironment));
EXPECT_EQ(base, memoryManager->getExternalHeapBaseAddress()); ASSERT_NE(nullptr, memoryManager->allocator32Bit.get());
EXPECT_EQ(base, memoryManager->allocator32Bit->getBase());
} }
TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) { TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
@ -275,7 +277,7 @@ TEST_F(WddmMemoryManagerSimpleTest,
givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalledWhenNotAlignedPtrIsPassedThenAlignedGraphicsAllocationIsCreated) { givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalledWhenNotAlignedPtrIsPassedThenAlignedGraphicsAllocationIsCreated) {
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto size = 13u; auto size = 13u;
auto hostPtr = reinterpret_cast<const void *>(0x10001); auto hostPtr = reinterpret_cast<const void *>(0x5001);
AllocationData allocationData; AllocationData allocationData;
allocationData.size = size; allocationData.size = size;
@ -517,7 +519,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocW
if (is64bit) { if (is64bit) {
EXPECT_TRUE(gpuAllocation->is32BitAllocation()); EXPECT_TRUE(gpuAllocation->is32BitAllocation());
uint64_t base = memoryManager->getExternalHeapBaseAddress(); uint64_t base = memoryManager->allocator32Bit->getBase();
EXPECT_EQ(GmmHelper::canonize(base), gpuAllocation->getGpuBaseAddress()); EXPECT_EQ(GmmHelper::canonize(base), gpuAllocation->getGpuBaseAddress());
} }
@ -848,8 +850,8 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::BUFFER); auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::BUFFER);
ASSERT_NE(nullptr, gpuAllocation); ASSERT_NE(nullptr, gpuAllocation);
EXPECT_LT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress()); EXPECT_LE(GmmHelper::canonize(wddm->getExternalHeapBase()), gpuAllocation->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize()); EXPECT_GT(GmmHelper::canonize(wddm->getExternalHeapBase()) + wddm->getExternalHeapSize() - 1, gpuAllocation->getGpuAddress());
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount); EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
memoryManager->freeGraphicsMemory(gpuAllocation); memoryManager->freeGraphicsMemory(gpuAllocation);
@ -860,8 +862,8 @@ TEST_F(WddmMemoryManagerTest, given32BitAllocationWhenItIsCreatedThenItHasNonZer
ASSERT_NE(nullptr, gpuAllocation); ASSERT_NE(nullptr, gpuAllocation);
EXPECT_NE(0llu, gpuAllocation->getGpuAddressToPatch()); EXPECT_NE(0llu, gpuAllocation->getGpuAddressToPatch());
EXPECT_LT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress()); EXPECT_LE(GmmHelper::canonize(wddm->getExternalHeapBase()), gpuAllocation->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize()); EXPECT_GT(GmmHelper::canonize(wddm->getExternalHeapBase()) + wddm->getExternalHeapSize() - 1, gpuAllocation->getGpuAddress());
memoryManager->freeGraphicsMemory(gpuAllocation); memoryManager->freeGraphicsMemory(gpuAllocation);
} }
@ -875,8 +877,8 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotDoT
EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize()); EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize());
EXPECT_LT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress()); EXPECT_LE(GmmHelper::canonize(wddm->getExternalHeapBase()), gpuAllocation->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(memoryManager->gfxPartition.getHeapLimit(HeapIndex::HEAP_EXTERNAL)), gpuAllocation->getGpuAddress() + gpuAllocation->getUnderlyingBufferSize()); EXPECT_GT(GmmHelper::canonize(wddm->getExternalHeapBase()) + wddm->getExternalHeapSize() - 1, gpuAllocation->getGpuAddress());
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount); EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
@ -892,7 +894,7 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress) {
ASSERT_NE(nullptr, gpuAllocation); ASSERT_NE(nullptr, gpuAllocation);
uint64_t cannonizedAddress = GmmHelper::canonize(memoryManager->gfxPartition.getHeapBase(HeapIndex::HEAP_EXTERNAL)); uint64_t cannonizedAddress = GmmHelper::canonize(wddm->getExternalHeapBase());
EXPECT_EQ(cannonizedAddress, gpuAllocation->getGpuBaseAddress()); EXPECT_EQ(cannonizedAddress, gpuAllocation->getGpuBaseAddress());
memoryManager->freeGraphicsMemory(gpuAllocation); memoryManager->freeGraphicsMemory(gpuAllocation);
@ -975,7 +977,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
} }
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) { TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x10000); void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000; size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(ptr, size, false)); std::unique_ptr<Gmm> gmm(new Gmm(ptr, size, false));
@ -1014,10 +1016,10 @@ TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocatio
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize()); EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress()); EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress()); auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress());
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->gfxPartition.getHeapLimit(internalHeapIndex)); auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Limit);
EXPECT_GT(wddmAllocation->getGpuAddress(), cannonizedHeapBase); EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
EXPECT_LT(wddmAllocation->getGpuAddress() + wddmAllocation->getUnderlyingBufferSize(), cannonizedHeapEnd); EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
EXPECT_NE(nullptr, wddmAllocation->getDriverAllocatedCpuPtr()); EXPECT_NE(nullptr, wddmAllocation->getDriverAllocatedCpuPtr());
EXPECT_TRUE(wddmAllocation->is32BitAllocation()); EXPECT_TRUE(wddmAllocation->is32BitAllocation());
@ -1033,10 +1035,10 @@ TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhe
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize()); EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress()); EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress()); auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress());
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->gfxPartition.getHeapLimit(internalHeapIndex)); auto cannonizedHeapEnd = GmmHelper::canonize(wddm->getGfxPartition().Heap32[static_cast<uint32_t>(internalHeapIndex)].Limit);
EXPECT_GT(wddmAllocation->getGpuAddress(), cannonizedHeapBase); EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
EXPECT_LT(wddmAllocation->getGpuAddress() + wddmAllocation->getUnderlyingBufferSize(), cannonizedHeapEnd); EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
EXPECT_EQ(nullptr, wddmAllocation->getDriverAllocatedCpuPtr()); EXPECT_EQ(nullptr, wddmAllocation->getDriverAllocatedCpuPtr());
EXPECT_TRUE(wddmAllocation->is32BitAllocation()); EXPECT_TRUE(wddmAllocation->is32BitAllocation());