diff --git a/runtime/os_interface/windows/os_context_win.cpp b/runtime/os_interface/windows/os_context_win.cpp index 7d63080426..4e1eb74f66 100644 --- a/runtime/os_interface/windows/os_context_win.cpp +++ b/runtime/os_interface/windows/os_context_win.cpp @@ -12,7 +12,7 @@ namespace OCLRT { -OsContextWin::OsContextImpl(Wddm &wddm) : wddm(wddm) { +OsContextWin::OsContextImpl(Wddm &wddm, uint32_t osContextId) : wddm(wddm), residencyController(osContextId) { UNRECOVERABLE_IF(!wddm.isInitialized()); auto wddmInterface = wddm.getWddmInterface(); if (!wddm.createContext(context)) { @@ -40,7 +40,7 @@ void OsContextWin::resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cp OsContext::OsContext(OSInterface *osInterface, uint32_t contextId) : contextId(contextId) { if (osInterface) { - osContextImpl = std::make_unique(*osInterface->get()->getWddm()); + osContextImpl = std::make_unique(*osInterface->get()->getWddm(), contextId); } } OsContext::~OsContext() = default; diff --git a/runtime/os_interface/windows/os_context_win.h b/runtime/os_interface/windows/os_context_win.h index 791b11f1a6..a6276f75d9 100644 --- a/runtime/os_interface/windows/os_context_win.h +++ b/runtime/os_interface/windows/os_context_win.h @@ -19,7 +19,7 @@ using OsContextWin = OsContext::OsContextImpl; class OsContext::OsContextImpl { public: OsContextImpl() = delete; - OsContextImpl(Wddm &wddm); + OsContextImpl(Wddm &wddm, uint32_t osContextId); ~OsContextImpl(); D3DKMT_HANDLE getContext() const { return context; diff --git a/runtime/os_interface/windows/wddm_allocation.h b/runtime/os_interface/windows/wddm_allocation.h index 2a060723ef..db21ae0568 100644 --- a/runtime/os_interface/windows/wddm_allocation.h +++ b/runtime/os_interface/windows/wddm_allocation.h @@ -35,8 +35,8 @@ class WddmAllocation : public GraphicsAllocation { handle(0), gpuPtr(0), alignedCpuPtr(alignedCpuPtr), - alignedSize(alignedSize) { - trimListPosition = trimListUnusedPosition; + alignedSize(alignedSize), + trimCandidateListPositions(osContextsCount, trimListUnusedPosition) { reservedAddressSpace = reservedAddr; this->memoryPool = pool; } @@ -46,8 +46,8 @@ class WddmAllocation : public GraphicsAllocation { handle(0), gpuPtr(0), alignedCpuPtr(nullptr), - alignedSize(sizeIn) { - trimListPosition = trimListUnusedPosition; + alignedSize(sizeIn), + trimCandidateListPositions(osContextsCount, trimListUnusedPosition) { reservedAddressSpace = nullptr; this->memoryPool = pool; } @@ -73,12 +73,15 @@ class WddmAllocation : public GraphicsAllocation { return residency; } - void setTrimCandidateListPosition(size_t position) { - trimListPosition = position; + void setTrimCandidateListPosition(uint32_t osContextId, size_t position) { + trimCandidateListPositions[osContextId] = position; } - size_t getTrimCandidateListPosition() { - return trimListPosition; + size_t getTrimCandidateListPosition(uint32_t osContextId) const { + if (osContextId < trimCandidateListPositions.size()) { + return trimCandidateListPositions[osContextId]; + } + return trimListUnusedPosition; } void *getReservedAddress() const { @@ -93,7 +96,7 @@ class WddmAllocation : public GraphicsAllocation { void *alignedCpuPtr; size_t alignedSize; ResidencyData residency; - size_t trimListPosition; + std::vector trimCandidateListPositions; void *reservedAddressSpace; }; } // namespace OCLRT diff --git a/runtime/os_interface/windows/wddm_memory_manager.cpp b/runtime/os_interface/windows/wddm_memory_manager.cpp index 59db42dca4..685f3fe4a1 100644 --- a/runtime/os_interface/windows/wddm_memory_manager.cpp +++ b/runtime/os_interface/windows/wddm_memory_manager.cpp @@ -313,9 +313,7 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation if (osContext) { auto &residencyController = osContext->get()->getResidencyController(); residencyController.acquireLock(); - if (input->getTrimCandidateListPosition() != trimListUnusedPosition) { - residencyController.removeFromTrimCandidateList(gfxAllocation, true); - } + residencyController.removeFromTrimCandidateListIfUsed(input, true); residencyController.releaseLock(); } } @@ -492,7 +490,7 @@ bool WddmMemoryManager::makeResidentResidencyAllocations(ResidencyContainer &all DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", allocation, mainResidency ? "resident" : "not resident"); - if (allocation->getTrimCandidateListPosition() != trimListUnusedPosition) { + if (allocation->getTrimCandidateListPosition(osContext.getContextId()) != trimListUnusedPosition) { DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", allocation, "on trimCandidateList"); osContext.get()->getResidencyController().removeFromTrimCandidateList(allocation, false); diff --git a/runtime/os_interface/windows/wddm_residency_controller.cpp b/runtime/os_interface/windows/wddm_residency_controller.cpp index c3f6ed9525..0427057988 100644 --- a/runtime/os_interface/windows/wddm_residency_controller.cpp +++ b/runtime/os_interface/windows/wddm_residency_controller.cpp @@ -5,14 +5,14 @@ * */ -#include "wddm_residency_controller.h" +#include "runtime/os_interface/windows/wddm_residency_controller.h" #include "runtime/os_interface/windows/wddm_allocation.h" #include "runtime/os_interface/debug_settings_manager.h" #include "runtime/utilities/spinlock.h" namespace OCLRT { -WddmResidencyController::WddmResidencyController() : lock(false), lastTrimFenceValue(0u) {} +WddmResidencyController::WddmResidencyController(uint32_t osContextId) : osContextId(osContextId) {} void WddmResidencyController::acquireLock() { bool previousLockValue = false; @@ -53,10 +53,10 @@ void WddmResidencyController::addToTrimCandidateList(GraphicsAllocation *allocat DEBUG_BREAK_IF(trimCandidatesCount > trimCandidateList.size()); - if (wddmAllocation->getTrimCandidateListPosition() == trimListUnusedPosition) { + if (wddmAllocation->getTrimCandidateListPosition(this->osContextId) == trimListUnusedPosition) { trimCandidatesCount++; trimCandidateList.push_back(allocation); - wddmAllocation->setTrimCandidateListPosition(position); + wddmAllocation->setTrimCandidateListPosition(this->osContextId, position); } checkTrimCandidateCount(); @@ -64,7 +64,7 @@ void WddmResidencyController::addToTrimCandidateList(GraphicsAllocation *allocat void WddmResidencyController::removeFromTrimCandidateList(GraphicsAllocation *allocation, bool compactList) { WddmAllocation *wddmAllocation = (WddmAllocation *)allocation; - size_t position = wddmAllocation->getTrimCandidateListPosition(); + size_t position = wddmAllocation->getTrimCandidateListPosition(this->osContextId); DEBUG_BREAK_IF(!(trimCandidatesCount > (trimCandidatesCount - 1))); DEBUG_BREAK_IF(trimCandidatesCount > trimCandidateList.size()); @@ -93,7 +93,7 @@ void WddmResidencyController::removeFromTrimCandidateList(GraphicsAllocation *al trimCandidateList.resize(sizeRemaining); } } - wddmAllocation->setTrimCandidateListPosition(trimListUnusedPosition); + wddmAllocation->setTrimCandidateListPosition(this->osContextId, trimListUnusedPosition); if (compactList && checkTrimCandidateListCompaction()) { compactTrimCandidateList(); @@ -102,6 +102,12 @@ void WddmResidencyController::removeFromTrimCandidateList(GraphicsAllocation *al checkTrimCandidateCount(); } +void WddmResidencyController::removeFromTrimCandidateListIfUsed(WddmAllocation *allocation, bool compactList) { + if (allocation->getTrimCandidateListPosition(this->osContextId) != trimListUnusedPosition) { + this->removeFromTrimCandidateList(allocation, true); + } +} + void WddmResidencyController::checkTrimCandidateCount() { if (DebugManager.flags.ResidencyDebugEnable.get()) { uint32_t sum = 0; @@ -142,7 +148,7 @@ void WddmResidencyController::compactTrimCandidateList() { if (trimCandidateList[i] != nullptr && freePosition < i) { trimCandidateList[freePosition] = trimCandidateList[i]; trimCandidateList[i] = nullptr; - ((WddmAllocation *)trimCandidateList[freePosition])->setTrimCandidateListPosition(freePosition); + static_cast(trimCandidateList[freePosition])->setTrimCandidateListPosition(this->osContextId, freePosition); freePosition++; // Last element was moved, erase elements from freePosition diff --git a/runtime/os_interface/windows/wddm_residency_controller.h b/runtime/os_interface/windows/wddm_residency_controller.h index 6887c42917..39a5a13aa4 100644 --- a/runtime/os_interface/windows/wddm_residency_controller.h +++ b/runtime/os_interface/windows/wddm_residency_controller.h @@ -18,7 +18,7 @@ class WddmAllocation; class WddmResidencyController { public: - WddmResidencyController(); + WddmResidencyController(uint32_t osContextId); void acquireLock(); void releaseLock(); @@ -29,6 +29,7 @@ class WddmResidencyController { WddmAllocation *getTrimCandidateHead(); void addToTrimCandidateList(GraphicsAllocation *allocation); void removeFromTrimCandidateList(GraphicsAllocation *allocation, bool compactList); + void removeFromTrimCandidateListIfUsed(WddmAllocation *allocation, bool compactList); void checkTrimCandidateCount(); bool checkTrimCandidateListCompaction(); @@ -40,9 +41,10 @@ class WddmResidencyController { uint32_t peekTrimCandidatesCount() const { return trimCandidatesCount; } protected: - std::atomic lock; + uint32_t osContextId; + std::atomic lock = false; std::atomic_flag trimCallbackLock = ATOMIC_FLAG_INIT; - uint64_t lastTrimFenceValue; + uint64_t lastTrimFenceValue = 0u; ResidencyContainer trimCandidateList; uint32_t trimCandidatesCount = 0; }; diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 33a1ddacb6..be65f0a11d 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -694,7 +694,7 @@ TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) { EXPECT_EQ(1u, csr->getResidencyAllocations().size()); EXPECT_EQ(0u, csr->getEvictionAllocations().size()); - EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition()); + EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); csr->processResidency(csr->getResidencyAllocations(), *device->getOsContext()); @@ -703,7 +703,7 @@ TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) { EXPECT_EQ(0u, csr->getResidencyAllocations().size()); EXPECT_EQ(0u, csr->getEvictionAllocations().size()); - EXPECT_EQ(0u, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition()); + EXPECT_EQ(0u, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); memoryManager->freeGraphicsMemory(commandBuffer); } @@ -777,12 +777,12 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt EXPECT_TRUE(found); } - EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)tagAllocation)->getTrimCandidateListPosition()); - EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition()); - EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)dshAlloc)->getTrimCandidateListPosition()); - EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)iohAlloc)->getTrimCandidateListPosition()); - EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)sshAlloc)->getTrimCandidateListPosition()); - EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)csrCommandStream)->getTrimCandidateListPosition()); + EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)tagAllocation)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); + EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); + EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)dshAlloc)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); + EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)iohAlloc)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); + EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)sshAlloc)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); + EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)csrCommandStream)->getTrimCandidateListPosition(device->getOsContext()->getContextId())); memoryManager->freeGraphicsMemory(dshAlloc); memoryManager->freeGraphicsMemory(iohAlloc); diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 06cbf7bfc3..359f7b0da9 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -55,6 +55,21 @@ TEST(WddmMemoryManager, NonAssignable) { EXPECT_FALSE(std::is_copy_assignable::value); } +TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { + WddmAllocation allocation{nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull, 3u}; + OsContext osContext{nullptr, 1u}; + allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); + EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(2u)); +} + +TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) { + WddmAllocation allocation{nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u}; + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u)); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u)); +} + TEST(WddmMemoryManagerAllocator32BitTest, allocator32BitIsCreatedWithCorrectBase) { ExecutionEnvironment executionEnvironment; std::unique_ptr wddm(static_cast(Wddm::createWddm())); @@ -1005,7 +1020,7 @@ TEST_F(WddmMemoryManagerResidencyTest, givenOneUsedAllocationFromPreviousPeriodi // 1 allocation evicted EXPECT_EQ(1u, wddm->makeNonResidentResult.called); // removed from trim candidate list - EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition()); + EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition(osContext->getContextId())); //marked nonresident EXPECT_FALSE(allocation1.getResidencyData().resident); @@ -1126,9 +1141,9 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) { osContext->get()->getResidencyController().compactTrimCandidateList(); EXPECT_EQ(1u, osContext->get()->getResidencyController().peekTrimCandidateList().size()); - EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition()); - EXPECT_EQ(trimListUnusedPosition, allocation2.getTrimCandidateListPosition()); - EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition()); + EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_EQ(trimListUnusedPosition, allocation2.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTrimIsNotZero) { @@ -1184,9 +1199,9 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesToTr EXPECT_EQ(2u, wddm->makeNonResidentResult.called); EXPECT_EQ(1u, osContext->get()->getResidencyController().peekTrimCandidateList().size()); - EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition()); - EXPECT_EQ(trimListUnusedPosition, allocation2.getTrimCandidateListPosition()); - EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition()); + EXPECT_EQ(trimListUnusedPosition, allocation1.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_EQ(trimListUnusedPosition, allocation2.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonResident) { diff --git a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp index 6fa3cfdabe..5b02ea2d3f 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -6,6 +6,7 @@ */ #include "runtime/os_interface/windows/wddm_residency_controller.h" +#include "runtime/os_interface/os_context.h" #include "unit_tests/os_interface/windows/mock_wddm_allocation.h" #include "test.h" @@ -17,24 +18,40 @@ class MockWddmResidencyController : public WddmResidencyController { public: using WddmResidencyController::trimCandidateList; using WddmResidencyController::trimCandidatesCount; + using WddmResidencyController::WddmResidencyController; }; struct WddmResidencyControllerTest : ::testing::Test { void SetUp() { - residencyController = std::make_unique(); + osContext = std::make_unique(nullptr, 0u); + residencyController = std::make_unique(osContext->getContextId()); } + std::unique_ptr osContext; std::unique_ptr residencyController; }; +TEST_F(WddmResidencyControllerTest, givenUsedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenRemoveIt) { + MockWddmAllocation allocation; + residencyController->addToTrimCandidateList(&allocation); + residencyController->removeFromTrimCandidateListIfUsed(&allocation, false); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContext->getContextId())); +} + +TEST_F(WddmResidencyControllerTest, givenUnusedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenIgnore) { + MockWddmAllocation allocation; + residencyController->removeFromTrimCandidateListIfUsed(&allocation, false); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContext->getContextId())); +} + TEST_F(WddmResidencyControllerTest, addToTrimCandidateListPlacesAllocationInContainerAndAssignsPosition) { MockWddmAllocation allocation; residencyController->addToTrimCandidateList(&allocation); EXPECT_NE(0u, residencyController->trimCandidateList.size()); - EXPECT_NE(trimListUnusedPosition, allocation.getTrimCandidateListPosition()); + EXPECT_NE(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContext->getContextId())); - size_t position = allocation.getTrimCandidateListPosition(); + size_t position = allocation.getTrimCandidateListPosition(osContext->getContextId()); ASSERT_LT(position, residencyController->trimCandidateList.size()); EXPECT_EQ(&allocation, residencyController->trimCandidateList[position]); @@ -47,9 +64,9 @@ TEST_F(WddmResidencyControllerTest, addToTrimCandidateListDoesNotInsertAllocatio residencyController->addToTrimCandidateList(&allocation); - EXPECT_NE(trimListUnusedPosition, allocation.getTrimCandidateListPosition()); + EXPECT_NE(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContext->getContextId())); - size_t position = allocation.getTrimCandidateListPosition(); + size_t position = allocation.getTrimCandidateListPosition(osContext->getContextId()); ASSERT_LT(position, residencyController->trimCandidateList.size()); EXPECT_EQ(&allocation, residencyController->trimCandidateList[position]); @@ -58,7 +75,7 @@ TEST_F(WddmResidencyControllerTest, addToTrimCandidateListDoesNotInsertAllocatio residencyController->addToTrimCandidateList(&allocation); EXPECT_EQ(previousSize, residencyController->trimCandidateList.size()); - EXPECT_EQ(position, allocation.getTrimCandidateListPosition()); + EXPECT_EQ(position, allocation.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmResidencyControllerTest, removeFromTrimCandidateListAssignsUnusedPosition) { @@ -67,14 +84,14 @@ TEST_F(WddmResidencyControllerTest, removeFromTrimCandidateListAssignsUnusedPosi residencyController->addToTrimCandidateList(&allocation); residencyController->removeFromTrimCandidateList(&allocation, false); - EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition()); + EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmResidencyControllerTest, removeFromTrimCandidateListRemovesAllocationInAssignedPosition) { MockWddmAllocation allocation; residencyController->addToTrimCandidateList(&allocation); - size_t position = allocation.getTrimCandidateListPosition(); + size_t position = allocation.getTrimCandidateListPosition(osContext->getContextId()); residencyController->removeFromTrimCandidateList(&allocation, false); @@ -123,8 +140,8 @@ TEST_F(WddmResidencyControllerTest, successiveAddingToTrimCandidateListAssignsNe residencyController->addToTrimCandidateList(&allocation3); EXPECT_EQ(3u, residencyController->trimCandidateList.size()); - EXPECT_NE(allocation1.getTrimCandidateListPosition(), allocation2.getTrimCandidateListPosition()); - EXPECT_NE(allocation2.getTrimCandidateListPosition(), allocation3.getTrimCandidateListPosition()); + EXPECT_NE(allocation1.getTrimCandidateListPosition(osContext->getContextId()), allocation2.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_NE(allocation2.getTrimCandidateListPosition(osContext->getContextId()), allocation3.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmResidencyControllerTest, DISABLED_removingNotLastAllocationFromTrimCandidateListSubstituesLastPositionAllocation) { @@ -138,8 +155,8 @@ TEST_F(WddmResidencyControllerTest, DISABLED_removingNotLastAllocationFromTrimCa EXPECT_EQ(2u, residencyController->trimCandidateList.size()); - EXPECT_EQ(2u, allocation3.getTrimCandidateListPosition()); - EXPECT_NE(allocation2.getTrimCandidateListPosition(), allocation3.getTrimCandidateListPosition()); + EXPECT_EQ(2u, allocation3.getTrimCandidateListPosition(osContext->getContextId())); + EXPECT_NE(allocation2.getTrimCandidateListPosition(osContext->getContextId()), allocation3.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmResidencyControllerTest, removingNotLastAllocationFromTrimCandidateListPutsNullEntry) { @@ -148,8 +165,8 @@ TEST_F(WddmResidencyControllerTest, removingNotLastAllocationFromTrimCandidateLi residencyController->addToTrimCandidateList(&allocation1); residencyController->addToTrimCandidateList(&allocation2); residencyController->addToTrimCandidateList(&allocation3); - size_t position2 = allocation2.getTrimCandidateListPosition(); - size_t position3 = allocation3.getTrimCandidateListPosition(); + size_t position2 = allocation2.getTrimCandidateListPosition(osContext->getContextId()); + size_t position3 = allocation3.getTrimCandidateListPosition(osContext->getContextId()); residencyController->removeFromTrimCandidateList(&allocation2, false); @@ -166,8 +183,8 @@ TEST_F(WddmResidencyControllerTest, compactTrimCandidateListRemovesInitialNullEn residencyController->addToTrimCandidateList(&allocation3); residencyController->addToTrimCandidateList(&allocation4); - size_t position3 = allocation3.getTrimCandidateListPosition(); - size_t position4 = allocation4.getTrimCandidateListPosition(); + size_t position3 = allocation3.getTrimCandidateListPosition(osContext->getContextId()); + size_t position4 = allocation4.getTrimCandidateListPosition(osContext->getContextId()); residencyController->removeFromTrimCandidateList(&allocation2, false); residencyController->removeFromTrimCandidateList(&allocation1, false); @@ -179,10 +196,10 @@ TEST_F(WddmResidencyControllerTest, compactTrimCandidateListRemovesInitialNullEn EXPECT_EQ(2u, residencyController->trimCandidateList.size()); EXPECT_EQ(residencyController->trimCandidateList[0], &allocation3); - EXPECT_EQ(0u, allocation3.getTrimCandidateListPosition()); + EXPECT_EQ(0u, allocation3.getTrimCandidateListPosition(osContext->getContextId())); EXPECT_EQ(residencyController->trimCandidateList[1], &allocation4); - EXPECT_EQ(1u, allocation4.getTrimCandidateListPosition()); + EXPECT_EQ(1u, allocation4.getTrimCandidateListPosition(osContext->getContextId())); } TEST_F(WddmResidencyControllerTest, compactTrimCandidateListWithNonNullEntries) {