From 09f435b0776b6e592b9baddd4b1bf38806b56a7e Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Fri, 8 Sep 2023 00:30:50 -0400 Subject: [PATCH 1/3] Instantiate the debug sender inside connect() --- include/stdexec/execution.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index cf4885460..fe38b7699 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -1905,6 +1905,22 @@ namespace stdexec { __callable<__connect_awaitable_t, __tfx_sender<_Sender, _Receiver>, _Receiver>; struct connect_t { + + template + static constexpr bool __check_signatures() { + if constexpr (sender_in<_Sender, _Env>) { + // Instantiate __debug_sender via completion_signatures_of_t + // to check that the actual completions match the expected + // completions. + // + // Instantiate completion_signatures_of_t only if sender_in + // is true to workaround Clang not implementing CWG#2369 yet (connect() + // does have a constraint for _Sender satisfying sender_in). + using __checked_signatures [[maybe_unused]] = completion_signatures_of_t<_Sender, _Env>; + } + return true; + } + template static constexpr auto __select_impl() noexcept { // Report that 2300R5-style senders and receivers are deprecated: @@ -1914,6 +1930,8 @@ namespace stdexec { if constexpr (!enable_receiver<__decay_t<_Receiver>>) _PLEASE_UPDATE_YOUR_RECEIVER_TYPE< __decay_t<_Receiver>>(); + static_assert(__check_signatures<__decay_t<_Sender>, env_of_t<__decay_t<_Receiver>>>()); + constexpr bool _NothrowTfxSender = __nothrow_callable && __nothrow_callable>; @@ -4236,7 +4254,7 @@ namespace stdexec { __cvref_t<_CvrefSenderId>, __env_t<__t<_EnvId>>, completion_signatures< - set_error_t(const std::exception_ptr&), + set_error_t(std::exception_ptr&&), set_stopped_t()>, // NOT TO SPEC __q<__set_value_t>, __q<__set_error_t>>; From 1484798ba4dc2ddb0da8ab8e65df997f4e3ca3e0 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Fri, 8 Sep 2023 09:18:22 -0700 Subject: [PATCH 2/3] Don't decay the sender and receiver types in the completion signatures check --- include/stdexec/execution.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index fe38b7699..be7d24cff 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -1930,7 +1930,7 @@ namespace stdexec { if constexpr (!enable_receiver<__decay_t<_Receiver>>) _PLEASE_UPDATE_YOUR_RECEIVER_TYPE< __decay_t<_Receiver>>(); - static_assert(__check_signatures<__decay_t<_Sender>, env_of_t<__decay_t<_Receiver>>>()); + static_assert(__check_signatures<_Sender, env_of_t<_Receiver>>()); constexpr bool _NothrowTfxSender = __nothrow_callable From 9e647b37728993c8cf46b5537b571dc939b70474 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Sun, 10 Sep 2023 13:52:23 -0400 Subject: [PATCH 3/3] Deduce template types in continuation_kernel call --- include/nvexec/multi_gpu_context.cuh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nvexec/multi_gpu_context.cuh b/include/nvexec/multi_gpu_context.cuh index c36eeb15c..cc148714d 100644 --- a/include/nvexec/multi_gpu_context.cuh +++ b/include/nvexec/multi_gpu_context.cuh @@ -66,7 +66,7 @@ namespace nvexec { if (op.status_ == cudaSuccess) { continuation_kernel<<<1, 1, 0, op.stream_>>>(std::move(op.rec_), stdexec::set_value); } else { - continuation_kernel<<<1, 1, 0, op.stream_>>>( + continuation_kernel<<<1, 1, 0, op.stream_>>>( std::move(op.rec_), stdexec::set_error, std::move(op.status_)); } }