Peter Collingbourne | 6ab610c | 2010-12-01 03:15:31 +0000 | [diff] [blame] | 1 | /* Minimal declarations for CUDA support. Testing purposes only. */ |
| 2 | |
Peter Collingbourne | 5eec5f0 | 2011-02-09 21:12:02 +0000 | [diff] [blame] | 3 | #include <stddef.h> |
| 4 | |
Justin Lebar | 3eaaf86 | 2016-01-13 01:07:35 +0000 | [diff] [blame] | 5 | // Make this file work with nvcc, for testing compatibility. |
| 6 | |
| 7 | #ifndef __NVCC__ |
Peter Collingbourne | 6ab610c | 2010-12-01 03:15:31 +0000 | [diff] [blame] | 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)) |
Aaron Ballman | 6603993 | 2013-12-19 00:41:31 +0000 | [diff] [blame] | 13 | #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__))) |
Peter Collingbourne | 5eec5f0 | 2011-02-09 21:12:02 +0000 | [diff] [blame] | 14 | |
| 15 | struct dim3 { |
| 16 | unsigned x, y, z; |
Peter Collingbourne | 7277fe8 | 2011-10-02 23:49:40 +0000 | [diff] [blame] | 17 | __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} |
Peter Collingbourne | 5eec5f0 | 2011-02-09 21:12:02 +0000 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | typedef struct cudaStream *cudaStream_t; |
| 21 | |
| 22 | int cudaConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0, |
| 23 | cudaStream_t stream = 0); |
Justin Lebar | 18e2d82 | 2016-08-15 23:00:49 +0000 | [diff] [blame] | 24 | |
| 25 | // Device-side placement new overloads. |
| 26 | __device__ void *operator new(__SIZE_TYPE__, void *p) { return p; } |
| 27 | __device__ void *operator new[](__SIZE_TYPE__, void *p) { return p; } |
| 28 | |
Justin Lebar | 3eaaf86 | 2016-01-13 01:07:35 +0000 | [diff] [blame] | 29 | #endif // !__NVCC__ |