1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_OPERATION_STATE_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_OPERATION_STATE_HPP
18template <
typename Clsr>
19concept Closure =
requires(
const Clsr& clsr) {
20 typename Clsr::execution_space;
22 { clsr.submit() } -> std::same_as<void>;
24 { clsr.get_policy() };
25 requires Kokkos::ExecutionPolicy<std::remove_cvref_t<
decltype(clsr.get_policy())>>;
27 requires std::same_as<std::remove_cvref_t<
decltype(clsr.get_policy().space())>,
typename Clsr::execution_space>;
30template <
typename Exec,
typename Rcvr>
33 stdexec::__is_instance_of<Rcvr, Impl::SyncWait::Receiver>
34 || stdexec::__is_instance_of<Rcvr, ScheduleFromReceiver>) {
40 && stdexec::__queryable_with<stdexec::env_of_t<Rcvr>, stdexec::get_delegation_scheduler_t>) {
47template <
typename Exec,
typename Rcvr>
51requires(std::same_as<typename Clsr::execution_space, typename Clsrs::execution_space> && ...)
62 constexpr explicit OpStateBase(Rcvr rcvr, Clsr clsr_, Clsrs... clsrs_)
noexcept(
63 std::is_nothrow_constructible_v<completion_signal_t, Rcvr&&> && std::is_nothrow_move_constructible_v<Clsr>
64 && (std::is_nothrow_move_constructible_v<Clsrs> && ...))
66 ,
clsrs(std::move(clsr_), std::move(clsrs_)...) {
71 stdexec::__apply([](
auto&... clsr) { (clsr.submit(), ...); },
clsrs);
73 this->
complete(stdexec::set_error, std::current_exception());
79 template <
typename Error>
80 void complete(stdexec::set_error_t, Error&& error)
noexcept {
84 void complete(stdexec::set_stopped_t)
noexcept {
96 return stdexec::get_env(this->completion_signal.rcvr);
100template <stdexec::sender Sndr, stdexec::receiver Rcvr, Closure... Clsrs>
113 std::is_nothrow_constructible_v<
base_t, Rcvr&&, Clsrs&&...>;
120#if defined(KOKKOS_EXECUTION_IMPL_OPSTATE_IMMOVABLE_FIX)
128 :
base_t(std::move(rcvr_), std::move(clsrs_)...)
137template <
typename Sndr,
typename Rcvr,
typename... Clsrs>
140template <
typename Sndr,
typename Rcvr,
typename... Clsrs>
Concept that constrains the type of a sender that dispatches a functor for execution.
decltype(select_sync_policy< Exec, Rcvr >()) select_sync_policy_t
typename make_opstate_t< Sndr, Rcvr, Clsrs... >::type opstate_t
consteval auto select_sync_policy()
Impl::MakeOpState< Domain, OpState >::Huddle< Sndr, Rcvr, Clsrs... > make_opstate_t
constexpr get_exec_t get_exec
constexpr auto get_env() const noexcept -> stdexec::env_of_t< Rcvr >
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
select_sync_policy_t< execution_space, Rcvr > sync_policy_t
stdexec::__tuple< Clsr, Clsrs... > closures_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
Impl::CompletionSignal< sync_policy_t, execution_space, Rcvr > completion_signal_t
completion_signal_t completion_signal
void complete(stdexec::set_value_t) noexcept
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
stdexec::operation_state_tag operation_state_concept
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.