Skip to content

Commit f19d875

Browse files
authored
[BACKPORT 3.0] Backport diagnostic suppression machinery (#5281)
* Enhance our deprecation machinery so that we also suppress the right nvcc warnings (#5138) * Avoid deprecation suppression within a class definition * Rework deprecation machinery to also use the special NVCC deprecation * Fix failing warning suppression for nvrtc (#5278) I was pretty sure that NVRTC sets the cuda compiler to NVCC but it does not. We need to properly enable the warning suppression for nvrtc too :(
1 parent c53404e commit f19d875

40 files changed

+165
-179
lines changed

cub/cub/detail/fast_modulo_division.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include <cuda/std/type_traits> // ::cuda::std::is_integral
4949

5050
#if defined(CCCL_ENABLE_DEVICE_ASSERTIONS)
51-
_CCCL_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero
51+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero
5252
#endif // CCCL_ENABLE_DEVICE_ASSERTIONS
5353

5454
CUB_NAMESPACE_BEGIN
@@ -242,5 +242,5 @@ _CCCL_DIAG_POP
242242
CUB_NAMESPACE_END
243243

244244
#if defined(CCCL_ENABLE_DEVICE_ASSERTIONS)
245-
_CCCL_NV_DIAG_DEFAULT(186)
245+
_CCCL_END_NV_DIAG_SUPPRESS()
246246
#endif // CCCL_ENABLE_DEVICE_ASSERTIONS

cub/test/catch2_test_device_adjacent_difference_substract_right.cu

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy does not change the input"
8989
REQUIRE(reference == in);
9090
}
9191

92+
_CCCL_SUPPRESS_DEPRECATED_PUSH
9293
template <class T>
9394
struct ref_diff
9495
{
@@ -102,19 +103,17 @@ struct ref_diff
102103
{
103104
return ulonglong2{rhs.x - lhs.x, rhs.y - lhs.y};
104105
}
105-
106-
_CCCL_SUPPRESS_DEPRECATED_PUSH
107106
__host__ __device__ constexpr ulonglong4 operator()(const ulonglong4& lhs, const ulonglong4& rhs) const noexcept
108107
{
109108
return ulonglong4{rhs.x - lhs.x, rhs.y - lhs.y, rhs.z - lhs.z, rhs.w - lhs.w};
110109
}
111-
_CCCL_SUPPRESS_DEPRECATED_POP
112110

113111
__host__ __device__ constexpr long2 operator()(const long2& lhs, const long2& rhs) const noexcept
114112
{
115113
return long2{rhs.x - lhs.x, rhs.y - lhs.y};
116114
}
117115
};
116+
_CCCL_SUPPRESS_DEPRECATED_POP
118117

119118
C2H_TEST("DeviceAdjacentDifference::SubtractRight works with iterators", "[device][adjacent_difference]", types)
120119
{
@@ -196,6 +195,7 @@ C2H_TEST("DeviceAdjacentDifference::SubtractRightCopy works with pointers", "[de
196195
REQUIRE(reference == out);
197196
}
198197

198+
_CCCL_SUPPRESS_DEPRECATED_PUSH
199199
struct cust_diff
200200
{
201201
template <class T>
@@ -209,18 +209,17 @@ struct cust_diff
209209
return ulonglong2{lhs.x - rhs.x, lhs.y - rhs.y};
210210
}
211211

212-
_CCCL_SUPPRESS_DEPRECATED_PUSH
213212
__host__ __device__ constexpr ulonglong4 operator()(const ulonglong4& lhs, const ulonglong4& rhs) const noexcept
214213
{
215214
return ulonglong4{lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w};
216215
}
217-
_CCCL_SUPPRESS_DEPRECATED_POP
218216

219217
__host__ __device__ constexpr long2 operator()(const long2& lhs, const long2& rhs) const noexcept
220218
{
221219
return long2{lhs.x - rhs.x, lhs.y - rhs.y};
222220
}
223221
};
222+
_CCCL_SUPPRESS_DEPRECATED_POP
224223

225224
C2H_TEST("DeviceAdjacentDifference::SubtractRight works with custom difference",
226225
"[device][adjacent_difference]",

cub/test/catch2_test_device_reduce.cu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMin, device_arg_min);
4646
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::Max, device_max);
4747
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMax, device_arg_max);
4848

49-
// Suppress deprecation warning for the deprecated ArgMin and ArgMax interfaces
50-
_CCCL_NV_DIAG_SUPPRESS(1444)
5149
_CCCL_SUPPRESS_DEPRECATED_PUSH
5250
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMin, device_arg_min_old);
5351
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMax, device_arg_max_old);

cub/test/catch2_test_device_reduce_fp_inf.cu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMin, device_arg_min);
3939
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMax, device_arg_max);
4040

41-
// Suppress deprecation warning for the deprecated ArgMin and ArgMax interfaces
42-
_CCCL_NV_DIAG_SUPPRESS(1444)
4341
_CCCL_SUPPRESS_DEPRECATED_PUSH
4442
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMin, device_arg_min_old);
4543
DECLARE_LAUNCH_WRAPPER(cub::DeviceReduce::ArgMax, device_arg_max_old);

