diff --git a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp index 8dbcb84776..64f5a5f141 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp @@ -814,7 +814,7 @@ TEST_F(Wddm20Tests, GivenMultipleHandlesWhenMakingResidentThenBytesToTrimIsCorre EXPECT_EQ(gdi->getMakeResidentArg().NumBytesToTrim, bytesToTrim); } -TEST_F(Wddm20Tests, WhenMakingNonResidentThenEvictIsCalled) { +TEST_F(Wddm20Tests, WhenMakingNonResidentAndEvictNotNeededThenEvictIsCalledWithProperFlagSet) { D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234; gdi->getEvictArg().AllocationList = nullptr; @@ -831,6 +831,7 @@ TEST_F(Wddm20Tests, WhenMakingNonResidentThenEvictIsCalled) { EXPECT_EQ(&handle, gdi->getEvictArg().AllocationList); EXPECT_EQ(wddm->getDeviceHandle(), gdi->getEvictArg().hDevice); EXPECT_EQ(0u, gdi->getEvictArg().NumBytesToTrim); + EXPECT_EQ(1u, gdi->getEvictArg().Flags.EvictOnlyIfNecessary); } TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) { diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 480a8e3049..cc61015eaa 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -366,6 +366,7 @@ bool Wddm::evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_ evict.hDevice = device; evict.NumAllocations = numOfHandles; evict.NumBytesToTrim = 0; + evict.Flags.EvictOnlyIfNecessary = 1; status = getGdi()->evict(&evict);