kokkos-execution 0.0.1
Loading...
Searching...
No Matches
get_graph.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_GRAPH_GET_GRAPH_HPP
2#define KOKKOS_EXECUTION_GRAPH_GET_GRAPH_HPP
3
5
7
9
15struct get_graph_t : public stdexec::__query<get_graph_t> { };
16
17inline constexpr get_graph_t get_graph{};
18
19#if defined(KOKKOS_COMPILER_GNU) \
20 && (KOKKOS_COMPILER_GNU == 1420 || KOKKOS_COMPILER_GNU == 1520 || KOKKOS_COMPILER_GNU == 1601)
22template <typename... Booleans>
23struct gcc_mor_helper {
24 static constexpr bool value = (Booleans::value || ...);
25};
26
27template <typename... Booleans>
28static constexpr bool gcc_mor_v = gcc_mor_helper<Booleans...>::value;
29#endif
30
34 struct Attach { };
35
37 struct Create { };
38
40 template <typename... Queryables>
41 using policy_t = std::conditional_t<
42#if defined(KOKKOS_COMPILER_GNU) \
43 && (KOKKOS_COMPILER_GNU == 1420 || KOKKOS_COMPILER_GNU == 1520 || KOKKOS_COMPILER_GNU == 1601)
44 gcc_mor_v<stdexec::__mbool<stdexec::__queryable_with<Queryables, get_node_t>>...>,
45#else
46 (stdexec::__queryable_with<Queryables, get_node_t> || ...),
47#endif
48 Attach,
49 Create
50 >;
51
52 template <typename Exec, typename... Queryables>
54
55 template <typename Exec, typename... Queryables>
56 requires std::same_as<policy_t<Queryables...>, Create>
57 struct node_helper_t<Exec, Queryables...> {
58 using type = typename Kokkos::Experimental::Graph<Exec>::root_t;
59 };
60
61 template <typename Exec, typename FirstQueryable, typename... RestOfQueryables>
62 requires(
63 std::same_as<policy_t<FirstQueryable, RestOfQueryables...>, Attach>
64 && stdexec::__queryable_with<FirstQueryable, get_node_t>)
66 using type = stdexec::__query_result_t<FirstQueryable, get_node_t>;
67 };
68
69 template <typename Exec, typename FirstQueryable, typename... RestOfQueryables>
70 requires(std::same_as<policy_t<FirstQueryable, RestOfQueryables...>, Attach>)
72 using type = typename node_helper_t<Exec, RestOfQueryables...>::type;
73 };
74
79 template <typename Exec, typename... Queryables>
80 using node_t = typename node_helper_t<Exec, Queryables...>::type;
81};
82
83} // namespace Kokkos::Execution::GraphImpl
84
85#endif // KOKKOS_EXECUTION_GRAPH_GET_GRAPH_HPP
constexpr get_graph_t get_graph
Definition get_graph.hpp:17
Attach to the existing graph of the predecessor.
Definition get_graph.hpp:34
Create a new graph and attach after the root node.
Definition get_graph.hpp:37
Inspired by https://github.com/NVIDIA/stdexec/blob/8c5eedd0fcf9a8ebcdb75d988f72f88efcf64a37/include/s...
Definition get_graph.hpp:32
typename node_helper_t< Exec, Queryables... >::type node_t
Definition get_graph.hpp:80
std::conditional_t<(stdexec::__queryable_with< Queryables, get_node_t >||...), Attach, Create > policy_t
Use the Attach policy if any Queryables is queryable with get_node_t.
Definition get_graph.hpp:41