@@ -109,6 +109,30 @@ TEST_F(PoolResidencyTestFixture,
109109 umfPoolFree (pool, ptr);
110110}
111111
112+ TEST_F (PoolResidencyTestFixture,
113+ existingAllocationsShouldBeEvictedFromRemovedDevice) {
114+ initializeMemoryPool (l0mock.initializeMemoryProviderWithResidentDevices (
115+ OUR_DEVICE, {DEVICE_2}));
116+
117+ EXPECT_CALL (l0mock, zeMemAllocDevice (CONTEXT, _, _, _, OUR_DEVICE, _))
118+ .WillOnce (
119+ DoAll (SetArgPointee<5 >(POINTER_0), Return (ZE_RESULT_SUCCESS)));
120+ EXPECT_CALL (l0mock, zeContextMakeMemoryResident (CONTEXT, DEVICE_2, _, _))
121+ .WillOnce (Return (ZE_RESULT_SUCCESS));
122+
123+ void *ptr = umfPoolMalloc (pool, 123 );
124+ EXPECT_EQ (ptr, POINTER_0);
125+
126+ EXPECT_CALL (l0mock, zeContextEvictMemory (CONTEXT, DEVICE_2, _, _))
127+ .WillOnce (Return (ZE_RESULT_SUCCESS));
128+
129+ umf_memory_provider_handle_t provider = nullptr ;
130+ EXPECT_EQ (umfPoolGetMemoryProvider (pool, &provider), UMF_RESULT_SUCCESS);
131+ umfLevelZeroMemoryProviderResidentDeviceChange (provider, DEVICE_2, false );
132+
133+ umfPoolFree (pool, ptr);
134+ }
135+
112136TEST_F (PoolResidencyTestFixture,
113137 allocationShouldNotBeMadeResidentOnRemovedDevice) {
114138 initializeMemoryPool (l0mock.initializeMemoryProviderWithResidentDevices (
0 commit comments