kokkos-execution 0.0.1
Loading...
Searching...
No Matches
event.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_IMPL_SYCL_EVENT_HPP
2#define KOKKOS_EXECUTION_IMPL_SYCL_EVENT_HPP
3
4#include "Kokkos_Core.hpp"
5
11
13
14template <>
15struct HasNonBlockingDispatch<Kokkos::SYCL> : std::true_type { };
16
17template <>
18struct Event<Kokkos::SYCL> {
19 mutable std::optional<sycl::event> m_event = std::nullopt;
21
22 Event() = default;
23 Event(const Event&) = delete;
24 Event& operator=(const Event&) = delete;
25 Event(Event&& other) noexcept = delete;
26 Event& operator=(Event&& other) noexcept = delete;
27
32 void record(const Kokkos::SYCL& exec) {
33 m_event = exec.sycl_queue().ext_oneapi_submit_barrier();
34 }
35
36 void wait() const {
37 if (m_event.has_value()) {
38 m_event->wait_and_throw();
39 m_event = std::nullopt;
40 }
41 }
42};
43
44template <>
45void impl_wait(const Kokkos::SYCL& exec, const Event<Kokkos::SYCL>& event) {
46 KOKKOS_EXPECTS(event.m_event.has_value());
47 exec.sycl_queue().submit([&](sycl::handler& cgh) { cgh.depends_on(*event.m_event); });
48}
49
50} // namespace Kokkos::Execution::Impl
51
52#endif // KOKKOS_EXECUTION_IMPL_SYCL_EVENT_HPP
Constrain an EventType type to be a valid event type for Exec execution space type.
Definition event.hpp:24
static constexpr auto invalid_event_id
Definition event.hpp:49
void impl_wait(const Kokkos::Cuda &exec, const Event< Kokkos::Cuda > &event)
Definition event.hpp:48
Event & operator=(const Event &)=delete
Event(Event &&other) noexcept=delete
void record(const Kokkos::SYCL &exec)
Definition event.hpp:32
std::optional< sycl::event > m_event
Definition event.hpp:19
Event & operator=(Event &&other) noexcept=delete
An event that can be recorded on an execution space instance.
Definition event.hpp:108
Determine if the Kokkos backend has non-blocking dispatch.
Definition event.hpp:43