include/hip/hip_common.h Source File

include/hip/hip_common.h Source File#

HIP Runtime API Reference: include/hip/hip_common.h Source File
hip_common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#ifndef HIP_INCLUDE_HIP_HIP_COMMON_H
8#define HIP_INCLUDE_HIP_HIP_COMMON_H
9
10#if defined(__clang__)
11#pragma clang diagnostic push
12#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
13#endif
14// Common code included at start of every hip file.
15// Auto enable __HIP_PLATFORM_AMD__ if compiling on AMD platform
16// Other compiler (GCC,ICC,etc) need to set one of these macros explicitly
17#if defined(__clang__) && defined(__HIP__)
18#ifndef __HIP_PLATFORM_AMD__
19#define __HIP_PLATFORM_AMD__
20#endif
21#endif // defined(__clang__) && defined(__HIP__)
22
23// Auto enable __HIP_PLATFORM_NVIDIA__ if compiling with NVIDIA platform
24#if defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__) && !defined(__HIP__))
25#ifndef __HIP_PLATFORM_NVIDIA__
26#define __HIP_PLATFORM_NVIDIA__
27#endif
28
29#ifdef __CUDACC__
30#define __HIPCC__
31#endif
32
33#endif //__NVCC__
34
35// Auto enable __HIP_DEVICE_COMPILE__ if compiled in HCC or NVCC device path
36#if (defined(__HCC_ACCELERATOR__) && __HCC_ACCELERATOR__ != 0) || \
37 (defined(__CUDA_ARCH__) && __CUDA_ARCH__ != 0)
38#define __HIP_DEVICE_COMPILE__ 1
39#endif
40
41#if __HIP_DEVICE_COMPILE__ == 0
42// 32-bit Atomics
43#define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (0)
44#define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (0)
45#define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (0)
46#define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (0)
47#define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
48
49// 64-bit Atomics
50#define __HIP_ARCH_HAS_GLOBAL_INT64_ATOMICS__ (0)
51#define __HIP_ARCH_HAS_SHARED_INT64_ATOMICS__ (0)
52
53// Doubles
54#define __HIP_ARCH_HAS_DOUBLES__ (0)
55
56// Warp cross-lane operations
57#define __HIP_ARCH_HAS_WARP_VOTE__ (0)
58#define __HIP_ARCH_HAS_WARP_BALLOT__ (0)
59#define __HIP_ARCH_HAS_WARP_SHUFFLE__ (0)
60#define __HIP_ARCH_HAS_WARP_FUNNEL_SHIFT__ (0)
61
62// Sync
63#define __HIP_ARCH_HAS_THREAD_FENCE_SYSTEM__ (0)
64#define __HIP_ARCH_HAS_SYNC_THREAD_EXT__ (0)
65
66// Misc
67#define __HIP_ARCH_HAS_SURFACE_FUNCS__ (0)
68#define __HIP_ARCH_HAS_3DGRID__ (0)
69#define __HIP_ARCH_HAS_DYNAMIC_PARALLEL__ (0)
70#endif
71
72#if defined(__clang__)
73#pragma clang diagnostic pop
74#endif
75
76#define HIP_API_VERSION (HIP_VERSION_MAJOR * 100 + HIP_VERSION_MINOR)
77
78#ifndef HIP_FORCE_API_VERSION
79# define HIP_FORCE_API_VERSION HIP_API_VERSION
80#endif
81
82#endif