Skip to content

Commit 6002bc6

Browse files
committed
Forgot about the bounds types
1 parent 06c277f commit 6002bc6

7 files changed

Lines changed: 68 additions & 68 deletions

File tree

libcudacxx/include/cuda/__argument/argument.h

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ template <class _ElementType, class _StaticBounds>
174174
inline constexpr bool __valid_static_bounds_v = true;
175175

176176
template <class _ElementType, auto _Lowest, auto _Highest>
177-
inline constexpr bool __valid_static_bounds_v<_ElementType, __static_bounds<_Lowest, _Highest>> =
177+
inline constexpr bool __valid_static_bounds_v<_ElementType, static_bounds<_Lowest, _Highest>> =
178178
__static_bound_in_range<_ElementType, _Lowest>() && __static_bound_in_range<_ElementType, _Highest>();
179179

180180
template <class _ElementType, class _StaticBounds>
181181
_CCCL_API constexpr _ElementType __wrapper_static_lowest() noexcept
182182
{
183-
if constexpr (::cuda::std::is_same_v<_StaticBounds, __no_bounds>)
183+
if constexpr (::cuda::std::is_same_v<_StaticBounds, no_bounds>)
184184
{
185185
return ::cuda::std::numeric_limits<_ElementType>::lowest();
186186
}
@@ -193,7 +193,7 @@ _CCCL_API constexpr _ElementType __wrapper_static_lowest() noexcept
193193
template <class _ElementType, class _StaticBounds>
194194
_CCCL_API constexpr _ElementType __wrapper_static_highest() noexcept
195195
{
196-
if constexpr (::cuda::std::is_same_v<_StaticBounds, __no_bounds>)
196+
if constexpr (::cuda::std::is_same_v<_StaticBounds, no_bounds>)
197197
{
198198
return (::cuda::std::numeric_limits<_ElementType>::max)();
199199
}
@@ -204,28 +204,28 @@ _CCCL_API constexpr _ElementType __wrapper_static_highest() noexcept
204204
}
205205

206206
template <class _ElementType, class _StaticBounds>
207-
_CCCL_API constexpr _ElementType __effective_lowest(__runtime_bounds<_ElementType> __runtime_bounds) noexcept
207+
_CCCL_API constexpr _ElementType __effective_lowest(runtime_bounds<_ElementType> __runtime_bounds) noexcept
208208
{
209209
auto __static_lowest = __wrapper_static_lowest<_ElementType, _StaticBounds>();
210210
return __static_lowest > __runtime_bounds.lower() ? __static_lowest : __runtime_bounds.lower();
211211
}
212212

213213
template <class _ElementType, class _StaticBounds>
214-
_CCCL_API constexpr _ElementType __effective_highest(__runtime_bounds<_ElementType> __runtime_bounds) noexcept
214+
_CCCL_API constexpr _ElementType __effective_highest(runtime_bounds<_ElementType> __runtime_bounds) noexcept
215215
{
216216
auto __static_highest = __wrapper_static_highest<_ElementType, _StaticBounds>();
217217
return __static_highest < __runtime_bounds.upper() ? __static_highest : __runtime_bounds.upper();
218218
}
219219

220220
template <class _ElementType, class _StaticBounds>
221-
_CCCL_API constexpr bool __has_bounds_intersection(__runtime_bounds<_ElementType> __runtime_bounds) noexcept
221+
_CCCL_API constexpr bool __has_bounds_intersection(runtime_bounds<_ElementType> __runtime_bounds) noexcept
222222
{
223223
return __effective_lowest<_ElementType, _StaticBounds>(__runtime_bounds)
224224
<= __effective_highest<_ElementType, _StaticBounds>(__runtime_bounds);
225225
}
226226

227227
template <class _ElementType, class _StaticBounds>
228-
_CCCL_API constexpr void __validate_bounds_intersection(__runtime_bounds<_ElementType> __runtime_bounds) noexcept
228+
_CCCL_API constexpr void __validate_bounds_intersection(runtime_bounds<_ElementType> __runtime_bounds) noexcept
229229
{
230230
static_assert(__valid_static_bounds_v<_ElementType, _StaticBounds>,
231231
"static argument bounds cannot be represented by the element type");
@@ -236,7 +236,7 @@ _CCCL_API constexpr void __validate_bounds_intersection(__runtime_bounds<_Elemen
236236
template <class _ElementType, class _StaticBounds>
237237
_CCCL_API constexpr void __validate_static_element_bounds([[maybe_unused]] const _ElementType& __val) noexcept
238238
{
239-
if constexpr (!::cuda::std::is_same_v<_StaticBounds, __no_bounds>)
239+
if constexpr (!::cuda::std::is_same_v<_StaticBounds, no_bounds>)
240240
{
241241
_CCCL_ASSERT((__val >= __wrapper_static_lowest<_ElementType, _StaticBounds>()),
242242
"immediate argument value is below static lowest bound");
@@ -247,7 +247,7 @@ _CCCL_API constexpr void __validate_static_element_bounds([[maybe_unused]] const
247247

248248
template <class _ElementType>
249249
_CCCL_API constexpr void __validate_runtime_element_bounds(
250-
[[maybe_unused]] const _ElementType& __val, [[maybe_unused]] __runtime_bounds<_ElementType> __runtime_bounds) noexcept
250+
[[maybe_unused]] const _ElementType& __val, [[maybe_unused]] runtime_bounds<_ElementType> __runtime_bounds) noexcept
251251
{
252252
_CCCL_ASSERT((__val >= __runtime_bounds.lower()), "immediate argument value is below runtime lower bound");
253253
_CCCL_ASSERT((__val <= __runtime_bounds.upper()), "immediate argument value is above runtime upper bound");
@@ -260,7 +260,7 @@ _CCCL_API constexpr void __validate_runtime_element_bounds(
260260
//! @brief Wraps a runtime argument value with optional bounds.
261261
//!
262262
//! The value is host-accessible at API call time.
263-
template <class _Arg, class _StaticBounds = __no_bounds>
263+
template <class _Arg, class _StaticBounds = no_bounds>
264264
struct immediate
265265
{
266266
using __element_type = __element_type_of_t<_Arg>;
@@ -296,8 +296,8 @@ struct immediate
296296

297297
#ifndef _CCCL_DOXYGEN_INVOKED
298298
template <class _Arg, auto _Lowest, auto _Highest>
299-
_CCCL_HOST_DEVICE immediate(_Arg, __static_bounds<_Lowest, _Highest>)
300-
-> immediate<_Arg, __static_bounds<_Lowest, _Highest>>;
299+
_CCCL_HOST_DEVICE immediate(_Arg, static_bounds<_Lowest, _Highest>)
300+
-> immediate<_Arg, static_bounds<_Lowest, _Highest>>;
301301

302302
#endif // _CCCL_DOXYGEN_INVOKED
303303

@@ -306,7 +306,7 @@ _CCCL_HOST_DEVICE immediate(_Arg, __static_bounds<_Lowest, _Highest>)
306306
// =====================================================================
307307

308308
//! @brief Wraps a runtime argument sequence with optional bounds.
309-
template <class _Arg, class _StaticBounds = __no_bounds>
309+
template <class _Arg, class _StaticBounds = no_bounds>
310310
struct immediate_sequence
311311
{
312312
using __element_type = __element_type_of_t<_Arg>;
@@ -316,7 +316,7 @@ struct immediate_sequence
316316
"static argument bounds cannot be represented by the element type");
317317

318318
_Arg __arg_;
319-
__runtime_bounds<__element_type> __runtime_bounds_{};
319+
runtime_bounds<__element_type> __runtime_bounds_{};
320320

321321
private:
322322
_CCCL_API constexpr void __validate_bounds() const noexcept
@@ -357,7 +357,7 @@ struct immediate_sequence
357357
}
358358

359359
template <class _BoundsTp>
360-
_CCCL_API constexpr immediate_sequence(_Arg __arg, __runtime_bounds<_BoundsTp> __rb) noexcept
360+
_CCCL_API constexpr immediate_sequence(_Arg __arg, runtime_bounds<_BoundsTp> __rb) noexcept
361361
: __arg_{::cuda::std::move(__arg)}
362362
, __runtime_bounds_{__runtime_bound_cast<__element_type>(__rb.lower()),
363363
__runtime_bound_cast<__element_type>(__rb.upper())}
@@ -367,7 +367,7 @@ struct immediate_sequence
367367
}
368368

369369
template <class _BoundsTp>
370-
_CCCL_API constexpr immediate_sequence(_Arg __arg, _StaticBounds, __runtime_bounds<_BoundsTp> __rb) noexcept
370+
_CCCL_API constexpr immediate_sequence(_Arg __arg, _StaticBounds, runtime_bounds<_BoundsTp> __rb) noexcept
371371
: __arg_{::cuda::std::move(__arg)}
372372
, __runtime_bounds_{__runtime_bound_cast<__element_type>(__rb.lower()),
373373
__runtime_bound_cast<__element_type>(__rb.upper())}
@@ -377,31 +377,31 @@ struct immediate_sequence
377377
}
378378

379379
template <class _BoundsTp>
380-
_CCCL_API constexpr immediate_sequence(_Arg __arg, __runtime_bounds<_BoundsTp> __rb, _StaticBounds __sb) noexcept
380+
_CCCL_API constexpr immediate_sequence(_Arg __arg, runtime_bounds<_BoundsTp> __rb, _StaticBounds __sb) noexcept
381381
: immediate_sequence(::cuda::std::move(__arg), __sb, __rb)
382382
{}
383383
};
384384

385385
#ifndef _CCCL_DOXYGEN_INVOKED
386386
template <class _Arg, auto _Lowest, auto _Highest>
387-
_CCCL_HOST_DEVICE immediate_sequence(_Arg, __static_bounds<_Lowest, _Highest>)
388-
-> immediate_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
387+
_CCCL_HOST_DEVICE immediate_sequence(_Arg, static_bounds<_Lowest, _Highest>)
388+
-> immediate_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
389389

390390
template <class _Arg, auto _Lowest, auto _Highest, class _Tp>
391-
_CCCL_HOST_DEVICE immediate_sequence(_Arg, __static_bounds<_Lowest, _Highest>, __runtime_bounds<_Tp>)
392-
-> immediate_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
391+
_CCCL_HOST_DEVICE immediate_sequence(_Arg, static_bounds<_Lowest, _Highest>, runtime_bounds<_Tp>)
392+
-> immediate_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
393393

394394
template <class _Arg, class _Tp, auto _Lowest, auto _Highest>
395-
_CCCL_HOST_DEVICE immediate_sequence(_Arg, __runtime_bounds<_Tp>, __static_bounds<_Lowest, _Highest>)
396-
-> immediate_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
395+
_CCCL_HOST_DEVICE immediate_sequence(_Arg, runtime_bounds<_Tp>, static_bounds<_Lowest, _Highest>)
396+
-> immediate_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
397397
#endif // _CCCL_DOXYGEN_INVOKED
398398

399399
// =====================================================================
400400
// __deferred_base / deferred / deferred_sequence
401401
// =====================================================================
402402

403403
//! @brief Common base for deferred argument wrappers.
404-
template <class _Arg, class _StaticBounds = __no_bounds>
404+
template <class _Arg, class _StaticBounds = no_bounds>
405405
struct __deferred_base
406406
{
407407
using __element_type = __element_type_of_t<_Arg>;
@@ -410,7 +410,7 @@ struct __deferred_base
410410
"static argument bounds cannot be represented by the element type");
411411

412412
_Arg __arg_;
413-
__runtime_bounds<__element_type> __runtime_bounds_{};
413+
runtime_bounds<__element_type> __runtime_bounds_{};
414414

415415
_CCCL_API constexpr __deferred_base(_Arg __arg) noexcept
416416
: __arg_{::cuda::std::move(__arg)}
@@ -425,7 +425,7 @@ struct __deferred_base
425425
}
426426

427427
template <class _BoundsTp>
428-
_CCCL_API constexpr __deferred_base(_Arg __arg, __runtime_bounds<_BoundsTp> __rb) noexcept
428+
_CCCL_API constexpr __deferred_base(_Arg __arg, runtime_bounds<_BoundsTp> __rb) noexcept
429429
: __arg_{::cuda::std::move(__arg)}
430430
, __runtime_bounds_{__runtime_bound_cast<__element_type>(__rb.lower()),
431431
__runtime_bound_cast<__element_type>(__rb.upper())}
@@ -434,7 +434,7 @@ struct __deferred_base
434434
}
435435

436436
template <class _BoundsTp>
437-
_CCCL_API constexpr __deferred_base(_Arg __arg, _StaticBounds, __runtime_bounds<_BoundsTp> __rb) noexcept
437+
_CCCL_API constexpr __deferred_base(_Arg __arg, _StaticBounds, runtime_bounds<_BoundsTp> __rb) noexcept
438438
: __arg_{::cuda::std::move(__arg)}
439439
, __runtime_bounds_{__runtime_bound_cast<__element_type>(__rb.lower()),
440440
__runtime_bound_cast<__element_type>(__rb.upper())}
@@ -443,14 +443,14 @@ struct __deferred_base
443443
}
444444

445445
template <class _BoundsTp>
446-
_CCCL_API constexpr __deferred_base(_Arg __arg, __runtime_bounds<_BoundsTp> __rb, _StaticBounds __sb) noexcept
446+
_CCCL_API constexpr __deferred_base(_Arg __arg, runtime_bounds<_BoundsTp> __rb, _StaticBounds __sb) noexcept
447447
: __deferred_base(::cuda::std::move(__arg), __sb, __rb)
448448
{}
449449
};
450450

