mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Gmm construction cleanup
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
82ad3d61be
commit
c88fce0def
@ -56,7 +56,7 @@ Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) {
|
||||
size_t alignedSize = alignSizeWholePage(ptr, size);
|
||||
void *alignedPtr = alignUp(ptr, 4096);
|
||||
|
||||
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, false);
|
||||
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, false, false, {}, true);
|
||||
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
|
||||
return gmm;
|
||||
}
|
||||
@ -87,7 +87,7 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true));
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
@ -497,7 +497,7 @@ TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@ -534,7 +534,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@ -830,7 +830,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2;
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false, false, StorageInfo{}, true);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
|
@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
uint64_t gpuPtr = 0u;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
|
||||
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
|
||||
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
|
||||
@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
auto handle = 0u;
|
||||
auto resourceHandle = 0u;
|
||||
auto ptr = reinterpret_cast<void *>(0x10000);
|
||||
@ -152,7 +152,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
auto handle = 0u;
|
||||
|
||||
wddmWithKmDafMock->createAllocation(gmm.get(), handle);
|
||||
@ -167,7 +167,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
OsHandleStorage storage;
|
||||
OsHandleWin osHandle;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true));
|
||||
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
|
||||
storage.fragmentStorageData[0].fragmentSize = 100;
|
||||
static_cast<OsHandleWin *>(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get();
|
||||
|
@ -44,7 +44,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNotSetUseSystemMemoryWhenGraphicsAlloca
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -65,12 +65,13 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateInDevice
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
allocData.flags.shareable = true;
|
||||
allocData.storageInfo.memoryBanks = 2;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
@ -96,7 +97,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateGraphics
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
@ -121,7 +122,7 @@ struct WddmMemoryManagerDevicePoolAlignmentTests : WddmMemoryManagerSimpleTest {
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_EQ(alignUp(allocationSize, expectedAlignment), allocation->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(expectedAlignment, allocation->getDefaultGmm()->resourceParams.BaseAlignment);
|
||||
|
||||
@ -329,7 +330,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenEnabledLocalMemoryAndAllowed32BitWhen32
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -517,7 +518,7 @@ TEST_F(WddmMemoryManagerSimpleTestWithLocalMemory, givenLocalMemoryAndImageOrSha
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_TRUE(allocData.imgInfo->useLocalMemory);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -660,7 +661,7 @@ struct WddmMemoryManagerSimple64BitTest : public WddmMemoryManagerSimpleTest {
|
||||
uint64_t totalSizeFromGmms = 0u;
|
||||
for (uint32_t gmmId = 0u; gmmId < allocation->getNumGmms(); ++gmmId) {
|
||||
Gmm *gmm = allocation->getGmm(gmmId);
|
||||
EXPECT_FALSE(gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, gmm->resourceParams.BaseAlignment);
|
||||
EXPECT_TRUE(isAligned(gmm->resourceParams.BaseWidth64, gmm->resourceParams.BaseAlignment));
|
||||
|
||||
|
@ -180,7 +180,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemory
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@ -207,7 +208,10 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesEnabledWhenAl
|
||||
auto allocation = memoryManager->allocateGraphicsMemory64kb(allocationData);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@ -246,7 +250,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemory
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
for (size_t i = 0; i < allocation->fragmentsStorage.fragmentCount; i++) {
|
||||
EXPECT_TRUE(static_cast<OsHandleWin *>(allocation->fragmentsStorage.fragmentStorageData[i].osHandleStorage)->gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(1u, static_cast<OsHandleWin *>(allocation->fragmentsStorage.fragmentStorageData[i].osHandleStorage)->gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
}
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -260,7 +264,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocate32BitGraphicsM
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPagesWith32BitGpuAddressing, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@ -275,7 +280,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesDisabledWhenA
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
EXPECT_TRUE(svmAllocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
svmAllocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
memoryManager->freeGraphicsMemory(svmAllocation);
|
||||
}
|
||||
|
||||
@ -296,7 +302,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@ -316,7 +322,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@ -342,7 +348,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true);
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@ -601,7 +607,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
|
||||
@ -617,7 +623,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) {
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@ -644,7 +650,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE);
|
||||
@ -676,7 +682,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@ -699,7 +705,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@ -721,7 +727,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@ -743,7 +749,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@ -819,7 +825,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
wddm->failOpenSharedHandle = true;
|
||||
@ -1148,7 +1154,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
|
||||
osHandle0->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[0].freeTheFragment = true;
|
||||
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false);
|
||||
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true);
|
||||
|
||||
storage.fragmentStorageData[1].osHandleStorage = osHandle1;
|
||||
osHandle1->handle = ALLOCATION_HANDLE;
|
||||
@ -1159,7 +1165,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
storage.fragmentStorageData[2].osHandleStorage = osHandle2;
|
||||
osHandle2->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[2].freeTheFragment = true;
|
||||
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false);
|
||||
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true);
|
||||
storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount);
|
||||
|
||||
memoryManager->cleanOsHandles(storage, 0);
|
||||
@ -1207,7 +1213,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestriction
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
@ -1221,7 +1227,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x10000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@ -1237,7 +1243,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@ -1407,7 +1413,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false);
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@ -1445,7 +1451,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false);
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@ -1877,7 +1883,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
@ -1909,7 +1915,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
@ -2010,7 +2016,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenReleaseingThen
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
@ -2036,7 +2042,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThe
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
@ -2065,7 +2071,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsUnsetThenD
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true);
|
||||
myGmm->isCompressionEnabled = false;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
@ -2102,7 +2108,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true);
|
||||
myGmm->isCompressionEnabled = true;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
@ -2276,7 +2282,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSvmCpuAllocationWhenSizeAndAlignmentPro
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
EXPECT_EQ(allocation->getUnderlyingBuffer(), allocation->getDriverAllocatedCpuPtr());
|
||||
//limited platforms will not use heap HeapIndex::HEAP_SVM
|
||||
// limited platforms will not use heap HeapIndex::HEAP_SVM
|
||||
if (executionEnvironment->rootDeviceEnvironments[allocation->getRootDeviceIndex()]->isFullRangeSvm()) {
|
||||
EXPECT_EQ(alignUp(allocation->getReservedAddressPtr(), size), reinterpret_cast<void *>(allocation->getGpuAddress()));
|
||||
}
|
||||
@ -2418,7 +2424,7 @@ TEST(WddmMemoryManager, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsRet
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
//call multiple times to make sure that result is constant
|
||||
// call multiple times to make sure that result is constant
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
|
Reference in New Issue
Block a user