1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_SCOPED_REGION_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_SCOPED_REGION_HPP
8#include "impl/Kokkos_Profiling.hpp"
29enum class Kind : std::uint8_t {
34template <Kind kind, stdexec::__is_instance_of<Scheduler> Schd, stdexec::receiver Rcvr>
42 template <
typename Tag,
typename... Args>
43 void complete(Tag tag, Args&&... args) &&
noexcept {
44 schd.state->exec.fence(
47 Kokkos::Impl::TypeInfo<typename Schd::execution_space>::name(),
51 Kokkos::Profiling::pushRegion(
name);
53 Kokkos::Profiling::popRegion();
56 std::invoke(tag, std::move(
rcvr), std::forward<Args>(args)...);
60 std::move(*this).complete(stdexec::set_value);
63 template <
typename Error>
65 std::move(*this).complete(stdexec::set_error, std::forward<Error>(err));
71template <Kind kind, stdexec::sender Sndr>
77 template <
typename Rcvr>
80 template <
typename Rcvr>
83 template <stdexec::receiver Rcvr>
84 stdexec::operation_state
auto connect(Rcvr rcvr) &&
noexcept(
85 std::is_nothrow_constructible_v<rcvr_t<Rcvr>, std::string&&,
schd_t<Rcvr>&&, Rcvr&&>
86 && stdexec::__nothrow_connectable<Sndr&&, rcvr_t<Rcvr>>) {
88 stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(
sndr), stdexec::get_env(rcvr));
90 return stdexec::connect(
91 std::forward<Sndr>(
sndr),
92 rcvr_t<Rcvr>{.name = std::move(
name), .schd = std::move(schd), .rcvr = std::move(rcvr)});
102 template <stdexec::sender Sndr,
typename T>
104 return {.name = std::forward<T>(name), .sndr = std::forward<Sndr>(sndr)};
107 template <
typename T>
109 return stdexec::__closure{*
this, std::forward<T>(name)};
114 template <stdexec::sender Sndr>
116 return {.sndr = std::forward<Sndr>(sndr)};
120 return stdexec::__closure{*
this};
126 template <stdexec::sender Sndr,
typename T, stdexec::__sender_adaptor_closure Closure>
128 return std::forward<Sndr>(sndr) |
Push{}(std::forward<T>(name)) | std::forward<Closure>(closure) |
Pop{}();
131 template <
typename T, stdexec::__sender_adaptor_closure Closure>
133 return stdexec::__closure{*
this, std::forward<T>(name), std::forward<Closure>(closure)};
#define KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV(_type_, _obj_)
#define KOKKOS_EXECUTION_COMPL_SIGS_KEEP(_sndr_type_)
#define KOKKOS_EXECUTION_FORWARDING_GET_ENV(_type_, _obj_)
Retrieve the environment of _obj_ (with forwarding). // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)...
Kind
Kind of region action.
std::invoke_result_t< stdexec::get_completion_scheduler_t< Tag >, stdexec::env_of_t< Sndr >, Env... > completion_scheduler_of_t
Retrieve the completion scheduler for a given completion tag.
constexpr Kokkos::Execution::ExecutionSpaceImpl::Push push
constexpr Kokkos::Execution::ExecutionSpaceImpl::ScopedRegion scoped_region
constexpr Kokkos::Execution::ExecutionSpaceImpl::Pop pop
auto operator()() const noexcept
auto operator()(Sndr &&sndr) const noexcept -> RegionSender< Kind::POP, Sndr >
auto operator()(T &&name) const noexcept
auto operator()(Sndr &&sndr, T &&name) const noexcept -> RegionSender< Kind::PUSH, Sndr >
void set_error(Error &&err) &&noexcept
void complete(Tag tag, Args &&... args) &&noexcept
void set_value() &&noexcept
stdexec::receiver_tag receiver_concept
RegionReceiver< kind, schd_t< Rcvr >, Rcvr > rcvr_t
Impl::completion_scheduler_of_t< stdexec::set_value_t, Sndr, stdexec::env_of_t< Rcvr > > schd_t
stdexec::operation_state auto connect(Rcvr rcvr) &&noexcept(std::is_nothrow_constructible_v< rcvr_t< Rcvr >, std::string &&, schd_t< Rcvr > &&, Rcvr && > &&stdexec::__nothrow_connectable< Sndr &&, rcvr_t< Rcvr > >)
stdexec::sender_tag sender_concept
Helper for Kokkos::Profiling::scoped_region.
auto operator()(Sndr &&sndr, T &&name, Closure &&closure) const noexcept
auto operator()(T &&name, Closure &&closure) const noexcept