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_Macros.hpp"
5
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
6
import
kokkos.core;
7
# include "Kokkos_Assert.hpp"
8
#else
9
# include "Kokkos_Core.hpp"
10
#endif
11
17
18
namespace
Kokkos::Execution::Impl
{
19
20
template
<>
21
struct
HasNonBlockingDispatch
<
Kokkos
::SYCL> : std::true_type { };
22
23
template
<>
24
struct
Event
<
Kokkos
::SYCL> {
25
mutable
std::optional<sycl::event>
m_event
= std::nullopt;
26
uint64_t
m_event_id
= invalid_event_id;
27
28
Event
() =
default
;
29
Event
(
const
Event
&) =
delete
;
30
Event
&
operator=
(
const
Event
&) =
delete
;
31
Event
(
Event
&& other)
noexcept
=
delete
;
32
Event
&
operator=
(
Event
&& other)
noexcept
=
delete
;
33
38
void
record
(
const
Kokkos::SYCL& exec) {
39
m_event
= exec.sycl_queue().ext_oneapi_submit_barrier();
40
}
41
42
void
wait
()
const
{
43
if
(
m_event
.has_value()) {
44
m_event
->wait_and_throw();
45
m_event
= std::nullopt;
46
}
47
}
48
49
[[nodiscard]]
50
constexpr
const
sycl::event&
sycl_event
() const noexcept {
51
KOKKOS_EXPECTS(
m_event
.has_value());
52
return
*
m_event
;
53
}
54
};
55
56
template
<Kokkos::ExecutionSpace... ExecFrom>
57
requires
(std::same_as<ExecFrom, Kokkos::SYCL> && ...)
58
void
impl_wait
(const
Kokkos
::SYCL& exec, const
Event
<ExecFrom>&... events) {
59
exec.sycl_queue().submit([&](sycl::handler& cgh) { (cgh.depends_on(events.sycl_event()), ...); });
60
}
61
62
}
// namespace Kokkos::Execution::Impl
63
64
#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:60
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:42
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::record
void record(const Kokkos::SYCL &exec)
Definition
event.hpp:38
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:50
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::m_event_id
uint64_t m_event_id
Definition
event.hpp:26
Kokkos::Execution::Impl::Event< Kokkos::SYCL >::m_event
std::optional< sycl::event > m_event
Definition
event.hpp:25
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:115
Kokkos::Execution::Impl::HasNonBlockingDispatch
Determine if the Kokkos backend has non-blocking dispatch.
Definition
event.hpp:50
kokkos-execution
impl
SYCL
event.hpp
Generated on
for kokkos-execution by
1.18.0