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
3 changes: 1 addition & 2 deletions include/nvexec/multi_gpu_context.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ namespace nv::execution
return ctx_.hub_ == other.ctx_.hub_ && ctx_.priority_ == other.ctx_.priority_;
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device) auto schedule() const noexcept
STDEXEC_ATTRIBUTE(nodiscard, host, device) auto schedule() const noexcept
{
return sender{num_devices_, ctx_};
}
Expand Down
19 changes: 18 additions & 1 deletion include/stdexec/__detail/__config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,24 @@ namespace STDEXEC::__std
// STDEXEC_ATTRIBUTE(attr1, attr2, ...)
// void foo() { ... }
#define STDEXEC_ATTRIBUTE_I(_ATTR) STDEXEC_PP_SWITCH(STDEXEC_ATTRIBUTE, _ATTR)
#define STDEXEC_ATTRIBUTE(...) STDEXEC_PP_FOR_EACH(STDEXEC_ATTRIBUTE_I, __VA_ARGS__)

// Dispatch on the number of attributes. Specifying more than 4 attributes
// expands to an undeclared identifier whose name explains the problem.
#define STDEXEC_ATTRIBUTE(...) \
STDEXEC_PP_CAT(STDEXEC_ATTRIBUTE_N_, STDEXEC_ATTRIBUTE_COUNT(__VA_ARGS__))(__VA_ARGS__)
#define STDEXEC_ATTRIBUTE_COUNT(...) \
STDEXEC_ATTRIBUTE_PICK(__VA_ARGS__ __VA_OPT__(, ) many, 4, 3, 2, 1, 0)
#define STDEXEC_ATTRIBUTE_PICK(_1, _2, _3, _4, _5, _N, ...) _N
#define STDEXEC_ATTRIBUTE_N_0()
#define STDEXEC_ATTRIBUTE_N_1(_A1) STDEXEC_ATTRIBUTE_I(_A1)
#define STDEXEC_ATTRIBUTE_N_2(_A1, _A2) STDEXEC_ATTRIBUTE_I(_A1) STDEXEC_ATTRIBUTE_I(_A2)
#define STDEXEC_ATTRIBUTE_N_3(_A1, _A2, _A3) \
STDEXEC_ATTRIBUTE_I(_A1) STDEXEC_ATTRIBUTE_I(_A2) STDEXEC_ATTRIBUTE_I(_A3)
#define STDEXEC_ATTRIBUTE_N_4(_A1, _A2, _A3, _A4) \
STDEXEC_ATTRIBUTE_I(_A1) STDEXEC_ATTRIBUTE_I(_A2) STDEXEC_ATTRIBUTE_I(_A3) \
STDEXEC_ATTRIBUTE_I(_A4)
#define STDEXEC_ATTRIBUTE_N_many(...) \
STDEXEC_ATTRIBUTE_error_too_many_attributes_the_limit_is_4

