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

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

HIP Runtime API Reference: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-6.2.1/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#ifndef __HIP_PLATFORM_AMD__
35#define __HIP_PLATFORM_AMD__
36#endif
37#endif // defined(__clang__) && defined(__HIP__)
38
39// Auto enable __HIP_PLATFORM_NVIDIA__ if compiling with NVIDIA platform
40#if defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__) && !defined(__HIP__))
41#ifndef __HIP_PLATFORM_NVIDIA__
42#define __HIP_PLATFORM_NVIDIA__
43#endif
44
45#ifdef __CUDACC__
46#define __HIPCC__
47#endif
48
49#endif //__NVCC__
50
51// Auto enable __HIP_DEVICE_COMPILE__ if compiled in HCC or NVCC device path
52#if (defined(__HCC_ACCELERATOR__) && __HCC_ACCELERATOR__ != 0) || \
53 (defined(__CUDA_ARCH__) && __CUDA_ARCH__ != 0)
54#define __HIP_DEVICE_COMPILE__ 1
55#endif
56
57#ifdef __GNUC__
58#define HIP_PUBLIC_API __attribute__ ((visibility ("default")))
59#define HIP_INTERNAL_EXPORTED_API __attribute__ ((visibility ("default")))
60#else
61#define HIP_PUBLIC_API
62#define HIP_INTERNAL_EXPORTED_API
63#endif
64
65#if __HIP_DEVICE_COMPILE__ == 0
66// 32-bit Atomics
67#define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (0)
68#define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (0)
69#define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (0)
70#define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (0)
71#define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
72
73// 64-bit Atomics
74#define __HIP_ARCH_HAS_GLOBAL_INT64_ATOMICS__ (0)
75#define __HIP_ARCH_HAS_SHARED_INT64_ATOMICS__ (0)
76
77// Doubles
78#define __HIP_ARCH_HAS_DOUBLES__ (0)
79
80// Warp cross-lane operations
81#define __HIP_ARCH_HAS_WARP_VOTE__ (0)
82#define __HIP_ARCH_HAS_WARP_BALLOT__ (0)
83#define __HIP_ARCH_HAS_WARP_SHUFFLE__ (0)
84#define __HIP_ARCH_HAS_WARP_FUNNEL_SHIFT__ (0)
85
86// Sync
87#define __HIP_ARCH_HAS_THREAD_FENCE_SYSTEM__ (0)
88#define __HIP_ARCH_HAS_SYNC_THREAD_EXT__ (0)
89
90// Misc
91#define __HIP_ARCH_HAS_SURFACE_FUNCS__ (0)
92#define __HIP_ARCH_HAS_3DGRID__ (0)
93#define __HIP_ARCH_HAS_DYNAMIC_PARALLEL__ (0)
94#endif
95
96#if defined(__clang__)
97#pragma clang diagnostic pop
98#endif
99
100#endif