1#ifndef KOKKOS_EXECUTION_IMPL_COMPLETION_SIGNAL_HPP
2#define KOKKOS_EXECUTION_IMPL_COMPLETION_SIGNAL_HPP
6#if defined(KOKKOS_EXECUTION_ENABLE_DEBUG_LOGGING)
28template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
31 bool operator()(
const Exec& exec,
const Rcvr& rcvr)
const noexcept
32 requires(stdexec::__queryable_with<stdexec::env_of_t<Rcvr>,
get_exec_t>)
34 if constexpr (std::same_as<exec_of_t<stdexec::env_of_t<Rcvr>>, Exec>) {
35 const auto& src = exec;
36 const auto& dst =
get_exec(stdexec::get_env(rcvr)).get();
37#if defined(KOKKOS_EXECUTION_ENABLE_DEBUG_LOGGING)
38 PLOG_DEBUG <<
"The synchronization happens if " << Kokkos::Tools::Experimental::device_id(src)
39 <<
" is not equal to " << Kokkos::Tools::Experimental::device_id(dst) <<
'.';
47 constexpr bool operator()(
const Exec&,
const Rcvr&)
const noexcept
48 requires(!stdexec::__queryable_with<stdexec::env_of_t<Rcvr>,
get_exec_t>)
50#if defined(KOKKOS_EXECUTION_ENABLE_DEBUG_LOGGING)
51 PLOG_DEBUG <<
"Synchronization always required.";
57template <
typename Policy, Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
74template <
typename Policy>
75concept sync_policy = std::derived_from<Policy, SyncPolicyTag>;
82template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
90 stdexec::set_value(std::move(
rcvr));
93 exec.fence(std::string(
label));
94 stdexec::set_value(std::move(
rcvr));
96 stdexec::set_error(std::move(
rcvr), std::current_exception());
102template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
113 stdexec::set_error(std::move(
completion_signal->rcvr), std::current_exception());
124template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
129 stdexec::schedule_result_t<delegation_scheduler_t>,
139 stdexec::set_value(std::move(
rcvr));
146 stdexec::schedule(stdexec::get_delegation_scheduler(stdexec::get_env(
rcvr))),
150 stdexec::set_error(std::move(
rcvr), std::current_exception());
170template <
typename Policy>
173template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
178 std::move(
rcvr).submitted();
188template <Kokkos::ExecutionSpace Exec, stdexec::receiver Rcvr>
Data structure that has an interface similar to std::optional but stores the value with stdexec::__ma...
Constrain an EventType type to be a valid event type for Exec execution space type.
OptionalRef< const Event< Exec > > OptionalConstEventRef
Optionally stores a reference to a const Impl::Event.
std::optional< Event< Exec > > event_storage_t
stdexec::__query_result_t< const Env &, stdexec::get_delegation_scheduler_t > delegation_scheduler_of_t
void record(Event< Exec > &event, const Exec &exec)
Record event on exec.
void wait(const Event< Exec > &... events)
Wait for events to complete.
constexpr get_exec_t get_exec
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
Impl::event_storage_t< Exec > event_storage_t
void propagate(const Exec &exec) &noexcept
event_storage_t event_storage
void propagate(const Exec &) &noexcept
static constexpr auto label
void propagate(const Exec &exec) &noexcept
stdexec::connect_result_t< stdexec::schedule_result_t< delegation_scheduler_t >, ScheduleWaitEventReceiver< Exec, Rcvr > > inner_opstate_t
OptionalStorage< inner_opstate_t > inner_opstate
void propagate(const Exec &exec) &noexcept
Impl::event_storage_t< Exec > event_storage_t
Impl::delegation_scheduler_of_t< stdexec::env_of_t< Rcvr > > delegation_scheduler_t
constexpr bool operator()(const Exec &, const Rcvr &) const noexcept
bool operator()(const Exec &exec, const Rcvr &rcvr) const noexcept
stdexec::receiver_tag receiver_concept
void set_value() &&noexcept
CompletionSignal< SyncPolicy::ScheduleWaitEvent, Exec, Rcvr > * completion_signal
Under a sync policy, a terminal completion is propagated: in-flight operations must complete.