57 static_assert(stdexec::__nothrow_connectable<schedule_from_sndr_t, Tests::Utils::SinkReceiver>);
73 const auto [exec_A, exec_B] = Kokkos::Experimental::partition_space(
exec, 1, 1);
78 const context_t esc_A{exec_A}, esc_B{exec_B};
85 auto schs_A_then = std::move(schs_A) |
THEN_LABELED(
'A');
87 const auto sch_B = esc_B.get_scheduler();
88 auto schs_A_then_con_B = std::move(schs_A_then)
89 | stdexec::continues_on(sch_B);
92 ASSERT_EQ(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(schs_A_then_con_B)), sch_B);
94 auto schs_A_then_con_B_then = std::move(schs_A_then_con_B)
97 static_assert(std::same_as<
98 stdexec::__demangle_t<
decltype(schs_A_then_con_B_then)>,
103 stdexec::continues_on_t,
106 stdexec::schedule_from_t,
120 auto schs_A_then_con_B_then_con_h_then = std::move(schs_A_then_con_B_then)
123 stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(schs_A_then_con_B_then_con_h_then)),
126 auto op_state = stdexec::connect(
127 std::move(schs_A_then_con_B_then_con_h_then),
129 .state = std::addressof(esc_h.
m_state), .runloop_state =
nullptr, .result =
nullptr});
140 Kokkos::RangePolicy<host_execution_space, Kokkos::LaunchBounds<1>>
143 static_assert(std::same_as<
decltype(op_state.inner_opstate.completion_signal.rcvr.rcvr.rcvr), then_rcvr_t>);
152 static_assert(std::same_as<
decltype(op_state.inner_opstate.completion_signal.rcvr.rcvr), con_h_then_rcvr_t>);
154 static_assert(std::same_as<
155 stdexec::env_of_t<con_h_then_rcvr_t>,
161 stdexec::__env::__fwd<Kokkos::Execution::Impl::SyncWait::env>
175 static_assert(std::same_as<
decltype(op_state.inner_opstate.completion_signal.rcvr), sfrom_con_h_then_rcvr_t>);
179 using then_sfrom_con_h_then_rcvr_t =
181 sfrom_con_h_then_rcvr_t,
185 Kokkos::RangePolicy<TEST_EXECUTION_SPACE, Kokkos::LaunchBounds<1>>
188 static_assert(std::same_as<
189 decltype(op_state.inner_opstate.inner_opstate.completion_signal.rcvr.rcvr.rcvr),
190 then_sfrom_con_h_then_rcvr_t
192 static_assert(!stdexec::__queryable_with<
193 stdexec::env_of_t<then_sfrom_con_h_then_rcvr_t>,
200 then_sfrom_con_h_then_rcvr_t
202 static_assert(std::same_as<
203 decltype(op_state.inner_opstate.inner_opstate.completion_signal.rcvr.rcvr),
204 con_B_then_sfrom_con_h_then_rcvr_t
206 static_assert(stdexec::__queryable_with<
207 stdexec::env_of_t<con_B_then_sfrom_con_h_then_rcvr_t>,
210 static_assert(std::same_as<
211 stdexec::env_of_t<con_B_then_sfrom_con_h_then_rcvr_t>,
217 stdexec::__env::__fwd<stdexec::env<
222 stdexec::__env::__fwd<Kokkos::Execution::Impl::SyncWait::env>
228 stdexec::get_env(op_state.inner_opstate.inner_opstate.completion_signal.rcvr.rcvr))
236 con_B_then_sfrom_con_h_then_rcvr_t
238 static_assert(std::same_as<
239 decltype(op_state.inner_opstate.inner_opstate.completion_signal.rcvr),
240 sfrom_con_B_then_sfrom_con_h_then_rcvr_t
242 static_assert(!stdexec::__queryable_with<
243 stdexec::env_of_t<sfrom_con_B_then_sfrom_con_h_then_rcvr_t>,
247 using then_sfrom_con_B_then_sfrom_con_h_then_rcvr_t =
249 sfrom_con_B_then_sfrom_con_h_then_rcvr_t,
253 Kokkos::RangePolicy<TEST_EXECUTION_SPACE, Kokkos::LaunchBounds<1>>
256 static_assert(std::same_as<
257 decltype(op_state.inner_opstate.inner_opstate.inner_opstate.rcvr),
258 then_sfrom_con_B_then_sfrom_con_h_then_rcvr_t
260 static_assert(!stdexec::__queryable_with<
261 stdexec::env_of_t<then_sfrom_con_B_then_sfrom_con_h_then_rcvr_t>,
268 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
274 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
278 ::testing::ElementsAre(
282 ASSERT_EQ(data(), 1);
292 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
300 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
304 ::testing::ElementsAre(
310 ASSERT_EQ(data(), 3) <<
"A synchronization is missing.";
317TEST_F(
ContinuesOnTest, transition_to_another_execution_space_instance_and_back_same_type) {
318 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
320 const auto [exec_A, exec_B] = Kokkos::Experimental::partition_space(
exec, 1, 1);
331 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
338 ::testing::ElementsAre(
346 ::testing::ElementsAre(
355 ASSERT_EQ(data(), 3) <<
"A synchronization is missing.";
362TEST_F(
ContinuesOnTest, transition_to_another_execution_space_instance_and_back_different_type) {
363 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
374 using level_B_env_t = stdexec::__env::__fwd<stdexec::env<
379 stdexec::__env::__fwd<level_C_env_t>
381 using level_A_env_t = stdexec::__env::__fwd<stdexec::env<
394 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
401 ::testing::ElementsAre(
409 ::testing::ElementsAre(
418 ASSERT_EQ(data(), 3) <<
"A synchronization is missing.";
423 using sndr_continues_on_t =
424 decltype(stdexec::just() | stdexec::continues_on(std::declval<typename ContinuesOnTest::scheduler_t>()));
426 static_assert(std::same_as<
427 stdexec::__demangle_t<sndr_continues_on_t>,
429 stdexec::continues_on_t,
432 stdexec::schedule_from_t,
439 static_assert(stdexec::__detail::__has_nothrow_transform_sender<
441 stdexec::set_value_t,
442 sndr_continues_on_t&&,
446 using sndr_schedule_from_t =
decltype(stdexec::schedule_from(
447 stdexec::schedule(std::declval<typename ContinuesOnTest::scheduler_t>())));
449 static_assert(std::same_as<
450 stdexec::__demangle_t<sndr_schedule_from_t>,
452 stdexec::schedule_from_t,
458 static_assert(stdexec::__detail::__has_nothrow_transform_sender<
460 stdexec::set_value_t,
461 sndr_schedule_from_t&&,
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_BEGIN_PFOR(_exec_, _label_)
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, BeginParallelForEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
#define THEN_INCREMENT(_data_)
Add a then using Tests::Utils::Functors::Increment that may throw. // NOLINTNEXTLINE(cppcoreguideline...
#define THEN_LABELED(_id_)
Add a then using Tests::Utils::Functors::Labeled. // NOLINTNEXTLINE(cppcoreguidelines-macro-usage).
constexpr get_exec_t get_exec
consteval bool test_schedule_from_sndr_traits()
consteval bool test_sndr_nothrow_transformable()
consteval bool test_continues_on_sndr_traits()
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()
Check how the scheduler customizes stdexec::continues_on.
void show_exec_space_id(const Exec &exec, std::string_view label="", std::ostream &out=std::cout)
constexpr check_rcvr_env_t< ExpectedEnv > check_rcvr_env
bool are_same_instances(const Exec &exec, const OtherExec &other_exec)
Matcher to filter out events that are just noise for tests.
Execution context using a Kokkos execution space under the hood.
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Receiver for continues_on.
Scheduler for a Kokkos execution space.
Inspired by https://github.com/kokkos/kokkos/blob/69273c3a4e7b6adeb95066341ca201d62fe1e698/core/src/i...
Wrap a Kokkos execution space to make it cheap to copy/move in new environments.
Receiver for an object parent_op that implements complete.
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Receiver for stdexec::sync_wait.
Inspired by https://github.com/NVIDIA/stdexec/blob/16076a81efa4477513e6ede9c2741fd034ecef99/include/s...
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
Kokkos::DefaultHostExecutionSpace host_execution_space