|
11 | 11 |
|
12 | 12 | #include <helpers/TestKernel.hpp> |
13 | 13 | #include <helpers/UrMock.hpp> |
| 14 | +#include <sycl/usm.hpp> |
14 | 15 |
|
15 | 16 | #include <iostream> |
16 | 17 | #include <memory> |
@@ -189,4 +190,34 @@ TEST_F(SchedulerTest, InOrderQueueNoSchedulerPath) { |
189 | 190 | EXPECT_EQ(KernelEventListSize[1] /*EventsCount*/, 0u); |
190 | 191 | } |
191 | 192 |
|
| 193 | +// Test that barrier is not filtered out when waitlist contains an event |
| 194 | +// produced by command which is bypassing the scheduler. |
| 195 | +TEST_F(SchedulerTest, BypassSchedulerWithBarrier) { |
| 196 | + sycl::unittest::UrMock<> Mock; |
| 197 | + sycl::platform Plt = sycl::platform(); |
| 198 | + |
| 199 | + mock::getCallbacks().set_before_callback( |
| 200 | + "urEnqueueEventsWaitWithBarrier", &redefinedEnqueueEventsWaitWithBarrier); |
| 201 | + BarrierCalled = false; |
| 202 | + |
| 203 | + context Ctx{Plt}; |
| 204 | + queue Q1{Ctx, default_selector_v, property::queue::in_order()}; |
| 205 | + queue Q2{Ctx, default_selector_v, property::queue::in_order()}; |
| 206 | + static constexpr size_t Size = 10; |
| 207 | + |
| 208 | + int *X = malloc_host<int>(Size, Ctx); |
| 209 | + |
| 210 | + // Submit a command which bypasses the scheduler. |
| 211 | + auto FillEvent = Q2.memset(X, 0, sizeof(int) * Size); |
| 212 | + // Submit a barrier which depends on that event. |
| 213 | + ExpectedEvent = detail::getSyclObjImpl(FillEvent)->getHandle(); |
| 214 | + auto BarrierQ1 = Q1.ext_oneapi_submit_barrier({FillEvent}); |
| 215 | + Q1.wait(); |
| 216 | + Q2.wait(); |
| 217 | + // Verify that barrier is not filtered out. |
| 218 | + EXPECT_EQ(BarrierCalled, true); |
| 219 | + |
| 220 | + free(X, Ctx); |
| 221 | +} |
| 222 | + |
192 | 223 | } // anonymous namespace |
0 commit comments