cudax/include/cuda/experimental/__async/sender/env.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ _CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated-copy")
4646
// warning #20012-D: __device__ annotation is ignored on a
4747
// function("inplace_stop_source") that is explicitly defaulted on its first
4848
// declaration
49-
_CCCL_NV_DIAG_SUPPRESS(20012)
49+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(20012)
5050

5151
namespace cuda::experimental::__async
5252
{
@@ -204,7 +204,7 @@ template <class _Ty>
204204
using env_of_t = decltype(get_env(__declval<_Ty>()));
205205
} // namespace cuda::experimental::__async
206206

207-
_CCCL_NV_DIAG_DEFAULT(20012)
207+
_CCCL_END_NV_DIAG_SUPPRESS()
208208

209209
_CCCL_DIAG_POP
210210

cudax/include/cuda/experimental/__async/sender/epilogue.cuh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@
1313

1414
#undef _CUDAX_ASYNC_PROLOGUE_INCLUDED
1515

16+
#if _CCCL_CUDA_COMPILER(NVHPC)
17+
_CCCL_END_NV_DIAG_SUPPRESS()
18+
#endif // _CCCL_CUDA_COMPILER(NVHPC)
19+
1620
_CCCL_DIAG_POP

cudax/include/cuda/experimental/__async/sender/prologue.cuh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ _CCCL_DIAG_SUPPRESS_MSVC(4848) // [[no_unique_address]] prior to C++20 as a vend
2222
_CCCL_DIAG_SUPPRESS_GCC("-Wmissing-braces")
2323
_CCCL_DIAG_SUPPRESS_CLANG("-Wmissing-braces")
2424
_CCCL_DIAG_SUPPRESS_MSVC(5246) // missing braces around initializer
25+
26+
#if _CCCL_CUDA_COMPILER(NVHPC)
27+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(cuda_compile)
28+
#endif // _CCCL_CUDA_COMPILER(NVHPC)

cudax/include/cuda/experimental/__async/sender/stop_token.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// warning #20012-D: __device__ annotation is ignored on a
3939
// function("inplace_stop_source") that is explicitly defaulted on its first
4040
// declaration
41-
_CCCL_NV_DIAG_SUPPRESS(20012)
41+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(20012)
4242

4343
namespace cuda::experimental::__async
4444
{
@@ -481,7 +481,7 @@ template <class _Token, class _Callback>
481481
using stop_callback_for_t = typename _Token::template callback_type<_Callback>;
482482
} // namespace cuda::experimental::__async
483483

484-
_CCCL_NV_DIAG_DEFAULT(20012)
484+
_CCCL_END_NV_DIAG_SUPPRESS()
485485

486486
#include <cuda/experimental/__async/sender/epilogue.cuh>
487487

cudax/include/cuda/experimental/__async/sender/utility.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ _CUDAX_API constexpr _CUDA_VSTD::decay_t<_Ty> __decay_copy(_Ty&& __ty) noexcept(
122122
_CCCL_DIAG_PUSH
123123
_CCCL_DIAG_SUPPRESS_GCC("-Wnon-template-friend")
124124
_CCCL_DIAG_SUPPRESS_NVHPC(probable_guiding_friend)
125-
_CCCL_NV_DIAG_SUPPRESS(probable_guiding_friend)
125+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(probable_guiding_friend)
126126

127127
// __zip/__unzip is for keeping type names short. It has the unfortunate side
128128
// effect of obfuscating the types.
@@ -196,7 +196,7 @@ using __unzip = decltype(__slot_allocated(_Id())());
196196
using __ignore_this_typedef [[maybe_unused]] = __zip<void>;
197197
} // namespace
198198

199-
_CCCL_NV_DIAG_DEFAULT(probable_guiding_friend)
199+
_CCCL_END_NV_DIAG_SUPPRESS()
200200
_CCCL_DIAG_POP
201201

202202
} // namespace cuda::experimental::__async

cudax/include/cuda/experimental/__async/sender/when_all.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ extern __completion_metadata<_CUDA_VSTD::true_type, // There will be no value co
242242

243243
_CCCL_DIAG_PUSH
244244
_CCCL_DIAG_SUPPRESS_GCC("-Wunused-value")
245-
_CCCL_NV_DIAG_SUPPRESS(expr_has_no_effect)
245+
_CCCL_BEGIN_NV_DIAG_SUPPRESS(expr_has_no_effect)
246246
_CCCL_DIAG_SUPPRESS_NVHPC(expr_has_no_effect)
247247

248248
template <size_t... _Offsets>
249249
inline constexpr size_t __last_offset = (0, ..., _Offsets);
250250

251-
_CCCL_NV_DIAG_DEFAULT(expr_has_no_effect)
251+
_CCCL_END_NV_DIAG_SUPPRESS()
252252
_CCCL_DIAG_POP
253253

254254
template <size_t _Count, size_t... _Offsets>

0 commit comments

Comments
 (0)