Debian Codegraph @

clang/test/SemaCUDA/Inputs/cuda.h

raw
1 /* Minimal declarations for CUDA support. Testing purposes only. */
2
3 #include <stddef.h>
4
5 // Make this file work with nvcc, for testing compatibility.
6
7 #ifndef __NVCC__
8 #define __constant__ __attribute__((constant))
9 #define __device__ __attribute__((device))
10 #define __global__ __attribute__((global))
11 #define __host__ __attribute__((host))
12 #define __shared__ __attribute__((shared))
13 #define __managed__ __attribute__((managed))
14 #define __grid_constant__ __attribute__((grid_constant))
15 #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__)))
16 #define __cluster_dims__(...) __attribute__((cluster_dims(__VA_ARGS__)))
17 #define __no_cluster__ __attribute__((no_cluster))
18
19 struct dim3 {
20 unsigned x, y, z;
21 __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
22 };
23
24 #ifdef __HIP__
25 typedef struct hipStream *hipStream_t;
26 typedef enum hipError {} hipError_t;
27 int hipConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0,
28 hipStream_t stream = 0);
29 extern "C" hipError_t __hipPushCallConfiguration(dim3 gridSize, dim3 blockSize,
30 size_t sharedSize = 0,
31 hipStream_t stream = 0);
32 extern "C" hipError_t hipLaunchKernel(const void *func, dim3 gridDim,
33 dim3 blockDim, void **args,
34 size_t sharedMem,
35 hipStream_t stream);
36 #else
37 typedef struct cudaStream *cudaStream_t;
38 typedef enum cudaError {} cudaError_t;
39
40 extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize,
41 size_t sharedSize = 0,
42 cudaStream_t stream = 0);
43 extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize,
44 size_t sharedSize = 0,
45 cudaStream_t stream = 0);
46 extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim,
47 dim3 blockDim, void **args,
48 size_t sharedMem, cudaStream_t stream);
49 extern "C" __device__ cudaError_t cudaLaunchDevice(void *func,
50 void *parameterBuffer,
51 dim3 gridDim, dim3 blockDim,
52 unsigned int sharedMem,
53 cudaStream_t stream);
54 extern "C" __device__ void *cudaGetParameterBuffer(size_t alignment,
55 size_t size);
56 #endif
57
58 // Host- and device-side placement new overloads.
59 void *operator new(__SIZE_TYPE__, void *p) { return p; }
60 void *operator new[](__SIZE_TYPE__, void *p) { return p; }
61 __device__ void *operator new(__SIZE_TYPE__, void *p) { return p; }
62 __device__ void *operator new[](__SIZE_TYPE__, void *p) { return p; }
63
64 #endif // !__NVCC__