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
2 changes: 1 addition & 1 deletion include/exec/detail/shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ namespace experimental::execution::__shared
template <class _CvSender>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_CvSender, _Tag>);
static_assert(STDEXEC::__sender_for<_CvSender, _Tag>);
return __get_completion_signatures_impl<__child_of<_CvSender>,
__decay_t<__data_of<_CvSender>>>();
};
Expand Down
3 changes: 2 additions & 1 deletion include/exec/ensure_started.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "../stdexec/__detail/__senders.hpp"
#include "../stdexec/__detail/__transform_sender.hpp"
#include "detail/shared.hpp"
#include "sender_for.hpp"

namespace experimental::execution
{
Expand Down Expand Up @@ -68,7 +69,7 @@ namespace experimental::execution
static constexpr auto
transform_sender(STDEXEC::set_value_t, _CvSender&& __sndr, STDEXEC::__ignore)
{
static_assert(STDEXEC::sender_expr_for<_CvSender, ensure_started_t>);
static_assert(sender_for<_CvSender, ensure_started_t>);
auto __result = __shared::__sndr{ensure_started_t(),
STDEXEC::__get<2>(static_cast<_CvSender&&>(__sndr)),
STDEXEC::__get<1>(static_cast<_CvSender&&>(__sndr))};
Expand Down
26 changes: 26 additions & 0 deletions include/exec/sender_for.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 NVIDIA Corporation
*
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

#include "../stdexec/__detail/__sender_introspection.hpp"

namespace experimental::execution
{
template <class _Sender, class... _Tag>
concept sender_for = STDEXEC::__sender_for<_Sender, _Tag...>;
} // namespace experimental::execution

namespace exec = experimental::execution;
5 changes: 3 additions & 2 deletions include/exec/sequence/ignore_all_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// include these after execution.hpp
#include "../../stdexec/__detail/__tuple.hpp"
#include "../../stdexec/__detail/__variant.hpp"
#include "../sender_for.hpp"
#include "../sequence_senders.hpp"

#include "../../stdexec/__detail/__atomic.hpp"
Expand Down Expand Up @@ -316,7 +317,7 @@ namespace experimental::execution
template <class _Sender, class... _Env>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_Sender, ignore_all_values_t>);
static_assert(sender_for<_Sender, ignore_all_values_t>);
return __sequence_completion_signatures_of<__child_of<_Sender>, _Env...>();
}

Expand All @@ -325,7 +326,7 @@ namespace experimental::execution
__nothrow_applicable<__connect_fn, _Sender, _Receiver&>)
-> __apply_result_t<__connect_fn, _Sender, _Receiver&>
{
static_assert(sender_expr_for<_Sender, ignore_all_values_t>);
static_assert(sender_for<_Sender, ignore_all_values_t>);
return __apply(__connect_fn(), static_cast<_Sender&&>(__sndr), __rcvr);
};
};
Expand Down
7 changes: 5 additions & 2 deletions include/exec/sequence/iterate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# include "../../stdexec/execution.hpp"

# include "../detail/basic_sequence.hpp"
# include "../sender_for.hpp"
# include "../sequence.hpp"
# include "../sequence_senders.hpp"
# include "../trampoline_scheduler.hpp"
Expand Down Expand Up @@ -203,13 +204,14 @@ namespace experimental::execution
template <class _Sequence, class _Receiver>
using _NextSender = next_sender_of_t<_Receiver, __item_sender_t<_Sequence>>;

template <sender_expr_for<iterate_t> _SeqExpr,
template <class _SeqExpr,
sequence_receiver_of<item_types<__item_sender_t<_SeqExpr>>> _Receiver>
requires sender_to<_NextSender<_SeqExpr, _Receiver>, _NextReceiver<_SeqExpr, _Receiver>>
static constexpr auto subscribe(_SeqExpr&& __seq, _Receiver __rcvr)
noexcept(__nothrow_applicable<__subscribe_fn<_Receiver>, _SeqExpr>)
-> __apply_result_t<__subscribe_fn<_Receiver>, _SeqExpr>
{
static_assert(sender_for<_SeqExpr, iterate_t>);
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_SeqExpr&&>(__seq));
}

Expand All @@ -221,9 +223,10 @@ namespace experimental::execution
set_stopped_t()>();
}

