@@ -154,7 +154,7 @@ TEST(InMemCacheEvictionTests, TestBasicEvictionAndLRU) {
154154}
155155
156156// Test to verify eviction using concurrent kernel invocation.
157- TEST (InMemCacheEvictionTests, TestConcurrentEvictionDifferentQueue ) {
157+ TEST (InMemCacheEvictionTests, TestConcurrentEvictionSameQueue ) {
158158 NumProgramBuild = 0 ;
159159 sycl::unittest::UrMock<> Mock;
160160 mock::getCallbacks ().set_before_callback (" urProgramCreateWithIL" ,
@@ -165,25 +165,26 @@ TEST(InMemCacheEvictionTests, TestConcurrentEvictionDifferentQueue) {
165165 sycl::platform Plt{sycl::platform ()};
166166 context Ctx{Plt};
167167 auto CtxImpl = detail::getSyclObjImpl (Ctx);
168+ queue q (Ctx, default_selector_v);
168169
169170 // One program is of 10000 bytes, so 20005 eviction threshold can
170171 // accommodate two program.
171172 setCacheEvictionEnv (" 20005" );
172173
173- constexpr size_t ThreadCount = 100 ;
174+ constexpr size_t ThreadCount = 200 ;
174175 Barrier barrier (ThreadCount);
175176 {
176177 auto ConcurrentInvokeKernels = [&](std::size_t threadId) {
177- queue q (Ctx, default_selector_v);
178+
178179 barrier.wait ();
179180 q.single_task <class Kernel1 >([] {});
180181 q.single_task <class Kernel2 >([] {});
181182 q.single_task <class Kernel3 >([] {});
182- q.wait_and_throw ();
183183 };
184184
185185 ThreadPool MPool (ThreadCount, ConcurrentInvokeKernels);
186186 }
187+ q.wait_and_throw ();
187188
188189 CheckNumberOfEntriesInCacheAndEvictionList (*CtxImpl, 2 );
189190}
@@ -200,6 +201,7 @@ TEST(InMemCacheEvictionTests, TestConcurrentEvictionSmallCache) {
200201
201202 context Ctx{platform ()};
202203 auto CtxImpl = detail::getSyclObjImpl (Ctx);
204+ queue q (Ctx, default_selector_v);
203205
204206 // One program is of 10000 bytes, so 100 eviction threshold will
205207 // trigger immediate eviction.
@@ -212,14 +214,13 @@ TEST(InMemCacheEvictionTests, TestConcurrentEvictionSmallCache) {
212214 Barrier barrier (ThreadCount);
213215 {
214216 auto ConcurrentInvokeKernels = [&](std::size_t threadId) {
215- queue q (Ctx, default_selector_v);
216217 barrier.wait ();
217218 q.single_task <class Kernel1 >([] {});
218- q.wait_and_throw ();
219219 };
220220
221221 ThreadPool MPool (ThreadCount, ConcurrentInvokeKernels);
222222 }
223+ q.wait_and_throw ();
223224
224225 CheckNumberOfEntriesInCacheAndEvictionList (*CtxImpl, 0 );
225226}
0 commit comments