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