diff options
author | mikhnenko <[email protected]> | 2025-08-27 10:33:29 +0300 |
---|---|---|
committer | mikhnenko <[email protected]> | 2025-08-27 10:59:58 +0300 |
commit | 1462fc75b21e6ae4e2029e95fbc1df56af3b355d (patch) | |
tree | 7f60a900de99f9f038642646887da16d96f675c8 | |
parent | 9edf85d8840072bbd1089c51f39f54109bb7a104 (diff) |
clang20: Hide built-in functions for abseil to support clang20+cuda
commit_hash:602831c302dc4117f164efc02ff8636bb417c064
3 files changed, 15 insertions, 13 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda-10.patch b/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda-10.patch deleted file mode 100644 index c8569085bd7..00000000000 --- a/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda-10.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/y_absl/types/compare.h (index) -+++ b/y_absl/types/compare.h (working tree) -@@ -69,7 +69,7 @@ using value_type = int8_t; - - class OnlyLiteralZero { - public: --#if Y_ABSL_HAVE_ATTRIBUTE(enable_if) -+#if Y_ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__CUDACC__) - // On clang, we can avoid triggering modernize-use-nullptr by only enabling - // this overload when the value is a compile time integer constant equal to 0. - // diff --git a/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda.sh b/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda.sh new file mode 100644 index 00000000000..40e31584435 --- /dev/null +++ b/contrib/restricted/abseil-cpp-tstring/patches/fix-cuda.sh @@ -0,0 +1,13 @@ +set -xue + +replace_has_keyword_in() +{ + sed 's/#if Y_ABSL_HAVE_'${1}'('${2}')/#if Y_ABSL_HAVE_'${1}'('${2}') \&\& !defined(__CUDACC__)/g' -i ${3} +} + +# cuda 10 support +replace_has_keyword_in ATTRIBUTE enable_if y_absl/types/compare.h + +# clang20 + cuda 12 support +replace_has_keyword_in BUILTIN __builtin_clzg y_absl/numeric/internal/bits.h +replace_has_keyword_in BUILTIN __builtin_ctzg y_absl/numeric/internal/bits.h diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h index 152b5005a3c..5dd6470a10a 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/numeric/internal/bits.h @@ -167,7 +167,7 @@ CountLeadingZeroes32(uint32_t x) { Y_ABSL_ATTRIBUTE_ALWAYS_INLINE Y_ABSL_INTERNAL_CONSTEXPR_CLZ inline int CountLeadingZeroes16(uint16_t x) { -#if Y_ABSL_HAVE_BUILTIN(__builtin_clzg) +#if Y_ABSL_HAVE_BUILTIN(__builtin_clzg) && !defined(__CUDACC__) return x == 0 ? 16 : __builtin_clzg(x); #elif Y_ABSL_HAVE_BUILTIN(__builtin_clzs) static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int) @@ -305,7 +305,7 @@ CountTrailingZeroesNonzero64(uint64_t x) { Y_ABSL_ATTRIBUTE_ALWAYS_INLINE Y_ABSL_INTERNAL_CONSTEXPR_CTZ inline int CountTrailingZeroesNonzero16(uint16_t x) { -#if Y_ABSL_HAVE_BUILTIN(__builtin_ctzg) +#if Y_ABSL_HAVE_BUILTIN(__builtin_ctzg) && !defined(__CUDACC__) return __builtin_ctzg(x); #elif Y_ABSL_HAVE_BUILTIN(__builtin_ctzs) static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int) |