From 72dbc74be6a7c2c4e9abb9624aef334008eb83f8 Mon Sep 17 00:00:00 2001 From: fbusato Date: Thu, 16 Jan 2025 12:48:07 -0800 Subject: [PATCH 1/3] deprecate and replace CUB_IS_INT128_ENABLED --- cub/cub/detail/fast_modulo_division.cuh | 6 +++--- .../device/dispatch/dispatch_histogram.cuh | 12 +++++------ .../tuning/tuning_run_length_encode.cuh | 8 ++++---- .../device/dispatch/tuning/tuning_scan.cuh | 4 ++-- .../dispatch/tuning/tuning_scan_by_key.cuh | 20 +++++++++---------- .../dispatch/tuning/tuning_select_if.cuh | 16 +++++++-------- cub/cub/util_ptx.cuh | 2 +- cub/cub/util_type.cuh | 13 ++---------- .../catch2_test_device_for_each_in_extents.cu | 4 ++-- cub/test/catch2_test_printing.cu | 2 +- cub/test/internal/catch2_test_fast_div_mod.cu | 2 +- cub/test/test_util.h | 2 +- 12 files changed, 41 insertions(+), 50 deletions(-) diff --git a/cub/cub/detail/fast_modulo_division.cuh b/cub/cub/detail/fast_modulo_division.cuh index 4a5f2048e32..09068d87be0 100644 --- a/cub/cub/detail/fast_modulo_division.cuh +++ b/cub/cub/detail/fast_modulo_division.cuh @@ -38,7 +38,7 @@ #endif // no system header #include // implicit_prom_t -#include // CUB_IS_INT128_ENABLED +#include // _CCCL_HAS_INT128() #include // cuda::std::ceil_div #include // std::has_single_bit @@ -79,7 +79,7 @@ struct larger_unsigned_type using type = ::cuda::std::uint64_t; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct larger_unsigned_type::type> @@ -87,7 +87,7 @@ struct larger_unsigned_type using type = __uint128_t; }; -#endif // CUB_IS_INT128_ENABLED +#endif // _CCCL_HAS_INT128() template using larger_unsigned_type_t = typename larger_unsigned_type::type; diff --git a/cub/cub/device/dispatch/dispatch_histogram.cuh b/cub/cub/device/dispatch/dispatch_histogram.cuh index 900f758cdfb..61b467c9d8b 100644 --- a/cub/cub/device/dispatch/dispatch_histogram.cuh +++ b/cub/cub/device/dispatch/dispatch_histogram.cuh @@ -646,27 +646,27 @@ public: using IntArithmeticT = ::cuda::std::_If< // sizeof(SampleT) + sizeof(CommonT) <= sizeof(uint32_t), // uint32_t, // -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() ::cuda::std::_If< // (::cuda::std::is_same::value || // ::cuda::std::is_same::value), // CommonT, // uint64_t> // -#else // ^^^ CUB_IS_INT128_ENABLED ^^^ / vvv !CUB_IS_INT128_ENABLED vvv +#else // ^^^ _CCCL_HAS_INT128() ^^^ / vvv !_CCCL_HAS_INT128() vvv uint64_t -#endif // !CUB_IS_INT128_ENABLED +#endif // !_CCCL_HAS_INT128() >; // Alias template that excludes __[u]int128 from the integral types template using is_integral_excl_int128 = -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() ::cuda::std::_If<::cuda::std::is_same::value&& ::cuda::std::is_same::value, ::cuda::std::false_type, ::cuda::std::is_integral>; -#else // ^^^ CUB_IS_INT128_ENABLED ^^^ / vvv !CUB_IS_INT128_ENABLED vvv +#else // ^^^ _CCCL_HAS_INT128() ^^^ / vvv !_CCCL_HAS_INT128() vvv ::cuda::std::is_integral; -#endif // !CUB_IS_INT128_ENABLED +#endif // !_CCCL_HAS_INT128() union ScaleT { diff --git a/cub/cub/device/dispatch/tuning/tuning_run_length_encode.cuh b/cub/cub/device/dispatch/tuning/tuning_run_length_encode.cuh index 33771f6882f..064c9ef19bc 100644 --- a/cub/cub/device/dispatch/tuning/tuning_run_length_encode.cuh +++ b/cub/cub/device/dispatch/tuning/tuning_run_length_encode.cuh @@ -156,7 +156,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -216,7 +216,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { @@ -349,7 +349,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -414,7 +414,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { diff --git a/cub/cub/device/dispatch/tuning/tuning_scan.cuh b/cub/cub/device/dispatch/tuning/tuning_scan.cuh index 2efa551d4c6..fca97d464e4 100644 --- a/cub/cub/device/dispatch/tuning/tuning_scan.cuh +++ b/cub/cub/device/dispatch/tuning/tuning_scan.cuh @@ -174,7 +174,7 @@ struct sm80_tuning struct sm80_tuning<__int128_t, primitive_op::yes, primitive_accum::no, accum_size::_16> { @@ -220,7 +220,7 @@ template struct sm90_tuning struct sm90_tuning : sm90_tuning_vals {}; template <> struct sm90_tuning : sm90_tuning_vals {}; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm90_tuning<__int128_t, primitive_op::yes, primitive_accum::no, accum_size::_16> : sm90_tuning_vals<__int128_t, 576, 21, 860, 630> {}; template <> struct sm90_tuning<__uint128_t, primitive_op::yes, primitive_accum::no, accum_size::_16> diff --git a/cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh b/cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh index fc8add23a22..4203253c184 100644 --- a/cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh +++ b/cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh @@ -172,7 +172,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -229,7 +229,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -286,7 +286,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -343,7 +343,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -400,7 +400,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm80_tuning { @@ -465,7 +465,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { @@ -522,7 +522,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { @@ -579,7 +579,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { @@ -636,7 +636,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { @@ -693,7 +693,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template struct sm90_tuning { diff --git a/cub/cub/device/dispatch/tuning/tuning_select_if.cuh b/cub/cub/device/dispatch/tuning/tuning_select_if.cuh index 792b1669fa1..6093d187732 100644 --- a/cub/cub/device/dispatch/tuning/tuning_select_if.cuh +++ b/cub/cub/device/dispatch/tuning/tuning_select_if.cuh @@ -121,7 +121,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm80_tuning<__int128_t, flagged::no, keep_rejects::no, offset_size::_4, primitive::no, input_size::_16> { @@ -174,7 +174,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm80_tuning<__int128_t, flagged::yes, keep_rejects::no, offset_size::_4, primitive::no, input_size::_16> { @@ -227,7 +227,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm80_tuning<__int128_t, flagged::no, keep_rejects::yes, offset_size::_4, primitive::no, input_size::_16> { @@ -280,7 +280,7 @@ struct sm80_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm80_tuning<__int128_t, flagged::yes, keep_rejects::yes, offset_size::_4, primitive::no, input_size::_16> { @@ -336,7 +336,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm90_tuning<__int128_t, flagged::no, keep_rejects::no, offset_size::_4, primitive::no, input_size::_16> { @@ -389,7 +389,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm90_tuning<__int128_t, flagged::yes, keep_rejects::no, offset_size::_4, primitive::no, input_size::_16> { @@ -442,7 +442,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm90_tuning<__int128_t, flagged::no, keep_rejects::yes, offset_size::_4, primitive::no, input_size::_16> { @@ -495,7 +495,7 @@ struct sm90_tuning; }; -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() template <> struct sm90_tuning<__int128_t, flagged::yes, keep_rejects::yes, offset_size::_4, primitive::no, input_size::_16> { diff --git a/cub/cub/util_ptx.cuh b/cub/cub/util_ptx.cuh index 99beeed313e..e6bb45c4a31 100644 --- a/cub/cub/util_ptx.cuh +++ b/cub/cub/util_ptx.cuh @@ -99,7 +99,7 @@ BFE(UnsignedBits source, unsigned int bit_start, unsigned int num_bits, Int2Type return (source >> bit_start) & MASK; } -# if CUB_IS_INT128_ENABLED +# if _CCCL_HAS_INT128() /** * Bitfield-extract for 128-bit types. */ diff --git a/cub/cub/util_type.cuh b/cub/cub/util_type.cuh index 4d1db99a821..4f93b694de3 100644 --- a/cub/cub/util_type.cuh +++ b/cub/cub/util_type.cuh @@ -76,17 +76,8 @@ _CCCL_DIAG_POP CUB_NAMESPACE_BEGIN #ifndef CUB_IS_INT128_ENABLED -# if defined(__CUDACC_RTC__) -# if defined(__CUDACC_RTC_INT128__) -# define CUB_IS_INT128_ENABLED 1 -# endif // !defined(__CUDACC_RTC_INT128__) -# else // !defined(__CUDACC_RTC__) -# if _CCCL_CUDACC_AT_LEAST(11, 5) -# if _CCCL_COMPILER(GCC) || _CCCL_COMPILER(CLANG) || _CCCL_COMPILER(NVHPC) -# define CUB_IS_INT128_ENABLED 1 -# endif // GCC || CLANG || NVHPC -# endif // _CCCL_CUDACC_AT_LEAST(11, 5) -# endif // !defined(__CUDACC_RTC__) +# define CUB_IS_INT128_ENABLED \ + LIBCUDACXX_COMP_DEPR_IMPL(CUB_IS_INT128_ENABLED is deprecated in favor of _CCCL_HAS_INT128()) _CCCL_HAS_INT128() #endif // !defined(CUB_IS_INT128_ENABLED) /****************************************************************************** diff --git a/cub/test/catch2_test_device_for_each_in_extents.cu b/cub/test/catch2_test_device_for_each_in_extents.cu index 3e5a6c6689a..313b9e58b38 100644 --- a/cub/test/catch2_test_device_for_each_in_extents.cu +++ b/cub/test/catch2_test_device_for_each_in_extents.cu @@ -107,7 +107,7 @@ using index_types = uint16_t, int32_t, uint32_t -# if CUB_IS_INT128_ENABLED +# if _CCCL_HAS_INT128() , int64_t, uint64_t @@ -120,7 +120,7 @@ using index_types_dynamic = uint16_t, int32_t, uint32_t -# if CUB_IS_INT128_ENABLED +# if _CCCL_HAS_INT128() , int64_t, uint64_t diff --git a/cub/test/catch2_test_printing.cu b/cub/test/catch2_test_printing.cu index 6f93515114a..63b622f3554 100644 --- a/cub/test/catch2_test_printing.cu +++ b/cub/test/catch2_test_printing.cu @@ -11,7 +11,7 @@ std::string print(T val) return ss.str(); } -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() TEST_CASE("Test utils can print __int128", "[test][utils]") { REQUIRE(print(__int128_t{0}) == "0"); diff --git a/cub/test/internal/catch2_test_fast_div_mod.cu b/cub/test/internal/catch2_test_fast_div_mod.cu index 8a1a3e96a27..ec3b5e20d68 100644 --- a/cub/test/internal/catch2_test_fast_div_mod.cu +++ b/cub/test/internal/catch2_test_fast_div_mod.cu @@ -42,7 +42,7 @@ using index_types = uint16_t, int32_t, uint32_t -# if CUB_IS_INT128_ENABLED +# if _CCCL_HAS_INT128() , int64_t, uint64_t diff --git a/cub/test/test_util.h b/cub/test/test_util.h index c06d803ecb1..ac472cba693 100644 --- a/cub/test/test_util.h +++ b/cub/test/test_util.h @@ -716,7 +716,7 @@ std::ostream& operator<<(std::ostream& os, const CUB_NS_QUALIFIER::KeyValuePair< return os; } -#if CUB_IS_INT128_ENABLED +#if _CCCL_HAS_INT128() inline std::ostream& operator<<(std::ostream& os, __uint128_t val) { constexpr int max_digits = 40; From b9c6299c613a9f36859428c8536e6e77d4f6118f Mon Sep 17 00:00:00 2001 From: Federico Busato <50413820+fbusato@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:21:46 -0800 Subject: [PATCH 2/3] Update cub/cub/util_type.cuh Co-authored-by: Bernhard Manfred Gruber --- cub/cub/util_type.cuh | 1 + 1 file changed, 1 insertion(+) diff --git a/cub/cub/util_type.cuh b/cub/cub/util_type.cuh index 4f93b694de3..5e27dffebd2 100644 --- a/cub/cub/util_type.cuh +++ b/cub/cub/util_type.cuh @@ -76,6 +76,7 @@ _CCCL_DIAG_POP CUB_NAMESPACE_BEGIN #ifndef CUB_IS_INT128_ENABLED +// Deprecated [Since 2.8] # define CUB_IS_INT128_ENABLED \ LIBCUDACXX_COMP_DEPR_IMPL(CUB_IS_INT128_ENABLED is deprecated in favor of _CCCL_HAS_INT128()) _CCCL_HAS_INT128() #endif // !defined(CUB_IS_INT128_ENABLED) From b3827a80d4f6f78096ff0e32d3ee064d36d022d8 Mon Sep 17 00:00:00 2001 From: fbusato Date: Wed, 29 Jan 2025 12:54:10 -0800 Subject: [PATCH 3/3] remove pragma warning message (does not compile) --- cub/cub/util_type.cuh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cub/cub/util_type.cuh b/cub/cub/util_type.cuh index 5e27dffebd2..a89cd159309 100644 --- a/cub/cub/util_type.cuh +++ b/cub/cub/util_type.cuh @@ -77,8 +77,7 @@ CUB_NAMESPACE_BEGIN #ifndef CUB_IS_INT128_ENABLED // Deprecated [Since 2.8] -# define CUB_IS_INT128_ENABLED \ - LIBCUDACXX_COMP_DEPR_IMPL(CUB_IS_INT128_ENABLED is deprecated in favor of _CCCL_HAS_INT128()) _CCCL_HAS_INT128() +# define CUB_IS_INT128_ENABLED _CCCL_HAS_INT128() #endif // !defined(CUB_IS_INT128_ENABLED) /******************************************************************************