kokkos-execution 0.0.1
Loading...
Searching...
No Matches
make_opstate.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_IMPL_MAKE_OPSTATE_HPP
2#define KOKKOS_EXECUTION_IMPL_MAKE_OPSTATE_HPP
3
5
7
9
10template <typename DomainType, template <typename...> typename OpStateType>
12
13 template <typename Sndr, typename Rcvr, typename... Clsrs>
14 struct Huddle {
15 using type = OpStateType<Sndr, Rcvr, Clsrs...>;
16
17 // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
18 constexpr auto operator()(Sndr&& sndr, Rcvr rcvr, Clsrs... clsrs) const
19 noexcept(std::is_nothrow_constructible_v<type, Sndr&&, Rcvr&&, Clsrs&&...>) -> type {
20 return type(std::forward<Sndr>(sndr), std::move(rcvr), std::move(clsrs)...);
21 }
22 };
23
24 template <Impl::dispatching_sender Sndr, typename Rcvr, typename... Clsrs>
25 struct Huddle<Sndr, Rcvr, Clsrs...> {
26 using child_of_sndr_t = stdexec::__child_of<Sndr>;
27 using clsr_of_sndr_t = typename stdexec::transform_sender_result_t<Sndr, stdexec::env_of_t<Rcvr>>::closure_t;
28
30 using type = typename huddle_fn_t::type;
31
32 static constexpr bool sndr_has_nothrow_transform_sender = stdexec::__detail::__has_nothrow_transform_sender<
33 DomainType,
34 stdexec::set_value_t,
35 Sndr&&,
36 stdexec::env_of_t<Rcvr>
37 >;
38
39 static constexpr bool is_nothrow_huddle =
40 std::is_nothrow_invocable_v<huddle_fn_t, child_of_sndr_t&&, Rcvr&&, clsr_of_sndr_t&&, Clsrs&&...>;
41
48 // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
49 constexpr auto operator()(Sndr&& sndr, Rcvr&& rcvr, Clsrs... clsrs) const
51 auto trnsfrmd_sndr = stdexec::transform_sender(std::forward<Sndr>(sndr), stdexec::get_env(rcvr));
52 return huddle_fn_t{}(
53 stdexec::__forward_like<Sndr>(trnsfrmd_sndr.sndr),
54 std::forward<Rcvr>(rcvr),
55 std::move(trnsfrmd_sndr.clsr),
56 std::move(clsrs)...);
57 }
58 };
59};
60
61} // namespace Kokkos::Execution::Impl
62
63#endif // KOKKOS_EXECUTION_IMPL_MAKE_OPSTATE_HPP
Concept that constrains the type of a sender that dispatches a functor for execution.
constexpr auto operator()(Sndr &&sndr, Rcvr &&rcvr, Clsrs... clsrs) const noexcept(sndr_has_nothrow_transform_sender &&is_nothrow_huddle) -> type
Huddle< child_of_sndr_t, Rcvr, clsr_of_sndr_t, Clsrs... > huddle_fn_t
typename stdexec::transform_sender_result_t< Sndr, stdexec::env_of_t< Rcvr > >::closure_t clsr_of_sndr_t
OpStateType< Sndr, Rcvr, Clsrs... > type
constexpr auto operator()(Sndr &&sndr, Rcvr rcvr, Clsrs... clsrs) const noexcept(std::is_nothrow_constructible_v< type, Sndr &&, Rcvr &&, Clsrs &&... >) -> type