Mitigation for WDDM_LINUX allocation size limits

Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
This commit is contained in:
Jaroslaw Chodor
2021-07-14 16:51:47 +02:00
committed by Compute-Runtime-Automation
parent 058c30c9a8
commit 78499ca48d
15 changed files with 120 additions and 67 deletions

View File

@ -44,8 +44,8 @@ class MockWddmMemoryManager : public MemoryManagerCreate<WddmMemoryManager> {
return BaseClass::allocateGraphicsMemoryInDevicePool(allocationData, status);
}
size_t hugeGfxMemoryChunkSize = BaseClass::getHugeGfxMemoryChunkSize();
size_t getHugeGfxMemoryChunkSize() const override { return hugeGfxMemoryChunkSize; }
size_t hugeGfxMemoryChunkSize = BaseClass::getHugeGfxMemoryChunkSize(preferredAllocationMethod);
size_t getHugeGfxMemoryChunkSize(GfxMemoryAllocationMethod allocationMethod) const override { return hugeGfxMemoryChunkSize; }
MockWddmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(false, false, executionEnvironment) {
hostPtrManager.reset(new MockHostPtrManager);

View File

@ -155,7 +155,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
auto handle = 0u;
wddmWithKmDafMock->createAllocation64k(gmm.get(), handle);
wddmWithKmDafMock->createAllocation(gmm.get(), handle);
EXPECT_EQ(wddmWithKmDafMock->featureTable->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.ftrKmdDaf);
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.hAdapter);

View File

@ -1548,10 +1548,10 @@ TEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemor
if (memoryManager64k.isLimitedGPU(0)) {
GTEST_SKIP();
}
EXPECT_EQ(0, wddm->createAllocationResult.called);
EXPECT_EQ(0U, wddm->createAllocationResult.called);
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryWithProperties({rootDeviceIndex, MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, mockDeviceBitfield});
EXPECT_EQ(1, wddm->createAllocationResult.called);
EXPECT_NE(0U, wddm->createAllocationResult.called);
EXPECT_NE(nullptr, galloc);
EXPECT_EQ(true, galloc->isLocked());
EXPECT_NE(nullptr, galloc->getUnderlyingBuffer());
@ -1629,7 +1629,8 @@ TEST_F(MockWddmMemoryManagerTest, givenAllocateGraphicsMemoryForBufferAndRequest
TEST_F(MockWddmMemoryManagerTest, givenDefaultMemoryManagerWhenItIsCreatedThenCorrectHugeGfxMemoryChunkIsSet) {
MockWddmMemoryManager memoryManager(*executionEnvironment);
EXPECT_EQ(memoryManager.getHugeGfxMemoryChunkSize(), 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize64k);
EXPECT_EQ(memoryManager.getHugeGfxMemoryChunkSize(GfxMemoryAllocationMethod::AllocateByKmd), 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize64k);
EXPECT_EQ(memoryManager.getHugeGfxMemoryChunkSize(GfxMemoryAllocationMethod::UseUmdSystemPtr), 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize64k);
}
TEST_F(MockWddmMemoryManagerTest, givenAllocateGraphicsMemoryForHostBufferAndRequestedSizeIsHugeThenResultAllocationIsSplitted) {