template <sender_expr_for<iterate_t> _Sequence, class... _Env>
template <class _Sequence, class... _Env>
static consteval auto get_item_types() noexcept
{
static_assert(sender_for<_Sequence, iterate_t>);
return item_types<__item_sender_t<_Sequence>>();
}

Expand Down
7 changes: 4 additions & 3 deletions include/exec/sequence/merge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../../stdexec/execution.hpp"

#include "../detail/basic_sequence.hpp"
#include "../sender_for.hpp"
#include "../sequence_senders.hpp"
#include "ignore_all_values.hpp"
#include "transform_each.hpp"
Expand Down Expand Up @@ -175,7 +176,7 @@ namespace experimental::execution
template <class _Self, class... _Env>
static consteval auto get_completion_signatures() noexcept
{
static_assert(STDEXEC::sender_expr_for<_Self, merge_t>);
static_assert(sender_for<_Self, merge_t>);
auto __items = STDEXEC::__children_of<_Self, STDEXEC::__qq<item_types>>();
return exec::concat_completion_signatures(
completion_signatures<set_stopped_t()>(),
Expand All @@ -185,7 +186,7 @@ namespace experimental::execution
template <class _Self, class... _Env>
static consteval auto get_item_types()
{
static_assert(sender_expr_for<_Self, merge_t>);
static_assert(sender_for<_Self, merge_t>);
auto __items = STDEXEC::__children_of<_Self, STDEXEC::__qq<item_types>>();
return __items.__transform(__mk_get_item_types<_Env...>(), __mk_unique_concat_items());
}
Expand All @@ -195,7 +196,7 @@ namespace experimental::execution
noexcept(__nothrow_applicable<__subscribe_fn, _Self, _Receiver&>)
-> __apply_result_t<__subscribe_fn, _Self, _Receiver&>
{
static_assert(sender_expr_for<_Self, merge_t>);
static_assert(sender_for<_Self, merge_t>);
return STDEXEC::__apply(__subscribe_fn{}, static_cast<_Self&&>(__self), __rcvr);
}
};
Expand Down
8 changes: 5 additions & 3 deletions include/exec/sequence/merge_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "../../stdexec/__detail/__transform_completion_signatures.hpp"
#include "../../stdexec/__detail/__variant.hpp"
#include "../detail/basic_sequence.hpp"
#include "../sender_for.hpp"

#include <atomic>

Expand Down Expand Up @@ -1277,9 +1278,10 @@ namespace experimental::execution
return make_sequence_expr<merge_each_t>(__(), static_cast<_Sequence&&>(__sequence));
}

template <sender_expr_for<merge_each_t> _Self, class... _Env>
template <class _Self, class... _Env>
static consteval auto get_item_types()
{
static_assert(sender_for<_Self, merge_each_t>);
using __result_t =
__compute::__nested_values_t<__child_of<_Self>,
__env_with_inplace_stop_token_result_t<_Env>...>;
Expand Down Expand Up @@ -1310,7 +1312,7 @@ namespace experimental::execution
template <class _Self, class... _Env>
static consteval auto get_completion_signatures()
{
static_assert(sender_expr_for<_Self, merge_each_t>);
static_assert(sender_for<_Self, merge_each_t>);
// TODO: update this to use constant evaluation:
using __result_t = __minvoke<__mtry_q<__completions_t>,
_Self,
Expand All @@ -1331,7 +1333,7 @@ namespace experimental::execution
__nothrow_applicable<__subscribe_fn<_Receiver>, _Sequence>)
-> __apply_result_t<__subscribe_fn<_Receiver>, _Sequence>
{
static_assert(sender_expr_for<_Sequence, merge_each_t>);
static_assert(sender_for<_Sequence, merge_each_t>);
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_Sequence&&>(__sndr));
};
};
Expand Down
11 changes: 7 additions & 4 deletions include/exec/sequence/transform_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "../../stdexec/concepts.hpp"
#include "../../stdexec/execution.hpp"
#include "../sender_for.hpp"
#include "../sequence_senders.hpp"

#include "../detail/basic_sequence.hpp"
Expand Down Expand Up @@ -155,7 +156,7 @@ namespace experimental::execution
template <class _Self, class... _Env>
static consteval auto get_completion_signatures()
{
static_assert(sender_expr_for<_Self, transform_each_t>);
static_assert(sender_for<_Self, transform_each_t>);
return exec::__sequence_completion_signatures_of<__child_of<_Self>, _Env...>();
}

