Skip to content

Commit 8de5a7f

Browse files
author
Jaime Arteaga
committed
[UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier
When event list is null, a barrier is still needed for all previous commands if profiling is enabled, so fix it. Signed-off-by: Jaime Arteaga <[email protected]>
1 parent 1b201d8 commit 8de5a7f

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ endif()
5353
if(SYCL_PI_UR_USE_FETCH_CONTENT)
5454
include(FetchContent)
5555

56-
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
56+
set(UNIFIED_RUNTIME_REPO "https://github.com/jandres742/unified-runtime.git")
5757
# commit ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc
5858
# Merge: 62e6d2f9 5fb82924
5959
# Author: Kenneth Benzie (Benie) <[email protected]>
6060
# Date: Wed Nov 8 13:32:46 2023 +0000
6161
# Merge pull request #1022 from 0x12CC/l0_usm_error_checking_2
6262
# [UR][L0] Propagate OOM errors from `USMAllocationMakeResident`
63-
set(UNIFIED_RUNTIME_TAG ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc)
63+
set(UNIFIED_RUNTIME_TAG 60a09f65c7dafc7f21927b46cf31f617b55d5d59)
6464

6565
if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
6666
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")

sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
int main() {
1111
sycl::queue Q1({sycl::property::queue::in_order{}});
1212
sycl::queue Q2({sycl::property::queue::in_order{}});
13+
sycl::queue Q3({sycl::property::queue::in_order{},
14+
sycl::property::queue::enable_profiling{}});
1315

1416
// Test case 1 - events in the barrier's waitlist are from different queues.
1517
std::cout << "Test1" << std::endl;
@@ -126,5 +128,30 @@ int main() {
126128
assert(Event11.get_info<sycl::info::event::command_execution_status>() ==
127129
sycl::info::event_command_status::complete);
128130

131+
// Test case 6 - submit barrier after queue sync with profiling enabled, i.e.
132+
// last event = nullptr.
133+
std::cout << "Test3" << std::endl;
134+
auto Event12 = Q3.submit(
135+
[&](sycl::handler &cgh) { cgh.single_task<class kernel12>([]() {}); });
136+
auto Event13 = Q3.submit(
137+
[&](sycl::handler &cgh) { cgh.single_task<class kernel13>([]() {}); });
138+
Q3.wait();
139+
140+
// CHECK: Test3
141+
// CHECK: ---> piEnqueueEventsWaitWithBarrier(
142+
// CHECK: ZE ---> zeEventCreate
143+
// CHECK-NOT: ZE ---> zeCommandListAppendWaitOnEvents
144+
// CHECK-NOT: ZE ---> zeCommandListAppendSignalEvent
145+
// CHECK: ZE ---> zeCommandListAppendBarrier
146+
// CHECK: ) ---> pi_result : PI_SUCCESS
147+
auto BarrierEvent6 = Q3.ext_oneapi_submit_barrier({Event12, Event13});
148+
BarrierEvent6.wait();
149+
150+
// Check that kernel events are completed after waiting for barrier event.
151+
assert(Event12.get_info<sycl::info::event::command_execution_status>() ==
152+
sycl::info::event_command_status::complete);
153+
assert(Event13.get_info<sycl::info::event::command_execution_status>() ==
154+
sycl::info::event_command_status::complete);
155+
129156
return 0;
130157
}

0 commit comments

Comments
 (0)