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 #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__)))
11 
12 struct dim3 {
13   unsigned x, y, z;
xdim314   __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
15 };
16 
17 #ifdef __HIP__
18 typedef struct hipStream *hipStream_t;
19 typedef enum hipError {} hipError_t;
20 int hipConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0,
21                      hipStream_t stream = 0);
22 extern "C" hipError_t __hipPushCallConfiguration(dim3 gridSize, dim3 blockSize,
23                                                  size_t sharedSize = 0,
24                                                  hipStream_t stream = 0);
25 extern "C" hipError_t hipLaunchKernel(const void *func, dim3 gridDim,
26                                       dim3 blockDim, void **args,
27                                       size_t sharedMem,
28                                       hipStream_t stream);
29 #else
30 typedef struct cudaStream *cudaStream_t;
31 typedef enum cudaError {} cudaError_t;
32 extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize,
33                                  size_t sharedSize = 0,
34                                  cudaStream_t stream = 0);
35 extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize,
36                                            size_t sharedSize = 0,
37                                            cudaStream_t stream = 0);
38 extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim,
39                                         dim3 blockDim, void **args,
40                                         size_t sharedMem, cudaStream_t stream);
41 #endif
42 
43 extern "C" __device__ int printf(const char*, ...);
44