Author: Artem Belevich
Date: 2026-03-10T12:52:46-07:00
New Revision: ab048ac6c0339c631ea4a1064b675318867a3853

URL: 
https://github.com/llvm/llvm-project/commit/ab048ac6c0339c631ea4a1064b675318867a3853
DIFF: 
https://github.com/llvm/llvm-project/commit/ab048ac6c0339c631ea4a1064b675318867a3853.diff

LOG: [clang][CUDA] Define _NV_RSQRT_SPECIFIER for glibc-2.42/cuda-13.2 
compatibility (#185701)

CUDA-13.2 defines _NV_RSQRT_SPECIFIER to make its headers compileable
with glibc 2.42+. However, clang does not include the header that
defines the macro, and has to define it by itself.

Added: 
    

Modified: 
    clang/lib/Headers/__clang_cuda_runtime_wrapper.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/__clang_cuda_runtime_wrapper.h 
b/clang/lib/Headers/__clang_cuda_runtime_wrapper.h
index fcf1ea89ad6a3..295f4191f9927 100644
--- a/clang/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ b/clang/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -45,6 +45,18 @@
 #include <string.h>
 #undef __CUDACC__
 
+// math_functions.h from CUDA 13.2+ defines _NV_RSQRT_SPECIFIER.
+// Clang does not include it, so we need to define it ourselves.
+#if defined(__GNUC__) && defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 42)
+#define _NV_RSQRT_SPECIFIER noexcept(true)
+#endif
+#endif
+
+#ifndef _NV_RSQRT_SPECIFIER
+#define _NV_RSQRT_SPECIFIER
+#endif
+
 // Preserve common macros that will be changed below by us or by CUDA
 // headers.
 #pragma push_macro("__THROW")


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to