1 /* Minimal declarations for CUDA support.  Testing purposes only. */
2 
3 #include <stddef.h>
4 
5 #define __constant__ __attribute__((constant))
6 #define __device__ __attribute__((device))
7 #define __global__ __attribute__((global))
8 #define __host__ __attribute__((host))
9 #define __shared__ __attribute__((shared))
10 #if __HIP__
11 #define __managed__ __attribute__((managed))
12 #endif
13 #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__)))
14 
15 struct dim3 {
16   unsigned x, y, z;
xdim317   __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
18 };
19 
20 #ifdef __HIP__
21 typedef struct hipStream *hipStream_t;
22 typedef enum hipError {} hipError_t;
23 int hipConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0,
24                      hipStream_t stream = 0);
25 extern "C" hipError_t __hipPushCallConfiguration(dim3 gridSize, dim3 blockSize,
26                                                  size_t sharedSize = 0,
27                                                  hipStream_t stream = 0);
28 extern "C" hipError_t hipLaunchKernel(const void *func, dim3 gridDim,
29                                       dim3 blockDim, void **args,
30                                       size_t sharedMem,
31                                       hipStream_t stream);
32 #else
33 typedef struct cudaStream *cudaStream_t;
34 typedef enum cudaError {} cudaError_t;
35 extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize,
36                                  size_t sharedSize = 0,
37                                  cudaStream_t stream = 0);
38 extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize,
39                                            size_t sharedSize = 0,
40                                            cudaStream_t stream = 0);
41 extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim,
42                                         dim3 blockDim, void **args,
43                                         size_t sharedMem, cudaStream_t stream);
44 #endif
45 
46 extern "C" __device__ int printf(const char*, ...);
47