Expand All @@ -170,7 +171,7 @@ namespace experimental::execution
template <class _Self, class... _Env>
static consteval auto get_item_types()
{
static_assert(sender_expr_for<_Self, transform_each_t>);
static_assert(sender_for<_Self, transform_each_t>);
using __closure_t = STDEXEC::__decay_t<__data_of<_Self>>&;
auto __child_items = exec::get_item_types<__child_of<_Self>, _Env...>();

Expand Down Expand Up @@ -206,17 +207,19 @@ namespace experimental::execution
template <class _Self, class _Receiver>
using __operation_t = __operation<__child_of<_Self>, _Receiver, __data_of<_Self>>;

template <sender_expr_for<transform_each_t> _Self, receiver _Receiver>
template <class _Self, receiver _Receiver>
static auto subscribe(_Self&& __self, _Receiver __rcvr)
noexcept(__nothrow_applicable<__subscribe_fn<_Receiver>, _Self>)
-> __apply_result_t<__subscribe_fn<_Receiver>, _Self>
{
static_assert(sender_for<_Self, transform_each_t>);
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_Self&&>(__self));
}

template <sender_expr_for<transform_each_t> _Sexpr>
template <class _Sexpr>
static auto get_env(_Sexpr const & __sexpr) noexcept -> env_of_t<__child_of<_Sexpr>>
{
static_assert(sender_for<_Sexpr, transform_each_t>);
return __apply([]<class _Child>(__ignore, __ignore, _Child const & __child)
{ return STDEXEC::get_env(__child); },
__sexpr);
Expand Down
3 changes: 2 additions & 1 deletion include/exec/split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "../stdexec/__detail/__senders.hpp"
#include "../stdexec/__detail/__transform_sender.hpp"
#include "detail/shared.hpp"
#include "sender_for.hpp"

namespace experimental::execution
{
Expand Down Expand Up @@ -51,7 +52,7 @@ namespace experimental::execution
static constexpr auto
transform_sender(STDEXEC::set_value_t, _CvSender&& __sndr, STDEXEC::__ignore)
{
static_assert(STDEXEC::sender_expr_for<_CvSender, split_t>);
static_assert(sender_for<_CvSender, split_t>);
return __shared::__sndr{split_t(),
STDEXEC::__get<2>(static_cast<_CvSender&&>(__sndr)),
STDEXEC::__get<1>(static_cast<_CvSender&&>(__sndr))};
Expand Down
7 changes: 4 additions & 3 deletions include/exec/static_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "detail/numa.hpp"
#include "detail/xorshift.hpp"

#include "sender_for.hpp"
#include "sequence/iterate.hpp"
#include "sequence_senders.hpp"

Expand Down Expand Up @@ -275,7 +276,7 @@ namespace experimental::execution
struct domain : STDEXEC::default_domain
{
// transform the generic bulk_chunked sender into a parallel thread-pool bulk sender
template <sender_expr Sender, class Env>
template <sender_for Sender, class Env>
requires __one_of<tag_of_t<Sender>, bulk_chunked_t, bulk_unchunked_t>
constexpr auto
transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env) const noexcept
Expand All @@ -301,9 +302,9 @@ namespace experimental::execution
}

#if !STDEXEC_NO_STDCPP_RANGES()
template <sender_expr_for<exec::iterate_t> Sender, class Env>
template <sender_for<exec::iterate_t> Sender, class Env>
constexpr auto
transform_sender(STDEXEC::set_value_t, Sender&& sndr, const Env& env) const noexcept
transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env) const noexcept
{
if constexpr (__completes_on<Sender, _static_thread_pool::scheduler, Env>)
{
Expand Down
7 changes: 4 additions & 3 deletions include/exec/thread_pool_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
*/
#pragma once

#include <exec/static_thread_pool.hpp>
#include "sender_for.hpp"
#include "static_thread_pool.hpp"

namespace experimental::execution
{
Expand Down Expand Up @@ -54,7 +55,7 @@ namespace experimental::execution

struct domain : STDEXEC::default_domain
{
template <STDEXEC::sender_expr_for<STDEXEC::bulk_chunked_t> Sender, class Env>
template <sender_for<STDEXEC::bulk_chunked_t> Sender, class Env>
static constexpr auto transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env)
{
auto& [tag, data, child] = sndr;
Expand Down Expand Up @@ -84,7 +85,7 @@ namespace experimental::execution
}
}

template <STDEXEC::sender_expr_for<STDEXEC::bulk_unchunked_t> Sender, class Env>
template <sender_for<STDEXEC::bulk_unchunked_t> Sender, class Env>
static constexpr auto transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env);
};

Expand Down
4 changes: 3 additions & 1 deletion include/exec/unless_stop_requested.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "../stdexec/__detail/__receiver_ref.hpp"
#include "../stdexec/execution.hpp"

#include "sender_for.hpp"

namespace experimental::execution
{
namespace __unless_stop_requested
Expand Down Expand Up @@ -90,7 +92,7 @@ namespace experimental::execution
template <class _Self, class _Env>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_Self, unless_stop_requested_t>);
static_assert(sender_for<_Self, unless_stop_requested_t>);
// TODO: port this to use constant evaluation
return __completions_t<__child_of<_Self>, _Env>{};
};
Expand Down
3 changes: 2 additions & 1 deletion include/nvexec/stream/common.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stack>
#include <type_traits>

