kokkos-execution 0.0.1
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
8
10
11template <Kokkos::ExecutionSpace Exec>
12struct HasExecWaitEvent : std::false_type { };
13
15template <typename Exec>
17
30template <Kokkos::ExecutionSpace ExecTo, Kokkos::ExecutionSpace ExecFrom>
31struct Dependency {
32 Dependency(const ExecTo&, const ExecFrom& exec_from) {
33 exec_from.fence(std::string(Impl::dispatch_label<ExecFrom, ": dependency">()));
34 }
35};
36
37template <Kokkos::ExecutionSpace Exec>
38requires(!has_exec_wait_event<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
47template <Kokkos::ExecutionSpace Exec>
48requires has_exec_wait_event<Exec>
49struct [[nodiscard]]
50Dependency<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)
66#endif
67#if defined(KOKKOS_ENABLE_HIP)
69#endif
70#if defined(KOKKOS_ENABLE_HPX)
72#endif
73#if defined(KOKKOS_ENABLE_SYCL)
75#endif
76
77#endif // KOKKOS_EXECUTION_IMPL_DEPENDENCY_HPP
Constrain an EventType type to be a valid event type for Exec execution space type.
Definition event.hpp:26
Determine if the Kokkos backend can enqueue a wait for an event into an execution space instance.
void record(Event< Exec > &event, const Exec &exec)
Record event on exec.
Definition event.hpp:140
void wait(const Event< Exec > &... events)
Wait for events to complete.
Definition event.hpp:152
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
Dependency(const Exec &exec_to, const Exec &exec_from)
Dependency(const ExecTo &, const ExecFrom &exec_from)
An event that can be recorded on an execution space instance.
Definition event.hpp:110