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

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