From bbf4d5dc9cc180eadaf37f8d8ae43793bbf43aa8 Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Fri, 8 Dec 2023 13:42:39 -0600 Subject: [PATCH] [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 Co-authored-by: Kenneth Benzie (Benie) --- sycl/plugins/unified_runtime/CMakeLists.txt | 12 ++++----- .../level_zero_barrier_optimization.cpp | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index f56b90b588c4c..167d5d8c77695 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) include(FetchContent) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - # commit ce4acbc4e479c3e8c591f345f7ba30345a8a2a40 - # Merge: 76aaf05c 28590a82 + # commit e69ed21468e04ed6e832accf162422ed11736446 + # Merge: 20fa0b5f 7fd9dafd # Author: Kenneth Benzie (Benie) - # Date: Wed Dec 6 17:13:51 2023 +0000 - # Merge pull request #1099 from jandres742/largeallocations - # [UR][L0] Unify use of large allocation in L0 adapter - set(UNIFIED_RUNTIME_TAG ce4acbc4e479c3e8c591f345f7ba30345a8a2a40) + # Date: Fri Dec 8 12:18:51 2023 +0000 + # Merge pull request #962 from jandres742/fixwaitbarrierwithevent + # [UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier + set(UNIFIED_RUNTIME_TAG e69ed21468e04ed6e832accf162422ed11736446) if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO) set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}") diff --git a/sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp b/sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp index 08ad9d4ba1cf4..5df66e474535f 100644 --- a/sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp +++ b/sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp @@ -10,6 +10,8 @@ int main() { sycl::queue Q1({sycl::property::queue::in_order{}}); sycl::queue Q2({sycl::property::queue::in_order{}}); + sycl::queue Q3({sycl::property::queue::in_order{}, + sycl::property::queue::enable_profiling{}}); // Test case 1 - events in the barrier's waitlist are from different queues. std::cout << "Test1" << std::endl; @@ -126,5 +128,30 @@ int main() { assert(Event11.get_info() == sycl::info::event_command_status::complete); + // Test case 6 - submit barrier after queue sync with profiling enabled, i.e. + // last event = nullptr. + std::cout << "Test3" << std::endl; + auto Event12 = Q3.submit( + [&](sycl::handler &cgh) { cgh.single_task([]() {}); }); + auto Event13 = Q3.submit( + [&](sycl::handler &cgh) { cgh.single_task([]() {}); }); + Q3.wait(); + + // CHECK: Test3 + // CHECK: ---> piEnqueueEventsWaitWithBarrier( + // CHECK: ZE ---> zeEventCreate + // CHECK-NOT: ZE ---> zeCommandListAppendWaitOnEvents + // CHECK-NOT: ZE ---> zeCommandListAppendSignalEvent + // CHECK: ZE ---> zeCommandListAppendBarrier + // CHECK: ) ---> pi_result : PI_SUCCESS + auto BarrierEvent6 = Q3.ext_oneapi_submit_barrier({Event12, Event13}); + BarrierEvent6.wait(); + + // Check that kernel events are completed after waiting for barrier event. + assert(Event12.get_info() == + sycl::info::event_command_status::complete); + assert(Event13.get_info() == + sycl::info::event_command_status::complete); + return 0; }