Skip to content

Commit ee63b7a

Browse files
Initialize storageInfo for new create allocation
in WddmMemoryManager::allocateGraphicsMemory64kb Change-Id: Ie7ef14f2960c3923014941882c63f116ef265d74 Signed-off-by: Katarzyna Cencelewska <[email protected]>
1 parent a67544f commit ee63b7a

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,30 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesEnabledWhenAl
162162
memoryManager->freeGraphicsMemory(allocation);
163163
}
164164

165+
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationDataWithStorageInfoWhenAllocateGraphicsMemory64kbThenStorageInfoInAllocationIsSetCorrectly) {
166+
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
167+
AllocationData allocationData;
168+
allocationData.storageInfo = {};
169+
auto allocation = memoryManager->allocateGraphicsMemory64kb(allocationData);
170+
EXPECT_NE(nullptr, allocation);
171+
EXPECT_TRUE(memcmp(&allocationData.storageInfo, &allocation->storageInfo, sizeof(StorageInfo)) == 0);
172+
memoryManager->freeGraphicsMemory(allocation);
173+
}
174+
175+
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationDataWithFlagsWhenAllocateGraphicsMemory64kbThenAllocationFlagFlushL3RequiredIsSetCorrectly) {
176+
class MockGraphicsAllocation : public GraphicsAllocation {
177+
public:
178+
using GraphicsAllocation::allocationInfo;
179+
};
180+
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
181+
AllocationData allocationData;
182+
allocationData.flags.flushL3 = true;
183+
auto allocation = static_cast<MockGraphicsAllocation *>(memoryManager->allocateGraphicsMemory64kb(allocationData));
184+
EXPECT_NE(nullptr, allocation);
185+
EXPECT_EQ(allocationData.flags.flushL3, allocation->allocationInfo.flags.flushL3Required);
186+
memoryManager->freeGraphicsMemory(allocation);
187+
}
188+
165189
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemoryWithPtrIsCalledThenMemoryPoolIsSystem4KBPages) {
166190
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
167191
void *ptr = reinterpret_cast<void *>(0x1001);

shared/source/os_interface/windows/wddm_memory_manager.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,13 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(const Allocati
100100
0u, // shareable
101101
maxOsContextCount);
102102

103-
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {});
103+
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr,
104+
sizeAligned, allocationData.flags.uncacheable,
105+
allocationData.flags.preferRenderCompressed, true,
106+
allocationData.storageInfo);
104107
wddmAllocation->setDefaultGmm(gmm);
108+
wddmAllocation->setFlushL3Required(allocationData.flags.flushL3);
109+
wddmAllocation->storageInfo = allocationData.storageInfo;
105110

106111
if (!getWddm(allocationData.rootDeviceIndex).createAllocation64k(gmm, wddmAllocation->getHandleToModify(0u))) {
107112
delete gmm;

0 commit comments

Comments
 (0)