Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
branch = 1.1.11
[submodule "external/stdexec"]
path = external/stdexec
url = https://github.com/NVIDIA/stdexec
url = https://github.com/uliegecsm/stdexec.git
2 changes: 1 addition & 1 deletion external/stdexec
Submodule stdexec updated 358 files
81 changes: 24 additions & 57 deletions tests/execution_space/test_when_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,18 @@ TEST_F(WhenAllTest, single_branch) {
Kokkos::Execution::ExecutionSpaceImpl::Domain
>);

/// Even though the sender returned by @c stdexec::when_all is in the customized domain,
/// it does not have a completion scheduler and so it is not an execution space completing sender.
static_assert(!Kokkos::Execution::ExecutionSpaceImpl::execution_space_completing_sender<decltype(sndr)>);
/// After the implementation of P4269R0 in https://github.com/NVIDIA/stdexec/pull/2124,
/// when_all(s) with a single sender is expression-equivalent to auto(s).
static_assert(std::same_as<stdexec::tag_of_t<decltype(sndr)>, stdexec::then_t>);
static_assert(Kokkos::Execution::ExecutionSpaceImpl::execution_space_completing_sender<decltype(sndr)>);

ASSERT_EQ(data(), 0) << "Eager execution is not allowed.";

const auto recorded_events = Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr));

/// Because the sender returned by @c stdexec::when_all is not an execution space completing sender,
/// the default implementation of @c stdexec::sync_wait is used.
ASSERT_THAT(recorded_events, [&]() {
if constexpr (Kokkos::Execution::Impl::has_non_blocking_dispatch<TEST_EXECUTION_SPACE>) {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_RECORD_EVENT(exec),
MATCHER_FOR_WAIT_EVENT(recorded_events.at(1)));
} else {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "after dispatch")));
}
}());
ASSERT_THAT(
Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr)),
testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait"))));

ASSERT_EQ(data(), 1);
}
Expand Down Expand Up @@ -181,24 +171,13 @@ TEST_F(WhenAllTest, single_branch_followed_by_other_and_finish_on_self) {

KOKKOS_EXECUTION_THREADS_THROWS_ON_SYNC_WAIT_ASSERT_AND_SKIP(sndr)

const auto recorded_events = Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr));

ASSERT_THAT(recorded_events, [&]() {
if constexpr (Kokkos::Execution::Impl::has_non_blocking_dispatch<TEST_EXECUTION_SPACE>) {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_RECORD_EVENT(exec),
MATCHER_FOR_WAIT_EVENT(recorded_events.at(1)),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait")));
} else {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "after dispatch")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait")));
}
}());
ASSERT_THAT(
Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr)),
testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait"))));

ASSERT_EQ(data(), 3);
}
Expand Down Expand Up @@ -438,26 +417,14 @@ TEST_F(WhenAllTest, nested_with_inner_followed_by_other) {

KOKKOS_EXECUTION_THREADS_THROWS_ON_SYNC_WAIT_ASSERT_AND_SKIP(sndr)

const auto recorded_events = Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr));

ASSERT_THAT(recorded_events, [&]() {
if constexpr (Kokkos::Execution::Impl::has_non_blocking_dispatch<TEST_EXECUTION_SPACE>) {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_RECORD_EVENT(exec),
MATCHER_FOR_WAIT_EVENT(recorded_events.at(2)),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait")));
} else {
return testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "after dispatch")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait")));
}
}());
ASSERT_THAT(
Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr)),
testing::ElementsAre(
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from")),
MATCHER_FOR_BEGIN_PFOR(exec, dispatch_label(exec, "then")),
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "sync_wait"))));

ASSERT_EQ(data(), 4);
}
Expand Down
13 changes: 8 additions & 5 deletions tests/execution_space/test_when_all.failure.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "kokkos-execution/execution_space.hpp"

