kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
dependency.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_DEPENDENCY_HPP
2
#define KOKKOS_EXECUTION_IMPL_DEPENDENCY_HPP
3
4
#include "Kokkos_Core.hpp"
5
6
#include "
kokkos-execution/impl/dispatch_label.hpp
"
7
#include "
kokkos-execution/impl/event.hpp
"
8
9
namespace
Kokkos::Execution::Impl
{
10
11
template
<Kokkos::ExecutionSpace Exec>
12
struct
HasExecWaitEvent
: std::false_type { };
13
15
template
<
typename
Exec>
16
concept
has_exec_wait_event
=
HasExecWaitEvent<Exec>::value
;
17
30
template
<Kokkos::ExecutionSpace ExecTo, Kokkos::ExecutionSpace ExecFrom>
31
struct
Dependency
{
32
Dependency
(
const
ExecTo&,
const
ExecFrom& exec_from) {
33
exec_from.fence(std::string(
Impl::dispatch_label<ExecFrom, ": dependency">
()));
34
}
35
};
36
37
template
<Kokkos::ExecutionSpace Exec>
38
requires
(!has_exec_wait_event<Exec>)
39
struct
Dependency<Exec, Exec>
{
40
Dependency
(
const
Exec& exec_to,
const
Exec& exec_from) {
41
if
(exec_from != exec_to) {
42
exec_from.fence(std::string(
Impl::dispatch_label<Exec, ": dependency">
()));
43
}
44
}
45
};
46
47
template
<Kokkos::ExecutionSpace Exec>
48
requires
has_exec_wait_event<Exec>
49
struct
[[nodiscard]]
50
Dependency<Exec, Exec> {
51
Event<Exec>
event
{};
52
54
Dependency
(
const
Exec& exec_to,
const
Exec& exec_from) {
55
if
(exec_from != exec_to) {
56
record
(
event
, exec_from);
57
wait
(exec_to,
event
);
58
}
59
}
60
};
61
62
}
// namespace Kokkos::Execution::Impl
63
64
#if defined(KOKKOS_ENABLE_CUDA)
65
# include "
kokkos-execution/impl/Cuda/dependency.hpp
"
66
#endif
67
#if defined(KOKKOS_ENABLE_HIP)
68
# include "
kokkos-execution/impl/HIP/dependency.hpp
"
69
#endif
70
#if defined(KOKKOS_ENABLE_HPX)
71
# include "
kokkos-execution/impl/HPX/dependency.hpp
"
72
#endif
73
#if defined(KOKKOS_ENABLE_SYCL)
74
# include "
kokkos-execution/impl/SYCL/dependency.hpp
"
75
#endif
76
77
#endif
// KOKKOS_EXECUTION_IMPL_DEPENDENCY_HPP
dependency.hpp
dependency.hpp
dependency.hpp
dependency.hpp
Kokkos::Execution::Impl::event
Constrain an EventType type to be a valid event type for Exec execution space type.
Definition
event.hpp:26
Kokkos::Execution::Impl::has_exec_wait_event
Determine if the Kokkos backend can enqueue a wait for an event into an execution space instance.
Definition
dependency.hpp:16
dispatch_label.hpp
event.hpp
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::record
void record(Event< Exec > &event, const Exec &exec)
Record event on exec.
Definition
event.hpp:140
Kokkos::Execution::Impl::wait
void wait(const Event< Exec > &... events)
Wait for events to complete.
Definition
event.hpp:152
Kokkos::Execution::Impl::dispatch_label
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
Definition
dispatch_label.hpp:47
Kokkos::Execution::Impl::Dependency< Exec, Exec >::Dependency
Dependency(const Exec &exec_to, const Exec &exec_from)
Definition
dependency.hpp:40
Kokkos::Execution::Impl::Dependency::Dependency
Dependency(const ExecTo &, const ExecFrom &exec_from)
Definition
dependency.hpp:32
Kokkos::Execution::Impl::Event
An event that can be recorded on an execution space instance.
Definition
event.hpp:110
Kokkos::Execution::Impl::HasExecWaitEvent
Definition
dependency.hpp:12
kokkos-execution
impl
dependency.hpp
Generated on
for kokkos-execution by
1.18.0