Skip to content

Commit

Permalink
[UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier (i…
Browse files Browse the repository at this point in the history
…ntel#11541)

When event list is null, a barrier is still needed for all previous
commands, so fix it.

---------

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Co-authored-by: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
  • Loading branch information
Jaime Arteaga and kbenzie authored Dec 8, 2023
1 parent 03be036 commit bbf4d5d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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) <k.benzie@codeplay.com>
# 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}")
Expand Down
27 changes: 27 additions & 0 deletions sycl/test-e2e/Plugin/level_zero_barrier_optimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -126,5 +128,30 @@ int main() {
assert(Event11.get_info<sycl::info::event::command_execution_status>() ==
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<class kernel12>([]() {}); });
auto Event13 = Q3.submit(
[&](sycl::handler &cgh) { cgh.single_task<class kernel13>([]() {}); });
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_execution_status>() ==
sycl::info::event_command_status::complete);
assert(Event13.get_info<sycl::info::event::command_execution_status>() ==
sycl::info::event_command_status::complete);

return 0;
}

0 comments on commit bbf4d5d

Please sign in to comment.