1 /*===------ LLVM/Offload helpers for kernel languages (CUDA/HIP) -*- c++ -*-=== 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 *===-----------------------------------------------------------------------=== 8 */ 9 10 #include <stddef.h> 11 12 #define __host__ __attribute__((host)) 13 #define __device__ __attribute__((device)) 14 #define __global__ __attribute__((global)) 15 #define __shared__ __attribute__((shared)) 16 #define __constant__ __attribute__((constant)) 17 #define __managed__ __attribute__((managed)) 18 19 extern "C" { 20 21 typedef struct dim3 { dim3dim322 dim3() {} dim3dim323 dim3(unsigned x) : x(x) {} 24 unsigned x = 0, y = 0, z = 0; 25 } dim3; 26 27 // TODO: For some reason the CUDA device compilation requires this declaration 28 // to be present on the device while it is only used on the host. 29 unsigned __llvmPushCallConfiguration(dim3 gridDim, dim3 blockDim, 30 size_t sharedMem = 0, void *stream = 0); 31 } 32