Skip to content
Merged
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ target_sources(
kokkos-execution/impl/event.hpp
kokkos-execution/impl/HIP/event.hpp
kokkos-execution/impl/HPX/event.hpp
kokkos-execution/impl/immovable.hpp
kokkos-execution/impl/sender_concepts.hpp
kokkos-execution/impl/SYCL/event.hpp
kokkos-execution/impl/state.hpp
Expand Down
1 change: 1 addition & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_EXTRACT_ALL YES)
set(DOXYGEN_EXTRACT_STATIC YES)
set(DOXYGEN_FILE_PATTERNS *.c *.cpp *.h *.hpp)
set(DOXYGEN_GENERATE_BUGLIST YES)
set(DOXYGEN_IMAGE_PATH ${CMAKE_SOURCE_DIR})
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_PREDEFINED __DOXYGEN__)
Expand Down
2 changes: 1 addition & 1 deletion external/stdexec
Submodule stdexec updated 194 files
4 changes: 2 additions & 2 deletions kokkos-execution/execution_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct Scheduler {

template <stdexec::receiver Rcvr>
struct OpState {
using operation_state_concept = stdexec::operation_state_t;
using operation_state_concept = stdexec::operation_state_tag;

Rcvr rcvr;

Expand All @@ -46,7 +46,7 @@ struct Scheduler {
};

struct Sender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

using completion_signatures = stdexec::completion_signatures<stdexec::set_value_t()>;

Expand Down
4 changes: 2 additions & 2 deletions kokkos-execution/execution_space/continues_on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct FwdWithoutExec { };
//! Receiver for @c continues_on.
template <stdexec::receiver Rcvr, typename FwdPolicy = FwdWithExec>
struct ContinuesOnReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

Rcvr rcvr;

Expand Down Expand Up @@ -60,7 +60,7 @@ struct ContinuesOnReceiver {
//! Sender for @c continues_on.
template <stdexec::sender Sndr>
struct ContinuesOnSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

Sndr sndr; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)

Expand Down
15 changes: 8 additions & 7 deletions kokkos-execution/execution_space/operation_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "kokkos-execution/impl/dispatch_label.hpp"
#include "kokkos-execution/impl/env.hpp"
#include "kokkos-execution/impl/event.hpp"
#include "kokkos-execution/impl/immovable.hpp"
#include "kokkos-execution/impl/sender_concepts.hpp"
#include "kokkos-execution/impl/sync_wait.hpp"

Expand Down Expand Up @@ -100,7 +101,7 @@ struct MayDelegateCompletionWithEvent;

template <stdexec::receiver Rcvr, Kokkos::ExecutionSpace Exec>
struct WaitEventReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;
using event_t = Impl::Event<Exec>;

MayDelegateCompletionWithEvent<Rcvr, Exec>* opstate;
Expand Down Expand Up @@ -162,9 +163,7 @@ struct MayDelegateCompletionWithEvent<Rcvr, Exec, true> {

template <stdexec::receiver Rcvr, Closure Clsr, Closure... Clsrs>
requires(std::same_as<typename Clsr::execution_space, typename Clsrs::execution_space> && ...)
struct OpStateBase
: public stdexec::__immovable
, public MayDelegateCompletionWithEvent<Rcvr, typename Clsr::execution_space> {
struct OpStateBase : public MayDelegateCompletionWithEvent<Rcvr, typename Clsr::execution_space> {
using execution_space = typename Clsr::execution_space;
using receiver_t = Rcvr;
using closures_t = stdexec::__tuple<Clsr, Clsrs...>;
Expand Down Expand Up @@ -211,7 +210,7 @@ struct OpStateBase

template <typename ParentOp>
struct OpStateReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

ParentOp* parent_op;

Expand All @@ -237,8 +236,10 @@ struct OpStateReceiver {

template <stdexec::sender Sndr, stdexec::receiver Rcvr, Closure... Clsrs>
requires(!Impl::dispatching_sender<Sndr>)
struct OpState : public OpStateBase<Rcvr, Clsrs...> {
using operation_state_concept = stdexec::operation_state_t;
struct OpState
: public Impl::Immovable
, public OpStateBase<Rcvr, Clsrs...> {
using operation_state_concept = stdexec::operation_state_tag;

using base_t = OpStateBase<Rcvr, Clsrs...>;

Expand Down
2 changes: 1 addition & 1 deletion kokkos-execution/execution_space/parallel_for.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct ParallelForClosure {

template <stdexec::sender Sndr, typename Label, typename Functor, Kokkos::ExecutionPolicy ExecPolicy>
struct ParallelForSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

using closure_t = ParallelForClosure<Label, Functor, ExecPolicy>;
using execution_space = typename closure_t::execution_space;
Expand Down
4 changes: 2 additions & 2 deletions kokkos-execution/execution_space/schedule_from.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Kokkos::Execution::ExecutionSpaceImpl {
//! Receiver for @c schedule_from.
template <stdexec::scheduler Schd, stdexec::receiver Rcvr>
struct ScheduleFromReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

Schd schd;
Rcvr rcvr;
Expand Down Expand Up @@ -58,7 +58,7 @@ struct ScheduleFromReceiver {
//! Sender for @c schedule_from.
template <stdexec::scheduler Schd, stdexec::sender Sndr>
struct ScheduleFromSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

KOKKOS_EXECUTION_COMPL_SIGS_KEEP(ScheduleFromSender)

Expand Down
4 changes: 2 additions & 2 deletions kokkos-execution/execution_space/scoped_region.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum class Kind : std::uint8_t {

template <Kind kind, stdexec::__is_instance_of<Scheduler> Schd, stdexec::receiver Rcvr>
struct RegionReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

std::string name;
Schd schd;
Expand Down Expand Up @@ -69,7 +69,7 @@ struct RegionReceiver {

template <Kind kind, stdexec::sender Sndr>
struct RegionSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

KOKKOS_EXECUTION_COMPL_SIGS_KEEP(RegionSender)

Expand Down
4 changes: 2 additions & 2 deletions kokkos-execution/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Scheduler {

template <stdexec::receiver Rcvr>
struct OpState {
using operation_state_concept = stdexec::operation_state_t;
using operation_state_concept = stdexec::operation_state_tag;

Rcvr rcvr;

Expand All @@ -33,7 +33,7 @@ struct Scheduler {
};

struct Sender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

using completion_signatures = stdexec::completion_signatures<stdexec::set_value_t()>;

Expand Down
30 changes: 30 additions & 0 deletions kokkos-execution/impl/immovable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef KOKKOS_EXECUTION_IMPL_IMMOVABLE_HPP
#define KOKKOS_EXECUTION_IMPL_IMMOVABLE_HPP

namespace Kokkos::Execution::Impl {
/**
* @brief Immovable type.
*
* Heavily inspired by
* https://github.com/NVIDIA/stdexec/blob/47bb920c84be5bdb31e6a1d0f8c47ac6e7d54588/include/stdexec/__detail/__utility.hpp#L60-L64.
*
* However, commit
* https://github.com/NVIDIA/stdexec/commit/aab5da8b7f7ed60053d16798a687d0b1549e2e1d
* changed how @c STDEXEC_IMMOVABLE is defined for @c GCC, see
* https://github.com/NVIDIA/stdexec/blame/47bb920c84be5bdb31e6a1d0f8c47ac6e7d54588/include/stdexec/__detail/__config.hpp#L548,
* that is used in the definition of @c stdexec::__immovable.
*
* This implementation avoids relying on such internals by providing a minimal, self-contained definition.
*/
struct Immovable {
Immovable() = default;
Immovable(Immovable&&) = delete;
Immovable& operator=(Immovable&&) = delete;
Immovable(const Immovable&) = delete;
Immovable& operator=(const Immovable&) = delete;
~Immovable() = default;
};

} // namespace Kokkos::Execution::Impl

#endif // KOKKOS_EXECUTION_IMPL_IMMOVABLE_HPP
2 changes: 1 addition & 1 deletion kokkos-execution/impl/sync_wait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct State {
//! Receiver for @c stdexec::sync_wait.
template <Kokkos::ExecutionSpace Exec, typename... Values>
struct Receiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

static constexpr auto label = Impl::dispatch_label<Exec, ": sync_wait">();

Expand Down
2 changes: 1 addition & 1 deletion kokkos-execution/parallel_for.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct ParallelForData {

template <stdexec::sender Sndr, typename Label, typename Functor, Kokkos::ExecutionPolicy ExecPolicy>
struct ParallelForSender : stdexec::__tuple<parallel_for_t, ParallelForData<Label, Functor, ExecPolicy>, Sndr> {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

using base_t = stdexec::__tuple<parallel_for_t, ParallelForData<Label, Functor, ExecPolicy>, Sndr>;

Expand Down
16 changes: 16 additions & 0 deletions tests/execution_space/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@ add_one_test(NAME sync_wait)
add_one_test(NAME then)
add_one_test(NAME transfer_when_all)
add_one_test(NAME when_all)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION STREQUAL 14.2.0)
foreach(DEVICE IN LISTS Kokkos_DEVICES)
set(target_name tests_execution_space_any_sender.${DEVICE})
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
set_tests_properties(${target_name} PROPERTIES DISABLED TRUE)
add_test(NAME ${target_name}.compiler COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIGURATION> --target
${target_name} --verbose WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
set_tests_properties(
${target_name}.compiler
PROPERTIES PASS_REGULAR_EXPRESSION
"error: use of deleted function \'Kokkos::Execution::Impl::Immovable::Immovable"
)
endforeach()
endif()
45 changes: 21 additions & 24 deletions tests/execution_space/test_any_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,33 @@ class AnySenderTest
RecorderListener<EventDiscardMatcher<TEST_EXECUTION_SPACE>, BeginFenceEvent, BeginParallelForEvent>;
};

/**
* @test In order to get the same synchronization behavior as if using fully typed senders,
* type erased senders must advertise the completion domain and scheduler and type erased receivers
* must advertise their @ref Kokkos::Execution::ExecutionSpaceImpl::get_exec_t query.
*/
//! @test Check when synchronization happens.
TEST_F(AnySenderTest, then) {
using any_sender_t = experimental::execution::any_receiver_ref<
stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>,
Kokkos::Execution::ExecutionSpaceImpl::get_exec
.signature<Kokkos::Execution::ExecutionSpaceImpl::ExecutionSpaceRef<TEST_EXECUTION_SPACE>() noexcept>
>::
template any_sender<
stdexec::get_completion_scheduler<stdexec::set_value_t>.signature<scheduler_t() noexcept>,
stdexec::get_completion_domain<stdexec::set_value_t>.signature<Kokkos::Execution::ExecutionSpaceImpl::Domain() noexcept>
>;
using completion_signatures_t =
stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_error_t(std::exception_ptr)>;
using any_receiver_t = exec::any_receiver<completion_signatures_t>;
using any_sender_t = exec::any_sender<any_receiver_t>;

static_assert(std::same_as<
stdexec::__completion_domain_of_t<stdexec::set_value_t, any_sender_t>,
stdexec::indeterminate_domain<>
>);
static_assert(std::same_as<
stdexec::__completion_domain_of_t<stdexec::set_value_t, any_sender_t, stdexec::env<>>,
stdexec::default_domain
>);

static_assert(std::same_as<
std::invoke_result_t<stdexec::get_completion_signatures_t, any_sender_t, stdexec::env<>>,
completion_signatures_t
>);

const view_s_t data(Kokkos::view_alloc(exec, "data - shared space"));

const context_t esc{exec};

any_sender_t chain = stdexec::schedule(esc.get_scheduler()) | THEN_INCREMENT(data) | THEN_INCREMENT(data);

static_assert(std::same_as<
stdexec::__completion_domain_of_t<stdexec::set_value_t, decltype(chain)>,
Kokkos::Execution::ExecutionSpaceImpl::Domain
>);
static_assert(std::same_as<
stdexec::__completion_scheduler_of_t<stdexec::set_value_t, decltype(chain)>,
typename AnySenderTest::scheduler_t
>);

auto continues_on = std::move(chain) | stdexec::continues_on(esc.get_scheduler());

static_assert(std::same_as<
Expand All @@ -94,8 +90,9 @@ TEST_F(AnySenderTest, then) {
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"))));
MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "after dispatch"))));

ASSERT_EQ(data(), 3);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/execution_space/test_let_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TEST_F(LetValueTest, scoped_allocation) {
static_assert(
Tests::Utils::has_completion_signatures<decltype(allocate), stdexec::__mset<stdexec::set_value_t(view_of_5_t)>>);

//! FIXME: https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
//! @bug https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
#if defined(KOKKOS_COMPILER_CLANG) && defined(KOKKOS_ENABLE_CUDA)
//! @c Kokkos::View is not nothrow movable, so the error channel is added.
static_assert(Tests::Utils::has_completion_signatures<
Expand Down
3 changes: 2 additions & 1 deletion tests/execution_space/test_operation_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ consteval bool test_op_state_traits() {
//! Models the operation state concept.
static_assert(stdexec::operation_state<op_state_t>);

//! By inheriting from @c stdexec::__immovable, it is neither moveable nor copyable.
//! By inheriting from @ref Kokkos::Execution::Impl::Immovable, it is neither moveable nor copyable.
static_assert(std::derived_from<op_state_t, Kokkos::Execution::Impl::Immovable>);
static_assert(!std::move_constructible<op_state_t>);
static_assert(!std::is_move_assignable_v<op_state_t>);

Expand Down
4 changes: 2 additions & 2 deletions tests/execution_space/test_parallel_for.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ consteval bool test_sndr_traits() {
Kokkos::Execution::ExecutionSpaceImpl::ParallelForSender<schd_sndr_t, label_t, functor_t, policy_t>
>);

//! FIXME: https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
//! @bug https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
#if defined(KOKKOS_COMPILER_CLANG) && defined(KOKKOS_ENABLE_CUDA)
/**
* It is not no throw connectable because the @ref Kokkos::Execution::ExecutionSpaceImpl::ParallelForClosure
Expand Down Expand Up @@ -157,7 +157,7 @@ consteval bool test_closure_traits() {

return true;
}
//! FIXME: https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
//! @bug https://github.com/kokkos/kokkos/blob/393d4165a6c3687e78abe5e1665853f1eabc386d/core/src/Kokkos_View.hpp#L697
#if defined(KOKKOS_COMPILER_CLANG) && defined(KOKKOS_ENABLE_CUDA)
static_assert(test_closure_traits<typename ParallelForTest::view_s_t, false>());
#else
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/check_rcvr_env_queryable_with.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct check_rcvr_env_queryable_with_t {

template <bool IsQueryable, stdexec::sender Sndr, typename... Queries>
struct CheckRcvrEnvQueryableWithSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

Sndr sndr; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/check_scheduler_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct check_scheduler_type_t {

template <stdexec::sender Sndr, typename Tag, stdexec::scheduler Schd>
struct CheckSchedulerTypeSender {
using sender_concept = stdexec::sender_t;
using sender_concept = stdexec::sender_tag;

Sndr sndr; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/sink_receiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Tests::Utils {

//! A receiver that can handle all completions and does nothing with them.
struct SinkReceiver {
using receiver_concept = stdexec::receiver_t;
using receiver_concept = stdexec::receiver_tag;

void set_value(auto&&...) && noexcept {
}
Expand Down
Loading