|
| 1 | +// |
| 2 | +// Copyright (C) 2026 Intel Corporation |
| 3 | +// |
| 4 | +// Under the MIT License or the Apache License v2.0. |
| 5 | +// See LICENSE-MIT and LICENSE-APACHE for license information. |
| 6 | +// SPDX-License-Identifier: MIT OR Apache-2.0 |
| 7 | +// |
| 8 | + |
| 9 | +#include "oneapi-rs-sys/include/event.hpp" |
| 10 | + |
| 11 | +using sycl::info::event_command_status; |
| 12 | + |
| 13 | +namespace syclintel = sycl::ext::intel; |
| 14 | + |
| 15 | +namespace sycl_shims::event { |
| 16 | +void wait(std::unique_ptr<Event> & event) { |
| 17 | + event->wait(); |
| 18 | +} |
| 19 | +std::unique_ptr<Event> clone(Event const & event) { |
| 20 | + return std::make_unique<Event>(sycl::event(event)); |
| 21 | +} |
| 22 | +EventCommandStatus get_command_execution_status(Event const & event) { |
| 23 | + auto status = event.get_info<sycl::info::event::command_execution_status>(); |
| 24 | + switch (status) { |
| 25 | + case event_command_status::submitted: |
| 26 | + return EventCommandStatus::Submitted; |
| 27 | + case event_command_status::running: |
| 28 | + return EventCommandStatus::Running; |
| 29 | + case event_command_status::complete: |
| 30 | + return EventCommandStatus::Complete; |
| 31 | + default: |
| 32 | + return EventCommandStatus::Unknown; |
| 33 | + } |
| 34 | +} |
| 35 | +void register_callback(std::unique_ptr<Queue> & queue, Event const & event, SharedWaker const * waker) { |
| 36 | + queue->submit([=](sycl::handler& cgh) { |
| 37 | + cgh.depends_on(event); |
| 38 | + cgh.host_task([=]() { waker->wake(); }); |
| 39 | + }); |
| 40 | +} |
| 41 | +} // namespace sycl_shims::event |
0 commit comments