1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_SCOPED_REGION_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_SCOPED_REGION_HPP
8#include "impl/Kokkos_Profiling.hpp"
31enum class Kind : std::uint8_t {
36template <Kind kind, stdexec::__is_instance_of<Scheduler> Schd, stdexec::receiver Rcvr>
44 template <
typename Tag,
typename... Args>
45 void complete(Tag tag, Args&&... args) &&
noexcept {
46 schd.state->exec.fence(
53 Kokkos::Profiling::pushRegion(
name);
55 Kokkos::Profiling::popRegion();
58 std::invoke(tag, std::move(
rcvr), std::forward<Args>(args)...);
62 std::move(*this).complete(stdexec::set_value);
65 template <
typename Error>
67 std::move(*this).complete(stdexec::set_error, std::forward<Error>(err));
73template <Kind kind, stdexec::sender Sndr>
79 template <
typename Rcvr>
82 template <
typename Rcvr>
85 template <stdexec::__decays_to<RegionSender> Self, stdexec::receiver Rcvr>
87 constexpr STDEXEC_EXPLICIT_THIS_BEGIN(
88 auto connect)(
this Self&& self, Rcvr rcvr)
90 std::is_nothrow_constructible_v<
98 auto schd = stdexec::get_completion_scheduler<stdexec::set_value_t>(
99 stdexec::get_env(self.sndr), stdexec::get_env(rcvr));
101 return stdexec::connect(
105 .schd = std::move(schd),
106 .rcvr = std::move(rcvr)});
108 STDEXEC_EXPLICIT_THIS_END(
connect)
117 template <stdexec::sender Sndr,
typename T>
119 return {.name = std::forward<T>(name), .sndr = std::forward<Sndr>(sndr)};
122 template <
typename T>
124 return stdexec::__closure{*
this, std::forward<T>(name)};
129 template <stdexec::sender Sndr>
131 return {.sndr = std::forward<Sndr>(sndr)};
135 return stdexec::__closure{*
this};
141 template <stdexec::sender Sndr,
typename T, stdexec::__sender_adaptor_closure Closure>
143 return std::forward<Sndr>(sndr) |
Push{}(std::forward<T>(name)) | std::forward<Closure>(closure) |
Pop{}();
146 template <
typename T, stdexec::__sender_adaptor_closure Closure>
148 return stdexec::__closure{*
this, std::forward<T>(name), std::forward<Closure>(closure)};
#define KOKKOS_EXECUTION_COMPL_SIGS_KEEP(_decayed_self_type_, _sndr_type_)
#define KOKKOS_EXECUTION_FORWARDING_GET_ENV(_type_, _obj_)
Retrieve the environment of _obj_ (with forwarding). // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)...
#define KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV(_type_, _obj_)
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 auto display_string_of() noexcept -> std::string_view
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
constexpr auto connect(this Self &&self, Rcvr rcvr) noexcept(std::is_nothrow_constructible_v< rcvr_t< Rcvr >, decltype((std::declval< Self >().name)), schd_t< Rcvr > &&, Rcvr && > &&stdexec::__nothrow_connectable< decltype((std::declval< Self >().sndr)), rcvr_t< Rcvr > && >) -> stdexec::connect_result_t< decltype((std::declval< Self >().sndr)), rcvr_t< Rcvr > && >
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::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
#define KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T(_Self_, _member_)
Yields the type of member _member_ as accessed from expression _Self_, preserving the cv and ref qual...
#define KOKKOS_EXECUTION_IMPL_FORWARD_THIS(_Self_, _self_)
Equivalent to std::forward<_Self_>(_self_).