Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cuda_reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Oct 9, 2023
2 parents 6dce716 + c2ebe84 commit d97b5df
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 27 deletions.
12 changes: 12 additions & 0 deletions include/nvexec/stream/bulk.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,15 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId, class Shape, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::bulk_sender_t<__name_of<__t<SenderId>>, Shape, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::bulk_sender_t<SenderId, Shape, Fun>>{};

template <class SenderId, class Shape, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::multi_gpu_bulk_sender_t<__name_of<__t<SenderId>>, Shape, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::multi_gpu_bulk_sender_t<SenderId, Shape, Fun>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/ensure_started.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::ensure_started_sender_t<__name_of<__t<SenderId>>>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::ensure_started_sender_t<SenderId>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/launch.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,10 @@ namespace nvexec {
inline constexpr STDEXEC_STREAM_DETAIL_NS::launch_t launch{};

} // namespace nvexec

namespace stdexec::__detail {
template <class SenderId, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::launch_sender_t<__name_of<__t<SenderId>>, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::launch_sender_t<SenderId, Fun>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/let_xxx.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId, class Fun, class Set>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::let_sender_t<__name_of<__t<SenderId>>, Fun, Set>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::let_sender_t<SenderId, Fun, Set>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/split.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId>
extern __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::split_sender_t<__name_of<__t<SenderId>>>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::split_sender_t<SenderId>>;
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/then.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::then_sender_t<__name_of<__t<SenderId>>, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::then_sender_t<SenderId, Fun>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/upon_error.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::upon_error_sender_t<__name_of<__t<SenderId>>, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::upon_error_sender_t<SenderId, Fun>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/upon_stopped.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <class SenderId, class Fun>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::upon_stopped_sender_t<__name_of<__t<SenderId>>, Fun>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::upon_stopped_sender_t<SenderId, Fun>>{};
}
7 changes: 7 additions & 0 deletions include/nvexec/stream/when_all.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
};
};
}

namespace stdexec::__detail {
template <bool WithCompletionScheduler, class Scheduler, class... SenderIds>
inline constexpr __mconst<
nvexec::STDEXEC_STREAM_DETAIL_NS::when_all_sender_t<WithCompletionScheduler, Scheduler, __name_of<__t<SenderIds>>...>>
__name_of_v<nvexec::STDEXEC_STREAM_DETAIL_NS::when_all_sender_t<WithCompletionScheduler, Scheduler, SenderIds...>>{};
}
49 changes: 26 additions & 23 deletions include/stdexec/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,36 +2704,40 @@ namespace stdexec {
}
};

inline constexpr struct __just_t : __just_impl<__just_t, set_value_t> {
struct just_t : __just_impl<just_t, set_value_t> {
template <__movable_value... _Ts>
STDEXEC_DETAIL_CUDACC_HOST_DEVICE //
auto
operator()(_Ts&&... __ts) const noexcept((__nothrow_decay_copyable<_Ts> && ...)) {
return make_sender_expr<__just_t>(__decayed_tuple<_Ts...>{(_Ts&&) __ts...});
return make_sender_expr<just_t>(__decayed_tuple<_Ts...>{(_Ts&&) __ts...});
}
} just{};
};

inline constexpr struct __just_error_t : __just_impl<__just_error_t, set_error_t> {
struct just_error_t : __just_impl<just_error_t, set_error_t> {
template <__movable_value _Error>
STDEXEC_DETAIL_CUDACC_HOST_DEVICE //
auto
operator()(_Error&& __err) const noexcept(__nothrow_decay_copyable<_Error>) {
return make_sender_expr<__just_error_t>(__decayed_tuple<_Error>{(_Error&&) __err});
return make_sender_expr<just_error_t>(__decayed_tuple<_Error>{(_Error&&) __err});
}
} just_error{};
};

inline constexpr struct __just_stopped_t : __just_impl<__just_stopped_t, set_stopped_t> {
struct just_stopped_t : __just_impl<just_stopped_t, set_stopped_t> {
STDEXEC_DETAIL_CUDACC_HOST_DEVICE //
auto
operator()() const noexcept {
return make_sender_expr<__just_stopped_t>(__decayed_tuple<>());
return make_sender_expr<just_stopped_t>(__decayed_tuple<>());
}
} just_stopped{};
};
}

using __just::just;
using __just::just_error;
using __just::just_stopped;
using __just::just_t;
using __just::just_error_t;
using __just::just_stopped_t;

inline constexpr just_t just {};
inline constexpr just_error_t just_error {};
inline constexpr just_stopped_t just_stopped {};

