|
| 1 | + // Based off https://sourcegraph.com/github.com/llvm/llvm-project/-/blob/clang/test/SemaCUDA/Inputs/cuda.h |
| 2 | +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition [..] `<file>/cuda_stub.h`/ |
| 3 | + // |
| 4 | + // Add common stuff for CUDA headers here. |
| 5 | + |
| 6 | + using size_t = unsigned long long; |
| 7 | +// ^^^^^^ definition [..] size_t# |
| 8 | + |
| 9 | + // Make this file work with nvcc, for testing compatibility. |
| 10 | + |
| 11 | + #ifndef __NVCC__ |
| 12 | + #define __constant__ __attribute__((constant)) |
| 13 | +// ^^^^^^^^^^^^ definition [..] `cuda_stub.h:10:9`! |
| 14 | + #define __device__ __attribute__((device)) |
| 15 | +// ^^^^^^^^^^ definition [..] `cuda_stub.h:11:9`! |
| 16 | + #define __global__ __attribute__((global)) |
| 17 | +// ^^^^^^^^^^ definition [..] `cuda_stub.h:12:9`! |
| 18 | + #define __host__ __attribute__((host)) |
| 19 | +// ^^^^^^^^ definition [..] `cuda_stub.h:13:9`! |
| 20 | + #define __shared__ __attribute__((shared)) |
| 21 | +// ^^^^^^^^^^ definition [..] `cuda_stub.h:14:9`! |
| 22 | + #define __managed__ __attribute__((managed)) |
| 23 | +// ^^^^^^^^^^^ definition [..] `cuda_stub.h:15:9`! |
| 24 | + #define __launch_bounds__(...) __attribute__((launch_bounds(__VA_ARGS__))) |
| 25 | +// ^^^^^^^^^^^^^^^^^ definition [..] `cuda_stub.h:16:9`! |
| 26 | + |
| 27 | + struct dim3 { |
| 28 | +// ^^^^ definition [..] dim3# |
| 29 | + unsigned x, y, z; |
| 30 | +// ^ definition [..] dim3#x. |
| 31 | +// ^ definition [..] dim3#y. |
| 32 | +// ^ definition [..] dim3#z. |
| 33 | + __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} |
| 34 | +// ^^^^^^^^ reference [..] `cuda_stub.h:13:9`! |
| 35 | +// ^^^^^^^^^^ reference [..] `cuda_stub.h:11:9`! |
| 36 | +// ^^^^ definition [..] dim3#dim3(6df00707c193238d). |
| 37 | +// ^ definition local 0 |
| 38 | +// ^ definition local 1 |
| 39 | +// ^ definition local 2 |
| 40 | +// ^ reference [..] dim3#x. |
| 41 | +// ^ reference local 0 |
| 42 | +// ^ reference [..] dim3#y. |
| 43 | +// ^ reference local 1 |
| 44 | +// ^ reference [..] dim3#z. |
| 45 | +// ^ reference local 2 |
| 46 | + }; |
| 47 | + |
| 48 | + #ifdef __HIP__ |
| 49 | + typedef struct hipStream *hipStream_t; |
| 50 | + typedef enum hipError {} hipError_t; |
| 51 | + int hipConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0, |
| 52 | + hipStream_t stream = 0); |
| 53 | + extern "C" hipError_t __hipPushCallConfiguration(dim3 gridSize, dim3 blockSize, |
| 54 | + size_t sharedSize = 0, |
| 55 | + hipStream_t stream = 0); |
| 56 | + extern "C" hipError_t hipLaunchKernel(const void *func, dim3 gridDim, |
| 57 | + dim3 blockDim, void **args, |
| 58 | + size_t sharedMem, |
| 59 | + hipStream_t stream); |
| 60 | + #else |
| 61 | + typedef struct cudaStream *cudaStream_t; |
| 62 | +// ^^^^^^^^^^ reference [..] cudaStream# |
| 63 | +// ^^^^^^^^^^ reference [..] cudaStream# |
| 64 | +// ^^^^^^^^^^^^ definition [..] cudaStream_t# |
| 65 | + typedef enum cudaError {} cudaError_t; |
| 66 | +// ^^^^^^^^^ definition [..] cudaError# |
| 67 | +// ^^^^^^^^^^^ definition [..] cudaError_t# |
| 68 | + |
| 69 | + extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize, |
| 70 | +// ^^^^ reference [..] dim3# |
| 71 | +// ^^^^^^^^ definition local 3 |
| 72 | +// ^^^^ reference [..] dim3# |
| 73 | +// ^^^^^^^^^ definition local 4 |
| 74 | + size_t sharedSize = 0, |
| 75 | +// ^^^^^^ reference [..] size_t# |
| 76 | +// ^^^^^^^^^^ definition local 5 |
| 77 | + cudaStream_t stream = 0); |
| 78 | +// ^^^^^^^^^^^^ reference [..] cudaStream_t# |
| 79 | +// ^^^^^^ definition local 6 |
| 80 | + extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize, |
| 81 | +// ^^^^ reference [..] dim3# |
| 82 | +// ^^^^^^^^ definition local 7 |
| 83 | +// ^^^^ reference [..] dim3# |
| 84 | +// ^^^^^^^^^ definition local 8 |
| 85 | + size_t sharedSize = 0, |
| 86 | +// ^^^^^^ reference [..] size_t# |
| 87 | +// ^^^^^^^^^^ definition local 9 |
| 88 | + cudaStream_t stream = 0); |
| 89 | +// ^^^^^^^^^^^^ reference [..] cudaStream_t# |
| 90 | +// ^^^^^^ definition local 10 |
| 91 | + extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim, |
| 92 | +// ^^^^^^^^^^^ reference [..] cudaError_t# |
| 93 | +// ^^^^ definition local 11 |
| 94 | +// ^^^^ reference [..] dim3# |
| 95 | +// ^^^^^^^ definition local 12 |
| 96 | + dim3 blockDim, void **args, |
| 97 | +// ^^^^ reference [..] dim3# |
| 98 | +// ^^^^^^^^ definition local 13 |
| 99 | +// ^^^^ definition local 14 |
| 100 | + size_t sharedMem, cudaStream_t stream); |
| 101 | +// ^^^^^^ reference [..] size_t# |
| 102 | +// ^^^^^^^^^ definition local 15 |
| 103 | +// ^^^^^^^^^^^^ reference [..] cudaStream_t# |
| 104 | +// ^^^^^^ definition local 16 |
| 105 | + #endif |
| 106 | + |
| 107 | + // Host- and device-side placement new overloads. |
| 108 | + void *operator new(size_t, void *p) { return p; } |
| 109 | +// ^^^^^^^^ definition [..] `operator new`(ecd71fefd6822377). |
| 110 | +// ^^^^^^ reference [..] size_t# |
| 111 | +// ^ definition local 17 |
| 112 | +// ^ reference local 17 |
| 113 | + void *operator new[](size_t, void *p) { return p; } |
| 114 | +// ^^^^^^^^ definition [..] `operator new[]`(ecd71fefd6822377). |
| 115 | +// ^^^^^^ reference [..] size_t# |
| 116 | +// ^ definition local 18 |
| 117 | +// ^ reference local 18 |
| 118 | + __device__ void *operator new(size_t, void *p) { return p; } |
| 119 | +//^^^^^^^^^^ reference [..] `cuda_stub.h:11:9`! |
| 120 | +// ^^^^^^^^ definition [..] `operator new`(ecd71fefd6822377). |
| 121 | +// ^^^^^^ reference [..] size_t# |
| 122 | +// ^ definition local 19 |
| 123 | +// ^ reference local 19 |
| 124 | + __device__ void *operator new[](size_t, void *p) { return p; } |
| 125 | +//^^^^^^^^^^ reference [..] `cuda_stub.h:11:9`! |
| 126 | +// ^^^^^^^^ definition [..] `operator new[]`(ecd71fefd6822377). |
| 127 | +// ^^^^^^ reference [..] size_t# |
| 128 | +// ^ definition local 20 |
| 129 | +// ^ reference local 20 |
| 130 | + |
| 131 | + #endif // !__NVCC__ |
| 132 | + |
0 commit comments