1 /*===---- __clang_cuda_device_functions.h - CUDA runtime support -----------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10 #ifndef __CLANG_CUDA_DEVICE_FUNCTIONS_H__
11 #define __CLANG_CUDA_DEVICE_FUNCTIONS_H__
12
13 #ifndef __OPENMP_NVPTX__
14 #if CUDA_VERSION < 9000
15 #error This file is intended to be used with CUDA-9+ only.
16 #endif
17 #endif
18
19 // __DEVICE__ is a helper macro with common set of attributes for the wrappers
20 // we implement in this file. We need static in order to avoid emitting unused
21 // functions and __forceinline__ helps inlining these wrappers at -O1.
22 #pragma push_macro("__DEVICE__")
23 #ifdef __OPENMP_NVPTX__
24 #define __DEVICE__ static __attribute__((always_inline, nothrow))
25 #else
26 #define __DEVICE__ static __device__ __forceinline__
27 #endif
28
__all(int __a)29 __DEVICE__ int __all(int __a) { return __nvvm_vote_all(__a); }
__any(int __a)30 __DEVICE__ int __any(int __a) { return __nvvm_vote_any(__a); }
__ballot(int __a)31 __DEVICE__ unsigned int __ballot(int __a) { return __nvvm_vote_ballot(__a); }
__brev(unsigned int __a)32 __DEVICE__ unsigned int __brev(unsigned int __a) { return __nv_brev(__a); }
__brevll(unsigned long long __a)33 __DEVICE__ unsigned long long __brevll(unsigned long long __a) {
34 return __nv_brevll(__a);
35 }
36 #if defined(__cplusplus)
__brkpt()37 __DEVICE__ void __brkpt() { __asm__ __volatile__("brkpt;"); }
__brkpt(int __a)38 __DEVICE__ void __brkpt(int __a) { __brkpt(); }
39 #else
__brkpt(void)40 __DEVICE__ void __attribute__((overloadable)) __brkpt(void) {
41 __asm__ __volatile__("brkpt;");
42 }
__brkpt(int __a)43 __DEVICE__ void __attribute__((overloadable)) __brkpt(int __a) { __brkpt(); }
44 #endif
__byte_perm(unsigned int __a,unsigned int __b,unsigned int __c)45 __DEVICE__ unsigned int __byte_perm(unsigned int __a, unsigned int __b,
46 unsigned int __c) {
47 return __nv_byte_perm(__a, __b, __c);
48 }
__clz(int __a)49 __DEVICE__ int __clz(int __a) { return __nv_clz(__a); }
__clzll(long long __a)50 __DEVICE__ int __clzll(long long __a) { return __nv_clzll(__a); }
__cosf(float __a)51 __DEVICE__ float __cosf(float __a) { return __nv_fast_cosf(__a); }
__dAtomicAdd(double * __p,double __v)52 __DEVICE__ double __dAtomicAdd(double *__p, double __v) {
53 return __nvvm_atom_add_gen_d(__p, __v);
54 }
__dAtomicAdd_block(double * __p,double __v)55 __DEVICE__ double __dAtomicAdd_block(double *__p, double __v) {
56 return __nvvm_atom_cta_add_gen_d(__p, __v);
57 }
__dAtomicAdd_system(double * __p,double __v)58 __DEVICE__ double __dAtomicAdd_system(double *__p, double __v) {
59 return __nvvm_atom_sys_add_gen_d(__p, __v);
60 }
__dadd_rd(double __a,double __b)61 __DEVICE__ double __dadd_rd(double __a, double __b) {
62 return __nv_dadd_rd(__a, __b);
63 }
__dadd_rn(double __a,double __b)64 __DEVICE__ double __dadd_rn(double __a, double __b) {
65 return __nv_dadd_rn(__a, __b);
66 }
__dadd_ru(double __a,double __b)67 __DEVICE__ double __dadd_ru(double __a, double __b) {
68 return __nv_dadd_ru(__a, __b);
69 }
__dadd_rz(double __a,double __b)70 __DEVICE__ double __dadd_rz(double __a, double __b) {
71 return __nv_dadd_rz(__a, __b);
72 }
__ddiv_rd(double __a,double __b)73 __DEVICE__ double __ddiv_rd(double __a, double __b) {
74 return __nv_ddiv_rd(__a, __b);
75 }
__ddiv_rn(double __a,double __b)76 __DEVICE__ double __ddiv_rn(double __a, double __b) {
77 return __nv_ddiv_rn(__a, __b);
78 }
__ddiv_ru(double __a,double __b)79 __DEVICE__ double __ddiv_ru(double __a, double __b) {
80 return __nv_ddiv_ru(__a, __b);
81 }
__ddiv_rz(double __a,double __b)82 __DEVICE__ double __ddiv_rz(double __a, double __b) {
83 return __nv_ddiv_rz(__a, __b);
84 }
__dmul_rd(double __a,double __b)85 __DEVICE__ double __dmul_rd(double __a, double __b) {
86 return __nv_dmul_rd(__a, __b);
87 }
__dmul_rn(double __a,double __b)88 __DEVICE__ double __dmul_rn(double __a, double __b) {
89 return __nv_dmul_rn(__a, __b);
90 }
__dmul_ru(double __a,double __b)91 __DEVICE__ double __dmul_ru(double __a, double __b) {
92 return __nv_dmul_ru(__a, __b);
93 }
__dmul_rz(double __a,double __b)94 __DEVICE__ double __dmul_rz(double __a, double __b) {
95 return __nv_dmul_rz(__a, __b);
96 }
__double2float_rd(double __a)97 __DEVICE__ float __double2float_rd(double __a) {
98 return __nv_double2float_rd(__a);
99 }
__double2float_rn(double __a)100 __DEVICE__ float __double2float_rn(double __a) {
101 return __nv_double2float_rn(__a);
102 }
__double2float_ru(double __a)103 __DEVICE__ float __double2float_ru(double __a) {
104 return __nv_double2float_ru(__a);
105 }
__double2float_rz(double __a)106 __DEVICE__ float __double2float_rz(double __a) {
107 return __nv_double2float_rz(__a);
108 }
__double2hiint(double __a)109 __DEVICE__ int __double2hiint(double __a) { return __nv_double2hiint(__a); }
__double2int_rd(double __a)110 __DEVICE__ int __double2int_rd(double __a) { return __nv_double2int_rd(__a); }
__double2int_rn(double __a)111 __DEVICE__ int __double2int_rn(double __a) { return __nv_double2int_rn(__a); }
__double2int_ru(double __a)112 __DEVICE__ int __double2int_ru(double __a) { return __nv_double2int_ru(__a); }
__double2int_rz(double __a)113 __DEVICE__ int __double2int_rz(double __a) { return __nv_double2int_rz(__a); }
__double2ll_rd(double __a)114 __DEVICE__ long long __double2ll_rd(double __a) {
115 return __nv_double2ll_rd(__a);
116 }
__double2ll_rn(double __a)117 __DEVICE__ long long __double2ll_rn(double __a) {
118 return __nv_double2ll_rn(__a);
119 }
__double2ll_ru(double __a)120 __DEVICE__ long long __double2ll_ru(double __a) {
121 return __nv_double2ll_ru(__a);
122 }
__double2ll_rz(double __a)123 __DEVICE__ long long __double2ll_rz(double __a) {
124 return __nv_double2ll_rz(__a);
125 }
__double2loint(double __a)126 __DEVICE__ int __double2loint(double __a) { return __nv_double2loint(__a); }
__double2uint_rd(double __a)127 __DEVICE__ unsigned int __double2uint_rd(double __a) {
128 return __nv_double2uint_rd(__a);
129 }
__double2uint_rn(double __a)130 __DEVICE__ unsigned int __double2uint_rn(double __a) {
131 return __nv_double2uint_rn(__a);
132 }
__double2uint_ru(double __a)133 __DEVICE__ unsigned int __double2uint_ru(double __a) {
134 return __nv_double2uint_ru(__a);
135 }
__double2uint_rz(double __a)136 __DEVICE__ unsigned int __double2uint_rz(double __a) {
137 return __nv_double2uint_rz(__a);
138 }
__double2ull_rd(double __a)139 __DEVICE__ unsigned long long __double2ull_rd(double __a) {
140 return __nv_double2ull_rd(__a);
141 }
__double2ull_rn(double __a)142 __DEVICE__ unsigned long long __double2ull_rn(double __a) {
143 return __nv_double2ull_rn(__a);
144 }
__double2ull_ru(double __a)145 __DEVICE__ unsigned long long __double2ull_ru(double __a) {
146 return __nv_double2ull_ru(__a);
147 }
__double2ull_rz(double __a)148 __DEVICE__ unsigned long long __double2ull_rz(double __a) {
149 return __nv_double2ull_rz(__a);
150 }
__double_as_longlong(double __a)151 __DEVICE__ long long __double_as_longlong(double __a) {
152 return __nv_double_as_longlong(__a);
153 }
__drcp_rd(double __a)154 __DEVICE__ double __drcp_rd(double __a) { return __nv_drcp_rd(__a); }
__drcp_rn(double __a)155 __DEVICE__ double __drcp_rn(double __a) { return __nv_drcp_rn(__a); }
__drcp_ru(double __a)156 __DEVICE__ double __drcp_ru(double __a) { return __nv_drcp_ru(__a); }
__drcp_rz(double __a)157 __DEVICE__ double __drcp_rz(double __a) { return __nv_drcp_rz(__a); }
__dsqrt_rd(double __a)158 __DEVICE__ double __dsqrt_rd(double __a) { return __nv_dsqrt_rd(__a); }
__dsqrt_rn(double __a)159 __DEVICE__ double __dsqrt_rn(double __a) { return __nv_dsqrt_rn(__a); }
__dsqrt_ru(double __a)160 __DEVICE__ double __dsqrt_ru(double __a) { return __nv_dsqrt_ru(__a); }
__dsqrt_rz(double __a)161 __DEVICE__ double __dsqrt_rz(double __a) { return __nv_dsqrt_rz(__a); }
__dsub_rd(double __a,double __b)162 __DEVICE__ double __dsub_rd(double __a, double __b) {
163 return __nv_dsub_rd(__a, __b);
164 }
__dsub_rn(double __a,double __b)165 __DEVICE__ double __dsub_rn(double __a, double __b) {
166 return __nv_dsub_rn(__a, __b);
167 }
__dsub_ru(double __a,double __b)168 __DEVICE__ double __dsub_ru(double __a, double __b) {
169 return __nv_dsub_ru(__a, __b);
170 }
__dsub_rz(double __a,double __b)171 __DEVICE__ double __dsub_rz(double __a, double __b) {
172 return __nv_dsub_rz(__a, __b);
173 }
__exp10f(float __a)174 __DEVICE__ float __exp10f(float __a) { return __nv_fast_exp10f(__a); }
__expf(float __a)175 __DEVICE__ float __expf(float __a) { return __nv_fast_expf(__a); }
__fAtomicAdd(float * __p,float __v)176 __DEVICE__ float __fAtomicAdd(float *__p, float __v) {
177 return __nvvm_atom_add_gen_f(__p, __v);
178 }
__fAtomicAdd_block(float * __p,float __v)179 __DEVICE__ float __fAtomicAdd_block(float *__p, float __v) {
180 return __nvvm_atom_cta_add_gen_f(__p, __v);
181 }
__fAtomicAdd_system(float * __p,float __v)182 __DEVICE__ float __fAtomicAdd_system(float *__p, float __v) {
183 return __nvvm_atom_sys_add_gen_f(__p, __v);
184 }
__fAtomicExch(float * __p,float __v)185 __DEVICE__ float __fAtomicExch(float *__p, float __v) {
186 return __nv_int_as_float(
187 __nvvm_atom_xchg_gen_i((int *)__p, __nv_float_as_int(__v)));
188 }
__fAtomicExch_block(float * __p,float __v)189 __DEVICE__ float __fAtomicExch_block(float *__p, float __v) {
190 return __nv_int_as_float(
191 __nvvm_atom_cta_xchg_gen_i((int *)__p, __nv_float_as_int(__v)));
192 }
__fAtomicExch_system(float * __p,float __v)193 __DEVICE__ float __fAtomicExch_system(float *__p, float __v) {
194 return __nv_int_as_float(
195 __nvvm_atom_sys_xchg_gen_i((int *)__p, __nv_float_as_int(__v)));
196 }
__fadd_rd(float __a,float __b)197 __DEVICE__ float __fadd_rd(float __a, float __b) {
198 return __nv_fadd_rd(__a, __b);
199 }
__fadd_rn(float __a,float __b)200 __DEVICE__ float __fadd_rn(float __a, float __b) {
201 return __nv_fadd_rn(__a, __b);
202 }
__fadd_ru(float __a,float __b)203 __DEVICE__ float __fadd_ru(float __a, float __b) {
204 return __nv_fadd_ru(__a, __b);
205 }
__fadd_rz(float __a,float __b)206 __DEVICE__ float __fadd_rz(float __a, float __b) {
207 return __nv_fadd_rz(__a, __b);
208 }
__fdiv_rd(float __a,float __b)209 __DEVICE__ float __fdiv_rd(float __a, float __b) {
210 return __nv_fdiv_rd(__a, __b);
211 }
__fdiv_rn(float __a,float __b)212 __DEVICE__ float __fdiv_rn(float __a, float __b) {
213 return __nv_fdiv_rn(__a, __b);
214 }
__fdiv_ru(float __a,float __b)215 __DEVICE__ float __fdiv_ru(float __a, float __b) {
216 return __nv_fdiv_ru(__a, __b);
217 }
__fdiv_rz(float __a,float __b)218 __DEVICE__ float __fdiv_rz(float __a, float __b) {
219 return __nv_fdiv_rz(__a, __b);
220 }
__fdividef(float __a,float __b)221 __DEVICE__ float __fdividef(float __a, float __b) {
222 return __nv_fast_fdividef(__a, __b);
223 }
__ffs(int __a)224 __DEVICE__ int __ffs(int __a) { return __nv_ffs(__a); }
__ffsll(long long __a)225 __DEVICE__ int __ffsll(long long __a) { return __nv_ffsll(__a); }
__finite(double __a)226 __DEVICE__ int __finite(double __a) { return __nv_isfinited(__a); }
__finitef(float __a)227 __DEVICE__ int __finitef(float __a) { return __nv_finitef(__a); }
228 #ifdef _MSC_VER
229 __DEVICE__ int __finitel(long double __a);
230 #endif
__float2int_rd(float __a)231 __DEVICE__ int __float2int_rd(float __a) { return __nv_float2int_rd(__a); }
__float2int_rn(float __a)232 __DEVICE__ int __float2int_rn(float __a) { return __nv_float2int_rn(__a); }
__float2int_ru(float __a)233 __DEVICE__ int __float2int_ru(float __a) { return __nv_float2int_ru(__a); }
__float2int_rz(float __a)234 __DEVICE__ int __float2int_rz(float __a) { return __nv_float2int_rz(__a); }
__float2ll_rd(float __a)235 __DEVICE__ long long __float2ll_rd(float __a) { return __nv_float2ll_rd(__a); }
__float2ll_rn(float __a)236 __DEVICE__ long long __float2ll_rn(float __a) { return __nv_float2ll_rn(__a); }
__float2ll_ru(float __a)237 __DEVICE__ long long __float2ll_ru(float __a) { return __nv_float2ll_ru(__a); }
__float2ll_rz(float __a)238 __DEVICE__ long long __float2ll_rz(float __a) { return __nv_float2ll_rz(__a); }
__float2uint_rd(float __a)239 __DEVICE__ unsigned int __float2uint_rd(float __a) {
240 return __nv_float2uint_rd(__a);
241 }
__float2uint_rn(float __a)242 __DEVICE__ unsigned int __float2uint_rn(float __a) {
243 return __nv_float2uint_rn(__a);
244 }
__float2uint_ru(float __a)245 __DEVICE__ unsigned int __float2uint_ru(float __a) {
246 return __nv_float2uint_ru(__a);
247 }
__float2uint_rz(float __a)248 __DEVICE__ unsigned int __float2uint_rz(float __a) {
249 return __nv_float2uint_rz(__a);
250 }
__float2ull_rd(float __a)251 __DEVICE__ unsigned long long __float2ull_rd(float __a) {
252 return __nv_float2ull_rd(__a);
253 }
__float2ull_rn(float __a)254 __DEVICE__ unsigned long long __float2ull_rn(float __a) {
255 return __nv_float2ull_rn(__a);
256 }
__float2ull_ru(float __a)257 __DEVICE__ unsigned long long __float2ull_ru(float __a) {
258 return __nv_float2ull_ru(__a);
259 }
__float2ull_rz(float __a)260 __DEVICE__ unsigned long long __float2ull_rz(float __a) {
261 return __nv_float2ull_rz(__a);
262 }
__float_as_int(float __a)263 __DEVICE__ int __float_as_int(float __a) { return __nv_float_as_int(__a); }
__float_as_uint(float __a)264 __DEVICE__ unsigned int __float_as_uint(float __a) {
265 return __nv_float_as_uint(__a);
266 }
__fma_rd(double __a,double __b,double __c)267 __DEVICE__ double __fma_rd(double __a, double __b, double __c) {
268 return __nv_fma_rd(__a, __b, __c);
269 }
__fma_rn(double __a,double __b,double __c)270 __DEVICE__ double __fma_rn(double __a, double __b, double __c) {
271 return __nv_fma_rn(__a, __b, __c);
272 }
__fma_ru(double __a,double __b,double __c)273 __DEVICE__ double __fma_ru(double __a, double __b, double __c) {
274 return __nv_fma_ru(__a, __b, __c);
275 }
__fma_rz(double __a,double __b,double __c)276 __DEVICE__ double __fma_rz(double __a, double __b, double __c) {
277 return __nv_fma_rz(__a, __b, __c);
278 }
__fmaf_ieee_rd(float __a,float __b,float __c)279 __DEVICE__ float __fmaf_ieee_rd(float __a, float __b, float __c) {
280 return __nv_fmaf_ieee_rd(__a, __b, __c);
281 }
__fmaf_ieee_rn(float __a,float __b,float __c)282 __DEVICE__ float __fmaf_ieee_rn(float __a, float __b, float __c) {
283 return __nv_fmaf_ieee_rn(__a, __b, __c);
284 }
__fmaf_ieee_ru(float __a,float __b,float __c)285 __DEVICE__ float __fmaf_ieee_ru(float __a, float __b, float __c) {
286 return __nv_fmaf_ieee_ru(__a, __b, __c);
287 }
__fmaf_ieee_rz(float __a,float __b,float __c)288 __DEVICE__ float __fmaf_ieee_rz(float __a, float __b, float __c) {
289 return __nv_fmaf_ieee_rz(__a, __b, __c);
290 }
__fmaf_rd(float __a,float __b,float __c)291 __DEVICE__ float __fmaf_rd(float __a, float __b, float __c) {
292 return __nv_fmaf_rd(__a, __b, __c);
293 }
__fmaf_rn(float __a,float __b,float __c)294 __DEVICE__ float __fmaf_rn(float __a, float __b, float __c) {
295 return __nv_fmaf_rn(__a, __b, __c);
296 }
__fmaf_ru(float __a,float __b,float __c)297 __DEVICE__ float __fmaf_ru(float __a, float __b, float __c) {
298 return __nv_fmaf_ru(__a, __b, __c);
299 }
__fmaf_rz(float __a,float __b,float __c)300 __DEVICE__ float __fmaf_rz(float __a, float __b, float __c) {
301 return __nv_fmaf_rz(__a, __b, __c);
302 }
__fmul_rd(float __a,float __b)303 __DEVICE__ float __fmul_rd(float __a, float __b) {
304 return __nv_fmul_rd(__a, __b);
305 }
__fmul_rn(float __a,float __b)306 __DEVICE__ float __fmul_rn(float __a, float __b) {
307 return __nv_fmul_rn(__a, __b);
308 }
__fmul_ru(float __a,float __b)309 __DEVICE__ float __fmul_ru(float __a, float __b) {
310 return __nv_fmul_ru(__a, __b);
311 }
__fmul_rz(float __a,float __b)312 __DEVICE__ float __fmul_rz(float __a, float __b) {
313 return __nv_fmul_rz(__a, __b);
314 }
__frcp_rd(float __a)315 __DEVICE__ float __frcp_rd(float __a) { return __nv_frcp_rd(__a); }
__frcp_rn(float __a)316 __DEVICE__ float __frcp_rn(float __a) { return __nv_frcp_rn(__a); }
__frcp_ru(float __a)317 __DEVICE__ float __frcp_ru(float __a) { return __nv_frcp_ru(__a); }
__frcp_rz(float __a)318 __DEVICE__ float __frcp_rz(float __a) { return __nv_frcp_rz(__a); }
__frsqrt_rn(float __a)319 __DEVICE__ float __frsqrt_rn(float __a) { return __nv_frsqrt_rn(__a); }
__fsqrt_rd(float __a)320 __DEVICE__ float __fsqrt_rd(float __a) { return __nv_fsqrt_rd(__a); }
__fsqrt_rn(float __a)321 __DEVICE__ float __fsqrt_rn(float __a) { return __nv_fsqrt_rn(__a); }
__fsqrt_ru(float __a)322 __DEVICE__ float __fsqrt_ru(float __a) { return __nv_fsqrt_ru(__a); }
__fsqrt_rz(float __a)323 __DEVICE__ float __fsqrt_rz(float __a) { return __nv_fsqrt_rz(__a); }
__fsub_rd(float __a,float __b)324 __DEVICE__ float __fsub_rd(float __a, float __b) {
325 return __nv_fsub_rd(__a, __b);
326 }
__fsub_rn(float __a,float __b)327 __DEVICE__ float __fsub_rn(float __a, float __b) {
328 return __nv_fsub_rn(__a, __b);
329 }
__fsub_ru(float __a,float __b)330 __DEVICE__ float __fsub_ru(float __a, float __b) {
331 return __nv_fsub_ru(__a, __b);
332 }
__fsub_rz(float __a,float __b)333 __DEVICE__ float __fsub_rz(float __a, float __b) {
334 return __nv_fsub_rz(__a, __b);
335 }
__hadd(int __a,int __b)336 __DEVICE__ int __hadd(int __a, int __b) { return __nv_hadd(__a, __b); }
__hiloint2double(int __a,int __b)337 __DEVICE__ double __hiloint2double(int __a, int __b) {
338 return __nv_hiloint2double(__a, __b);
339 }
__iAtomicAdd(int * __p,int __v)340 __DEVICE__ int __iAtomicAdd(int *__p, int __v) {
341 return __nvvm_atom_add_gen_i(__p, __v);
342 }
__iAtomicAdd_block(int * __p,int __v)343 __DEVICE__ int __iAtomicAdd_block(int *__p, int __v) {
344 return __nvvm_atom_cta_add_gen_i(__p, __v);
345 }
__iAtomicAdd_system(int * __p,int __v)346 __DEVICE__ int __iAtomicAdd_system(int *__p, int __v) {
347 return __nvvm_atom_sys_add_gen_i(__p, __v);
348 }
__iAtomicAnd(int * __p,int __v)349 __DEVICE__ int __iAtomicAnd(int *__p, int __v) {
350 return __nvvm_atom_and_gen_i(__p, __v);
351 }
__iAtomicAnd_block(int * __p,int __v)352 __DEVICE__ int __iAtomicAnd_block(int *__p, int __v) {
353 return __nvvm_atom_cta_and_gen_i(__p, __v);
354 }
__iAtomicAnd_system(int * __p,int __v)355 __DEVICE__ int __iAtomicAnd_system(int *__p, int __v) {
356 return __nvvm_atom_sys_and_gen_i(__p, __v);
357 }
__iAtomicCAS(int * __p,int __cmp,int __v)358 __DEVICE__ int __iAtomicCAS(int *__p, int __cmp, int __v) {
359 return __nvvm_atom_cas_gen_i(__p, __cmp, __v);
360 }
__iAtomicCAS_block(int * __p,int __cmp,int __v)361 __DEVICE__ int __iAtomicCAS_block(int *__p, int __cmp, int __v) {
362 return __nvvm_atom_cta_cas_gen_i(__p, __cmp, __v);
363 }
__iAtomicCAS_system(int * __p,int __cmp,int __v)364 __DEVICE__ int __iAtomicCAS_system(int *__p, int __cmp, int __v) {
365 return __nvvm_atom_sys_cas_gen_i(__p, __cmp, __v);
366 }
__iAtomicExch(int * __p,int __v)367 __DEVICE__ int __iAtomicExch(int *__p, int __v) {
368 return __nvvm_atom_xchg_gen_i(__p, __v);
369 }
__iAtomicExch_block(int * __p,int __v)370 __DEVICE__ int __iAtomicExch_block(int *__p, int __v) {
371 return __nvvm_atom_cta_xchg_gen_i(__p, __v);
372 }
__iAtomicExch_system(int * __p,int __v)373 __DEVICE__ int __iAtomicExch_system(int *__p, int __v) {
374 return __nvvm_atom_sys_xchg_gen_i(__p, __v);
375 }
__iAtomicMax(int * __p,int __v)376 __DEVICE__ int __iAtomicMax(int *__p, int __v) {
377 return __nvvm_atom_max_gen_i(__p, __v);
378 }
__iAtomicMax_block(int * __p,int __v)379 __DEVICE__ int __iAtomicMax_block(int *__p, int __v) {
380 return __nvvm_atom_cta_max_gen_i(__p, __v);
381 }
__iAtomicMax_system(int * __p,int __v)382 __DEVICE__ int __iAtomicMax_system(int *__p, int __v) {
383 return __nvvm_atom_sys_max_gen_i(__p, __v);
384 }
__iAtomicMin(int * __p,int __v)385 __DEVICE__ int __iAtomicMin(int *__p, int __v) {
386 return __nvvm_atom_min_gen_i(__p, __v);
387 }
__iAtomicMin_block(int * __p,int __v)388 __DEVICE__ int __iAtomicMin_block(int *__p, int __v) {
389 return __nvvm_atom_cta_min_gen_i(__p, __v);
390 }
__iAtomicMin_system(int * __p,int __v)391 __DEVICE__ int __iAtomicMin_system(int *__p, int __v) {
392 return __nvvm_atom_sys_min_gen_i(__p, __v);
393 }
__iAtomicOr(int * __p,int __v)394 __DEVICE__ int __iAtomicOr(int *__p, int __v) {
395 return __nvvm_atom_or_gen_i(__p, __v);
396 }
__iAtomicOr_block(int * __p,int __v)397 __DEVICE__ int __iAtomicOr_block(int *__p, int __v) {
398 return __nvvm_atom_cta_or_gen_i(__p, __v);
399 }
__iAtomicOr_system(int * __p,int __v)400 __DEVICE__ int __iAtomicOr_system(int *__p, int __v) {
401 return __nvvm_atom_sys_or_gen_i(__p, __v);
402 }
__iAtomicXor(int * __p,int __v)403 __DEVICE__ int __iAtomicXor(int *__p, int __v) {
404 return __nvvm_atom_xor_gen_i(__p, __v);
405 }
__iAtomicXor_block(int * __p,int __v)406 __DEVICE__ int __iAtomicXor_block(int *__p, int __v) {
407 return __nvvm_atom_cta_xor_gen_i(__p, __v);
408 }
__iAtomicXor_system(int * __p,int __v)409 __DEVICE__ int __iAtomicXor_system(int *__p, int __v) {
410 return __nvvm_atom_sys_xor_gen_i(__p, __v);
411 }
__illAtomicMax(long long * __p,long long __v)412 __DEVICE__ long long __illAtomicMax(long long *__p, long long __v) {
413 return __nvvm_atom_max_gen_ll(__p, __v);
414 }
__illAtomicMax_block(long long * __p,long long __v)415 __DEVICE__ long long __illAtomicMax_block(long long *__p, long long __v) {
416 return __nvvm_atom_cta_max_gen_ll(__p, __v);
417 }
__illAtomicMax_system(long long * __p,long long __v)418 __DEVICE__ long long __illAtomicMax_system(long long *__p, long long __v) {
419 return __nvvm_atom_sys_max_gen_ll(__p, __v);
420 }
__illAtomicMin(long long * __p,long long __v)421 __DEVICE__ long long __illAtomicMin(long long *__p, long long __v) {
422 return __nvvm_atom_min_gen_ll(__p, __v);
423 }
__illAtomicMin_block(long long * __p,long long __v)424 __DEVICE__ long long __illAtomicMin_block(long long *__p, long long __v) {
425 return __nvvm_atom_cta_min_gen_ll(__p, __v);
426 }
__illAtomicMin_system(long long * __p,long long __v)427 __DEVICE__ long long __illAtomicMin_system(long long *__p, long long __v) {
428 return __nvvm_atom_sys_min_gen_ll(__p, __v);
429 }
__int2double_rn(int __a)430 __DEVICE__ double __int2double_rn(int __a) { return __nv_int2double_rn(__a); }
__int2float_rd(int __a)431 __DEVICE__ float __int2float_rd(int __a) { return __nv_int2float_rd(__a); }
__int2float_rn(int __a)432 __DEVICE__ float __int2float_rn(int __a) { return __nv_int2float_rn(__a); }
__int2float_ru(int __a)433 __DEVICE__ float __int2float_ru(int __a) { return __nv_int2float_ru(__a); }
__int2float_rz(int __a)434 __DEVICE__ float __int2float_rz(int __a) { return __nv_int2float_rz(__a); }
__int_as_float(int __a)435 __DEVICE__ float __int_as_float(int __a) { return __nv_int_as_float(__a); }
__isfinited(double __a)436 __DEVICE__ int __isfinited(double __a) { return __nv_isfinited(__a); }
__isinf(double __a)437 __DEVICE__ int __isinf(double __a) { return __nv_isinfd(__a); }
__isinff(float __a)438 __DEVICE__ int __isinff(float __a) { return __nv_isinff(__a); }
439 #ifdef _MSC_VER
440 __DEVICE__ int __isinfl(long double __a);
441 #endif
__isnan(double __a)442 __DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); }
__isnanf(float __a)443 __DEVICE__ int __isnanf(float __a) { return __nv_isnanf(__a); }
444 #ifdef _MSC_VER
445 __DEVICE__ int __isnanl(long double __a);
446 #endif
__ll2double_rd(long long __a)447 __DEVICE__ double __ll2double_rd(long long __a) {
448 return __nv_ll2double_rd(__a);
449 }
__ll2double_rn(long long __a)450 __DEVICE__ double __ll2double_rn(long long __a) {
451 return __nv_ll2double_rn(__a);
452 }
__ll2double_ru(long long __a)453 __DEVICE__ double __ll2double_ru(long long __a) {
454 return __nv_ll2double_ru(__a);
455 }
__ll2double_rz(long long __a)456 __DEVICE__ double __ll2double_rz(long long __a) {
457 return __nv_ll2double_rz(__a);
458 }
__ll2float_rd(long long __a)459 __DEVICE__ float __ll2float_rd(long long __a) { return __nv_ll2float_rd(__a); }
__ll2float_rn(long long __a)460 __DEVICE__ float __ll2float_rn(long long __a) { return __nv_ll2float_rn(__a); }
__ll2float_ru(long long __a)461 __DEVICE__ float __ll2float_ru(long long __a) { return __nv_ll2float_ru(__a); }
__ll2float_rz(long long __a)462 __DEVICE__ float __ll2float_rz(long long __a) { return __nv_ll2float_rz(__a); }
__llAtomicAnd(long long * __p,long long __v)463 __DEVICE__ long long __llAtomicAnd(long long *__p, long long __v) {
464 return __nvvm_atom_and_gen_ll(__p, __v);
465 }
__llAtomicAnd_block(long long * __p,long long __v)466 __DEVICE__ long long __llAtomicAnd_block(long long *__p, long long __v) {
467 return __nvvm_atom_cta_and_gen_ll(__p, __v);
468 }
__llAtomicAnd_system(long long * __p,long long __v)469 __DEVICE__ long long __llAtomicAnd_system(long long *__p, long long __v) {
470 return __nvvm_atom_sys_and_gen_ll(__p, __v);
471 }
__llAtomicOr(long long * __p,long long __v)472 __DEVICE__ long long __llAtomicOr(long long *__p, long long __v) {
473 return __nvvm_atom_or_gen_ll(__p, __v);
474 }
__llAtomicOr_block(long long * __p,long long __v)475 __DEVICE__ long long __llAtomicOr_block(long long *__p, long long __v) {
476 return __nvvm_atom_cta_or_gen_ll(__p, __v);
477 }
__llAtomicOr_system(long long * __p,long long __v)478 __DEVICE__ long long __llAtomicOr_system(long long *__p, long long __v) {
479 return __nvvm_atom_sys_or_gen_ll(__p, __v);
480 }
__llAtomicXor(long long * __p,long long __v)481 __DEVICE__ long long __llAtomicXor(long long *__p, long long __v) {
482 return __nvvm_atom_xor_gen_ll(__p, __v);
483 }
__llAtomicXor_block(long long * __p,long long __v)484 __DEVICE__ long long __llAtomicXor_block(long long *__p, long long __v) {
485 return __nvvm_atom_cta_xor_gen_ll(__p, __v);
486 }
__llAtomicXor_system(long long * __p,long long __v)487 __DEVICE__ long long __llAtomicXor_system(long long *__p, long long __v) {
488 return __nvvm_atom_sys_xor_gen_ll(__p, __v);
489 }
__log10f(float __a)490 __DEVICE__ float __log10f(float __a) { return __nv_fast_log10f(__a); }
__log2f(float __a)491 __DEVICE__ float __log2f(float __a) { return __nv_fast_log2f(__a); }
__logf(float __a)492 __DEVICE__ float __logf(float __a) { return __nv_fast_logf(__a); }
__longlong_as_double(long long __a)493 __DEVICE__ double __longlong_as_double(long long __a) {
494 return __nv_longlong_as_double(__a);
495 }
__mul24(int __a,int __b)496 __DEVICE__ int __mul24(int __a, int __b) { return __nv_mul24(__a, __b); }
__mul64hi(long long __a,long long __b)497 __DEVICE__ long long __mul64hi(long long __a, long long __b) {
498 return __nv_mul64hi(__a, __b);
499 }
__mulhi(int __a,int __b)500 __DEVICE__ int __mulhi(int __a, int __b) { return __nv_mulhi(__a, __b); }
__pm0(void)501 __DEVICE__ unsigned int __pm0(void) { return __nvvm_read_ptx_sreg_pm0(); }
__pm1(void)502 __DEVICE__ unsigned int __pm1(void) { return __nvvm_read_ptx_sreg_pm1(); }
__pm2(void)503 __DEVICE__ unsigned int __pm2(void) { return __nvvm_read_ptx_sreg_pm2(); }
__pm3(void)504 __DEVICE__ unsigned int __pm3(void) { return __nvvm_read_ptx_sreg_pm3(); }
__popc(int __a)505 __DEVICE__ int __popc(int __a) { return __nv_popc(__a); }
__popcll(long long __a)506 __DEVICE__ int __popcll(long long __a) { return __nv_popcll(__a); }
__powf(float __a,float __b)507 __DEVICE__ float __powf(float __a, float __b) {
508 return __nv_fast_powf(__a, __b);
509 }
510
511 // Parameter must have a known integer value.
512 #define __prof_trigger(__a) __asm__ __volatile__("pmevent \t%0;" ::"i"(__a))
__rhadd(int __a,int __b)513 __DEVICE__ int __rhadd(int __a, int __b) { return __nv_rhadd(__a, __b); }
__sad(int __a,int __b,unsigned int __c)514 __DEVICE__ unsigned int __sad(int __a, int __b, unsigned int __c) {
515 return __nv_sad(__a, __b, __c);
516 }
__saturatef(float __a)517 __DEVICE__ float __saturatef(float __a) { return __nv_saturatef(__a); }
__signbitd(double __a)518 __DEVICE__ int __signbitd(double __a) { return __nv_signbitd(__a); }
__signbitf(float __a)519 __DEVICE__ int __signbitf(float __a) { return __nv_signbitf(__a); }
__sincosf(float __a,float * __s,float * __c)520 __DEVICE__ void __sincosf(float __a, float *__s, float *__c) {
521 return __nv_fast_sincosf(__a, __s, __c);
522 }
__sinf(float __a)523 __DEVICE__ float __sinf(float __a) { return __nv_fast_sinf(__a); }
__syncthreads_and(int __a)524 __DEVICE__ int __syncthreads_and(int __a) { return __nvvm_bar0_and(__a); }
__syncthreads_count(int __a)525 __DEVICE__ int __syncthreads_count(int __a) { return __nvvm_bar0_popc(__a); }
__syncthreads_or(int __a)526 __DEVICE__ int __syncthreads_or(int __a) { return __nvvm_bar0_or(__a); }
__tanf(float __a)527 __DEVICE__ float __tanf(float __a) { return __nv_fast_tanf(__a); }
__threadfence(void)528 __DEVICE__ void __threadfence(void) { __nvvm_membar_gl(); }
__threadfence_block(void)529 __DEVICE__ void __threadfence_block(void) { __nvvm_membar_cta(); };
__threadfence_system(void)530 __DEVICE__ void __threadfence_system(void) { __nvvm_membar_sys(); };
__trap(void)531 __DEVICE__ void __trap(void) { __asm__ __volatile__("trap;"); }
__uAtomicAdd(unsigned int * __p,unsigned int __v)532 __DEVICE__ unsigned int __uAtomicAdd(unsigned int *__p, unsigned int __v) {
533 return __nvvm_atom_add_gen_i((int *)__p, __v);
534 }
__uAtomicAdd_block(unsigned int * __p,unsigned int __v)535 __DEVICE__ unsigned int __uAtomicAdd_block(unsigned int *__p,
536 unsigned int __v) {
537 return __nvvm_atom_cta_add_gen_i((int *)__p, __v);
538 }
__uAtomicAdd_system(unsigned int * __p,unsigned int __v)539 __DEVICE__ unsigned int __uAtomicAdd_system(unsigned int *__p,
540 unsigned int __v) {
541 return __nvvm_atom_sys_add_gen_i((int *)__p, __v);
542 }
__uAtomicAnd(unsigned int * __p,unsigned int __v)543 __DEVICE__ unsigned int __uAtomicAnd(unsigned int *__p, unsigned int __v) {
544 return __nvvm_atom_and_gen_i((int *)__p, __v);
545 }
__uAtomicAnd_block(unsigned int * __p,unsigned int __v)546 __DEVICE__ unsigned int __uAtomicAnd_block(unsigned int *__p,
547 unsigned int __v) {
548 return __nvvm_atom_cta_and_gen_i((int *)__p, __v);
549 }
__uAtomicAnd_system(unsigned int * __p,unsigned int __v)550 __DEVICE__ unsigned int __uAtomicAnd_system(unsigned int *__p,
551 unsigned int __v) {
552 return __nvvm_atom_sys_and_gen_i((int *)__p, __v);
553 }
__uAtomicCAS(unsigned int * __p,unsigned int __cmp,unsigned int __v)554 __DEVICE__ unsigned int __uAtomicCAS(unsigned int *__p, unsigned int __cmp,
555 unsigned int __v) {
556 return __nvvm_atom_cas_gen_i((int *)__p, __cmp, __v);
557 }
558 __DEVICE__ unsigned int
__uAtomicCAS_block(unsigned int * __p,unsigned int __cmp,unsigned int __v)559 __uAtomicCAS_block(unsigned int *__p, unsigned int __cmp, unsigned int __v) {
560 return __nvvm_atom_cta_cas_gen_i((int *)__p, __cmp, __v);
561 }
562 __DEVICE__ unsigned int
__uAtomicCAS_system(unsigned int * __p,unsigned int __cmp,unsigned int __v)563 __uAtomicCAS_system(unsigned int *__p, unsigned int __cmp, unsigned int __v) {
564 return __nvvm_atom_sys_cas_gen_i((int *)__p, __cmp, __v);
565 }
__uAtomicDec(unsigned int * __p,unsigned int __v)566 __DEVICE__ unsigned int __uAtomicDec(unsigned int *__p, unsigned int __v) {
567 return __nvvm_atom_dec_gen_ui(__p, __v);
568 }
__uAtomicDec_block(unsigned int * __p,unsigned int __v)569 __DEVICE__ unsigned int __uAtomicDec_block(unsigned int *__p,
570 unsigned int __v) {
571 return __nvvm_atom_cta_dec_gen_ui(__p, __v);
572 }
__uAtomicDec_system(unsigned int * __p,unsigned int __v)573 __DEVICE__ unsigned int __uAtomicDec_system(unsigned int *__p,
574 unsigned int __v) {
575 return __nvvm_atom_sys_dec_gen_ui(__p, __v);
576 }
__uAtomicExch(unsigned int * __p,unsigned int __v)577 __DEVICE__ unsigned int __uAtomicExch(unsigned int *__p, unsigned int __v) {
578 return __nvvm_atom_xchg_gen_i((int *)__p, __v);
579 }
__uAtomicExch_block(unsigned int * __p,unsigned int __v)580 __DEVICE__ unsigned int __uAtomicExch_block(unsigned int *__p,
581 unsigned int __v) {
582 return __nvvm_atom_cta_xchg_gen_i((int *)__p, __v);
583 }
__uAtomicExch_system(unsigned int * __p,unsigned int __v)584 __DEVICE__ unsigned int __uAtomicExch_system(unsigned int *__p,
585 unsigned int __v) {
586 return __nvvm_atom_sys_xchg_gen_i((int *)__p, __v);
587 }
__uAtomicInc(unsigned int * __p,unsigned int __v)588 __DEVICE__ unsigned int __uAtomicInc(unsigned int *__p, unsigned int __v) {
589 return __nvvm_atom_inc_gen_ui(__p, __v);
590 }
__uAtomicInc_block(unsigned int * __p,unsigned int __v)591 __DEVICE__ unsigned int __uAtomicInc_block(unsigned int *__p,
592 unsigned int __v) {
593 return __nvvm_atom_cta_inc_gen_ui(__p, __v);
594 }
__uAtomicInc_system(unsigned int * __p,unsigned int __v)595 __DEVICE__ unsigned int __uAtomicInc_system(unsigned int *__p,
596 unsigned int __v) {
597 return __nvvm_atom_sys_inc_gen_ui(__p, __v);
598 }
__uAtomicMax(unsigned int * __p,unsigned int __v)599 __DEVICE__ unsigned int __uAtomicMax(unsigned int *__p, unsigned int __v) {
600 return __nvvm_atom_max_gen_ui(__p, __v);
601 }
__uAtomicMax_block(unsigned int * __p,unsigned int __v)602 __DEVICE__ unsigned int __uAtomicMax_block(unsigned int *__p,
603 unsigned int __v) {
604 return __nvvm_atom_cta_max_gen_ui(__p, __v);
605 }
__uAtomicMax_system(unsigned int * __p,unsigned int __v)606 __DEVICE__ unsigned int __uAtomicMax_system(unsigned int *__p,
607 unsigned int __v) {
608 return __nvvm_atom_sys_max_gen_ui(__p, __v);
609 }
__uAtomicMin(unsigned int * __p,unsigned int __v)610 __DEVICE__ unsigned int __uAtomicMin(unsigned int *__p, unsigned int __v) {
611 return __nvvm_atom_min_gen_ui(__p, __v);
612 }
__uAtomicMin_block(unsigned int * __p,unsigned int __v)613 __DEVICE__ unsigned int __uAtomicMin_block(unsigned int *__p,
614 unsigned int __v) {
615 return __nvvm_atom_cta_min_gen_ui(__p, __v);
616 }
__uAtomicMin_system(unsigned int * __p,unsigned int __v)617 __DEVICE__ unsigned int __uAtomicMin_system(unsigned int *__p,
618 unsigned int __v) {
619 return __nvvm_atom_sys_min_gen_ui(__p, __v);
620 }
__uAtomicOr(unsigned int * __p,unsigned int __v)621 __DEVICE__ unsigned int __uAtomicOr(unsigned int *__p, unsigned int __v) {
622 return __nvvm_atom_or_gen_i((int *)__p, __v);
623 }
__uAtomicOr_block(unsigned int * __p,unsigned int __v)624 __DEVICE__ unsigned int __uAtomicOr_block(unsigned int *__p, unsigned int __v) {
625 return __nvvm_atom_cta_or_gen_i((int *)__p, __v);
626 }
__uAtomicOr_system(unsigned int * __p,unsigned int __v)627 __DEVICE__ unsigned int __uAtomicOr_system(unsigned int *__p,
628 unsigned int __v) {
629 return __nvvm_atom_sys_or_gen_i((int *)__p, __v);
630 }
__uAtomicXor(unsigned int * __p,unsigned int __v)631 __DEVICE__ unsigned int __uAtomicXor(unsigned int *__p, unsigned int __v) {
632 return __nvvm_atom_xor_gen_i((int *)__p, __v);
633 }
__uAtomicXor_block(unsigned int * __p,unsigned int __v)634 __DEVICE__ unsigned int __uAtomicXor_block(unsigned int *__p,
635 unsigned int __v) {
636 return __nvvm_atom_cta_xor_gen_i((int *)__p, __v);
637 }
__uAtomicXor_system(unsigned int * __p,unsigned int __v)638 __DEVICE__ unsigned int __uAtomicXor_system(unsigned int *__p,
639 unsigned int __v) {
640 return __nvvm_atom_sys_xor_gen_i((int *)__p, __v);
641 }
__uhadd(unsigned int __a,unsigned int __b)642 __DEVICE__ unsigned int __uhadd(unsigned int __a, unsigned int __b) {
643 return __nv_uhadd(__a, __b);
644 }
__uint2double_rn(unsigned int __a)645 __DEVICE__ double __uint2double_rn(unsigned int __a) {
646 return __nv_uint2double_rn(__a);
647 }
__uint2float_rd(unsigned int __a)648 __DEVICE__ float __uint2float_rd(unsigned int __a) {
649 return __nv_uint2float_rd(__a);
650 }
__uint2float_rn(unsigned int __a)651 __DEVICE__ float __uint2float_rn(unsigned int __a) {
652 return __nv_uint2float_rn(__a);
653 }
__uint2float_ru(unsigned int __a)654 __DEVICE__ float __uint2float_ru(unsigned int __a) {
655 return __nv_uint2float_ru(__a);
656 }
__uint2float_rz(unsigned int __a)657 __DEVICE__ float __uint2float_rz(unsigned int __a) {
658 return __nv_uint2float_rz(__a);
659 }
__uint_as_float(unsigned int __a)660 __DEVICE__ float __uint_as_float(unsigned int __a) {
661 return __nv_uint_as_float(__a);
662 } //
__ull2double_rd(unsigned long long __a)663 __DEVICE__ double __ull2double_rd(unsigned long long __a) {
664 return __nv_ull2double_rd(__a);
665 }
__ull2double_rn(unsigned long long __a)666