| 1 |
/* Communication between GCC and libgomp. |
| 2 |
|
| 3 |
Copyright (C) 2014-2025 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
Contributed by Mentor Embedded. |
| 6 |
|
| 7 |
This file is part of the GNU Offloading and Multi Processing Library |
| 8 |
(libgomp). |
| 9 |
|
| 10 |
Libgomp is free software; you can redistribute it and/or modify it |
| 11 |
under the terms of the GNU General Public License as published by |
| 12 |
the Free Software Foundation; either version 3, or (at your option) |
| 13 |
any later version. |
| 14 |
|
| 15 |
Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY |
| 16 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 17 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 18 |
more details. |
| 19 |
|
| 20 |
Under Section 7 of GPL version 3, you are granted additional |
| 21 |
permissions described in the GCC Runtime Library Exception, version |
| 22 |
3.1, as published by the Free Software Foundation. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public License and |
| 25 |
a copy of the GCC Runtime Library Exception along with this program; |
| 26 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 27 |
<http://www.gnu.org/licenses/>. */ |
| 28 |
|
| 29 |
#ifndef GOMP_CONSTANTS_H |
| 30 |
#define GOMP_CONSTANTS_H 1 |
| 31 |
|
| 32 |
/* Memory mapping types. */ |
| 33 |
|
| 34 |
/* One byte. */ |
| 35 |
#define GOMP_MAP_LAST (1 << 8) |
| 36 |
|
| 37 |
#define GOMP_MAP_FLAG_TO (1 << 0) |
| 38 |
#define GOMP_MAP_FLAG_FROM (1 << 1) |
| 39 |
/* Special map kinds, enumerated starting here. */ |
| 40 |
#define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2) |
| 41 |
#define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3) |
| 42 |
#define GOMP_MAP_FLAG_SPECIAL_2 (1 << 4) |
| 43 |
#define GOMP_MAP_FLAG_SPECIAL_3 (1 << 5) |
| 44 |
#define GOMP_MAP_FLAG_SPECIAL_4 (1 << 6) |
| 45 |
#define GOMP_MAP_FLAG_SPECIAL_5 (1 << 7) |
| 46 |
#define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \ |
| 47 |
| GOMP_MAP_FLAG_SPECIAL_0) |
| 48 |
#define GOMP_MAP_DEEP_COPY (GOMP_MAP_FLAG_SPECIAL_4 \ |
| 49 |
| GOMP_MAP_FLAG_SPECIAL_2) |
| 50 |
/* This value indicates the map was created implicitly according to |
| 51 |
OpenMP rules. */ |
| 52 |
#define GOMP_MAP_IMPLICIT (GOMP_MAP_FLAG_SPECIAL_3 \ |
| 53 |
| GOMP_MAP_FLAG_SPECIAL_4) |
| 54 |
/* Mask for entire set of special map kind bits. */ |
| 55 |
#define GOMP_MAP_FLAG_SPECIAL_BITS (GOMP_MAP_FLAG_SPECIAL_0 \ |
| 56 |
| GOMP_MAP_FLAG_SPECIAL_1 \ |
| 57 |
| GOMP_MAP_FLAG_SPECIAL_2 \ |
| 58 |
| GOMP_MAP_FLAG_SPECIAL_3 \ |
| 59 |
| GOMP_MAP_FLAG_SPECIAL_4 \ |
| 60 |
| GOMP_MAP_FLAG_SPECIAL_5) |
| 61 |
/* Flag to force a specific behavior (or else, trigger a run-time error). */ |
| 62 |
#define GOMP_MAP_FLAG_FORCE (GOMP_MAP_FLAG_SPECIAL_5) |
| 63 |
#define GOMP_MAP_FLAG_PRESENT (GOMP_MAP_FLAG_SPECIAL_5 \ |
| 64 |
| GOMP_MAP_FLAG_SPECIAL_0) |
| 65 |
#define GOMP_MAP_FLAG_ALWAYS_PRESENT (GOMP_MAP_FLAG_SPECIAL_2 \ |
| 66 |
| GOMP_MAP_FLAG_PRESENT) |
| 67 |
|
| 68 |
enum gomp_map_kind |
| 69 |
{ |
| 70 |
/* If not already present, allocate. */ |
| 71 |
GOMP_MAP_ALLOC = 0, |
| 72 |
/* ..., and copy to device. */ |
| 73 |
GOMP_MAP_TO = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO), |
| 74 |
/* ..., and copy from device. */ |
| 75 |
GOMP_MAP_FROM = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM), |
| 76 |
/* ..., and copy to and from device. */ |
| 77 |
GOMP_MAP_TOFROM = (GOMP_MAP_TO | GOMP_MAP_FROM), |
| 78 |
/* The following kind is an internal only map kind, used for pointer based |
| 79 |
array sections. OMP_CLAUSE_SIZE for these is not the pointer size, |
| 80 |
which is implicitly POINTER_SIZE_UNITS, but the bias. */ |
| 81 |
GOMP_MAP_POINTER = (GOMP_MAP_FLAG_SPECIAL_0 | 0), |
| 82 |
/* Also internal, behaves like GOMP_MAP_TO, but additionally any |
| 83 |
GOMP_MAP_POINTER records consecutive after it which have addresses |
| 84 |
falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't |
| 85 |
mapped already. |
| 86 |
For OpenACC attach operations (e.g. copyin of struct members), |
| 87 |
GOMP_MAP_TO_PSET is followed by a single GOMP_MAP_ATTACH mapping |
| 88 |
instead. */ |
| 89 |
GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1), |
| 90 |
/* Must already be present. */ |
| 91 |
GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2), |
| 92 |
/* Deallocate a mapping, without copying from device. */ |
| 93 |
GOMP_MAP_DELETE = (GOMP_MAP_FLAG_SPECIAL_0 | 3), |
| 94 |
/* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly |
| 95 |
POINTER_SIZE_UNITS. */ |
| 96 |
GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0), |
| 97 |
/* OpenACC device_resident. */ |
| 98 |
GOMP_MAP_DEVICE_RESIDENT = (GOMP_MAP_FLAG_SPECIAL_1 | 1), |
| 99 |
/* OpenACC link. */ |
| 100 |
GOMP_MAP_LINK = (GOMP_MAP_FLAG_SPECIAL_1 | 2), |
| 101 |
/* Use device data if present, fall back to host address otherwise. */ |
| 102 |
GOMP_MAP_IF_PRESENT = (GOMP_MAP_FLAG_SPECIAL_1 | 3), |
| 103 |
/* Do not map, copy bits for firstprivate instead. */ |
| 104 |
GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0), |
| 105 |
/* Similarly, but store the value in the pointer rather than |
| 106 |
pointed by the pointer. */ |
| 107 |
GOMP_MAP_FIRSTPRIVATE_INT = (GOMP_MAP_FLAG_SPECIAL | 1), |
| 108 |
/* Pointer translate host address into device address and copy that |
| 109 |
back to host. */ |
| 110 |
GOMP_MAP_USE_DEVICE_PTR = (GOMP_MAP_FLAG_SPECIAL | 2), |
| 111 |
/* Allocate a zero length array section. Prefer next non-zero length |
| 112 |
mapping over previous non-zero length mapping over zero length mapping |
| 113 |
at the address. If not already mapped, do nothing (and pointer translate |
| 114 |
to NULL). */ |
| 115 |
GOMP_MAP_ZERO_LEN_ARRAY_SECTION = (GOMP_MAP_FLAG_SPECIAL | 3), |
| 116 |
/* Allocate. */ |
| 117 |
GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC), |
| 118 |
/* ..., and copy to device. */ |
| 119 |
GOMP_MAP_FORCE_TO = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO), |
| 120 |
/* ..., and copy from device. */ |
| 121 |
GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM), |
| 122 |
/* ..., and copy to and from device. */ |
| 123 |
GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM), |
| 124 |
/* Like GOMP_MAP_USE_DEVICE_PTR above, translate a host to a device |
| 125 |
address. If translation fails because the target is not mapped, |
| 126 |
continue using the host address. */ |
| 127 |
GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT = (GOMP_MAP_FLAG_SPECIAL_2 | 0), |
| 128 |
/* If not already present, allocate. And unconditionally copy to |
| 129 |
device. */ |
| 130 |
GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_TO), |
| 131 |
/* If not already present, allocate. And unconditionally copy from |
| 132 |
device. */ |
| 133 |
GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_SPECIAL_2 |
| 134 |
| GOMP_MAP_FROM), |
| 135 |
/* If not already present, allocate. And unconditionally copy to and from |
| 136 |
device. */ |
| 137 |
GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_SPECIAL_2 |
| 138 |
| GOMP_MAP_TOFROM), |
| 139 |
/* Must already be present, unconditionally copy to device. */ |
| 140 |
GOMP_MAP_ALWAYS_PRESENT_TO = (GOMP_MAP_FLAG_ALWAYS_PRESENT |
| 141 |
| GOMP_MAP_TO), |
| 142 |
/* Must already be present, unconditionally copy from device. */ |
| 143 |
GOMP_MAP_ALWAYS_PRESENT_FROM = (GOMP_MAP_FLAG_ALWAYS_PRESENT |
| 144 |
| GOMP_MAP_FROM), |
| 145 |
/* Must already be present, unconditionally copy to and from device. */ |
| 146 |
GOMP_MAP_ALWAYS_PRESENT_TOFROM = (GOMP_MAP_FLAG_ALWAYS_PRESENT |
| 147 |
| GOMP_MAP_TOFROM), |
| 148 |
/* Map a sparse struct; the address is the base of the structure, alignment |
| 149 |
it's required alignment, and size is the number of adjacent entries |
| 150 |
that belong to the struct. The adjacent entries should be sorted by |
| 151 |
increasing address, so it is easy to determine lowest needed address |
| 152 |
(address of the first adjacent entry) and highest needed address |
| 153 |
(address of the last adjacent entry plus its size). */ |
| 154 |
GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_SPECIAL_2 |
| 155 |
| GOMP_MAP_FLAG_SPECIAL | 0), |
| 156 |
/* As above, but followed by an unordered list of adjacent entries. |
| 157 |
At present, this is used only to diagnose incorrect usage of variable |
| 158 |
indices into arrays of structs. */ |
| 159 |
GOMP_MAP_STRUCT_UNORD = (GOMP_MAP_FLAG_SPECIAL_4 |
| 160 |
| GOMP_MAP_FLAG_SPECIAL_2 |
| 161 |
| GOMP_MAP_FLAG_SPECIAL | 0), |
| 162 |
/* On a location of a pointer/reference that is assumed to be already mapped |
| 163 |
earlier, store the translated address of the preceeding mapping. |
| 164 |
No refcount is bumped by this, and the store is done unconditionally. */ |
| 165 |
GOMP_MAP_ALWAYS_POINTER = (GOMP_MAP_FLAG_SPECIAL_2 |
| 166 |
| GOMP_MAP_FLAG_SPECIAL | 1), |
| 167 |
/* Like GOMP_MAP_POINTER, but allow zero-length array section, i.e. set to |
| 168 |
NULL if target is not mapped. */ |
| 169 |
GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION |
| 170 |
= (GOMP_MAP_FLAG_SPECIAL_2 |
| 171 |
| GOMP_MAP_FLAG_SPECIAL | 2), |
| 172 |
/* Forced deallocation of zero length array section. */ |
| 173 |
GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION |
| 174 |
= (GOMP_MAP_FLAG_SPECIAL_2 |
| 175 |
| GOMP_MAP_FLAG_SPECIAL | 3), |
| 176 |
/* Decrement usage count and deallocate if zero. */ |
| 177 |
GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_SPECIAL_2 |
| 178 |
| GOMP_MAP_DELETE), |
| 179 |
/* The attach/detach mappings below use the OMP_CLAUSE_SIZE field as a |
| 180 |
bias. This will typically be zero, except when mapping an array slice |
| 181 |
with a non-zero base. In that case the bias will indicate the |
| 182 |
(positive) difference between the start of the actual mapped data and |
| 183 |
the "virtual" origin of the array. |
| 184 |
In OpenACC, attach a pointer to a mapped struct field. */ |
| 185 |
GOMP_MAP_ATTACH = (GOMP_MAP_DEEP_COPY | 0), |
| 186 |
/* In OpenACC, detach a pointer to a mapped struct field. */ |
| 187 |
GOMP_MAP_DETACH = (GOMP_MAP_DEEP_COPY | 1), |
| 188 |
/* In OpenACC, detach a pointer to a mapped struct field. */ |
| 189 |
GOMP_MAP_FORCE_DETACH = (GOMP_MAP_DEEP_COPY |
| 190 |
| GOMP_MAP_FLAG_FORCE | 1), |
| 191 |
|
| 192 |
/* Like GOMP_MAP_ATTACH, but allow attaching to zero-length array sections |
| 193 |
(i.e. set to NULL when array section is not mapped) Currently only used |
| 194 |
by OpenMP. */ |
| 195 |
GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION |
| 196 |
= (GOMP_MAP_DEEP_COPY | 2), |
| 197 |
|
| 198 |
/* Internal to GCC, not used in libgomp. */ |
| 199 |
/* Do not map, but pointer assign a pointer instead. */ |
| 200 |
GOMP_MAP_FIRSTPRIVATE_POINTER = (GOMP_MAP_LAST | 1), |
| 201 |
/* Do not map, but pointer assign a reference instead. */ |
| 202 |
GOMP_MAP_FIRSTPRIVATE_REFERENCE = (GOMP_MAP_LAST | 2), |
| 203 |
/* An attach or detach operation. Rewritten to the appropriate type during |
| 204 |
gimplification, depending on directive (i.e. "enter data" or |
| 205 |
parallel/kernels region vs. "exit data"). */ |
| 206 |
GOMP_MAP_ATTACH_DETACH = (GOMP_MAP_LAST | 3), |
| 207 |
/* Must already be present - all of following map to GOMP_MAP_FORCE_PRESENT |
| 208 |
as no data transfer is needed. */ |
| 209 |
GOMP_MAP_PRESENT_ALLOC = (GOMP_MAP_LAST | 4), |
| 210 |
GOMP_MAP_PRESENT_TO = (GOMP_MAP_LAST | 5), |
| 211 |
GOMP_MAP_PRESENT_FROM = (GOMP_MAP_LAST | 6), |
| 212 |
GOMP_MAP_PRESENT_TOFROM = (GOMP_MAP_LAST | 7) |
| 213 |
}; |
| 214 |
|
| 215 |
#define GOMP_MAP_COPY_TO_P(X) \ |
| 216 |
((!((X) & GOMP_MAP_FLAG_SPECIAL) || GOMP_MAP_PRESENT_P (X)) \ |
| 217 |
&& ((X) & GOMP_MAP_FLAG_TO)) |
| 218 |
|
| 219 |
#define GOMP_MAP_COPY_FROM_P(X) \ |
| 220 |
((!((X) & GOMP_MAP_FLAG_SPECIAL) || GOMP_MAP_PRESENT_P (X)) \ |
| 221 |
&& ((X) & GOMP_MAP_FLAG_FROM)) |
| 222 |
|
| 223 |
#define GOMP_MAP_ALWAYS_POINTER_P(X) \ |
| 224 |
((X) == GOMP_MAP_ALWAYS_POINTER) |
| 225 |
|
| 226 |
#define GOMP_MAP_POINTER_P(X) \ |
| 227 |
((X) == GOMP_MAP_POINTER \ |
| 228 |
|| (X) == GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION) |
| 229 |
|
| 230 |
#define GOMP_MAP_ALWAYS_TO_P(X) \ |
| 231 |
(((X) == GOMP_MAP_ALWAYS_TO) || ((X) == GOMP_MAP_ALWAYS_TOFROM) \ |
| 232 |
|| ((X) == GOMP_MAP_ALWAYS_PRESENT_TO) \ |
| 233 |
|| ((X) == GOMP_MAP_ALWAYS_PRESENT_TOFROM)) |
| 234 |
|
| 235 |
#define GOMP_MAP_ALWAYS_FROM_P(X) \ |
| 236 |
(((X) == GOMP_MAP_ALWAYS_FROM) || ((X) == GOMP_MAP_ALWAYS_TOFROM) \ |
| 237 |
|| ((X) == GOMP_MAP_ALWAYS_PRESENT_FROM) \ |
| 238 |
|| ((X) == GOMP_MAP_ALWAYS_PRESENT_TOFROM)) |
| 239 |
|
| 240 |
#define GOMP_MAP_ALWAYS_P(X) \ |
| 241 |
(GOMP_MAP_ALWAYS_TO_P (X) || GOMP_MAP_ALWAYS_FROM_P (X)) |
| 242 |
|
| 243 |
#define GOMP_MAP_IMPLICIT_P(X) \ |
| 244 |
(((X) & GOMP_MAP_FLAG_SPECIAL_BITS) == GOMP_MAP_IMPLICIT) |
| 245 |
|
| 246 |
#define GOMP_MAP_FORCE_P(X) \ |
| 247 |
(((X) & GOMP_MAP_FLAG_SPECIAL_BITS) == GOMP_MAP_FLAG_FORCE) |
| 248 |
|
| 249 |
#define GOMP_MAP_PRESENT_P(X) \ |
| 250 |
(((X) & GOMP_MAP_FLAG_PRESENT) == GOMP_MAP_FLAG_PRESENT \ |
| 251 |
|| (X) == GOMP_MAP_FORCE_PRESENT) |
| 252 |
|
| 253 |
|
| 254 |
/* Asynchronous behavior. Keep in sync with |
| 255 |
libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */ |
| 256 |
|
| 257 |
#define GOMP_ASYNC_NOVAL -1 |
| 258 |
#define GOMP_ASYNC_SYNC -2 |
| 259 |
|
| 260 |
|
| 261 |
/* Device codes. Keep in sync with |
| 262 |
libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as |
| 263 |
libgomp/libgomp-plugin.h. */ |
| 264 |
#define GOMP_DEVICE_NONE 0 |
| 265 |
#define GOMP_DEVICE_DEFAULT 1 |
| 266 |
#define GOMP_DEVICE_HOST 2 |
| 267 |
/* #define GOMP_DEVICE_HOST_NONSHM 3 removed. */ |
| 268 |
#define GOMP_DEVICE_NOT_HOST 4 |
| 269 |
#define GOMP_DEVICE_NVIDIA_PTX 5 |
| 270 |
/* #define GOMP_DEVICE_INTEL_MIC 6 removed. */ |
| 271 |
/* #define GOMP_DEVICE_HSA 7 removed. */ |
| 272 |
#define GOMP_DEVICE_GCN 8 |
| 273 |
|
| 274 |
/* We have a compatibility issue. OpenMP 5.2 introduced |
| 275 |
omp_initial_device with value of -1 which clashes with our |
| 276 |
GOMP_DEVICE_ICV, so we need to remap user supplied device |
| 277 |
ids, -1 (aka omp_initial_device) to GOMP_DEVICE_HOST_FALLBACK, |
| 278 |
and -2 (one of many non-conforming device numbers, but with |
| 279 |
OMP_TARGET_OFFLOAD=mandatory needs to be treated a |
| 280 |
omp_invalid_device) to -3 (so that for dev_num >= -2U we can |
| 281 |
subtract 1). -4 is then what we use for omp_invalid_device, |
| 282 |
which unlike the other non-conforming device numbers results |
| 283 |
in fatal error regardless of OMP_TARGET_OFFLOAD. |
| 284 |
Furthermore, OpenMP 6.1 exposes the default device to the user; hence, |
| 285 |
GOMP_DEVICE_DEFAULT_OMP_61 can be used for it, |
| 286 |
with and without remapped device numbers. */ |
| 287 |
#define GOMP_DEVICE_ICV -1 |
| 288 |
#define GOMP_DEVICE_HOST_FALLBACK -2 |
| 289 |
#define GOMP_DEVICE_INVALID -4 |
| 290 |
#define GOMP_DEVICE_DEFAULT_OMP_61 -5 |
| 291 |
|
| 292 |
/* GOMP_task/GOMP_taskloop* flags argument. */ |
| 293 |
#define GOMP_TASK_FLAG_UNTIED (1 << 0) |
| 294 |
#define GOMP_TASK_FLAG_FINAL (1 << 1) |
| 295 |
#define GOMP_TASK_FLAG_MERGEABLE (1 << 2) |
| 296 |
#define GOMP_TASK_FLAG_DEPEND (1 << 3) |
| 297 |
#define GOMP_TASK_FLAG_PRIORITY (1 << 4) |
| 298 |
#define GOMP_TASK_FLAG_UP (1 << 8) |
| 299 |
#define GOMP_TASK_FLAG_GRAINSIZE (1 << 9) |
| 300 |
#define GOMP_TASK_FLAG_IF (1 << 10) |
| 301 |
#define GOMP_TASK_FLAG_NOGROUP (1 << 11) |
| 302 |
#define GOMP_TASK_FLAG_REDUCTION (1 << 12) |
| 303 |
#define GOMP_TASK_FLAG_DETACH (1 << 13) |
| 304 |
#define GOMP_TASK_FLAG_STRICT (1 << 14) |
| 305 |
|
| 306 |
/* GOMP_target{_ext,update_ext,enter_exit_data} flags argument. */ |
| 307 |
#define GOMP_TARGET_FLAG_NOWAIT (1 << 0) |
| 308 |
#define GOMP_TARGET_FLAG_EXIT_DATA (1 << 1) |
| 309 |
/* Internal to libgomp. */ |
| 310 |
#define GOMP_TARGET_FLAG_UPDATE (1U << 31) |
| 311 |
|
| 312 |
|
| 313 |
/* OpenACC construct flags. */ |
| 314 |
|
| 315 |
/* Force host fallback execution. */ |
| 316 |
#define GOACC_FLAG_HOST_FALLBACK (1 << 0) |
| 317 |
/* Execute on local device (i.e. host multicore CPU). */ |
| 318 |
#define GOACC_FLAG_LOCAL_DEVICE (1 << 1) |
| 319 |
|
| 320 |
/* For legacy reasons, in the ABI, the GOACC_FLAGs are encoded as an inverted |
| 321 |
bitmask. */ |
| 322 |
#define GOACC_FLAGS_MARSHAL_OP BIT_NOT_EXPR |
| 323 |
#define GOACC_FLAGS_UNMARSHAL(X) (~(X)) |
| 324 |
|
| 325 |
|
| 326 |
/* Versions of libgomp and device-specific plugins. GOMP_VERSION |
| 327 |
should be incremented whenever an ABI-incompatible change is introduced |
| 328 |
to the plugin interface defined in libgomp/libgomp.h. */ |
| 329 |
#define GOMP_VERSION 3 |
| 330 |
#define GOMP_VERSION_NVIDIA_PTX 1 |
| 331 |
#define GOMP_VERSION_GCN 3 |
| 332 |
|
| 333 |
#define GOMP_VERSION_PACK(LIB, DEV) (((LIB) << 16) | (DEV)) |
| 334 |
#define GOMP_VERSION_LIB(PACK) (((PACK) >> 16) & 0xffff) |
| 335 |
#define GOMP_VERSION_DEV(PACK) ((PACK) & 0xffff) |
| 336 |
|
| 337 |
#define GOMP_VERSION_SUPPORTS_INDIRECT_FUNCS(VER) (GOMP_VERSION_LIB(VER) >= 3) |
| 338 |
|
| 339 |
#define GOMP_DIM_GANG 0 |
| 340 |
#define GOMP_DIM_WORKER 1 |
| 341 |
#define GOMP_DIM_VECTOR 2 |
| 342 |
#define GOMP_DIM_MAX 3 |
| 343 |
#define GOMP_DIM_MASK(X) (1u << (X)) |
| 344 |
|
| 345 |
/* Varadic launch arguments. End of list is marked by a zero. */ |
| 346 |
#define GOMP_LAUNCH_DIM 1 /* Launch dimensions, op = mask */ |
| 347 |
#define GOMP_LAUNCH_ASYNC 2 /* Async, op = cst val if not MAX */ |
| 348 |
#define GOMP_LAUNCH_WAIT 3 /* Waits, op = num waits. */ |
| 349 |
#define GOMP_LAUNCH_CODE_SHIFT 28 |
| 350 |
#define GOMP_LAUNCH_DEVICE_SHIFT 16 |
| 351 |
#define GOMP_LAUNCH_OP_SHIFT 0 |
| 352 |
#define GOMP_LAUNCH_PACK(CODE,DEVICE,OP) \ |
| 353 |
(((CODE) << GOMP_LAUNCH_CODE_SHIFT) \ |
| 354 |
| ((DEVICE) << GOMP_LAUNCH_DEVICE_SHIFT) \ |
| 355 |
| ((OP) << GOMP_LAUNCH_OP_SHIFT)) |
| 356 |
#define GOMP_LAUNCH_CODE(X) (((X) >> GOMP_LAUNCH_CODE_SHIFT) & 0xf) |
| 357 |
#define GOMP_LAUNCH_DEVICE(X) (((X) >> GOMP_LAUNCH_DEVICE_SHIFT) & 0xfff) |
| 358 |
#define GOMP_LAUNCH_OP(X) (((X) >> GOMP_LAUNCH_OP_SHIFT) & 0xffff) |
| 359 |
#define GOMP_LAUNCH_OP_MAX 0xffff |
| 360 |
|
| 361 |
/* Bitmask to apply in order to find out the intended device of a target |
| 362 |
argument. */ |
| 363 |
#define GOMP_TARGET_ARG_DEVICE_MASK ((1 << 7) - 1) |
| 364 |
/* The target argument is significant for all devices. */ |
| 365 |
#define GOMP_TARGET_ARG_DEVICE_ALL 0 |
| 366 |
|
| 367 |
/* Flag set when the subsequent element in the device-specific argument |
| 368 |
values. */ |
| 369 |
#define GOMP_TARGET_ARG_SUBSEQUENT_PARAM (1 << 7) |
| 370 |
|
| 371 |
/* Bitmask to apply to a target argument to find out the value identifier. */ |
| 372 |
#define GOMP_TARGET_ARG_ID_MASK (((1 << 8) - 1) << 8) |
| 373 |
/* Target argument index of NUM_TEAMS. */ |
| 374 |
#define GOMP_TARGET_ARG_NUM_TEAMS (1 << 8) |
| 375 |
/* Target argument index of THREAD_LIMIT. */ |
| 376 |
#define GOMP_TARGET_ARG_THREAD_LIMIT (2 << 8) |
| 377 |
|
| 378 |
/* If the value is directly embeded in target argument, it should be a 16-bit |
| 379 |
at most and shifted by this many bits. */ |
| 380 |
#define GOMP_TARGET_ARG_VALUE_SHIFT 16 |
| 381 |
|
| 382 |
/* Dependence types in omp_depend_t objects. */ |
| 383 |
#define GOMP_DEPEND_IN 1 |
| 384 |
#define GOMP_DEPEND_OUT 2 |
| 385 |
#define GOMP_DEPEND_INOUT 3 |
| 386 |
#define GOMP_DEPEND_MUTEXINOUTSET 4 |
| 387 |
#define GOMP_DEPEND_INOUTSET 5 |
| 388 |
|
| 389 |
/* Predefined allocator value ranges. */ |
| 390 |
#define GOMP_OMP_PREDEF_ALLOC_MAX 8 |
| 391 |
#define GOMP_OMPX_PREDEF_ALLOC_MIN 200 |
| 392 |
#define GOMP_OMPX_PREDEF_ALLOC_MAX 200 |
| 393 |
|
| 394 |
/* Predefined allocator with access == thread. */ |
| 395 |
#define GOMP_OMP_PREDEF_ALLOC_THREADS 8 |
| 396 |
|
| 397 |
/* Flag values for OpenMP 'requires' directive features. */ |
| 398 |
// compiler use only: OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER 0xf |
| 399 |
#define GOMP_REQUIRES_UNIFIED_ADDRESS 0x10 |
| 400 |
#define GOMP_REQUIRES_UNIFIED_SHARED_MEMORY 0x20 |
| 401 |
// compiler use only: OMP_REQUIRES_DYNAMIC_ALLOCATORS 0x40 |
| 402 |
#define GOMP_REQUIRES_REVERSE_OFFLOAD 0x80 |
| 403 |
// compiler use only: OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER_USED 0x100 |
| 404 |
#define GOMP_REQUIRES_TARGET_USED 0x200 |
| 405 |
#define GOMP_REQUIRES_SELF_MAPS 0x400 |
| 406 |
|
| 407 |
/* Interop foreign-runtime data; |
| 408 |
OpenMP defines positive values; reserve 0 and negative for GCC. */ |
| 409 |
#define GOMP_INTEROP_IFR_LAST 7 |
| 410 |
#define GOMP_INTEROP_IFR_SEPARATOR ((char)(-__INT8_MAX__-1)) |
| 411 |
#define GOMP_INTEROP_IFR_UNKNOWN ((char)(-__INT8_MAX__)) |
| 412 |
|
| 413 |
/* GOMP_interop target_targetsync argument. */ |
| 414 |
#define GOMP_INTEROP_TARGET (1 << 0) |
| 415 |
#define GOMP_INTEROP_TARGETSYNC (1 << 1) |
| 416 |
|
| 417 |
/* GOMP_interop flags argument. */ |
| 418 |
#define GOMP_INTEROP_FLAG_NOWAIT (1 << 0) |
| 419 |
|
| 420 |
/* HSA specific data structures. */ |
| 421 |
|
| 422 |
/* Identifiers of device-specific target arguments. */ |
| 423 |
#define GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES (1 << 8) |
| 424 |
|
| 425 |
#endif |