mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Add osContextsCount argument to WddmAllocation's constructors
The argument is not anywhere yet, this is just a preparation step for future change. Change-Id: I5a441352cb5cf10d1a0ff31933041ff9521d0307 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
ef65e6433e
commit
ac2c2763ab
@@ -12,7 +12,7 @@ namespace OCLRT {
|
||||
|
||||
class MockWddmAllocation : public WddmAllocation {
|
||||
public:
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull) {
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x100);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, fakePtr, 0x3000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, fakePtr, 0x3000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.gmm = gmm.get();
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -170,7 +170,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
|
||||
TEST_F(Wddm20Tests, allocation) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -194,7 +194,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
size_t underlyingPages = underlyingSize / MemoryConstants::pageSize;
|
||||
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation allocation(ptr, 0x2100, ptr, 0x3000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, 0x2100, ptr, 0x3000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -217,7 +217,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -240,7 +240,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -268,7 +268,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAddressWithingHeap1Limits) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
@@ -318,7 +318,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -344,7 +344,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -363,7 +363,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -568,7 +568,7 @@ TEST(DebugFlagTest, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledTh
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@@ -590,7 +590,7 @@ TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@@ -630,7 +630,7 @@ TEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -658,7 +658,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -681,7 +681,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -739,7 +739,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(fakePtr, 100, false);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
|
||||
|
||||
@@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -100,7 +100,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDaf
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.gpuPtr = GPUVA;
|
||||
|
||||
wddmWithKmDafMock->freeGpuVirtualAddres(allocation.gpuPtr, allocation.getUnderlyingBufferSize());
|
||||
@@ -140,7 +140,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
@@ -154,7 +154,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->hostPtrManager.getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@@ -781,7 +781,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@@ -797,7 +797,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_TRUE(ret);
|
||||
@@ -813,7 +813,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 2);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@@ -1155,9 +1155,9 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTri
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount()),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount()),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@@ -1250,8 +1250,8 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGr
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@@ -1309,9 +1309,9 @@ TEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerTha
|
||||
void *ptr2 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x3000);
|
||||
void *ptr3 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x5000);
|
||||
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, ptr1, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, ptr2, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, ptr3, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, ptr1, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, ptr2, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, ptr3, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@@ -1600,7 +1600,7 @@ TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsSucceedsWhenMakeR
|
||||
MockWddmAllocation allocation1;
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocationToTrim.getResidencyData().updateCompletionData(osContext->get()->getMonitoredFence().lastSubmittedFence, osContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user