blob: d0546704598e27c091e51c7477d41cbb2bf66440 [file] [log] [blame]
Peter Collingbourne6ab610c2010-12-01 03:15:31 +00001/* Minimal declarations for CUDA support. Testing purposes only. */
2
Peter Collingbourne5eec5f02011-02-09 21:12:02 +00003#include <stddef.h>
4
Justin Lebar3eaaf862016-01-13 01:07:35 +00005// Make this file work with nvcc, for testing compatibility.
6
7#ifndef __NVCC__
Peter Collingbourne6ab610c2010-12-01 03:15:31 +00008#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 Ballman66039932013-12-19 00:41:31 +000013#define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__)))
Peter Collingbourne5eec5f02011-02-09 21:12:02 +000014
15struct dim3 {
16 unsigned x, y, z;
Peter Collingbourne7277fe82011-10-02 23:49:40 +000017 __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
Peter Collingbourne5eec5f02011-02-09 21:12:02 +000018};
19
20typedef struct cudaStream *cudaStream_t;
21
22int cudaConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0,
23 cudaStream_t stream = 0);
Justin Lebar18e2d822016-08-15 23:00:49 +000024
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 Lebar3eaaf862016-01-13 01:07:35 +000029#endif // !__NVCC__