/**
* @test A @c stdexec::when_all with a single branch on @ref Kokkos::Execution::ExecutionSpaceContext,
* @test A @c stdexec::when_all with two branches on @ref Kokkos::Execution::ExecutionSpaceContext,
* followed by work without any explicit scheduler provided.
*
* It is similar to @ref Tests::ExecutionSpaceImpl::WhenAllTest_single_branch_followed_by_self_Test.
* However, there is no completion scheduler in the environment after @c stdexec::when_all, yet the completion
* There is no completion scheduler in the environment after @c stdexec::when_all, yet the completion
* domain is @ref Kokkos::Execution::ExecutionSpaceImpl::Domain, such that our customization fails.
*
* @verbatim
* schedule(esc) | then -- when_all --> then
* schedule(esc) | then -- \
* when_all --> then
* schedule(esc) | then -- /
* @endverbatim
*/
int main() {
Expand All @@ -19,7 +20,9 @@ int main() {

const Kokkos::Execution::ExecutionSpaceContext<TEST_EXECUTION_SPACE> ctx{exec};

stdexec::sender auto when_all = stdexec::when_all(stdexec::schedule(ctx.get_scheduler()) | stdexec::then([]() { }));
stdexec::sender auto when_all = stdexec::when_all(
stdexec::schedule(ctx.get_scheduler()) | stdexec::then([]() { }),
stdexec::schedule(ctx.get_scheduler()) | stdexec::then([]() { }));

//! Completion domain is @ref Kokkos::Execution::ExecutionSpaceImpl::Domain.
static_assert(std::same_as<
Expand Down
16 changes: 4 additions & 12 deletions tests/graph/test_when_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,9 @@ consteval bool test_sndr_nothrow_transformable() {
static_assert(std::same_as<
stdexec::__demangle_t<when_all_sndr_t>,
Tests::Utils::basic_sender_t<
stdexec::when_all_t,
stdexec::__,
Tests::Utils::basic_sender_t<
stdexec::then_t,
Tests::Utils::Functors::NoOp<false, false, false>,
typename TEST_CATEGORY(WhenAllTest)::schedule_sender_t
>
stdexec::then_t,
Tests::Utils::Functors::NoOp<false, false, false>,
typename TEST_CATEGORY(WhenAllTest)::schedule_sender_t
>
>);

Expand Down Expand Up @@ -210,10 +206,8 @@ TEST_F(TEST_CATEGORY(WhenAllTest), one_branch) {
testing::ElementsAre(
MATCHER_FOR_GRAPH_CREATE(default_device_handle),
MATCHER_FOR_GRAPH_ADDNODE(recorded_events.at(0), device_handle, nullptr),
MATCHER_FOR_GRAPH_ADD_AGGREGATE_NODE(
recorded_events.at(0), MATCHER_FOR_GRAPH_NODE_OF(recorded_events.at(1))),
MATCHER_FOR_GRAPH_SUBMIT(TEST_EXECUTION_SPACE{}, recorded_events.at(0)),
MATCHER_FOR_BEGIN_FENCE(TEST_EXECUTION_SPACE{}, dispatch_label(TEST_EXECUTION_SPACE{}, "after dispatch"))));
MATCHER_FOR_BEGIN_FENCE(TEST_EXECUTION_SPACE{}, dispatch_label(TEST_EXECUTION_SPACE{}, "sync_wait"))));

ASSERT_EQ(data(), 1);
}
Expand Down Expand Up @@ -441,8 +435,6 @@ TEST_F(TEST_CATEGORY(WhenAllTest), forwarding_env) {
testing::ElementsAre(
MATCHER_FOR_GRAPH_CREATE(default_device_handle),
MATCHER_FOR_GRAPH_ADDNODE(recorded_events.at(0), device_handle, nullptr),
MATCHER_FOR_GRAPH_ADD_AGGREGATE_NODE(
recorded_events.at(0), MATCHER_FOR_GRAPH_NODE_OF(recorded_events.at(1))),
Comment on lines -444 to -445

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to go over the tests again and see which ones should be reworked the other way around, i.e. add a branch so that we stay in when_all.

MATCHER_FOR_GRAPH_SUBMIT(TEST_EXECUTION_SPACE{}, recorded_events.at(0)),
MATCHER_FOR_BEGIN_FENCE(TEST_EXECUTION_SPACE{}, dispatch_label(TEST_EXECUTION_SPACE{}, "after dispatch"))));

Expand Down
Loading