10 #ifndef __CUDA_BUILTIN_VARS_H
11 #define __CUDA_BUILTIN_VARS_H
30 #define __CUDA_DEVICE_BUILTIN(FIELD, INTRINSIC) \
31 __declspec(property(get = __fetch_builtin_##FIELD)) unsigned int FIELD; \
32 static inline __attribute__((always_inline)) \
33 __attribute__((device)) unsigned int __fetch_builtin_##FIELD(void) { \
37 #if __cplusplus >= 201103L
38 #define __DELETE =delete
46 #define __CUDA_DISALLOW_BUILTINVAR_ACCESS(TypeName) \
47 __attribute__((device)) TypeName() __DELETE; \
48 __attribute__((device)) TypeName(const TypeName &) __DELETE; \
49 __attribute__((device)) void operator=(const TypeName &) const __DELETE; \
50 __attribute__((device)) TypeName *operator&() const __DELETE
96 #define __CUDA_BUILTIN_VAR \
97 extern const __attribute__((device)) __attribute__((weak))
108 #undef __CUDA_DEVICE_BUILTIN
109 #undef __CUDA_BUILTIN_VAR
110 #undef __CUDA_DISALLOW_BUILTINVAR_ACCESS
__CUDA_BUILTIN_VAR __cuda_builtin_blockDim_t blockDim
__CUDA_BUILTIN_VAR __cuda_builtin_gridDim_t gridDim
__CUDA_BUILTIN_VAR __cuda_builtin_blockIdx_t blockIdx
#define __CUDA_BUILTIN_VAR
__CUDA_BUILTIN_VAR __cuda_builtin_threadIdx_t threadIdx
__attribute__((device)) const int warpSize
__attribute__((device)) operator dim3() const
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockDim_t)
__CUDA_DEVICE_BUILTIN(z, __nvvm_read_ptx_sreg_ntid_z())
__CUDA_DEVICE_BUILTIN(y, __nvvm_read_ptx_sreg_ntid_y())
__CUDA_DEVICE_BUILTIN(x, __nvvm_read_ptx_sreg_ntid_x())
__attribute__((device)) operator uint3() const
__CUDA_DEVICE_BUILTIN(y, __nvvm_read_ptx_sreg_ctaid_y())
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockIdx_t)
__CUDA_DEVICE_BUILTIN(z, __nvvm_read_ptx_sreg_ctaid_z())
__CUDA_DEVICE_BUILTIN(x, __nvvm_read_ptx_sreg_ctaid_x())
__CUDA_DEVICE_BUILTIN(y, __nvvm_read_ptx_sreg_nctaid_y())
__attribute__((device)) operator dim3() const
__CUDA_DEVICE_BUILTIN(x, __nvvm_read_ptx_sreg_nctaid_x())
__CUDA_DEVICE_BUILTIN(z, __nvvm_read_ptx_sreg_nctaid_z())
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_gridDim_t)
__CUDA_DEVICE_BUILTIN(y, __nvvm_read_ptx_sreg_tid_y())
__CUDA_DEVICE_BUILTIN(x, __nvvm_read_ptx_sreg_tid_x())
__attribute__((device)) operator uint3() const
__CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_threadIdx_t)
__CUDA_DEVICE_BUILTIN(z, __nvvm_read_ptx_sreg_tid_z())