@@ -105,7 +105,7 @@ TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThe
105
105
EXPECT_EQ (MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool ());
106
106
}
107
107
108
- TEST (WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase ) {
108
+ TEST (WddmMemoryManagerAllocator32BitTest, allocator32BitIsCreatedWithCorrectBase ) {
109
109
HardwareInfo *hwInfo;
110
110
auto executionEnvironment = getExecutionEnvironmentImpl (hwInfo);
111
111
std::unique_ptr<WddmMock> wddm (static_cast <WddmMock *>(Wddm::createWddm ()));
@@ -116,7 +116,9 @@ TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) {
116
116
117
117
std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager (*executionEnvironment));
118
118
119
- EXPECT_EQ (base, memoryManager->getExternalHeapBaseAddress ());
119
+ ASSERT_NE (nullptr , memoryManager->allocator32Bit .get ());
120
+
121
+ EXPECT_EQ (base, memoryManager->allocator32Bit ->getBase ());
120
122
}
121
123
122
124
TEST (WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
@@ -275,7 +277,7 @@ TEST_F(WddmMemoryManagerSimpleTest,
275
277
givenAllocateGraphicsMemoryForNonSvmHostPtrIsCalledWhenNotAlignedPtrIsPassedThenAlignedGraphicsAllocationIsCreated) {
276
278
memoryManager.reset (new MockWddmMemoryManager (false , false , *executionEnvironment));
277
279
auto size = 13u ;
278
- auto hostPtr = reinterpret_cast <const void *>(0x10001 );
280
+ auto hostPtr = reinterpret_cast <const void *>(0x5001 );
279
281
280
282
AllocationData allocationData;
281
283
allocationData.size = size;
@@ -517,7 +519,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocW
517
519
if (is64bit) {
518
520
EXPECT_TRUE (gpuAllocation->is32BitAllocation ());
519
521
520
- uint64_t base = memoryManager->getExternalHeapBaseAddress ();
522
+ uint64_t base = memoryManager->allocator32Bit -> getBase ();
521
523
EXPECT_EQ (GmmHelper::canonize (base), gpuAllocation->getGpuBaseAddress ());
522
524
}
523
525
@@ -848,8 +850,8 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
848
850
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory (3 * MemoryConstants::pageSize, nullptr , GraphicsAllocation::AllocationType::BUFFER);
849
851
850
852
ASSERT_NE (nullptr , gpuAllocation);
851
- EXPECT_LT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapBase (HeapIndex::HEAP_EXTERNAL )), gpuAllocation->getGpuAddress ());
852
- EXPECT_GT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapLimit (HeapIndex::HEAP_EXTERNAL)), gpuAllocation-> getGpuAddress () + gpuAllocation->getUnderlyingBufferSize ());
853
+ EXPECT_LE (GmmHelper::canonize (wddm-> getExternalHeapBase ( )), gpuAllocation->getGpuAddress ());
854
+ EXPECT_GT (GmmHelper::canonize (wddm-> getExternalHeapBase ()) + wddm-> getExternalHeapSize () - 1 , gpuAllocation->getGpuAddress ());
853
855
854
856
EXPECT_EQ (0u , gpuAllocation->fragmentsStorage .fragmentCount );
855
857
memoryManager->freeGraphicsMemory (gpuAllocation);
@@ -860,8 +862,8 @@ TEST_F(WddmMemoryManagerTest, given32BitAllocationWhenItIsCreatedThenItHasNonZer
860
862
861
863
ASSERT_NE (nullptr , gpuAllocation);
862
864
EXPECT_NE (0llu, gpuAllocation->getGpuAddressToPatch ());
863
- EXPECT_LT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapBase (HeapIndex::HEAP_EXTERNAL )), gpuAllocation->getGpuAddress ());
864
- EXPECT_GT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapLimit (HeapIndex::HEAP_EXTERNAL)), gpuAllocation-> getGpuAddress () + gpuAllocation->getUnderlyingBufferSize ());
865
+ EXPECT_LE (GmmHelper::canonize (wddm-> getExternalHeapBase ( )), gpuAllocation->getGpuAddress ());
866
+ EXPECT_GT (GmmHelper::canonize (wddm-> getExternalHeapBase ()) + wddm-> getExternalHeapSize () - 1 , gpuAllocation->getGpuAddress ());
865
867
memoryManager->freeGraphicsMemory (gpuAllocation);
866
868
}
867
869
@@ -875,8 +877,8 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotDoT
875
877
876
878
EXPECT_EQ (alignSizeWholePage (misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize ());
877
879
878
- EXPECT_LT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapBase (HeapIndex::HEAP_EXTERNAL )), gpuAllocation->getGpuAddress ());
879
- EXPECT_GT (GmmHelper::canonize (memoryManager-> gfxPartition . getHeapLimit (HeapIndex::HEAP_EXTERNAL)), gpuAllocation-> getGpuAddress () + gpuAllocation->getUnderlyingBufferSize ());
880
+ EXPECT_LE (GmmHelper::canonize (wddm-> getExternalHeapBase ( )), gpuAllocation->getGpuAddress ());
881
+ EXPECT_GT (GmmHelper::canonize (wddm-> getExternalHeapBase ()) + wddm-> getExternalHeapSize () - 1 , gpuAllocation->getGpuAddress ());
880
882
881
883
EXPECT_EQ (0u , gpuAllocation->fragmentsStorage .fragmentCount );
882
884
@@ -892,7 +894,7 @@ TEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress) {
892
894
893
895
ASSERT_NE (nullptr , gpuAllocation);
894
896
895
- uint64_t cannonizedAddress = GmmHelper::canonize (memoryManager-> gfxPartition . getHeapBase (HeapIndex::HEAP_EXTERNAL ));
897
+ uint64_t cannonizedAddress = GmmHelper::canonize (wddm-> getExternalHeapBase ( ));
896
898
EXPECT_EQ (cannonizedAddress, gpuAllocation->getGpuBaseAddress ());
897
899
898
900
memoryManager->freeGraphicsMemory (gpuAllocation);
@@ -975,7 +977,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
975
977
}
976
978
977
979
TEST_F (WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
978
- void *ptr = reinterpret_cast <void *>(0x10000 );
980
+ void *ptr = reinterpret_cast <void *>(0x1000 );
979
981
size_t size = 0x1000 ;
980
982
std::unique_ptr<Gmm> gmm (new Gmm (ptr, size, false ));
981
983
@@ -1014,10 +1016,10 @@ TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocatio
1014
1016
EXPECT_EQ (4096u , wddmAllocation->getUnderlyingBufferSize ());
1015
1017
EXPECT_NE ((uint64_t )wddmAllocation->getUnderlyingBuffer (), wddmAllocation->getGpuAddress ());
1016
1018
auto cannonizedHeapBase = GmmHelper::canonize (memoryManager->getInternalHeapBaseAddress ());
1017
- auto cannonizedHeapEnd = GmmHelper::canonize (memoryManager-> gfxPartition . getHeapLimit (internalHeapIndex));
1019
+ auto cannonizedHeapEnd = GmmHelper::canonize (this -> wddm -> getGfxPartition (). Heap32 [ static_cast < uint32_t > (internalHeapIndex)]. Limit );
1018
1020
1019
- EXPECT_GT (wddmAllocation->getGpuAddress (), cannonizedHeapBase);
1020
- EXPECT_LT (wddmAllocation->getGpuAddress () + wddmAllocation-> getUnderlyingBufferSize (), cannonizedHeapEnd);
1021
+ EXPECT_GE (wddmAllocation->getGpuAddress (), cannonizedHeapBase);
1022
+ EXPECT_LE (wddmAllocation->getGpuAddress (), cannonizedHeapEnd);
1021
1023
1022
1024
EXPECT_NE (nullptr , wddmAllocation->getDriverAllocatedCpuPtr ());
1023
1025
EXPECT_TRUE (wddmAllocation->is32BitAllocation ());
@@ -1033,10 +1035,10 @@ TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhe
1033
1035
EXPECT_EQ (4096u , wddmAllocation->getUnderlyingBufferSize ());
1034
1036
EXPECT_NE ((uint64_t )wddmAllocation->getUnderlyingBuffer (), wddmAllocation->getGpuAddress ());
1035
1037
auto cannonizedHeapBase = GmmHelper::canonize (memoryManager->getInternalHeapBaseAddress ());
1036
- auto cannonizedHeapEnd = GmmHelper::canonize (memoryManager-> gfxPartition . getHeapLimit (internalHeapIndex));
1038
+ auto cannonizedHeapEnd = GmmHelper::canonize (wddm-> getGfxPartition (). Heap32 [ static_cast < uint32_t > (internalHeapIndex)]. Limit );
1037
1039
1038
- EXPECT_GT (wddmAllocation->getGpuAddress (), cannonizedHeapBase);
1039
- EXPECT_LT (wddmAllocation->getGpuAddress () + wddmAllocation-> getUnderlyingBufferSize (), cannonizedHeapEnd);
1040
+ EXPECT_GE (wddmAllocation->getGpuAddress (), cannonizedHeapBase);
1041
+ EXPECT_LE (wddmAllocation->getGpuAddress (), cannonizedHeapEnd);
1040
1042
1041
1043
EXPECT_EQ (nullptr , wddmAllocation->getDriverAllocatedCpuPtr ());
1042
1044
EXPECT_TRUE (wddmAllocation->is32BitAllocation ());
0 commit comments