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_HIP_EVENT_HPP
2
#define KOKKOS_EXECUTION_IMPL_HIP_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
::HIP> : std::true_type { };
22
23
template
<>
24
struct
Event
<
Kokkos
::HIP> {
25
hipEvent_t
m_event
=
nullptr
;
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
&&) noexcept = delete;
32
Event
& operator=(
Event
&&) noexcept = delete;
33
34
~
Event
() {
35
if
(
m_event
!=
nullptr
)
36
KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(
m_event
));
37
}
38
39
void
record
(
const
Kokkos::HIP& exec) {
40
if
(
m_event
==
nullptr
) {
41
KOKKOS_IMPL_HIP_SAFE_CALL(hipEventCreateWithFlags(&
m_event
, hipEventDisableTiming));
42
}
43
KOKKOS_IMPL_HIP_SAFE_CALL(hipEventRecord(
m_event
, exec.hip_stream()));
44
}
45
46
void
wait
()
const
{
47
if
(hipEventQuery(
m_event
) != hipSuccess) {
48
KOKKOS_IMPL_HIP_SAFE_CALL(hipEventSynchronize(
m_event
));
49
}
50
}
51
52
[[nodiscard]]
53
constexpr
hipEvent_t
hip_event
() const noexcept {
54
return
m_event
;
55
}
56
};
57
58
template
<Kokkos::ExecutionSpace... ExecFrom>
59
requires
(std::same_as<ExecFrom, Kokkos::HIP> && ...)
60
void
impl_wait
(const
Kokkos
::HIP& exec, const
Event
<ExecFrom>&... events) {
61
auto
do_impl_wait = [&exec](
const
auto
&
event
) {
62
KOKKOS_EXPECTS(
bool
(
event
.hip_event()));
63
KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamWaitEvent(exec.hip_stream(),
event
.hip_event()));
64
};
65
(do_impl_wait(events), ...);
66
}
67
68
}
// namespace Kokkos::Execution::Impl
69
70
#endif
// KOKKOS_EXECUTION_IMPL_HIP_EVENT_HPP
Kokkos::Execution::Impl::event
Constrain an EventType type to be a valid event type for Exec execution space type.
Definition
event.hpp:31
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::HIP >::Event
Event(const Event &)=delete
Kokkos::Execution::Impl::Event< Kokkos::HIP >::wait
void wait() const
Definition
event.hpp:46
Kokkos::Execution::Impl::Event< Kokkos::HIP >::m_event
hipEvent_t m_event
Definition
event.hpp:25
Kokkos::Execution::Impl::Event< Kokkos::HIP >::record
void record(const Kokkos::HIP &exec)
Definition
event.hpp:39
Kokkos::Execution::Impl::Event< Kokkos::HIP >::Event
Event()=default
Kokkos::Execution::Impl::Event< Kokkos::HIP >::operator=
Event & operator=(const Event &)=delete
Kokkos::Execution::Impl::Event< Kokkos::HIP >::hip_event
constexpr hipEvent_t hip_event() const noexcept
Definition
event.hpp:53
Kokkos::Execution::Impl::Event< Kokkos::HIP >::m_event_id
uint64_t m_event_id
Definition
event.hpp:26
Kokkos::Execution::Impl::Event< Kokkos::HIP >::Event
Event(Event &&) 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
HIP
event.hpp
Generated on
for kokkos-execution by
1.18.0