From aced55243ccb4078869053feb089abb46489bf14 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Thu, 14 Jul 2022 22:29:14 +0000 Subject: [PATCH] Enable eviction only when needed flag in wddm Related-To: NEO-7179 Signed-off-by: Zbigniew Zdanowicz --- opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp | 3 ++- shared/source/os_interface/windows/wddm/wddm.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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);