Skip to content

Commit bbf4d5d

Browse files
Jaime Arteagakbenzie
andauthored
[UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier (#11541)
When event list is null, a barrier is still needed for all previous commands, so fix it. --------- Signed-off-by: Jaime Arteaga <[email protected]> Co-authored-by: Kenneth Benzie (Benie) <[email protected]>
1 parent 03be036 commit bbf4d5d

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
5757
include(FetchContent)
5858

5959
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
60-
# commit ce4acbc4e479c3e8c591f345f7ba30345a8a2a40
61-
# Merge: 76aaf05c 28590a82
60+
# commit e69ed21468e04ed6e832accf162422ed11736446
61+
# Merge: 20fa0b5f 7fd9dafd
6262
# Author: Kenneth Benzie (Benie) <[email protected]>
63-
# Date: Wed Dec 6 17:13:51 2023 +0000
64-
# Merge pull request #1099 from jandres742/largeallocations
65-
# [UR][L0] Unify use of large allocation in L0 adapter
66-
set(UNIFIED_RUNTIME_TAG ce4acbc4e479c3e8c591f345f7ba30345a8a2a40)
63+
# Date: Fri Dec 8 12:18:51 2023 +0000
64+
# Merge pull request #962 from jandres742/fixwaitbarrierwithevent
65+
# [UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier
66+
set(UNIFIED_RUNTIME_TAG e69ed21468e04ed6e832accf162422ed11736446)
6767

6868
if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
6969
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)