/////////////////////////////////////////////////////////////////////////////
// [execution.execute]
Expand Down Expand Up @@ -3303,7 +3307,7 @@ namespace stdexec {
#endif

template <sender_expr_for<then_t> _Sender, class _Env>
static auto get_completion_signatures(_Sender&& __sndr, _Env&&)
static auto get_completion_signatures(_Sender&&, _Env&&)
-> __completion_signatures_t<__decay_t<__data_of<_Sender>>, __child_of<_Sender>, _Env> {
return {};
}
Expand Down Expand Up @@ -3444,7 +3448,7 @@ namespace stdexec {
#endif

template <sender_expr_for<upon_error_t> _Sender, class _Env>
static auto get_completion_signatures(_Sender&& __sndr, _Env&&)
static auto get_completion_signatures(_Sender&&, _Env&&)
-> __completion_signatures_t<__decay_t<__data_of<_Sender>>, __child_of<_Sender>, _Env> {
return {};
}
Expand Down Expand Up @@ -3588,7 +3592,7 @@ namespace stdexec {
#endif

template <sender_expr_for<upon_stopped_t> _Sender, class _Env>
static auto get_completion_signatures(_Sender&& __sndr, _Env&&)
static auto get_completion_signatures(_Sender&&, _Env&&)
-> __completion_signatures_t<__decay_t<__data_of<_Sender>>, __child_of<_Sender>, _Env> {
return {};
}
Expand Down Expand Up @@ -3795,7 +3799,7 @@ namespace stdexec {
using __shape_t = decltype(__decay_t<__data_of<_Sender>>::__shape_);

template <sender_expr_for<bulk_t> _Sender, class _Env>
static auto get_completion_signatures(_Sender&& __sndr, _Env&&)
static auto get_completion_signatures(_Sender&&, _Env&&)
-> __completion_signatures<__child_of<_Sender>, _Env, __shape_t<_Sender>, __fun_t<_Sender>> {
return {};
}
Expand Down Expand Up @@ -4070,7 +4074,7 @@ namespace stdexec {
}

template <sender_expr_for<__split_t> _Self, class _OtherEnv>
static auto get_completion_signatures(_Self&& __self, _OtherEnv&&)
static auto get_completion_signatures(_Self&&, _OtherEnv&&)
-> __call_result_t<apply_sender_t, _Self, __mtypeof<__get_completion_signatures_fn>> {
return {};
}
Expand Down Expand Up @@ -4407,7 +4411,7 @@ namespace stdexec {
}

template <sender_expr_for<__ensure_started_t> _Self, class _OtherEnv>
static auto get_completion_signatures(_Self&& __self, _OtherEnv&&)
static auto get_completion_signatures(_Self&&, _OtherEnv&&)
-> __call_result_t<apply_sender_t, _Self, __mtypeof<__get_completion_signatures_fn>> {
return {};
}
Expand Down Expand Up @@ -4722,7 +4726,7 @@ namespace stdexec {

template <class _Receiver2>
__t(_Sender&& __sndr, _Receiver2&& __rcvr, _Fun __fun)
: __op_base_t{{{}, (_Receiver2&&) __rcvr, query_or(get_completion_scheduler<_Set>, get_env(__sndr), __none_such())}, (_Fun&&) __fun}
: __op_base_t{{{}, (_Receiver2&&) __rcvr, query_or(get_completion_scheduler<_Set>, get_env(__sndr), __none_such())}, (_Fun&&) __fun, {}, {}}
, __op_state2_(connect((_Sender&&) __sndr, __receiver_t{this})) {
}

Expand Down Expand Up @@ -5487,7 +5491,7 @@ namespace stdexec {
}

template <sender_expr_for<schedule_from_t> _Sender, class _Env>
static auto get_completion_signatures(_Sender&& __sndr, const _Env&) noexcept
static auto get_completion_signatures(_Sender&&, const _Env&) noexcept
-> __completions_t<__scheduler_t<_Sender>, __child_of<_Sender>, _Env> {
return {};
}
Expand Down Expand Up @@ -6430,7 +6434,7 @@ namespace stdexec {
__children_of<_Self, __mbind_front_q<__completions_t, __env_t<_Env>>>;

template <sender_expr_for<when_all_t> _Self, class _Env>
static auto get_completion_signatures(_Self&& __self, _Env&&) {
static auto get_completion_signatures(_Self&&, _Env&&) {
return __minvoke<__mtry_catch<__q<__completions>, __q<__error>>, _Self, _Env>();
}

Expand Down Expand Up @@ -6825,12 +6829,11 @@ namespace stdexec {
(_Sender&&) __sndr,
[&]<class _Data, class _Child>(__ignore, _Data&& __data, _Child&& __child) {
auto&& [__sched, __clsur] = (_Data&&) __data;
using _Scheduler = decltype(__sched);
using _Closure = decltype(__clsur);
return __write(
transfer(
((_Closure&&) __clsur)(
transfer(__write((_Child&&) __child, __mkenv(__old)), (_Scheduler&&) __sched)),
transfer(__write((_Child&&) __child, __mkenv(__old)), __sched)),
__old),
__mkenv(__sched));
}),
Expand Down
8 changes: 4 additions & 4 deletions test/exec/test_variant_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

using just_int_t = decltype(just(0));
using just_t = decltype(just());
using just_void_t = decltype(just());

TEST_CASE("variant_sender - default constructible", "[types][variant_sender]") {
variant_sender<just_t, just_int_t> variant{just()};
variant_sender<just_void_t, just_int_t> variant{just()};
CHECK(variant.index() == 0);
}

TEST_CASE("variant_sender - using an overloaded then adaptor", "[types][variant_sender]") {
variant_sender<just_t, just_int_t> variant = just();
variant_sender<just_void_t, just_int_t> variant = just();
int index = -1;
STATIC_REQUIRE(sender<variant_sender<just_t, just_int_t>>);
STATIC_REQUIRE(sender<variant_sender<just_void_t, just_int_t>>);
sync_wait(variant | then([&index](auto... xs) { index = sizeof...(xs); }));
CHECK(index == 0);

Expand Down

0 comments on commit d97b5df

Please sign in to comment.