Skip to content

Commit a728297

Browse files
bernhardmgruberdavebayer
authored andcommitted
Deprecate Thrust's cpp_compatibility.h macros (NVIDIA#3299)
1 parent 6551d1a commit a728297

File tree

18 files changed

+36
-55
lines changed

18 files changed

+36
-55
lines changed

docs/repo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ doxygen_predefined = [
273273
"_CCCL_DIAG_SUPPRESS_GCC(x)=",
274274
"_CCCL_DIAG_SUPPRESS_MSVC(x)=",
275275
"_CCCL_DIAG_SUPPRESS_NVHPC(x)=",
276+
"_CCCL_GLOBAL_CONSTANT=constexpr",
276277
"CUDASTF_HOST=",
277278
"CUDASTF_DEVICE=",
278279
"CUDASTF_HOST_DEVICE=",

thrust/thrust/async/copy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct copy_fn final
116116

117117
} // namespace copy_detail
118118

119-
THRUST_INLINE_CONSTANT copy_detail::copy_fn copy{};
119+
_CCCL_GLOBAL_CONSTANT copy_detail::copy_fn copy{};
120120

121121
/*! \endcond
122122
*/

thrust/thrust/async/for_each.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct for_each_fn final
9393

9494
} // namespace for_each_detail
9595

96-
THRUST_INLINE_CONSTANT for_each_detail::for_each_fn for_each{};
96+
_CCCL_GLOBAL_CONSTANT for_each_detail::for_each_fn for_each{};
9797

9898
/*! \endcond
9999
*/

thrust/thrust/async/reduce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ struct reduce_fn final
159159

160160
} // namespace reduce_detail
161161

162-
THRUST_INLINE_CONSTANT reduce_detail::reduce_fn reduce{};
162+
_CCCL_GLOBAL_CONSTANT reduce_detail::reduce_fn reduce{};
163163

164164
///////////////////////////////////////////////////////////////////////////////
165165

@@ -295,7 +295,7 @@ struct reduce_into_fn final
295295

296296
} // namespace reduce_into_detail
297297

298-
THRUST_INLINE_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{};
298+
_CCCL_GLOBAL_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{};
299299

300300
/*! \endcond
301301
*/

thrust/thrust/async/scan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct inclusive_scan_fn final
178178

179179
} // namespace inclusive_scan_detail
180180

181-
THRUST_INLINE_CONSTANT inclusive_scan_detail::inclusive_scan_fn inclusive_scan{};
181+
_CCCL_GLOBAL_CONSTANT inclusive_scan_detail::inclusive_scan_fn inclusive_scan{};
182182

183183
namespace exclusive_scan_detail
184184
{
@@ -287,7 +287,7 @@ struct exclusive_scan_fn final
287287

288288
} // namespace exclusive_scan_detail
289289

290-
THRUST_INLINE_CONSTANT exclusive_scan_detail::exclusive_scan_fn exclusive_scan{};
290+
_CCCL_GLOBAL_CONSTANT exclusive_scan_detail::exclusive_scan_fn exclusive_scan{};
291291

292292
} // namespace async
293293

thrust/thrust/async/sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct stable_sort_fn final
145145

146146
} // namespace stable_sort_detail
147147

148-
THRUST_INLINE_CONSTANT stable_sort_detail::stable_sort_fn stable_sort{};
148+
_CCCL_GLOBAL_CONSTANT stable_sort_detail::stable_sort_fn stable_sort{};
149149

150150
namespace fallback
151151
{
@@ -258,7 +258,7 @@ struct sort_fn final
258258

259259
} // namespace sort_detail
260260

261-
THRUST_INLINE_CONSTANT sort_detail::sort_fn sort{};
261+
_CCCL_GLOBAL_CONSTANT sort_detail::sort_fn sort{};
262262

263263
/*! \endcond
264264
*/

thrust/thrust/async/transform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct transform_fn final
124124

125125
} // namespace transform_detail
126126

127-
THRUST_INLINE_CONSTANT transform_detail::transform_fn transform{};
127+
_CCCL_GLOBAL_CONSTANT transform_detail::transform_fn transform{};
128128

129129
/*! \endcond
130130
*/

thrust/thrust/detail/config/cpp_compatibility.h

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#pragma once
1818

19-
// Internal config header that is only included through thrust/detail/config/config.h
19+
#include <cuda/__cccl_config>
2020

2121
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
2222
# pragma GCC system_header
@@ -26,29 +26,9 @@
2626
# pragma system_header
2727
#endif // no system header
2828

29-
#include <thrust/detail/config/cpp_dialect.h> // IWYU pragma: export
30-
31-
#include <cuda/std/cstddef>
32-
29+
// deprecated [Since 2.8.0]
3330
#define THRUST_NODISCARD _CCCL_NODISCARD
34-
35-
// FIXME: Combine THRUST_INLINE_CONSTANT and
36-
// THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT into one macro when NVCC properly
37-
// supports `constexpr` globals in host and device code.
38-
#if defined(__CUDA_ARCH__) || defined(_NVHPC_CUDA)
39-
// FIXME: Add this when NVCC supports inline variables.
40-
// # if _CCCL_STD_VER >= 2017
41-
// # define THRUST_INLINE_CONSTANT inline constexpr
42-
// # define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT inline constexpr
43-
# define THRUST_INLINE_CONSTANT static const _CCCL_DEVICE
44-
# define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr
45-
46-
#else
47-
// FIXME: Add this when NVCC supports inline variables.
48-
// # if _CCCL_STD_VER >= 2017
49-
// # define THRUST_INLINE_CONSTANT inline constexpr
50-
// # define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT inline constexpr
51-
# define THRUST_INLINE_CONSTANT static constexpr
52-
# define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr
53-
54-
#endif
31+
// deprecated [Since 2.8.0]
32+
#define THRUST_INLINE_CONSTANT _CCCL_GLOBAL_CONSTANT
33+
// deprecated [Since 2.8.0]
34+
#define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr

thrust/thrust/detail/select_system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct select_system_fn final
6464

6565
} // namespace select_system_detail
6666

67-
THRUST_INLINE_CONSTANT select_system_detail::select_system_fn select_system{};
67+
_CCCL_GLOBAL_CONSTANT select_system_detail::select_system_fn select_system{};
6868

6969
} // namespace detail
7070

thrust/thrust/detail/seq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ struct seq_t
4949

5050
} // namespace detail
5151

52-
THRUST_INLINE_CONSTANT detail::seq_t seq;
52+
_CCCL_GLOBAL_CONSTANT detail::seq_t seq;
5353

5454
THRUST_NAMESPACE_END

0 commit comments

Comments
 (0)