#define STDEXEC_ATTRIBUTE_SWITCH_no_unique_address STDEXEC_PP_CASE(NO_UNIQUE_ADDRESS)
#define STDEXEC_ATTRIBUTE_SWITCH_always_inline STDEXEC_PP_CASE(ALWAYS_INLINE)
Expand Down
16 changes: 6 additions & 10 deletions include/stdexec/__detail/__on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,8 @@ namespace STDEXEC
STDEXEC_TERMINATE();
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(always_inline, host, device) constexpr auto get_env() const noexcept
-> env_of_t<_Child>
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto get_env() const noexcept -> env_of_t<_Child>
{
return STDEXEC::get_env(__child_);
}
Expand Down Expand Up @@ -240,10 +239,8 @@ namespace STDEXEC
template <class _Query, class _Env>
requires __completion_query<_Query> && __can_return_v<_Sender, _Env>
&& __queryable_with<env_of_t<__lowered_proxy_t<_Sender, _Env>>, _Query, _Env const &>
[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device) constexpr auto query(_Query,
_Env const & __env) const noexcept
-> decltype(auto)
STDEXEC_ATTRIBUTE(nodiscard, host, device)
constexpr auto query(_Query, _Env const & __env) const noexcept -> decltype(auto)
{
auto __lowered = __on::__lower_proxy(__sndr_, __env);
return STDEXEC::get_env(__lowered).query(_Query(), __env);
Expand All @@ -252,9 +249,8 @@ namespace STDEXEC
template <__forwarding_query _Query, class... _Args>
requires(!__completion_query<_Query>)
&& __queryable_with<env_of_t<__user_child_t<_Sender>>, _Query, _Args...>
[[nodiscard]]
STDEXEC_ATTRIBUTE(always_inline, host, device) constexpr auto query(_Query,
_Args&&... __args) const
STDEXEC_ATTRIBUTE(nodiscard, always_inline, host, device)
constexpr auto query(_Query, _Args&&... __args) const
noexcept(__nothrow_queryable_with<env_of_t<__user_child_t<_Sender>>, _Query, _Args...>)
-> decltype(auto)
{
Expand Down
32 changes: 0 additions & 32 deletions include/stdexec/__detail/__preprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,38 +77,6 @@

#define STDEXEC_PP_WHEN(_XP, ...) STDEXEC_PP_IF(_XP, STDEXEC_PP_EXPAND, STDEXEC_PP_EAT)(__VA_ARGS__)

////////////////////////////////////////////////////////////////////////////////
// STDEXEC_PP_FOR_EACH
// Inspired by "Recursive macros with C++20 __VA_OPT__", by David Mazières
// https://www.scs.stanford.edu/~dm/blog/va-opt.html
#define STDEXEC_PP_EXPAND_R3(...) \
STDEXEC_PP_EXPAND(STDEXEC_PP_EXPAND(STDEXEC_PP_EXPAND(STDEXEC_PP_EXPAND(__VA_ARGS__))))
#define STDEXEC_PP_EXPAND_R2(...) \
STDEXEC_PP_EXPAND_R3( \
STDEXEC_PP_EXPAND_R3(STDEXEC_PP_EXPAND_R3(STDEXEC_PP_EXPAND_R3(__VA_ARGS__))))
#define STDEXEC_PP_EXPAND_R1(...) \
STDEXEC_PP_EXPAND_R2( \
STDEXEC_PP_EXPAND_R2(STDEXEC_PP_EXPAND_R2(STDEXEC_PP_EXPAND_R2(__VA_ARGS__))))
#define STDEXEC_PP_EXPAND_R(...) \
STDEXEC_PP_EXPAND_R1( \
STDEXEC_PP_EXPAND_R1(STDEXEC_PP_EXPAND_R1(STDEXEC_PP_EXPAND_R1(__VA_ARGS__))))

#define STDEXEC_PP_FOR_EACH_AGAIN() STDEXEC_PP_FOR_EACH_HELPER
#define STDEXEC_PP_FOR_EACH_HELPER(_MACRO, _A1, ...) \
_MACRO(_A1) __VA_OPT__(STDEXEC_PP_FOR_EACH_AGAIN STDEXEC_PP_PARENS()(_MACRO, __VA_ARGS__)) /**/
#define STDEXEC_PP_FOR_EACH(_MACRO, ...) \
__VA_OPT__(STDEXEC_PP_EXPAND_R(STDEXEC_PP_FOR_EACH_HELPER(_MACRO, __VA_ARGS__)))

////////////////////////////////////////////////////////////////////////////////

#define STDEXEC_PP_BACK_AGAIN() STDEXEC_PP_BACK_I
#define STDEXEC_PP_BACK_I(_A1, ...) \
STDEXEC_PP_FRONT(__VA_OPT__(, ) _A1, ) \
__VA_OPT__(STDEXEC_PP_BACK_AGAIN STDEXEC_PP_PARENS()(__VA_ARGS__))
#define STDEXEC_PP_BACK(...) __VA_OPT__(STDEXEC_PP_EXPAND_R(STDEXEC_PP_BACK_I(__VA_ARGS__)))

#define STDEXEC_PP_TAIL(_IGN, ...) __VA_ARGS__

#define STDEXEC_PP_REPEAT_I(_N, _MACRO, ...) STDEXEC_PP_REPEAT_##_N(_MACRO, __VA_ARGS__)
#define STDEXEC_PP_REPEAT_0(_MACRO, ...)
#define STDEXEC_PP_REPEAT_1(_MACRO, ...) _MACRO(0 __VA_OPT__(, ) __VA_ARGS__)
Expand Down
3 changes: 1 addition & 2 deletions include/stdexec/__detail/__sender_facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,7 @@ namespace STDEXEC
STDEXEC_MODULE_EXPORT_AUTHORING
struct __no_env_receiver : __receiver_archetype_base
{
[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device) constexpr auto get_env() const noexcept -> env<>
STDEXEC_ATTRIBUTE(nodiscard, host, device) constexpr auto get_env() const noexcept -> env<>
{
return {};
}
Expand Down
20 changes: 8 additions & 12 deletions include/stdexec/__detail/__variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,30 +306,26 @@ namespace STDEXEC
return *this;
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device, always_inline) //
constexpr auto __data() noexcept -> void *
STDEXEC_ATTRIBUTE(nodiscard, host, device, always_inline)
constexpr auto __data() noexcept -> void *
{
return std::addressof(__storage_);
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device, always_inline) //
constexpr auto __data() const noexcept -> void const *
STDEXEC_ATTRIBUTE(nodiscard, host, device, always_inline)
constexpr auto __data() const noexcept -> void const *
{
return std::addressof(__storage_);
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device, always_inline) //
constexpr auto index() const noexcept -> std::size_t
STDEXEC_ATTRIBUTE(nodiscard, host, device, always_inline)
constexpr auto index() const noexcept -> std::size_t
{
return __index_;
}

[[nodiscard]]
STDEXEC_ATTRIBUTE(host, device, always_inline) //
constexpr auto __is_valueless() const noexcept -> bool
STDEXEC_ATTRIBUTE(nodiscard, host, device, always_inline)
constexpr auto __is_valueless() const noexcept -> bool
{
return __index_ == __variant_npos;
}
Expand Down
Loading