451451
//! @brief Wraps a reference to a single value that is potentially not available at API call time but will be available
452452
//! by the time the argument is consumed in stream order.
453-
template <class _Arg, class _StaticBounds = __no_bounds>
453+
template <class _Arg, class _StaticBounds = no_bounds>
454454
struct deferred : __deferred_base<_Arg, _StaticBounds>
455455
{
456456
using __deferred_base<_Arg, _StaticBounds>::__deferred_base;
@@ -461,24 +461,24 @@ template <class _Arg>
461461
_CCCL_HOST_DEVICE deferred(_Arg) -> deferred<_Arg>;
462462

463463
template <class _Arg, auto _Lowest, auto _Highest>
464-
_CCCL_HOST_DEVICE deferred(_Arg, __static_bounds<_Lowest, _Highest>)
465-
-> deferred<_Arg, __static_bounds<_Lowest, _Highest>>;
464+
_CCCL_HOST_DEVICE deferred(_Arg, static_bounds<_Lowest, _Highest>)
465+
-> deferred<_Arg, static_bounds<_Lowest, _Highest>>;
466466

467467
template <class _Arg, class _Tp>
468-
_CCCL_HOST_DEVICE deferred(_Arg, __runtime_bounds<_Tp>) -> deferred<_Arg>;
468+
_CCCL_HOST_DEVICE deferred(_Arg, runtime_bounds<_Tp>) -> deferred<_Arg>;
469469

470470
template <class _Arg, auto _Lowest, auto _Highest, class _Tp>
471-
_CCCL_HOST_DEVICE deferred(_Arg, __static_bounds<_Lowest, _Highest>, __runtime_bounds<_Tp>)
472-
-> deferred<_Arg, __static_bounds<_Lowest, _Highest>>;
471+
_CCCL_HOST_DEVICE deferred(_Arg, static_bounds<_Lowest, _Highest>, runtime_bounds<_Tp>)
472+
-> deferred<_Arg, static_bounds<_Lowest, _Highest>>;
473473

474474
template <class _Arg, class _Tp, auto _Lowest, auto _Highest>
475-
_CCCL_HOST_DEVICE deferred(_Arg, __runtime_bounds<_Tp>, __static_bounds<_Lowest, _Highest>)
476-
-> deferred<_Arg, __static_bounds<_Lowest, _Highest>>;
475+
_CCCL_HOST_DEVICE deferred(_Arg, runtime_bounds<_Tp>, static_bounds<_Lowest, _Highest>)
476+
-> deferred<_Arg, static_bounds<_Lowest, _Highest>>;
477477
#endif // _CCCL_DOXYGEN_INVOKED
478478

479479
//! @brief Wraps a reference to a sequence of values that is potentially not available at API call time but will be
480480
//! available by the time the argument is consumed in stream order.
481-
template <class _Arg, class _StaticBounds = __no_bounds>
481+
template <class _Arg, class _StaticBounds = no_bounds>
482482
struct deferred_sequence : __deferred_base<_Arg, _StaticBounds>
483483
{
484484
using __deferred_base<_Arg, _StaticBounds>::__deferred_base;
@@ -489,19 +489,19 @@ template <class _Arg>
489489
_CCCL_HOST_DEVICE deferred_sequence(_Arg) -> deferred_sequence<_Arg>;
490490

491491
template <class _Arg, auto _Lowest, auto _Highest>
492-
_CCCL_HOST_DEVICE deferred_sequence(_Arg, __static_bounds<_Lowest, _Highest>)
493-
-> deferred_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
492+
_CCCL_HOST_DEVICE deferred_sequence(_Arg, static_bounds<_Lowest, _Highest>)
493+
-> deferred_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
494494

495495
template <class _Arg, class _Tp>
496-
_CCCL_HOST_DEVICE deferred_sequence(_Arg, __runtime_bounds<_Tp>) -> deferred_sequence<_Arg>;
496+
_CCCL_HOST_DEVICE deferred_sequence(_Arg, runtime_bounds<_Tp>) -> deferred_sequence<_Arg>;
497497

498498
template <class _Arg, auto _Lowest, auto _Highest, class _Tp>
499-
_CCCL_HOST_DEVICE deferred_sequence(_Arg, __static_bounds<_Lowest, _Highest>, __runtime_bounds<_Tp>)
500-
-> deferred_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
499+
_CCCL_HOST_DEVICE deferred_sequence(_Arg, static_bounds<_Lowest, _Highest>, runtime_bounds<_Tp>)
500+
-> deferred_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
501501

502502
template <class _Arg, class _Tp, auto _Lowest, auto _Highest>
503-
_CCCL_HOST_DEVICE deferred_sequence(_Arg, __runtime_bounds<_Tp>, __static_bounds<_Lowest, _Highest>)
504-
-> deferred_sequence<_Arg, __static_bounds<_Lowest, _Highest>>;
503+
_CCCL_HOST_DEVICE deferred_sequence(_Arg, runtime_bounds<_Tp>, static_bounds<_Lowest, _Highest>)
504+
-> deferred_sequence<_Arg, static_bounds<_Lowest, _Highest>>;
505505
#endif // _CCCL_DOXYGEN_INVOKED
506506

507507
// =====================================================================

libcudacxx/include/cuda/__argument/argument_bounds.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
_CCCL_BEGIN_NAMESPACE_CUDA_ARGUMENT
3232

3333
//! @brief Sentinel type indicating no bounds are present.
34-
struct __no_bounds
34+
struct no_bounds
3535
{};
3636

3737
// =====================================================================
@@ -45,7 +45,7 @@ struct __no_bounds
4545
//! @tparam _Lower The static lower bound.
4646
//! @tparam _Upper The static upper bound.
4747
template <auto _Lower, auto _Upper>
48-
struct __static_bounds
48+
struct static_bounds
4949
{
5050
static_assert(::cuda::std::is_same_v<decltype(_Lower), decltype(_Upper)>,
5151
"Static bounds endpoints must have the same type");
@@ -64,7 +64,7 @@ struct __static_bounds
6464
template <class _Tp>
6565
inline constexpr bool __is_static_bounds_v = false;
6666
template <auto _Lower, auto _Upper>
67-
inline constexpr bool __is_static_bounds_v<__static_bounds<_Lower, _Upper>> = true;
67+
inline constexpr bool __is_static_bounds_v<static_bounds<_Lower, _Upper>> = true;
6868

6969
// =====================================================================
7070
// runtime_bounds
@@ -74,14 +74,14 @@ inline constexpr bool __is_static_bounds_v<__static_bounds<_Lower, _Upper>> = tr
7474
//!
7575
//! @tparam _Tp The value type of the bounds.
7676
template <class _Tp>
77-
struct __runtime_bounds
77+
struct runtime_bounds
7878
{
7979
_Tp __lower_ = ::cuda::std::numeric_limits<_Tp>::lowest();
8080
_Tp __upper_ = (::cuda::std::numeric_limits<_Tp>::max)();
8181

82-
constexpr __runtime_bounds() noexcept = default;
82+
constexpr runtime_bounds() noexcept = default;
8383

84-
_CCCL_API constexpr __runtime_bounds(_Tp __lower, _Tp __upper) noexcept
84+
_CCCL_API constexpr runtime_bounds(_Tp __lower, _Tp __upper) noexcept
8585
: __lower_(__lower)
8686
, __upper_(__upper)
8787
{
@@ -101,13 +101,13 @@ struct __runtime_bounds
101101

102102
#ifndef _CCCL_DOXYGEN_INVOKED
103103
template <class _Tp>
104-
_CCCL_HOST_DEVICE __runtime_bounds(_Tp, _Tp) -> __runtime_bounds<_Tp>;
104+
_CCCL_HOST_DEVICE runtime_bounds(_Tp, _Tp) -> runtime_bounds<_Tp>;
105105
#endif // _CCCL_DOXYGEN_INVOKED
106106

107107
template <class _Tp>
108108
inline constexpr bool __is_runtime_bounds_v = false;
109109
template <class _Tp>
110-
inline constexpr bool __is_runtime_bounds_v<__runtime_bounds<_Tp>> = true;
110+
inline constexpr bool __is_runtime_bounds_v<runtime_bounds<_Tp>> = true;
111111

112112
// =====================================================================
113113
// bounds — factory functions
@@ -119,7 +119,7 @@ inline constexpr bool __is_runtime_bounds_v<__runtime_bounds<_Tp>> = true;
119119
//! @tparam _Upper The static upper bound.
120120
//! @return A compile-time bounds object.
121121
template <auto _Lower, auto _Upper>
122-
[[nodiscard]] _CCCL_API constexpr __static_bounds<_Lower, _Upper> bounds() noexcept
122+
[[nodiscard]] _CCCL_API constexpr static_bounds<_Lower, _Upper> bounds() noexcept
123123
{
124124
return {};
125125
}
@@ -130,7 +130,7 @@ template <auto _Lower, auto _Upper>
130130
//! @param __upper The runtime upper bound.
131131
//! @return A runtime bounds object.
132132
template <class _Tp>
133-
[[nodiscard]] _CCCL_API constexpr __runtime_bounds<_Tp> bounds(_Tp __lower, _Tp __upper) noexcept
133+
[[nodiscard]] _CCCL_API constexpr runtime_bounds<_Tp> bounds(_Tp __lower, _Tp __upper) noexcept
134134
{
135135
return {__lower, __upper};
136136
}

0 commit comments

Comments
 (0)