1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUCOMMONDEFAPI_H
16#define GPUCOMMONDEFAPI_H
17// clang-format off
18
19#ifndef GPUCOMMONDEF_H
20 #error Please include GPUCommonDef.h!
21#endif
22
23#ifndef GPUCA_GPUCODE_DEVICE
24#include <cstdint>
25#endif
26
27//Define macros for GPU keywords. i-version defines inline functions.
28//All host-functions in GPU code are automatically inlined, to avoid duplicate symbols.
29//For non-inline host only functions, use no keyword at all!
30#if !defined(GPUCA_GPUCODE) || defined(__OPENCL_HOST__) || defined(__METAL_HOST__) || defined(__CPUDEVICE__) // For host / ROOT dictionary, and for the CPUDevice backend whose device code runs on the host
50 #define GPUconstexpr() static constexpr // constexpr on GPU that needs to be instantiated for dynamic access (e.g. arrays), becomes __constant on GPU
51 #define GPUglobalconstexpr() constexpr // constexpr variable at program scope, needs the constant address space in MSL
52 #define GPUnoexcept() noexcept // noexcept where the backend supports it
119 #if !defined(__OPENCL__) // Other special defines for OpenCL 1
120 #define GPUCA_USE_TEMPLATE_ADDRESS_SPACES // TODO: check if we can make this (partially, where it is already implemented) compatible with OpenCL CPP