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) && (KOKKOS_COMPILER_GNU == 1420 || KOKKOS_COMPILER_GNU == 1520)
21template <typename... Booleans>
22struct gcc_mor_helper {
23 static constexpr bool value = (Booleans::value || ...);
24};
25
26template <typename... Booleans>
27static constexpr bool gcc_mor_v = gcc_mor_helper<Booleans...>::value;
28#endif
29
33 struct Attach { };
34
36 struct Create { };
37
39 template <typename... Queryables>
40 using policy_t = std::conditional_t<
41#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU == 1420 || KOKKOS_COMPILER_GNU == 1520)
42 gcc_mor_v<stdexec::__mbool<stdexec::__queryable_with<Queryables, get_node_t>>...>,
43#else
44 (stdexec::__queryable_with<Queryables, get_node_t> || ...),
45#endif
46 Attach,
47 Create
48 >;
49
50 template <typename Exec, typename... Queryables>
52
53 template <typename Exec, typename... Queryables>
54 requires std::same_as<policy_t<Queryables...>, Create>
55 struct node_helper_t<Exec, Queryables...> {
56 using type = typename Kokkos::Experimental::Graph<Exec>::root_t;
57 };
58
59 template <typename Exec, typename FirstQueryable, typename... RestOfQueryables>
60 requires(
61 std::same_as<policy_t<FirstQueryable, RestOfQueryables...>, Attach>
62 && stdexec::__queryable_with<FirstQueryable, get_node_t>)
64 using type = stdexec::__query_result_t<FirstQueryable, get_node_t>;
65 };
66
67 template <typename Exec, typename FirstQueryable, typename... RestOfQueryables>
68 requires(std::same_as<policy_t<FirstQueryable, RestOfQueryables...>, Attach>)
70 using type = typename node_helper_t<Exec, RestOfQueryables...>::type;
71 };
72
77 template <typename Exec, typename... Queryables>
78 using node_t = typename node_helper_t<Exec, Queryables...>::type;
79};
80
81} // namespace Kokkos::Execution::GraphImpl
82
83#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:33
Create a new graph and attach after the root node.
Definition get_graph.hpp:36
Inspired by https://github.com/NVIDIA/stdexec/blob/8c5eedd0fcf9a8ebcdb75d988f72f88efcf64a37/include/s...
Definition get_graph.hpp:31
typename node_helper_t< Exec, Queryables... >::type node_t
Definition get_graph.hpp:78
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:40