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 extern "C" hipError_t hipLaunchKernel(const void *func, dim3 gridDim, 39 dim3 blockDim, void **args, 40 size_t sharedMem, 41 hipStream_t stream); 42 #else 43 typedef struct cudaStream *cudaStream_t; 44 typedef enum cudaError {} cudaError_t; 45 extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize, 46 size_t sharedSize = 0, 47 cudaStream_t stream = 0); 48 extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize, 49 size_t sharedSize = 0, 50 cudaStream_t stream = 0); 51 extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim, 52 dim3 blockDim, void **args, 53 size_t sharedMem, cudaStream_t stream); 54 #endif 55 56 extern "C" __device__ int printf(const char*, ...); 57