================
@@ -61,11 +61,16 @@ __GPU_COORD_BUILTIN(__gpu_builtin_gridDim_t, 
__gpu_num_blocks_x(),
 #pragma pop_macro("__GPU_COORD_BUILTIN")
 #pragma pop_macro("__GPU_DISALLOW_BUILTINVAR_ACCESS")
 
-static inline const
-    __attribute__((device)) __gpu_builtin_threadIdx_t threadIdx{};
-static inline const __attribute__((device)) __gpu_builtin_blockIdx_t 
blockIdx{};
-static inline const __attribute__((device)) __gpu_builtin_blockDim_t 
blockDim{};
-static inline const __attribute__((device)) __gpu_builtin_gridDim_t gridDim{};
+#pragma push_macro("__GPU_BUILTIN_VAR")
+#define __GPU_BUILTIN_VAR                                                      
\
+  extern const __attribute__((device)) __attribute__((weak))
+
+__GPU_BUILTIN_VAR __gpu_builtin_threadIdx_t threadIdx;
----------------
jhuber6 wrote:

`extern const` is different from normal `extern`, they are defined but get a 
linkable symbol.

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

Reply via email to