38using namespace Kokkos::utils::callbacks;
66 using then_sndr_t = stdexec::transform_sender_result_t<
67 decltype(stdexec::then(std::declval<schd_sndr_t>(), std::declval<functor_t>())),
73 static_assert(std::same_as<Kokkos::Execution::Impl::exec_of_t<then_sndr_t>, TEST_EXECUTION_SPACE>);
95 static_assert(std::same_as<
97 stdexec::then_t::__sender<
103 static_assert(stdexec::__detail::__has_nothrow_transform_sender<
105 stdexec::set_value_t,
110 using sndr_then_maythrow_on_move_t =
113 static_assert(!stdexec::__detail::__has_nothrow_transform_sender<
114 Kokkos::Execution::GraphImpl::Domain,
115 stdexec::set_value_t,
116 sndr_then_maythrow_on_move_t&&,
128 static_assert(!std::is_nothrow_constructible_v<Kokkos::Experimental::Graph<TEST_EXECUTION_SPACE>>);
131 decltype(stdexec::schedule(std::declval<typename ThenTest::scheduler_t>()) | stdexec::then(Tests::Utils::Functors::NoOp<false, false, false>{}));
133 static_assert(!stdexec::__nothrow_connectable<sndr_then_t, Tests::Utils::SinkReceiver>);
145 decltype(stdexec::schedule(std::declval<typename ThenTest::scheduler_t>()) | stdexec::then(functor_t{}) | stdexec::then(functor_t{}));
146 using connect_result_t = stdexec::connect_result_t<sndr_t, Tests::Utils::SinkReceiver>;
148 static_assert(stdexec::__is_instance_of<connect_result_t, Kokkos::Execution::GraphImpl::OpState>);
150 using root_t =
typename ThenTest::graph_t::root_t;
151 using then_A_t = Kokkos::Experimental::GraphNodeRef<
152 TEST_EXECUTION_SPACE,
153 Kokkos::Impl::GraphNodeThenImpl<TEST_EXECUTION_SPACE, Kokkos::Experimental::ThenPolicy<>, functor_t>,
156 using then_B_t = Kokkos::Experimental::GraphNodeRef<
157 TEST_EXECUTION_SPACE,
158 Kokkos::Impl::GraphNodeThenImpl<TEST_EXECUTION_SPACE, Kokkos::Experimental::ThenPolicy<>, functor_t>,
162 static_assert(std::same_as<typename connect_result_t::predecessor_t, root_t>);
163 static_assert(std::same_as<typename connect_result_t::node_t, then_B_t>);
175 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
182 | stdexec::then(functor_t{.prev = 0, .value = 4, .data = data.data()})
183 | stdexec::then(functor_t{.prev = 4, .value = 3, .data = data.data()});
185 using sndr_t =
decltype(sndr);
187 static_assert(std::same_as<
188 stdexec::transform_sender_result_t<sndr_t, stdexec::env<>>,
190 TEST_EXECUTION_SPACE,
191 stdexec::then_t::__sender<functor_t, typename ThenTest::schedule_sender_t>,
197 static_assert(std::same_as<stdexec::__domain_of_t<stdexec::env_of_t<sndr_t>>, stdexec::default_domain>);
198 static_assert(std::same_as<
199 stdexec::__detail::__completing_domain_t<stdexec::set_value_t, sndr_t>,
204 static_assert(std::same_as<
209 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
216 testing::ElementsAre(
225 ASSERT_EQ(data(), 7);
232 using expt_node_t = Kokkos::Experimental::GraphNodeRef<
233 TEST_EXECUTION_SPACE,
234 Kokkos::Impl::GraphNodeThenImpl<TEST_EXECUTION_SPACE, Kokkos::Experimental::ThenPolicy<>, functor_t>,
235 Kokkos::Experimental::GraphNodeRef<
236 TEST_EXECUTION_SPACE,
237 Kokkos::Impl::GraphNodeThenImpl<TEST_EXECUTION_SPACE, Kokkos::Experimental::ThenPolicy<>, functor_t>,
238 Kokkos::Experimental::GraphNodeRef<TEST_EXECUTION_SPACE, Kokkos::Experimental::GraphNodeRootTag>
245 stdexec::schedule(gctx.
get_scheduler()) | stdexec::then(functor_t{}) | stdexec::then(functor_t{})
254 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
263 using chain_t =
decltype(chain);
266 stdexec::get_completion_signatures<chain_t>()
267 == stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>{});
270 std::same_as<stdexec::__completion_domain_of_t<stdexec::set_value_t, chain_t>, stdexec::indeterminate_domain<>>);
273 auto starts_on = stdexec::starts_on(gctx.
get_scheduler(), std::move(chain));
275 using starts_on_t =
decltype(starts_on);
278 static_assert(stdexec::__has_eptr_completion<chain_t>);
279 static_assert(!stdexec::dependent_sender<starts_on_t>);
281 stdexec::get_completion_signatures<starts_on_t>()
282 == stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>{});
285 static_assert(stdexec::__completes_where_it_starts<stdexec::set_value_t, stdexec::env_of_t<chain_t>>);
287 static_assert(std::same_as<
291 static_assert(std::same_as<
292 stdexec::__completion_domain_of_t<stdexec::set_value_t, starts_on_t, stdexec::env<>>,
296 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
302 testing::ElementsAre(
309 ASSERT_EQ(data(), 1);
314 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
316 std::atomic<size_t> count = 0;
322 stdexec::sender
auto sndr =
323 stdexec::read_env(stdexec::get_allocator)
329 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
337 testing::ElementsAre(
344 ASSERT_EQ(data(), 1);
346 ASSERT_EQ(value, 42);
constexpr std::string dispatch_label(const Exec &, const std::string_view label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
RecorderListener< ConjunctionMatcher< EventDiscardMatcher< TEST_EXECUTION_SPACE >, GraphEventDiscardMatcher< TEST_EXECUTION_SPACE > >, BeginFenceEvent, BeginParallelForEvent, AllocateDataEvent, DeallocateDataEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent, Kokkos::Execution::GraphImpl::GraphAddNodeEvent, Kokkos::Execution::GraphImpl::GraphCreateEvent, Kokkos::Execution::GraphImpl::GraphInstantiateEvent, Kokkos::Execution::GraphImpl::GraphSubmitEvent > recorder_listener_t
Concept for a sender whose completion scheduler is Kokkos::Execution::GraphImpl::Scheduler.
Concept that constrains the type of a sender that dispatches a functor for execution.
#define KOKKOS_EXECUTION_TEST_UTILS_GRAPH_FENCE(_exec_)
#define THEN_INCREMENT(_data_)
Add a then using Tests::Utils::Functors::Increment that may throw. // NOLINTNEXTLINE(cppcoreguideline...
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.
consteval bool test_sndr_nothrow_transformable()
consteval bool test_then_op_state_traits()
consteval bool test_sndr_traits()
consteval bool test_sndr_nothrow_connectable()
constexpr check_node_type_t< NodeType > check_node_type
The provided type NodeType is compared without cv type qualifiers during connect.
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)
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< execution_space >
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph node is added.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is created.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is instantiated.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is submitted.
Sender for stdexec::then.
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Similar to EventDiscardMatcher, for graph-related events.
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::GraphContext< Exec > context_t
Load the value at data and check it is equal to prev. Then, add value to it.
device_handle_t device_handle
A minimal tracking allocator.
#define MATCHER_FOR_GRAPH_CREATE(_device_handle_)
#define MATCHER_FOR_GRAPH_ADDNODE(_graph_create_event_variant_, _device_handle_, _predecessor_,...)
#define MATCHER_FOR_GRAPH_SUBMIT(_exec_, _graph_create_event_variant_)
#define MATCHER_FOR_GRAPH_ROOT_NODE_OF(_graph_create_event_)
#define MATCHER_FOR_GRAPH_NODE_OF(_graph_add_node_event_)