Skip to content

Commit

Permalink
Merge pull request #1110 from NVIDIA/transform-when-all-algos
Browse files Browse the repository at this point in the history
port all the `when_all` composite algos to `transform_sender`
  • Loading branch information
ericniebler authored Oct 15, 2023
2 parents 8a6d8a7 + b4f6661 commit 64c82a5
Show file tree
Hide file tree
Showing 9 changed files with 527 additions and 147 deletions.
2 changes: 1 addition & 1 deletion include/exec/any_sender_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ namespace exec {
friend __env_t<env_of_t<_Receiver>> tag_invoke(_GetEnv, const _Self& __self) noexcept {
return __make_env(
get_env(__self.__op_->__rcvr_),
__with_(get_stop_token, __self.__op_->__stop_source_.get_token()));
__mkprop(__self.__op_->__stop_source_.get_token(), get_stop_token));
}
};
};
Expand Down
8 changes: 4 additions & 4 deletions include/exec/async_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ namespace exec {
using __spawn_env_t = __result_of<
__join_env,
_Env,
__env::__prop<get_stop_token_t, in_place_stop_token>,
__env::__prop<get_scheduler_t, __inln::__scheduler>>;
__env::__prop<in_place_stop_token(get_stop_token_t)>,
__env::__prop<__inln::__scheduler(get_scheduler_t)>>;

template <class _EnvId>
struct __spawn_op_base {
Expand Down Expand Up @@ -647,8 +647,8 @@ namespace exec {
template <__decays_to<_Sender> _Sndr>
__spawn_op(_Sndr&& __sndr, _Env __env, const __impl* __scope)
: __spawn_op_base<_EnvId>{__join_env((_Env&&) __env,
__mkprop(get_stop_token, __scope->__stop_source_.get_token()),
__mkprop(get_scheduler, __inln::__scheduler{})),
__mkprop(__scope->__stop_source_.get_token(), get_stop_token),
__mkprop(__inln::__scheduler{}, get_scheduler)),
[](__spawn_op_base<_EnvId>* __op) {
delete static_cast<__spawn_op*>(__op);
}}
Expand Down
8 changes: 4 additions & 4 deletions include/exec/env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
#endif

namespace exec {
template <class _Tag, class _Value = stdexec::__none_such>
template <class _Tag, class _Value = void>
using with_t = stdexec::__with<_Tag, _Value>;

namespace __detail {
struct __with_t {
template <class _Tag, class _Value>
with_t<_Tag, _Value> operator()(_Tag, _Value&& __val) const {
return stdexec::__with_(_Tag(), (_Value&&) __val);
with_t<_Tag, stdexec::__decay_t<_Value>> operator()(_Tag, _Value&& __val) const {
return stdexec::__mkprop((_Value&&) __val, _Tag());
}

template <class _Tag>
with_t<_Tag> operator()(_Tag) const {
return stdexec::__with_(_Tag());
return stdexec::__mkprop(_Tag());
}
};
} // namespace __detail
Expand Down
5 changes: 2 additions & 3 deletions include/exec/when_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ namespace exec {
}

friend __env_t<env_of_t<_Receiver>> tag_invoke(get_env_t, const __t& __self) noexcept {
using __with_token = __with<get_stop_token_t, in_place_stop_token>;
auto __token = __with_(get_stop_token, __self.__op_->__stop_source_.get_token());
return __make_env(get_env(__self.__op_->__receiver_), (__with_token&&) __token);
auto __token = __mkprop(__self.__op_->__stop_source_.get_token(), get_stop_token);
return __make_env(get_env(__self.__op_->__receiver_), std::move(__token));
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion include/nvexec/stream/common.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ namespace nvexec {

template <class BaseEnv>
auto make_stream_env(BaseEnv&& base_env, stream_provider_t* stream_provider) noexcept {
return __join_env(__mkprop(get_stream_provider, stream_provider), (BaseEnv&&) base_env);
return __join_env(__mkprop(stream_provider, get_stream_provider), (BaseEnv&&) base_env);
}

template <class BaseEnv>
Expand Down
2 changes: 1 addition & 1 deletion include/nvexec/stream/when_all.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
auto env = make_terminal_stream_env(
exec::make_env(
stdexec::get_env(base()),
__with_(get_stop_token, op_state_->stop_source_.get_token())),
__mkprop(op_state_->stop_source_.get_token(), get_stop_token)),
&const_cast<stream_provider_t&>(op_state_->stream_providers_[Index]));

return env;
Expand Down
Loading

0 comments on commit 64c82a5

Please sign in to comment.