kokkos-execution
0.0.1
Toggle main menu visibility
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
12
namespace
Kokkos::Execution::Impl
{
13
14
template
<>
15
struct
HasNonBlockingDispatch
<
Kokkos
::SYCL> : std::true_type { };
16
17
template
<>
18
struct
Event
<
Kokkos
::SYCL> {
19
mutable
std::optional<sycl::event>
m_event
= std::nullopt;
20
uint64_t
m_event_id
= invalid_event_id;
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
[[nodiscard]]
44
constexpr
const
sycl::event&
sycl_event
() const noexcept {
45
KOKKOS_EXPECTS(
m_event
.has_value());
46
return
*
m_event
;
47
}
48
};
49
50
template
<Kokkos::ExecutionSpace... ExecFrom>
51
requires
(std::same_as<ExecFrom, Kokkos::SYCL> && ...)
52
void
impl_wait
(const
Kokkos
::SYCL& exec, const
Event
<ExecFrom>&... events) {
53
exec.sycl_queue().submit([&](sycl::handler& cgh) { (cgh.depends_on(events.sycl_event()), ...); });
54
}
55
56
}
// namespace Kokkos::Execution::Impl
57
58
#endif
// KOKKOS_EXECUTION_IMPL_SYCL_EVENT_HPP
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::impl_wait
void impl_wait(const Kokkos::Cuda &exec, const Event< ExecFrom > &... events)
Definition
event.hpp:54
Kokkos
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::operator=
Event & operator=(const Event &)=delete
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::Event
Event(Event &&other) noexcept=delete
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::wait
void wait() const
Definition
event.hpp:36
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::record
void record(const Kokkos::SYCL &exec)
Definition
event.hpp:32
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::Event
Event(const Event &)=delete
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::sycl_event
constexpr const sycl::event & sycl_event() const noexcept
Definition
event.hpp:44
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::m_event_id
uint64_t m_event_id
Definition
event.hpp:20
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::m_event
std::optional< sycl::event > m_event
Definition
event.hpp:19
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::Event
Event()=default
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::operator=
Event & operator=(Event &&other) noexcept=delete
Kokkos::Execution::Impl::Event
An event that can be recorded on an execution space instance.
Definition
event.hpp:110
Kokkos::Execution::Impl::HasNonBlockingDispatch
Determine if the Kokkos backend has non-blocking dispatch.
Definition
event.hpp:45
kokkos-execution
impl
SYCL
event.hpp
Generated on
for kokkos-execution by
1.18.0