Skip to content

Commit 9082d76

Browse files
authored
fix problems exposed by eschewing static_get_completion_signatures and static_connect members (#1720)
1 parent 36a92fd commit 9082d76

22 files changed

+127
-75
lines changed

.clangd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ CompileFlags:
8080
- -profiler
8181
- -ignore-system
8282
- "-fconcepts-diagnostics-depth=*"
83+
- "-gopt"
8384
Diagnostics:
8485
Suppress:
8586
- "variadic_device_fn"

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@
7474
"args": "-v normal ${input:CUDA_TEST_TAGS}",
7575
},
7676
{
77-
"name": "maxwell_gpu_s (cuda-gdb)",
77+
"name": "maxwell_cpu_st (cuda-gdb)",
7878
"type": "cuda-gdb",
7979
"request": "launch",
8080
"stopAtEntry": false,
8181
"breakOnLaunch": false,
8282
"internalConsoleOptions": "openOnFirstSessionStart",
83-
"program": "${command:cmake.buildDirectory}/examples/nvexec/maxwell_gpu_s",
83+
"program": "${command:cmake.buildDirectory}/examples/nvexec/maxwell_cpu_st",
8484
"cwd": "${command:cmake.buildDirectory}",
85-
"args": ["--iterations=1000", "--N=512", "--run-cuda", "--run-stdpar", "--run-stream-scheduler"],
85+
"args": ["--iterations=1000", "--N=512", "--run-cpp", "--run-inline-scheduler"],
8686
},
8787
],
8888
"inputs": [

examples/nvexec/maxwell/common.cuh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ struct deleter_t {
5656
};
5757

5858
template <class T>
59-
STDEXEC_ATTRIBUTE(host, device)
6059
inline auto allocate_on(bool gpu, std::size_t elements = 1) -> std::unique_ptr<T, deleter_t> {
6160
T *ptr{};
6261

examples/nvexec/maxwell_cpu_mt.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
// This file causes clangd to crash during parsing
18+
#if !defined(STDEXEC_CLANGD_INVOKED)
19+
1720
#include "maxwell/snr.cuh"
1821
#include "maxwell/std.cuh"
1922
#include "maxwell/stdpar.cuh" // IWYU pragma: keep
@@ -85,3 +88,5 @@ auto main(int argc, char *argv[]) -> int {
8588
}
8689
#endif
8790
}
91+
92+
#endif // !defined(STDEXEC_CLANGD_INVOKED)

examples/nvexec/maxwell_cpu_st.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
// This file causes clangd to crash during parsing
18+
#if !defined(STDEXEC_CLANGD_INVOKED)
19+
1720
#include "maxwell/snr.cuh"
1821
#include "maxwell/cpp.cuh"
1922

@@ -65,3 +68,5 @@ auto main(int argc, char *argv[]) -> int {
6568
run_cpp(dt, write_vtk, n_iterations, grid, "CPU (cpp)");
6669
}
6770
}
71+
72+
#endif // !defined(STDEXEC_CLANGD_INVOKED)

examples/nvexec/maxwell_distributed.cu

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
// This file causes clangd to crash during parsing
18+
#if !defined(STDEXEC_CLANGD_INVOKED)
19+
1720
#include "maxwell/snr.cuh" // IWYU pragma: keep
1821
#include "nvexec/stream_context.cuh" // IWYU pragma: keep
1922

@@ -512,7 +515,7 @@ auto main(int argc, char *argv[]) -> int {
512515
}
513516

