[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / openmp / libomptarget / deviceRTLs / amdgcn / src / target_impl.h
blob1303258f17494da53511c62542294af40376de98
1 //===------- target_impl.h - AMDGCN OpenMP GPU implementation ----- HIP -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Declarations and definitions of target specific functions and constants
11 //===----------------------------------------------------------------------===//
12 #ifndef OMPTARGET_AMDGCN_TARGET_IMPL_H
13 #define OMPTARGET_AMDGCN_TARGET_IMPL_H
15 #ifndef __AMDGCN__
16 #error "amdgcn target_impl.h expects to be compiled under __AMDGCN__"
17 #endif
19 #include "amdgcn_interface.h"
21 #include <stddef.h>
22 #include <stdint.h>
24 // subset of inttypes.h
25 #define PRId64 "ld"
26 #define PRIu64 "lu"
28 typedef uint64_t __kmpc_impl_lanemask_t;
30 #define INLINE inline
31 #define NOINLINE __attribute__((noinline))
32 #define ALIGN(N) __attribute__((aligned(N)))
33 #define PLUGIN_ACCESSIBLE \
34 __attribute__((used)) /* Don't discard values the plugin reads */ \
35 __attribute__((weak)) /* We may have multiple definitions */ \
36 __attribute__((retain)) /* Also needed to keep values alive */ \
37 __attribute__((visibility("default"))) /* Access via SHT_HASH */ \
38 __attribute__((section(".data"))) /* Not .bss, can write before load */
40 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
42 INLINE constexpr const llvm::omp::GV &getGridValue() {
43 return llvm::omp::getAMDGPUGridValues<__AMDGCN_WAVEFRONT_SIZE>();
46 ////////////////////////////////////////////////////////////////////////////////
47 // Kernel options
48 ////////////////////////////////////////////////////////////////////////////////
50 ////////////////////////////////////////////////////////////////////////////////
51 // The following def must match the absolute limit hardwired in the host RTL
52 // max number of threads per team
53 enum { MAX_THREADS_PER_TEAM = getGridValue().GV_Max_WG_Size };
54 enum { WARPSIZE = getGridValue().GV_Warp_Size };
56 // Maximum number of omp state objects per SM allocated statically in global
57 // memory.
58 #define OMP_STATE_COUNT 32
59 #define MAX_SM 64
61 #define OMP_ACTIVE_PARALLEL_LEVEL 128
63 // Data sharing related quantities, need to match what is used in the compiler.
64 enum DATA_SHARING_SIZES {
65 // The size reserved for data in a shared memory slot.
66 DS_Slot_Size = getGridValue().GV_Slot_Size,
67 // The slot size that should be reserved for a working warp.
68 DS_Worker_Warp_Slot_Size = getGridValue().warpSlotSize(),
69 // The maximum number of warps in use
70 DS_Max_Warp_Number = getGridValue().maxWarpNumber(),
73 enum : __kmpc_impl_lanemask_t {
74 __kmpc_impl_all_lanes = ~(__kmpc_impl_lanemask_t)0
77 // The return code of printf is not checked in the call sites in this library.
78 // A call to a function named printf currently hits some special case handling
79 // for opencl, which translates to calls that do not presently exist for openmp
80 // Therefore, for now, stub out printf while building this library.
81 #define printf(...)
83 #endif