Warning: This file is not a C or C++ file. It does not have highlighting.
1 | //===---------- DeviceTypes.h - OpenMP types ---------------------- C++ -*-===// |
---|---|
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 | // |
10 | //===----------------------------------------------------------------------===// |
11 | |
12 | #ifndef OMPTARGET_TYPES_H |
13 | #define OMPTARGET_TYPES_H |
14 | |
15 | #include <gpuintrin.h> |
16 | #include <stddef.h> |
17 | #include <stdint.h> |
18 | |
19 | template <typename T> using Private = __gpu_private T; |
20 | template <typename T> using Constant = __gpu_constant T; |
21 | template <typename T> using Local = __gpu_local T; |
22 | template <typename T> using Global = __gpu_local T; |
23 | |
24 | enum omp_proc_bind_t { |
25 | omp_proc_bind_false = 0, |
26 | omp_proc_bind_true = 1, |
27 | omp_proc_bind_master = 2, |
28 | omp_proc_bind_close = 3, |
29 | omp_proc_bind_spread = 4 |
30 | }; |
31 | |
32 | enum omp_sched_t { |
33 | omp_sched_static = 1, /* chunkSize >0 */ |
34 | omp_sched_dynamic = 2, /* chunkSize >0 */ |
35 | omp_sched_guided = 3, /* chunkSize >0 */ |
36 | omp_sched_auto = 4, /* no chunkSize */ |
37 | }; |
38 | |
39 | enum kmp_sched_t { |
40 | kmp_sched_static_chunk = 33, |
41 | kmp_sched_static_nochunk = 34, |
42 | kmp_sched_dynamic = 35, |
43 | kmp_sched_guided = 36, |
44 | kmp_sched_runtime = 37, |
45 | kmp_sched_auto = 38, |
46 | |
47 | kmp_sched_static_balanced_chunk = 45, |
48 | |
49 | kmp_sched_static_ordered = 65, |
50 | kmp_sched_static_nochunk_ordered = 66, |
51 | kmp_sched_dynamic_ordered = 67, |
52 | kmp_sched_guided_ordered = 68, |
53 | kmp_sched_runtime_ordered = 69, |
54 | kmp_sched_auto_ordered = 70, |
55 | |
56 | kmp_sched_distr_static_chunk = 91, |
57 | kmp_sched_distr_static_nochunk = 92, |
58 | kmp_sched_distr_static_chunk_sched_static_chunkone = 93, |
59 | |
60 | kmp_sched_default = kmp_sched_static_nochunk, |
61 | kmp_sched_unordered_first = kmp_sched_static_chunk, |
62 | kmp_sched_unordered_last = kmp_sched_auto, |
63 | kmp_sched_ordered_first = kmp_sched_static_ordered, |
64 | kmp_sched_ordered_last = kmp_sched_auto_ordered, |
65 | kmp_sched_distribute_first = kmp_sched_distr_static_chunk, |
66 | kmp_sched_distribute_last = |
67 | kmp_sched_distr_static_chunk_sched_static_chunkone, |
68 | |
69 | /* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers. |
70 | * Since we need to distinguish the three possible cases (no modifier, |
71 | * monotonic modifier, nonmonotonic modifier), we need separate bits for |
72 | * each modifier. The absence of monotonic does not imply nonmonotonic, |
73 | * especially since 4.5 says that the behaviour of the "no modifier" case |
74 | * is implementation defined in 4.5, but will become "nonmonotonic" in 5.0. |
75 | * |
76 | * Since we're passing a full 32 bit value, we can use a couple of high |
77 | * bits for these flags; out of paranoia we avoid the sign bit. |
78 | * |
79 | * These modifiers can be or-ed into non-static schedules by the compiler |
80 | * to pass the additional information. They will be stripped early in the |
81 | * processing in __kmp_dispatch_init when setting up schedules, so |
82 | * most of the code won't ever see schedules with these bits set. |
83 | */ |
84 | kmp_sched_modifier_monotonic = (1 << 29), |
85 | /**< Set if the monotonic schedule modifier was present */ |
86 | kmp_sched_modifier_nonmonotonic = (1 << 30), |
87 | /**< Set if the nonmonotonic schedule modifier was present */ |
88 | |
89 | #define SCHEDULE_WITHOUT_MODIFIERS(s) \ |
90 | (enum kmp_sched_t)( \ |
91 | (s) & ~(kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic)) |
92 | #define SCHEDULE_HAS_MONOTONIC(s) (((s) & kmp_sched_modifier_monotonic) != 0) |
93 | #define SCHEDULE_HAS_NONMONOTONIC(s) \ |
94 | (((s) & kmp_sched_modifier_nonmonotonic) != 0) |
95 | #define SCHEDULE_HAS_NO_MODIFIERS(s) \ |
96 | (((s) & (kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic)) == \ |
97 | 0) |
98 | |
99 | }; |
100 | |
101 | struct TaskDescriptorTy; |
102 | using TaskFnTy = int32_t (*)(int32_t global_tid, TaskDescriptorTy *taskDescr); |
103 | struct TaskDescriptorTy { |
104 | void *Payload; |
105 | TaskFnTy TaskFn; |
106 | }; |
107 | |
108 | using LaneMaskTy = uint64_t; |
109 | |
110 | namespace lanes { |
111 | enum : LaneMaskTy { All = ~(LaneMaskTy)0 }; |
112 | } // namespace lanes |
113 | |
114 | /// The ident structure that describes a source location. The struct is |
115 | /// identical to the one in the kmp.h file. We maintain the same data structure |
116 | /// for compatibility. |
117 | struct IdentTy { |
118 | int32_t reserved_1; /**< might be used in Fortran; see above */ |
119 | int32_t flags; /**< also f.flags; KMP_IDENT_xxx flags; KMP_IDENT_KMPC |
120 | identifies this union member */ |
121 | int32_t reserved_2; /**< not really used in Fortran any more; see above */ |
122 | int32_t reserved_3; /**< source[4] in Fortran, do not use for C++ */ |
123 | char const *psource; /**< String describing the source location. |
124 | The string is composed of semi-colon separated fields |
125 | which describe the source file, the function and a pair |
126 | of line numbers that delimit the construct. */ |
127 | }; |
128 | |
129 | using __kmpc_impl_lanemask_t = LaneMaskTy; |
130 | |
131 | using ParallelRegionFnTy = void *; |
132 | |
133 | using CriticalNameTy = int32_t[8]; |
134 | |
135 | struct omp_lock_t { |
136 | void *Lock; |
137 | }; |
138 | |
139 | using InterWarpCopyFnTy = void (*)(void *src, int32_t warp_num); |
140 | using ShuffleReductFnTy = void (*)(void *rhsData, int16_t lane_id, |
141 | int16_t lane_offset, int16_t shortCircuit); |
142 | using ListGlobalFnTy = void (*)(void *buffer, int idx, void *reduce_data); |
143 | |
144 | /// Macros for allocating variables in different address spaces. |
145 | ///{ |
146 | |
147 | // Follows the pattern in interface.h |
148 | typedef enum omp_allocator_handle_t { |
149 | omp_null_allocator = 0, |
150 | omp_default_mem_alloc = 1, |
151 | omp_large_cap_mem_alloc = 2, |
152 | omp_const_mem_alloc = 3, |
153 | omp_high_bw_mem_alloc = 4, |
154 | omp_low_lat_mem_alloc = 5, |
155 | omp_cgroup_mem_alloc = 6, |
156 | omp_pteam_mem_alloc = 7, |
157 | omp_thread_mem_alloc = 8, |
158 | KMP_ALLOCATOR_MAX_HANDLE = ~(0LU) |
159 | } omp_allocator_handle_t; |
160 | |
161 | #define __PRAGMA(STR) _Pragma(#STR) |
162 | #define OMP_PRAGMA(STR) __PRAGMA(omp STR) |
163 | |
164 | ///} |
165 | |
166 | #endif |
167 |
Warning: This file is not a C or C++ file. It does not have highlighting.