514517
write();
515-
# else
518+
# else // ^^ defined(OVERLAP) ^^ // vv !defined(OVERLAP) vv
516519
for (std::size_t compute_step = 0; compute_step < n_iterations; compute_step++) {
517520
auto compute_h =
518521
ex::just()
@@ -531,7 +534,7 @@ auto main(int argc, char *argv[]) -> int {
531534
}
532535

533536
write();
534-
# endif
537+
# endif // defined(OVERLAP)
535538

536539
MPI_Barrier(MPI_COMM_WORLD);
537540
const auto end = std::chrono::system_clock::now();
@@ -550,3 +553,5 @@ auto main(int argc, char *argv[]) -> int {
550553
MPI_Finalize();
551554
}
552555
#endif
556+
557+
#endif // !defined(STDEXEC_CLANGD_INVOKED)

examples/nvexec/maxwell_gpu_m.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
// This file causes clangd to crash during parsing
18+
#if !defined(STDEXEC_CLANGD_INVOKED)
19+
1720
#include "maxwell/snr.cuh"
1821

1922
auto main(int argc, char *argv[]) -> int {
@@ -52,3 +55,5 @@ auto main(int argc, char *argv[]) -> int {
5255
nvexec::multi_gpu_stream_context stream_context{};
5356
run_snr_on("GPU (multi-GPU)", stream_context.get_scheduler());
5457
}
58+
59+
#endif // !defined(STDEXEC_CLANGD_INVOKED)

examples/nvexec/maxwell_gpu_s.cu

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
// This file causes clangd to crash during parsing
18+
#if !defined(STDEXEC_CLANGD_INVOKED)
19+
1720
#include "maxwell/snr.cuh"
1821
#include "maxwell/stdpar.cuh" // IWYU pragma: keep
1922
#include "maxwell/cuda.cuh"
@@ -79,5 +82,7 @@ auto main(int argc, char *argv[]) -> int {
7982

8083
run_stdpar(dt, write_vtk, n_iterations, grid, stdexec::par_unseq, method);
8184
}
82-
#endif
85+
#endif // STDEXEC_HAS_PARALLEL_ALGORITHMS()
8386
}
87+
88+
#endif // !defined(STDEXEC_CLANGD_INVOKED)

include/exec/sequence.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ namespace exec {
186186
stdexec::__minvoke<stdexec::__mfold_left<void, stdexec::__q2<_fold_fn>>, Sndrs...>;
187187
};
188188

189-
template <class... Sndrs>
190-
struct _sndr {
189+
template <class Sndr0, class... Sndrs>
190+
struct _sndr<Sndr0, Sndrs...> {
191191
using sender_concept = stdexec::sender_t;
192192

193193
template <class... Env>
194-
using _completions_t = stdexec::__minvoke<_completions<Env...>, Sndrs...>;
194+
using _completions_t = stdexec::__minvoke<_completions<Env...>, Sndr0, Sndrs...>;
195195

196196
template <class Self, class... Env>
197-
requires(stdexec::__decay_copyable<stdexec::__copy_cvref_t<Self, Sndrs>> && ...)
197+
requires stdexec::__decay_copyable<Self>
198198
STDEXEC_ATTRIBUTE(host, device)
199199
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this Self&&, Env&&...)
200200
-> _completions_t<Env...> {
@@ -203,17 +203,17 @@ namespace exec {
203203
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
204204

205205
template <class Self, class Rcvr>
206-
requires(stdexec::__decay_copyable<stdexec::__copy_cvref_t<Self, Sndrs>> && ...)
206+
requires stdexec::__decay_copyable<Self>
207207
STDEXEC_ATTRIBUTE(host, device)
208208
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this Self&& self, Rcvr rcvr) {
209-
return _opstate<Rcvr, Sndrs...>{
209+
return _opstate<Rcvr, stdexec::__copy_cvref_t<Self, Sndr0>, Sndrs...>{
210210
static_cast<Rcvr&&>(rcvr), static_cast<Self&&>(self)._sndrs};
211211
}
212212
STDEXEC_EXPLICIT_THIS_END(connect)
213213

214214
STDEXEC_ATTRIBUTE(no_unique_address, maybe_unused) sequence_t _tag;
215215
STDEXEC_ATTRIBUTE(no_unique_address, maybe_unused) stdexec::__ignore _ignore;
216-
stdexec::__tuple<Sndrs...> _sndrs;
216+
stdexec::__tuple<Sndr0, Sndrs...> _sndrs;
217217
};
218218

219219
template <class Sndr>

include/exec/sequence/merge_each.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "../../stdexec/__detail/__senders_core.hpp"
3333
#include "../../stdexec/__detail/__stop_token.hpp"
3434
#include "../../stdexec/__detail/__transform_completion_signatures.hpp"
35-
#include "../../stdexec/__detail/__unstoppable.hpp"
3635
#include "../../stdexec/__detail/__variant.hpp"
3736

3837
#include <atomic>
@@ -240,7 +239,7 @@ namespace exec {
240239

241240
__operation_base_interface_t* __op_;
242241

243-
template <std::same_as<__t> _Self, class... _Env>
242+
template <class _Self, class... _Env>
244243
STDEXEC_EXPLICIT_THIS_BEGIN(
245244
auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
246245
-> stdexec::__mapply<
@@ -252,8 +251,9 @@ namespace exec {
252251
> {
253252
return {};
254253
}
254+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
255255

256-
template <std::same_as<__t> _Self, receiver _ErrorReceiver>
256+
template <class _Self, receiver _ErrorReceiver>
257257
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this _Self&& __self, _ErrorReceiver&& __rcvr)
258258
noexcept(__nothrow_move_constructible<_ErrorReceiver>)
259259
-> __error_op_t<stdexec::__id<_ErrorReceiver>> {
@@ -607,7 +607,7 @@ namespace exec {
607607
_NestedValueSender __nested_value_;
608608
__operation_base_interface_t* __op_;
609609

610-
template <std::same_as<__t> _Self, class... _Env>
610+
template <class _Self, class... _Env>
611611
STDEXEC_EXPLICIT_THIS_BEGIN(
612612
auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
613613
-> stdexec::transform_completion_signatures<
@@ -618,8 +618,9 @@ namespace exec {
618618
> {
619619
return {};
620620
}
621+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
621622

622-
template <std::same_as<__t> _Self, receiver _NestedValueReceiver>
623+
template <class _Self, receiver _NestedValueReceiver>
623624
STDEXEC_EXPLICIT_THIS_BEGIN(
624625
auto connect)(this _Self&& __self, _NestedValueReceiver&& __rcvr)
625626
noexcept(__nothrow_constructible_from<
@@ -1072,14 +1073,16 @@ namespace exec {
10721073
_OperationBase* __op_;
10731074
_NestedSequenceSender __nested_sequence_;
10741075

1075-
template <std::same_as<__t> _Self, class... _Env>
1076+
template <class _Self, class... _Env>
10761077
STDEXEC_EXPLICIT_THIS_BEGIN(
10771078
auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
10781079
-> stdexec::completion_signatures<stdexec::set_value_t(), stdexec::set_stopped_t()> {
10791080
return {};
10801081
}
1082+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
10811083

1082-
template <std::same_as<__t> _Self, receiver _NextReceiver>
1084+
1085+
template <class _Self, receiver _NextReceiver>
10831086
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this _Self&& __self, _NextReceiver&& __rcvr)
10841087
noexcept(__nothrow_constructible_from<
10851088
__next_sequence_op_t<stdexec::__id<_NextReceiver>>,

0 commit comments

Comments
 (0)