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_Macros.hpp"
5
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
6
import
kokkos.core;
7
#else
8
# include "Kokkos_Core.hpp"
9
#endif
10
11
#include "
kokkos-execution/impl/dispatch_label.hpp
"
12
#include "
kokkos-execution/impl/event.hpp
"
13
14
namespace
Kokkos::Execution::Impl
{
15
16
template
<Kokkos::ExecutionSpace Exec>
17
struct
HasExecWaitEvent
: std::false_type { };
18
20
template
<
typename
Exec>
21
concept
has_exec_wait_event
=
HasExecWaitEvent<Exec>::value
;
22
35
template
<Kokkos::ExecutionSpace ExecTo, Kokkos::ExecutionSpace ExecFrom>
36
struct
Dependency
{
37
Dependency
(
const
ExecTo&,
const
ExecFrom& exec_from) {
38
exec_from.fence(std::string(
KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL
(ExecFrom,
": dependency"
)));
39
}
40
};
41
42
template
<Kokkos::ExecutionSpace Exec>
43
requires
(!has_exec_wait_event<Exec>)
44
struct
Dependency<Exec, Exec>
{
45
Dependency
(
const
Exec& exec_to,
const
Exec& exec_from) {
46
if
(exec_from != exec_to) {
47
exec_from.fence(std::string(
KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL
(Exec,
": dependency"
)));
48
}
49
}
50
};
51
52
template
<Kokkos::ExecutionSpace Exec>
53
requires
has_exec_wait_event<Exec>
54
struct
[[nodiscard]]
55
Dependency<Exec, Exec> {
56
Event<Exec>
event
{};
57
59
Dependency
(
const
Exec& exec_to,
const
Exec& exec_from) {
60
if
(exec_from != exec_to) {
61
record
(
event
, exec_from);
62
wait
(exec_to,
event
);
63
}
64
}
65
};
66
67
}
// namespace Kokkos::Execution::Impl
68
69
#if defined(KOKKOS_ENABLE_CUDA)
70
# include "
kokkos-execution/impl/Cuda/dependency.hpp
"
71
#endif
72
#if defined(KOKKOS_ENABLE_HIP)
73
# include "
kokkos-execution/impl/HIP/dependency.hpp
"
74
#endif
75
#if defined(KOKKOS_ENABLE_HPX)
76
# include "
kokkos-execution/impl/HPX/dependency.hpp
"
77
#endif
78
#if defined(KOKKOS_ENABLE_SYCL)
79
# include "
kokkos-execution/impl/SYCL/dependency.hpp
"
80
#endif
81
82
#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:31
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:21
dispatch_label.hpp
KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL
#define KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL(_exec_, _suffix_)
Definition
dispatch_label.hpp:51
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:145
Kokkos::Execution::Impl::wait
void wait(const Event< Exec > &... events)
Wait for events to complete.
Definition
event.hpp:157
Kokkos::Execution::Impl::Dependency< Exec, Exec >::Dependency
Dependency(const Exec &exec_to, const Exec &exec_from)
Definition
dependency.hpp:45
Kokkos::Execution::Impl::Dependency::Dependency
Dependency(const ExecTo &, const ExecFrom &exec_from)
Definition
dependency.hpp:37
Kokkos::Execution::Impl::Event
An event that can be recorded on an execution space instance.
Definition
event.hpp:115
Kokkos::Execution::Impl::HasExecWaitEvent
Definition
dependency.hpp:17
kokkos-execution
impl
dependency.hpp
Generated on
for kokkos-execution by
1.18.0