#include "../../exec/sender_for.hpp" // IWYU pragma: keep for sender_for
#include "../detail/config.cuh"
#include "../detail/cuda_atomic.cuh" // IWYU pragma: keep
#include "../detail/queue.cuh"
Expand Down Expand Up @@ -96,7 +97,7 @@ namespace nv::execution
// algorithms use the current scheduler's domain to transform senders before starting them.
struct stream_domain : STDEXEC::default_domain
{
template <STDEXEC::sender_expr Sender, class Tag = STDEXEC::tag_of_t<Sender>, class Env>
template <::exec::sender_for Sender, class Tag = STDEXEC::tag_of_t<Sender>, class Env>
requires STDEXEC::__applicable<_strm::transform_sender_for<Tag>, Sender, Env const &>
static auto transform_sender(STDEXEC::set_value_t, Sender&& sndr, Env const & env)
{
Expand Down
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__affine_on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace STDEXEC
template <class _Sender, class _Env>
static constexpr auto transform_sender(set_value_t, _Sender &&__sndr, _Env const &__env)
{
static_assert(sender_expr_for<_Sender, affine_on_t>);
static_assert(__sender_for<_Sender, affine_on_t>);
auto &[__tag, __ign, __child] = __sndr;
using __child_t = decltype(__child);
using __cv_child_t = __copy_cvref_t<_Sender, __child_t>;
Expand Down
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__associate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ namespace STDEXEC
__completion_signatures_of_t<__wrap_sender_of_t<_Sender>, _Env...>,
completion_signatures<set_stopped_t()>>
{
static_assert(sender_expr_for<_Sender, associate_t>);
static_assert(__sender_for<_Sender, associate_t>);
return {};
};

Expand Down
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__bulk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ namespace STDEXEC
template <class _Sender, class... _Env>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_Sender, _AlgoTag>);
static_assert(__sender_for<_Sender, _AlgoTag>);
// TODO: port this to use constant evaluation
return __completion_signatures<_AlgoTag,
__fun_t<_Sender>,
Expand Down
4 changes: 2 additions & 2 deletions include/stdexec/__detail/__continues_on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ namespace STDEXEC
template <class _Sender, class... _Env>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_Sender, continues_on_t>);
static_assert(__sender_for<_Sender, continues_on_t>);
using __scheduler_t = __decay_t<__data_of<_Sender>>;
using __child_t = __child_of<_Sender>;
auto __child_completions = __get_child_completions<__child_t, _Env...>();
Expand All @@ -371,7 +371,7 @@ namespace STDEXEC
_Receiver&& __rcvr) -> __state_for_t<_Sender, _Receiver>
requires sender_in<__child_of<_Sender>, __fwd_env_t<env_of_t<_Receiver>>>
{
static_assert(sender_expr_for<_Sender, continues_on_t>);
static_assert(__sender_for<_Sender, continues_on_t>);
auto& [__tag, __sched, __child] = __sndr;
return __state_for_t<_Sender, _Receiver>{__sched, static_cast<_Receiver&&>(__rcvr)};
};
Expand Down
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__into_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace STDEXEC
template <class _Self, class... _Env>
static consteval auto __get_completion_signatures()
{
static_assert(sender_expr_for<_Self, into_variant_t>);
static_assert(__sender_for<_Self, into_variant_t>);
return __completions<__child_of<_Self>, _Env...>{};
};
};
Expand Down
Loading
Loading