mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Use correct Heap32 index for local memory allocations
Change-Id: I068f712ab2b05ee3d5a9716b21de685a7fee3a02 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
4076d3e294
commit
6dd07bd3bc
@ -926,7 +926,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationThen32
|
||||
EXPECT_LT(address64bit, MemoryConstants::max32BitAddress);
|
||||
EXPECT_TRUE(allocation->is32BitAllocation());
|
||||
|
||||
EXPECT_EQ(GmmHelper::canonize(memoryManager->getExternalHeapBaseAddress(allocation->getRootDeviceIndex())), allocation->getGpuBaseAddress());
|
||||
EXPECT_EQ(GmmHelper::canonize(memoryManager->getExternalHeapBaseAddress(allocation->getRootDeviceIndex(), allocation->isAllocatedInLocalMemoryPool())), allocation->getGpuBaseAddress());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -2029,7 +2029,7 @@ TEST_F(DrmMemoryManagerTest, given32BitAddressingWhenBufferFromSharedHandleAndBi
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(graphicsAllocation);
|
||||
EXPECT_TRUE(graphicsAllocation->is32BitAllocation());
|
||||
EXPECT_EQ(1, lseekCalledCount);
|
||||
EXPECT_EQ(GmmHelper::canonize(memoryManager->getExternalHeapBaseAddress(graphicsAllocation->getRootDeviceIndex())), drmAllocation->getGpuBaseAddress());
|
||||
EXPECT_EQ(GmmHelper::canonize(memoryManager->getExternalHeapBaseAddress(graphicsAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool())), drmAllocation->getGpuBaseAddress());
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
@ -2482,7 +2482,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedForInternalAllocationWit
|
||||
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex()));
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
@ -2515,7 +2515,7 @@ TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWhenAskedForInternalAlloc
|
||||
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex()));
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
@ -2572,7 +2572,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedForInternalAllocationWit
|
||||
|
||||
auto gpuPtr = drmAllocation->getGpuAddress();
|
||||
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex()));
|
||||
auto heapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(drmAllocation->getRootDeviceIndex(), drmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto heapSize = 4 * GB;
|
||||
|
||||
EXPECT_GE(gpuPtr, heapBase);
|
||||
@ -2689,7 +2689,7 @@ TEST_F(DrmMemoryManagerBasic, givenDefaultDrmMemoryManagerWhenItIsQueriedForInte
|
||||
true,
|
||||
executionEnvironment));
|
||||
auto heapBase = memoryManager->getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY);
|
||||
EXPECT_EQ(heapBase, memoryManager->getInternalHeapBaseAddress(rootDeviceIndex));
|
||||
EXPECT_EQ(heapBase, memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, true));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerBasic, givenMemoryManagerWithEnabledHostMemoryValidationWhenFeatureIsQueriedThenTrueIsReturned) {
|
||||
|
@ -52,7 +52,8 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
|
||||
AllocationData allocationData;
|
||||
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);
|
||||
getAllocationData(allocationData, properties, ptr, createStorageInfoFromProperties(properties));
|
||||
return allocate32BitGraphicsMemoryImpl(allocationData);
|
||||
bool useLocalMemory = !allocationData.flags.useSystemMemory && this->localMemorySupported[rootDeviceIndex];
|
||||
return allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory);
|
||||
}
|
||||
|
||||
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override {
|
||||
|
@ -122,7 +122,7 @@ TEST(WddmMemoryManagerExternalHeapTest, WhenExternalHeapIsCreatedThenItHasCorrec
|
||||
|
||||
std::unique_ptr<WddmMemoryManager> memoryManager = std::unique_ptr<WddmMemoryManager>(new WddmMemoryManager(*executionEnvironment));
|
||||
|
||||
EXPECT_EQ(base, memoryManager->getExternalHeapBaseAddress(0));
|
||||
EXPECT_EQ(base, memoryManager->getExternalHeapBaseAddress(0, false));
|
||||
}
|
||||
|
||||
TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWmmWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
|
||||
@ -566,7 +566,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
|
||||
if (is64bit) {
|
||||
EXPECT_TRUE(gpuAllocation->is32BitAllocation());
|
||||
|
||||
uint64_t base = memoryManager->getExternalHeapBaseAddress(gpuAllocation->getRootDeviceIndex());
|
||||
uint64_t base = memoryManager->getExternalHeapBaseAddress(gpuAllocation->getRootDeviceIndex(), gpuAllocation->isAllocatedInLocalMemoryPool());
|
||||
EXPECT_EQ(GmmHelper::canonize(base), gpuAllocation->getGpuBaseAddress());
|
||||
}
|
||||
|
||||
@ -970,7 +970,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocating32BitMemoryThenGpuBaseAddressIsCanno
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
|
||||
uint64_t cannonizedAddress = GmmHelper::canonize(memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_EXTERNAL));
|
||||
uint64_t cannonizedAddress = GmmHelper::canonize(memoryManager->getGfxPartition(0)->getHeapBase(MemoryManager::selectExternalHeap(gpuAllocation->isAllocatedInLocalMemoryPool())));
|
||||
EXPECT_EQ(cannonizedAddress, gpuAllocation->getGpuBaseAddress());
|
||||
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
@ -1087,12 +1087,12 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeapInternal) {
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, nullptr, GraphicsAllocation::AllocationType::INTERNAL_HEAP));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex())));
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(wddmAllocation->getRootDeviceIndex(), wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
|
||||
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
||||
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex));
|
||||
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY));
|
||||
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, wddmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(MemoryManager::selectInternalHeap(wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
|
||||
EXPECT_GT(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
||||
EXPECT_LT(wddmAllocation->getGpuAddress() + wddmAllocation->getUnderlyingBufferSize(), cannonizedHeapEnd);
|
||||
@ -1106,12 +1106,12 @@ TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhe
|
||||
auto ptr = reinterpret_cast<void *>(0x1000000);
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, MemoryConstants::pageSize, ptr, GraphicsAllocation::AllocationType::INTERNAL_HEAP));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex)));
|
||||
EXPECT_EQ(wddmAllocation->getGpuBaseAddress(), GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
|
||||
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
|
||||
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex));
|
||||
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY));
|
||||
auto cannonizedHeapBase = GmmHelper::canonize(memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, wddmAllocation->isAllocatedInLocalMemoryPool()));
|
||||
auto cannonizedHeapEnd = GmmHelper::canonize(memoryManager->getGfxPartition(rootDeviceIndex)->getHeapLimit(MemoryManager::selectInternalHeap(wddmAllocation->isAllocatedInLocalMemoryPool())));
|
||||
|
||||
EXPECT_GT(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
|
||||
EXPECT_LT(wddmAllocation->getGpuAddress() + wddmAllocation->getUnderlyingBufferSize(), cannonizedHeapEnd);
|
||||
@ -1386,7 +1386,7 @@ TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForI
|
||||
wddm->init();
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress(0));
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress(0, true));
|
||||
}
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledWithTripleAllocationThenSuccessIsReturned) {
|
||||
|
Reference in New Issue
Block a user