1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_OPERATION_STATE_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_OPERATION_STATE_HPP
19template <
typename Clsr>
20concept Closure =
requires(
const Clsr& clsr) {
21 typename Clsr::execution_space;
23 { clsr.submit() } -> std::same_as<void>;
25 { clsr.get_policy() };
26 requires Kokkos::ExecutionPolicy<std::remove_cvref_t<
decltype(clsr.get_policy())>>;
28 requires std::same_as<std::remove_cvref_t<
decltype(clsr.get_policy().space())>,
typename Clsr::execution_space>;
31template <
typename Exec,
typename Rcvr>
39 && stdexec::__queryable_with<stdexec::env_of_t<Rcvr>, stdexec::get_delegation_scheduler_t>) {
46template <stdexec::receiver Rcvr, Closure Clsr, Closure... Clsrs>
47requires(std::same_as<typename Clsr::execution_space, typename Clsrs::execution_space> && ...)
58 constexpr explicit OpStateBase(Rcvr rcvr, Clsr clsr_, Clsrs... clsrs_)
noexcept(
59 std::is_nothrow_constructible_v<completion_signal_t, Rcvr&&> && std::is_nothrow_move_constructible_v<Clsr>
60 && (std::is_nothrow_move_constructible_v<Clsrs> && ...))
62 ,
clsrs(std::move(clsr_), std::move(clsrs_)...) {
69 template <
typename Error>
70 void complete(stdexec::set_error_t, Error&& error)
noexcept {
71 stdexec::set_error(std::move(
completion_signal.rcvr), std::forward<Error>(error));
74 void complete(stdexec::set_stopped_t)
noexcept {
80 stdexec::__apply([](
auto&... clsr) { (clsr.submit(), ...); },
clsrs);
82 this->
complete(stdexec::set_error, std::current_exception());
97template <stdexec::sender Sndr, stdexec::receiver Rcvr,
Closure... Clsrs>
110 std::is_nothrow_constructible_v<
base_t, Rcvr&&, Clsrs&&...>;
117#if defined(KOKKOS_EXECUTION_IMPL_OPSTATE_IMMOVABLE_FIX)
125 :
base_t(std::move(rcvr_), std::move(clsrs_)...)
134template <
typename Sndr,
typename Rcvr,
typename... Clsrs>
137template <
typename Sndr,
typename Rcvr,
typename... Clsrs>
Concept that constrains the type of a sender that dispatches a functor for execution.
#define KOKKOS_EXECUTION_GET_ENV(_type_, _obj_)
Retrieve the environment of _obj_. // NOLINTNEXTLINE(cppcoreguidelines-macro-usage).
typename make_opstate_t< Sndr, Rcvr, Clsrs... >::type opstate_t
consteval auto select_completion_signal_policy()
Impl::MakeOpState< Domain, OpState >::Huddle< Sndr, Rcvr, Clsrs... > make_opstate_t
constexpr get_exec_t get_exec
Impl::CompletionSignal< completion_signal_policy_t, execution_space, Rcvr > completion_signal_t
constexpr auto query(Impl::get_exec_t) const noexcept -> Impl::ExecutionSpaceRef< execution_space >
typename Clsr::execution_space execution_space
void complete(stdexec::set_stopped_t) noexcept
stdexec::__tuple< Clsr, Clsrs... > closures_t
decltype(select_completion_signal_policy< execution_space, Rcvr >()) completion_signal_policy_t
constexpr OpStateBase(Rcvr rcvr, Clsr clsr_, Clsrs... clsrs_) noexcept(std::is_nothrow_constructible_v< completion_signal_t, Rcvr && > &&std::is_nothrow_move_constructible_v< Clsr > &&(std::is_nothrow_move_constructible_v< Clsrs > &&...))
void complete(stdexec::set_error_t, Error &&error) noexcept
completion_signal_t completion_signal
void complete(stdexec::set_value_t) noexcept
Impl::SubmittedOperationStateTag operation_state_concept
Impl::Receiver< base_t > rcvr_t
constexpr OpState(Sndr &&sndr, Rcvr rcvr_, Clsrs... clsrs_) noexcept(opstate_base_is_nothrow_constructible &&inner_opstate_is_nothrow_constructible)
stdexec::connect_result_t< Sndr, rcvr_t > inner_opstate_t
inner_opstate_t inner_opstate
OpStateBase< Rcvr, Clsrs... > base_t
static constexpr bool opstate_base_is_nothrow_constructible
static constexpr bool inner_opstate_is_nothrow_constructible
Wrap a Kokkos execution space to make it cheap to copy/move in new environments.
Receiver for an object parent_op that implements complete.