/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.7.0/include/hip/hip_common.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.7.0/include/hip/hip_common.h Source File#

HIP Runtime API Reference: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.7.0/include/hip/hip_common.h Source File
hip_common.h
Go to the documentation of this file.
1/*
2Copyright (c) 2015 - 2023 Advanced Micro Devices, Inc. All rights reserved.
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22
23#ifndef HIP_INCLUDE_HIP_HIP_COMMON_H
24#define HIP_INCLUDE_HIP_HIP_COMMON_H
25
26#if defined(__clang__)
27#pragma clang diagnostic push
28#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
29#endif
30// Common code included at start of every hip file.
31// Auto enable __HIP_PLATFORM_AMD__ if compiling on AMD platform
32// Other compiler (GCC,ICC,etc) need to set one of these macros explicitly
33#if defined(__clang__) && defined(__HIP__)
34// The following macro will be removed after upstream updation
35#ifndef __HIP_PLATFORM_HCC__
36#define __HIP_PLATFORM_HCC__
37#endif
38
39#ifndef __HIP_PLATFORM_AMD__
40#define __HIP_PLATFORM_AMD__
41#endif
42#endif // defined(__clang__) && defined(__HIP__)
43
44// Auto enable __HIP_PLATFORM_NVIDIA__ if compiling with NVIDIA platform
45#if defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__) && !defined(__HIP__))
46// The following macro will be removed after upstream updation
47#ifndef __HIP_PLATFORM_NVCC__
48#define __HIP_PLATFORM_NVCC__
49#endif
50
51#ifndef __HIP_PLATFORM_NVIDIA__
52#define __HIP_PLATFORM_NVIDIA__
53#endif
54
55#ifdef __CUDACC__
56#define __HIPCC__
57#endif
58
59#endif //__NVCC__
60
61// Auto enable __HIP_DEVICE_COMPILE__ if compiled in HCC or NVCC device path
62#if (defined(__HCC_ACCELERATOR__) && __HCC_ACCELERATOR__ != 0) || \
63 (defined(__CUDA_ARCH__) && __CUDA_ARCH__ != 0)
64#define __HIP_DEVICE_COMPILE__ 1
65#endif
66
67#ifdef __GNUC__
68#define HIP_PUBLIC_API __attribute__ ((visibility ("default")))
69#define HIP_INTERNAL_EXPORTED_API __attribute__ ((visibility ("default")))
70#else
71#define HIP_PUBLIC_API
72#define HIP_INTERNAL_EXPORTED_API
73#endif
74
75#if __HIP_DEVICE_COMPILE__ == 0
76// 32-bit Atomics
77#define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (0)
78#define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (0)
79#define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (0)
80#define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (0)
81#define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
82
83// 64-bit Atomics
84#define __HIP_ARCH_HAS_GLOBAL_INT64_ATOMICS__ (0)
85#define __HIP_ARCH_HAS_SHARED_INT64_ATOMICS__ (0)
86
87// Doubles
88#define __HIP_ARCH_HAS_DOUBLES__ (0)
89
90// Warp cross-lane operations
91#define __HIP_ARCH_HAS_WARP_VOTE__ (0)
92#define __HIP_ARCH_HAS_WARP_BALLOT__ (0)
93#define __HIP_ARCH_HAS_WARP_SHUFFLE__ (0)
94#define __HIP_ARCH_HAS_WARP_FUNNEL_SHIFT__ (0)
95
96// Sync
97#define __HIP_ARCH_HAS_THREAD_FENCE_SYSTEM__ (0)
98#define __HIP_ARCH_HAS_SYNC_THREAD_EXT__ (0)
99
100// Misc
101#define __HIP_ARCH_HAS_SURFACE_FUNCS__ (0)
102#define __HIP_ARCH_HAS_3DGRID__ (0)
103#define __HIP_ARCH_HAS_DYNAMIC_PARALLEL__ (0)
104#endif
105
106#if defined(__clang__)
107#pragma clang diagnostic pop
108#endif
109
110#endif