26#ifndef __CLANG_CUDA_RUNTIME_WRAPPER_H__
27#define __CLANG_CUDA_RUNTIME_WRAPPER_H__
29#if defined(__CUDA__) && defined(__clang__)
48#pragma push_macro("__THROW")
49#pragma push_macro("__CUDA_ARCH__")
55#if !defined(CUDA_VERSION)
56#error "cuda.h did not define CUDA_VERSION"
57#elif CUDA_VERSION < 7000
58#error "Unsupported CUDA version!"
61#pragma push_macro("__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__")
62#if CUDA_VERSION >= 10000
63#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
69#define __CUDA_ARCH__ 350
76#define __DEVICE_LAUNCH_PARAMETERS_H__
81#define __DEVICE_FUNCTIONS_H__
82#define __MATH_FUNCTIONS_H__
83#define __COMMON_FUNCTIONS_H__
86#define __DEVICE_FUNCTIONS_DECLS_H__
89#if CUDA_VERSION < 9000
93#define __CUDA_LIBDEVICE__
97#include "host_defines.h"
99#include "driver_types.h"
100#include "host_config.h"
105#pragma push_macro("nv_weak")
108#undef __CUDA_LIBDEVICE__
110#include "cuda_runtime.h"
112#pragma pop_macro("nv_weak")
118#define __nvvm_memcpy(s, d, n, a) __builtin_memcpy(s, d, n)
119#define __nvvm_memset(d, c, n, a) __builtin_memset(d, c, n)
121#if CUDA_VERSION < 9000
122#include "crt/device_runtime.h"
124#include "crt/host_runtime.h"
129#undef __cxa_vec_cctor
134#undef __cxa_vec_delete2
135#undef __cxa_vec_delete
136#undef __cxa_vec_delete3
137#undef __cxa_pure_virtual
144 return std::signbit(x);
155#if CUDA_VERSION >= 9000
171#if defined(CU_DEVICE_INVALID)
172#if !defined(__USE_FAST_MATH__)
173#define __USE_FAST_MATH__ 0
176#if !defined(__CUDA_PREC_DIV)
177#define __CUDA_PREC_DIV 0
183#pragma push_macro("__host__")
184#define __host__ UNEXPECTED_HOST_ATTRIBUTE
190#pragma push_macro("__forceinline__")
191#define __forceinline__ __device__ __inline__ __attribute__((always_inline))
192#if CUDA_VERSION < 9000
193#include "device_functions.hpp"
202#pragma push_macro("__USE_FAST_MATH__")
203#if defined(__CLANG_CUDA_APPROX_TRANSCENDENTALS__)
204#define __USE_FAST_MATH__ 1
207#if CUDA_VERSION >= 9000
210#if CUDA_VERSION >= 9020
213#include "crt/math_functions.hpp"
215#include "math_functions.hpp"
218#pragma pop_macro("__USE_FAST_MATH__")
220#if CUDA_VERSION < 9000
221#include "math_functions_dbl_ptx3.hpp"
223#pragma pop_macro("__forceinline__")
227#undef __MATH_FUNCTIONS_HPP__
229#if CUDA_VERSION < 9000
230#include "math_functions.hpp"
247#if CUDA_VERSION < 9000
250static inline __device__
void __brkpt(
int __c) { __brkpt(); }
261#if CUDA_VERSION >= 9000
264#include "device_atomic_functions.h"
266#undef __DEVICE_FUNCTIONS_HPP__
267#include "device_atomic_functions.hpp"
268#if CUDA_VERSION >= 9000
269#include "crt/device_functions.hpp"
270#include "crt/device_double_functions.hpp"
272#include "device_functions.hpp"
274#include "device_double_functions.h"
277#include "sm_20_atomic_functions.hpp"
278#include "sm_20_intrinsics.hpp"
279#include "sm_32_atomic_functions.hpp"
289#if CUDA_VERSION >= 8000
290#pragma push_macro("__CUDA_ARCH__")
292#include "sm_60_atomic_functions.hpp"
293#include "sm_61_intrinsics.hpp"
294#pragma pop_macro("__CUDA_ARCH__")
297#undef __MATH_FUNCTIONS_HPP__
303#pragma push_macro("signbit")
304#pragma push_macro("__GNUC__")
306#define signbit __ignored_cuda_signbit
311#pragma push_macro("_GLIBCXX_MATH_H")
312#pragma push_macro("_LIBCPP_VERSION")
313#if CUDA_VERSION >= 9000
314#undef _GLIBCXX_MATH_H
316#ifdef _LIBCPP_VERSION
317#define _LIBCPP_VERSION 3700
321#if CUDA_VERSION >= 9000
322#include "crt/math_functions.hpp"
324#include "math_functions.hpp"
326#pragma pop_macro("_GLIBCXX_MATH_H")
327#pragma pop_macro("_LIBCPP_VERSION")
328#pragma pop_macro("__GNUC__")
329#pragma pop_macro("signbit")
331#pragma pop_macro("__host__")
333#include "texture_indirect_functions.h"
336#pragma pop_macro("__CUDA_ARCH__")
337#pragma pop_macro("__THROW")
349__device__
int vprintf(
const char *,
const char *);
350__device__
void free(
void *) __attribute((nothrow));
351__device__
void *malloc(
size_t) __attribute((nothrow))
__attribute__((malloc));
352__device__
void __assertfail(
const char *__message,
const char *__file,
353 unsigned __line,
const char *__function,
358__device__
static inline void __assert_fail(
const char *__message,
359 const char *__file,
unsigned __line,
360 const char *__function) {
361 __assertfail(__message, __file, __line, __function,
sizeof(
char));
366__device__
int printf(
const char *, ...);
371__device__
static inline void free(
void *__ptr) { ::free(__ptr); }
372__device__
static inline void *malloc(
size_t __size) {
373 return ::malloc(__size);
380__device__
inline __cuda_builtin_threadIdx_t::operator uint3()
const {
388__device__
inline __cuda_builtin_blockIdx_t::operator uint3()
const {
396__device__
inline __cuda_builtin_blockDim_t::operator dim3()
const {
397 return dim3(x, y, z);
400__device__
inline __cuda_builtin_gridDim_t::operator dim3()
const {
401 return dim3(x, y, z);
414#pragma push_macro("dim3")
415#pragma push_macro("uint3")
416#define dim3 __cuda_builtin_blockDim_t
417#define uint3 __cuda_builtin_threadIdx_t
418#include "curand_mtgp32_kernel.h"
419#pragma pop_macro("dim3")
420#pragma pop_macro("uint3")
421#pragma pop_macro("__USE_FAST_MATH__")
422#pragma pop_macro("__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__")
428#if CUDA_VERSION >= 9020
429extern "C" unsigned __cudaPushCallConfiguration(dim3
gridDim, dim3
blockDim,
430 size_t sharedMem = 0,
__CUDA_BUILTIN_VAR __cuda_builtin_blockDim_t blockDim
__CUDA_BUILTIN_VAR __cuda_builtin_gridDim_t gridDim
__DEVICE__ int __signbitd(double __a)
__DEVICE__ float rsqrtf(float __a)
__DEVICE__ double normcdf(double __a)
__DEVICE_VOID__ void sincospi(double __a, double *__s, double *__c)
__DEVICE__ float rcbrtf(float __a)
__DEVICE__ float erfcinvf(float __a)
__DEVICE__ float sinpif(float __a)
__DEVICE_VOID__ void sincospif(float __a, float *__s, float *__c)
__DEVICE__ double rcbrt(double __a)
__DEVICE__ float normcdff(float __a)
__DEVICE__ double cospi(double __a)
__DEVICE__ double sinpi(double __a)
__DEVICE__ float erfcxf(float __a)
__DEVICE__ float normcdfinvf(float __a)
__DEVICE__ double normcdfinv(double __a)
__DEVICE__ float cospif(float __a)
__DEVICE__ double erfcx(double __a)
__DEVICE__ double rsqrt(double __a)
__DEVICE__ double erfcinv(double __a)
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
static __inline__ vector float vector float vector float __c
static __inline__ vector float vector float __b
static __inline__ void int __a
int printf(__constant const char *st,...) __attribute__((format(printf