31using namespace Kokkos::utils::callbacks;
46 using variant_t =
typename recorder_listener_t::event_variant_t;
56 using then_sndr_t = stdexec::transform_sender_result_t<
57 decltype(stdexec::then(std::declval<schd_sndr_t>(), std::declval<functor_t>())),
63 static_assert(std::same_as<Kokkos::Execution::Impl::exec_of_t<then_sndr_t>, TEST_EXECUTION_SPACE>);
69 using policy_t =
typename then_sndr_t::closure_t::policy_t;
70 static_assert(std::same_as<typename policy_t::launch_bounds, Kokkos::LaunchBounds<1>>);
88 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
94 using chain_t =
decltype(chain);
97 static_assert(std::same_as<stdexec::__domain_of_t<stdexec::env_of_t<chain_t>>, stdexec::default_domain>);
98 static_assert(std::same_as<
99 stdexec::__detail::__completing_domain_t<stdexec::set_value_t, chain_t>,
104 static_assert(std::same_as<
105 decltype(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(chain))),
111 testing::ElementsAre(
116 ASSERT_EQ(data(), 2);
124 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
134 using chain_t =
decltype(chain);
139 stdexec::__mset<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>
143 std::same_as<stdexec::__completion_domain_of_t<stdexec::set_value_t, chain_t>, stdexec::indeterminate_domain<>>);
146 auto starts_on = stdexec::starts_on(esc.
get_scheduler(), std::move(chain));
148 using starts_on_t =
decltype(starts_on);
152 static_assert(std::same_as<
153 decltype(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(starts_on))),
157 static_assert(std::same_as<
158 std::invoke_result_t<stdexec::get_completion_signatures_t, starts_on_t, stdexec::env<>>,
159 stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>
162 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
166 ASSERT_THAT(recorded_events, [&]() {
168 return testing::ElementsAre(
174 return testing::ElementsAre(
181 ASSERT_EQ(data(), 2);
192 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
198 | stdexec::then(KOKKOS_LAMBDA() {
199 Kokkos::abort(
"The value channel should be used at this point.");
202 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
205 recorder_listener_t::record([sndr = std::move(sndr)]()
mutable {
208 testing::ThrowsMessage<std::runtime_error>(
209 testing::HasSubstr(
"ThrowsWhenCopied: Throwing in copy constructor!")));
211 testing::ElementsAre(
216 ASSERT_EQ(data(), 1);
229 auto create_chain_in_scope = [&]() {
230 const view_s_t data(Kokkos::view_alloc(
"data - shared space",
exec));
236 auto run_test = [&]() {
237 auto chain = create_chain_in_scope();
239 using chain_t =
decltype(chain);
242 static_assert(std::same_as<stdexec::__domain_of_t<stdexec::env_of_t<chain_t>>, stdexec::default_domain>);
243 static_assert(std::same_as<
244 stdexec::__detail::__completing_domain_t<stdexec::set_value_t, chain_t>,
249 static_assert(std::same_as<
250 decltype(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(chain))),
254 stdexec::sync_wait(std::move(chain));
258 recorder_listener_t::record(run_test),
280 static_assert(std::same_as<
281 stdexec::__demangle_t<sndr_then_t>,
289 static_assert(stdexec::__detail::__has_nothrow_transform_sender<
291 stdexec::set_value_t,
296 using sndr_then_maythrow_on_move_t =
299 static_assert(!stdexec::__detail::__has_nothrow_transform_sender<
301 stdexec::set_value_t,
302 sndr_then_maythrow_on_move_t&&,
312 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
314 std::atomic<size_t> count = 0;
320 stdexec::sender
auto sndr =
321 stdexec::read_env(stdexec::get_allocator)
327 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
331 ASSERT_THAT(recorded_events, [&]() {
333 return testing::ElementsAre(
338 return testing::ElementsAre(
344 ASSERT_EQ(data(), 1);
346 ASSERT_EQ(value, 42);
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_WAIT_EVENT(_record_event_variant_)
#define MATCHER_FOR_BEGIN_PFOR(_exec_, _label_)
#define MATCHER_FOR_RECORD_EVENT(_exec_)
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
typename recorder_listener_t::event_variant_t variant_t
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, BeginParallelForEvent, AllocateDataEvent, DeallocateDataEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
Concept for a sender whose completion scheduler is Kokkos::Execution::ExecutionSpaceImpl::Scheduler.
Concept that constrains the type of a sender that dispatches a functor for execution.
#define THEN_INCREMENT(_data_)
Add a then using Tests::Utils::Functors::Increment that may throw. // NOLINTNEXTLINE(cppcoreguideline...
auto AAllocateDataEvent(Matchers &&... matchers)
auto ADeallocateDataEvent(Matchers &&... matchers)
auto ContainsInOrder(Matchers &&... matchers)
consteval bool test_sndr_traits()
consteval bool test_sndr_nothrow_transformable()
typename stdexec::__basic_sender< Args... >::type basic_sender_t
See https://github.com/NVIDIA/stdexec/pull/1873#discussion_r2834863237.
auto record_sync_wait(Sndr &&sndr)
consteval bool check_continues_on_after_just_stopped()
constexpr check_rcvr_env_queryable_with_t< true, Queries... > check_rcvr_env_queryable_with
auto round_trip_allocate(Allocator &allocator, T &&value)
Matcher to filter out events that are just noise for tests.
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
decltype(std::declval< const context_t >().get_scheduler()) scheduler_t
decltype(stdexec::schedule(std::declval< scheduler_t >())) schedule_sender_t
Kokkos::View< value_t, Kokkos::SharedSpace > view_s_t
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
This helper struct throws when copy constructed.
A minimal tracking allocator.