|
8 | 8 |
|
9 | 9 | #include <helpers/TestKernel.hpp>
|
10 | 10 | #include <helpers/UrMock.hpp>
|
| 11 | +#include <sycl/sycl.hpp> |
11 | 12 |
|
12 | 13 | #include <gtest/gtest.h>
|
13 | 14 |
|
14 | 15 | static unsigned NumOfEventsWaitWithBarrierCalls = 0;
|
| 16 | +static unsigned NumEventsInWaitList = 0; |
15 | 17 |
|
16 |
| -static ur_result_t redefined_urEnqueueEventsWaitWithBarrierExt(void *) { |
| 18 | +static ur_result_t redefined_urEnqueueEventsWaitWithBarrierExt(void *pParams) { |
17 | 19 | NumOfEventsWaitWithBarrierCalls++;
|
| 20 | + // Get the number of events in the wait list |
| 21 | + auto params = *static_cast<ur_enqueue_events_wait_with_barrier_ext_params_t *>(pParams); |
| 22 | + NumEventsInWaitList = *params.pnumEventsInWaitList; |
18 | 23 |
|
19 | 24 | return UR_RESULT_SUCCESS;
|
20 | 25 | }
|
@@ -94,3 +99,18 @@ TEST(Queue, ExtOneAPISubmitBarrierWithWaitList) {
|
94 | 99 |
|
95 | 100 | ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
|
96 | 101 | }
|
| 102 | + |
| 103 | +TEST(Queue, BarrierWithBarrierDep) { |
| 104 | + sycl::unittest::UrMock<> Mock; |
| 105 | + mock::getCallbacks().set_before_callback( |
| 106 | + "urEnqueueEventsWaitWithBarrierExt", |
| 107 | + &redefined_urEnqueueEventsWaitWithBarrierExt); |
| 108 | + sycl::queue Q1(sycl::property::queue::in_order{}); |
| 109 | + sycl::queue Q2(sycl::property::queue::in_order{}); |
| 110 | + Q1.submit( |
| 111 | + [&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); }); |
| 112 | + sycl::event Barrier1 = Q1.ext_oneapi_submit_barrier(); |
| 113 | + NumEventsInWaitList = 0; |
| 114 | + Q2.ext_oneapi_submit_barrier({Barrier1}); |
| 115 | + ASSERT_EQ(NumEventsInWaitList, 1u); |
| 116 | +} |
0 commit comments