Skip to content

Commit c3983c6

Browse files
committed
tidy some nvexec test utilities
1 parent c6b3423 commit c3983c6

4 files changed

Lines changed: 20 additions & 26 deletions

File tree

test/nvexec/common.cuh

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace {
8989
}
9090

9191
auto is_set_n_times(int n) -> bool {
92-
int host_flags[N];
92+
int host_flags[N]; // NOLINT
9393
THROW_ON_CUDA_ERROR(cudaMemcpy(host_flags, flags_, sizeof(int) * N, cudaMemcpyDeviceToHost));
9494

9595
return std::count(host_flags, host_flags + N, n) == N;
@@ -183,13 +183,12 @@ namespace {
183183
using op_t =
184184
_operation_state_t<stdexec::__copy_cvref_t<Self, Sender>, _receiver_t<Receiver, Fun>>;
185185

186-
template <class Self, class Env>
186+
template <class Self, class... Env>
187187
using __completions_t = //
188-
stdexec::__try_make_completion_signatures<
189-
stdexec::__copy_cvref_t<Self, Sender>,
190-
Env,
188+
stdexec::transform_completion_signatures<
189+
stdexec::__completion_signatures_of_t<stdexec::__copy_cvref_t<Self, Sender>, Env...>,
191190
stdexec::completion_signatures<>,
192-
stdexec::__mbind_front_q<stdexec::__set_value_invoke_t, Fun>>;
191+
stdexec::__mbind_front_q<stdexec::__set_value_invoke_t, Fun>::template __f>;
193192

194193
template <stdexec::__decays_to<__t> Self, stdexec::receiver Receiver>
195194
requires stdexec::receiver_of<Receiver, __completions_t<Self, stdexec::env_of_t<Receiver>>>
@@ -200,8 +199,8 @@ namespace {
200199
_receiver_t<Receiver, Fun>(static_cast<Receiver&&>(rcvr), self.fun_));
201200
}
202201

203-
template <stdexec::__decays_to<__t> Self, class Env>
204-
static auto get_completion_signatures(Self&&, Env) -> __completions_t<Self, Env> {
202+
template <stdexec::__decays_to<__t> Self, class... Env>
203+
static auto get_completion_signatures(Self&&, Env&&...) -> __completions_t<Self, Env...> {
205204
return {};
206205
}
207206

@@ -255,24 +254,19 @@ namespace {
255254
template <class Self, class Receiver>
256255
using op_t = _operation_state_t<stdexec::__copy_cvref_t<Self, Sender>, Receiver>;
257256

258-
template <class Self, class Env>
259-
using completion_signatures = //
260-
stdexec::__try_make_completion_signatures<
261-
stdexec::__copy_cvref_t<Self, Sender>,
262-
Env,
263-
stdexec::completion_signatures<>>;
257+
template <class Self, class... Env>
258+
using _completions_t = //
259+
stdexec::__completion_signatures_of_t<stdexec::__copy_cvref_t<Self, Sender>, Env...>;
264260

265261
template <stdexec::__decays_to<__t> Self, stdexec::receiver Receiver>
266-
requires stdexec::
267-
receiver_of<Receiver, completion_signatures<Self, stdexec::env_of_t<Receiver>>>
268-
friend auto
269-
tag_invoke(stdexec::connect_t, Self&& self, Receiver&& rcvr) -> op_t<Self, Receiver> {
262+
requires stdexec::receiver_of<Receiver, _completions_t<Self, stdexec::env_of_t<Receiver>>>
263+
static auto connect(Self&& self, Receiver&& rcvr) -> op_t<Self, Receiver> {
270264
return op_t<Self, Receiver>(
271265
static_cast<Self&&>(self).sndr_, static_cast<Receiver&&>(rcvr));
272266
}
273267

274-
template <stdexec::__decays_to<__t> Self, class Env>
275-
static auto get_completion_signatures(Self&&, Env&&) -> completion_signatures<Self, Env> {
268+
template <stdexec::__decays_to<__t> Self, class... Env>
269+
static auto get_completion_signatures(Self&&, Env&&...) -> _completions_t<Self, Env...> {
276270
return {};
277271
}
278272

@@ -300,7 +294,6 @@ namespace {
300294
using sender_th = detail::a_sender::_sender_t<_Sender, _Fun>;
301295

302296
template <stdexec::sender _Sender, class _Fun>
303-
requires stdexec::sender<sender_th<_Sender, _Fun>>
304297
auto operator()(_Sender&& __sndr, _Fun __fun) const -> sender_th<_Sender, _Fun> {
305298
return sender_th<_Sender, _Fun>{static_cast<_Sender&&>(__sndr), static_cast<_Fun&&>(__fun)};
306299
}
@@ -318,7 +311,6 @@ namespace {
318311
using receiverless_sender_th = detail::a_receiverless_sender::_sender_t<_Sender>;
319312

320313
template <stdexec::sender _Sender>
321-
requires stdexec::sender<receiverless_sender_th<_Sender>>
322314
auto operator()(_Sender&& __sndr) const -> receiverless_sender_th<_Sender> {
323315
return receiverless_sender_th<_Sender>{static_cast<_Sender&&>(__sndr)};
324316
}
@@ -336,7 +328,7 @@ namespace {
336328
using a_sender_helper_t<a_sender_kind::receiverless>::operator();
337329
};
338330

339-
constexpr a_sender_t a_sender;
331+
constexpr a_sender_t a_sender; // NOLINT (unused-const-variable)
340332

341333
struct move_only_t {
342334
static constexpr auto invalid() -> int {

test/nvexec/start_detached.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#include <cstdlib>
2-
#include <atomic>
32
#include <catch2/catch.hpp>
43
#include <stdexec/execution.hpp>
54

6-
#include "nvexec/detail/cuda_atomic.cuh"
5+
#include "nvexec/detail/cuda_atomic.cuh" // IWYU pragma: keep
76
#include "nvexec/stream/common.cuh"
87
#include "nvexec/stream_context.cuh"
98
#include "common.cuh"

test/nvexec/tracer_resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ namespace {
4848
return this == &other;
4949
}
5050
};
51-
}
51+
} // namespace

test/nvexec/variant.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "nvexec/detail/variant.cuh"
2424
#include "common.cuh"
2525

26+
STDEXEC_PRAGMA_PUSH()
2627
STDEXEC_PRAGMA_IGNORE_EDG(cuda_compile)
2728

2829
using nvexec::variant_t;
@@ -145,3 +146,5 @@ namespace {
145146
1);
146147
}
147148
} // namespace
149+
150+
STDEXEC_PRAGMA_POP()

0 commit comments

Comments
 (0)