annotate include/gomp-constants.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Communication between GCC and libgomp.
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 Copyright (C) 2014-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 Contributed by Mentor Embedded.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 This file is part of the GNU Offloading and Multi Processing Library
kono
parents:
diff changeset
8 (libgomp).
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 Libgomp is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
11 under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
12 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
13 any later version.
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
kono
parents:
diff changeset
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
kono
parents:
diff changeset
18 more details.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
21 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
22 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
25 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
27 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 #ifndef GOMP_CONSTANTS_H
kono
parents:
diff changeset
30 #define GOMP_CONSTANTS_H 1
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* Memory mapping types. */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* One byte. */
kono
parents:
diff changeset
35 #define GOMP_MAP_LAST (1 << 8)
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 #define GOMP_MAP_FLAG_TO (1 << 0)
kono
parents:
diff changeset
38 #define GOMP_MAP_FLAG_FROM (1 << 1)
kono
parents:
diff changeset
39 /* Special map kinds, enumerated starting here. */
kono
parents:
diff changeset
40 #define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2)
kono
parents:
diff changeset
41 #define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3)
kono
parents:
diff changeset
42 #define GOMP_MAP_FLAG_SPECIAL_2 (1 << 4)
kono
parents:
diff changeset
43 #define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \
kono
parents:
diff changeset
44 | GOMP_MAP_FLAG_SPECIAL_0)
kono
parents:
diff changeset
45 /* Flag to force a specific behavior (or else, trigger a run-time error). */
kono
parents:
diff changeset
46 #define GOMP_MAP_FLAG_FORCE (1 << 7)
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 enum gomp_map_kind
kono
parents:
diff changeset
49 {
kono
parents:
diff changeset
50 /* If not already present, allocate. */
kono
parents:
diff changeset
51 GOMP_MAP_ALLOC = 0,
kono
parents:
diff changeset
52 /* ..., and copy to device. */
kono
parents:
diff changeset
53 GOMP_MAP_TO = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
kono
parents:
diff changeset
54 /* ..., and copy from device. */
kono
parents:
diff changeset
55 GOMP_MAP_FROM = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
kono
parents:
diff changeset
56 /* ..., and copy to and from device. */
kono
parents:
diff changeset
57 GOMP_MAP_TOFROM = (GOMP_MAP_TO | GOMP_MAP_FROM),
kono
parents:
diff changeset
58 /* The following kind is an internal only map kind, used for pointer based
kono
parents:
diff changeset
59 array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
kono
parents:
diff changeset
60 which is implicitly POINTER_SIZE_UNITS, but the bias. */
kono
parents:
diff changeset
61 GOMP_MAP_POINTER = (GOMP_MAP_FLAG_SPECIAL_0 | 0),
kono
parents:
diff changeset
62 /* Also internal, behaves like GOMP_MAP_TO, but additionally any
kono
parents:
diff changeset
63 GOMP_MAP_POINTER records consecutive after it which have addresses
kono
parents:
diff changeset
64 falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
kono
parents:
diff changeset
65 mapped already. */
kono
parents:
diff changeset
66 GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1),
kono
parents:
diff changeset
67 /* Must already be present. */
kono
parents:
diff changeset
68 GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2),
kono
parents:
diff changeset
69 /* Deallocate a mapping, without copying from device. */
kono
parents:
diff changeset
70 GOMP_MAP_DELETE = (GOMP_MAP_FLAG_SPECIAL_0 | 3),
kono
parents:
diff changeset
71 /* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly
kono
parents:
diff changeset
72 POINTER_SIZE_UNITS. */
kono
parents:
diff changeset
73 GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0),
kono
parents:
diff changeset
74 /* Do not map, copy bits for firstprivate instead. */
kono
parents:
diff changeset
75 /* OpenACC device_resident. */
kono
parents:
diff changeset
76 GOMP_MAP_DEVICE_RESIDENT = (GOMP_MAP_FLAG_SPECIAL_1 | 1),
kono
parents:
diff changeset
77 /* OpenACC link. */
kono
parents:
diff changeset
78 GOMP_MAP_LINK = (GOMP_MAP_FLAG_SPECIAL_1 | 2),
kono
parents:
diff changeset
79 /* Allocate. */
kono
parents:
diff changeset
80 GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0),
kono
parents:
diff changeset
81 /* Similarly, but store the value in the pointer rather than
kono
parents:
diff changeset
82 pointed by the pointer. */
kono
parents:
diff changeset
83 GOMP_MAP_FIRSTPRIVATE_INT = (GOMP_MAP_FLAG_SPECIAL | 1),
kono
parents:
diff changeset
84 /* Pointer translate host address into device address and copy that
kono
parents:
diff changeset
85 back to host. */
kono
parents:
diff changeset
86 GOMP_MAP_USE_DEVICE_PTR = (GOMP_MAP_FLAG_SPECIAL | 2),
kono
parents:
diff changeset
87 /* Allocate a zero length array section. Prefer next non-zero length
kono
parents:
diff changeset
88 mapping over previous non-zero length mapping over zero length mapping
kono
parents:
diff changeset
89 at the address. If not already mapped, do nothing (and pointer translate
kono
parents:
diff changeset
90 to NULL). */
kono
parents:
diff changeset
91 GOMP_MAP_ZERO_LEN_ARRAY_SECTION = (GOMP_MAP_FLAG_SPECIAL | 3),
kono
parents:
diff changeset
92 /* Allocate. */
kono
parents:
diff changeset
93 GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
kono
parents:
diff changeset
94 /* ..., and copy to device. */
kono
parents:
diff changeset
95 GOMP_MAP_FORCE_TO = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
kono
parents:
diff changeset
96 /* ..., and copy from device. */
kono
parents:
diff changeset
97 GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
kono
parents:
diff changeset
98 /* ..., and copy to and from device. */
kono
parents:
diff changeset
99 GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM),
kono
parents:
diff changeset
100 /* If not already present, allocate. And unconditionally copy to
kono
parents:
diff changeset
101 device. */
kono
parents:
diff changeset
102 GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_SPECIAL_2 | GOMP_MAP_TO),
kono
parents:
diff changeset
103 /* If not already present, allocate. And unconditionally copy from
kono
parents:
diff changeset
104 device. */
kono
parents:
diff changeset
105 GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
106 | GOMP_MAP_FROM),
kono
parents:
diff changeset
107 /* If not already present, allocate. And unconditionally copy to and from
kono
parents:
diff changeset
108 device. */
kono
parents:
diff changeset
109 GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
110 | GOMP_MAP_TOFROM),
kono
parents:
diff changeset
111 /* Map a sparse struct; the address is the base of the structure, alignment
kono
parents:
diff changeset
112 it's required alignment, and size is the number of adjacent entries
kono
parents:
diff changeset
113 that belong to the struct. The adjacent entries should be sorted by
kono
parents:
diff changeset
114 increasing address, so it is easy to determine lowest needed address
kono
parents:
diff changeset
115 (address of the first adjacent entry) and highest needed address
kono
parents:
diff changeset
116 (address of the last adjacent entry plus its size). */
kono
parents:
diff changeset
117 GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
118 | GOMP_MAP_FLAG_SPECIAL | 0),
kono
parents:
diff changeset
119 /* On a location of a pointer/reference that is assumed to be already mapped
kono
parents:
diff changeset
120 earlier, store the translated address of the preceeding mapping.
kono
parents:
diff changeset
121 No refcount is bumped by this, and the store is done unconditionally. */
kono
parents:
diff changeset
122 GOMP_MAP_ALWAYS_POINTER = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
123 | GOMP_MAP_FLAG_SPECIAL | 1),
kono
parents:
diff changeset
124 /* Forced deallocation of zero length array section. */
kono
parents:
diff changeset
125 GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION
kono
parents:
diff changeset
126 = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
127 | GOMP_MAP_FLAG_SPECIAL | 3),
kono
parents:
diff changeset
128 /* Decrement usage count and deallocate if zero. */
kono
parents:
diff changeset
129 GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_SPECIAL_2
kono
parents:
diff changeset
130 | GOMP_MAP_DELETE),
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 /* Internal to GCC, not used in libgomp. */
kono
parents:
diff changeset
133 /* Do not map, but pointer assign a pointer instead. */
kono
parents:
diff changeset
134 GOMP_MAP_FIRSTPRIVATE_POINTER = (GOMP_MAP_LAST | 1),
kono
parents:
diff changeset
135 /* Do not map, but pointer assign a reference instead. */
kono
parents:
diff changeset
136 GOMP_MAP_FIRSTPRIVATE_REFERENCE = (GOMP_MAP_LAST | 2)
kono
parents:
diff changeset
137 };
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 #define GOMP_MAP_COPY_TO_P(X) \
kono
parents:
diff changeset
140 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
kono
parents:
diff changeset
141 && ((X) & GOMP_MAP_FLAG_TO))
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 #define GOMP_MAP_COPY_FROM_P(X) \
kono
parents:
diff changeset
144 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
kono
parents:
diff changeset
145 && ((X) & GOMP_MAP_FLAG_FROM))
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 #define GOMP_MAP_POINTER_P(X) \
kono
parents:
diff changeset
148 ((X) == GOMP_MAP_POINTER)
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 #define GOMP_MAP_ALWAYS_TO_P(X) \
kono
parents:
diff changeset
151 (((X) == GOMP_MAP_ALWAYS_TO) || ((X) == GOMP_MAP_ALWAYS_TOFROM))
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 #define GOMP_MAP_ALWAYS_FROM_P(X) \
kono
parents:
diff changeset
154 (((X) == GOMP_MAP_ALWAYS_FROM) || ((X) == GOMP_MAP_ALWAYS_TOFROM))
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 #define GOMP_MAP_ALWAYS_P(X) \
kono
parents:
diff changeset
157 (GOMP_MAP_ALWAYS_TO_P (X) || ((X) == GOMP_MAP_ALWAYS_FROM))
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 /* Asynchronous behavior. Keep in sync with
kono
parents:
diff changeset
161 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 #define GOMP_ASYNC_NOVAL -1
kono
parents:
diff changeset
164 #define GOMP_ASYNC_SYNC -2
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 /* Device codes. Keep in sync with
kono
parents:
diff changeset
168 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
kono
parents:
diff changeset
169 libgomp/libgomp-plugin.h. */
kono
parents:
diff changeset
170 #define GOMP_DEVICE_NONE 0
kono
parents:
diff changeset
171 #define GOMP_DEVICE_DEFAULT 1
kono
parents:
diff changeset
172 #define GOMP_DEVICE_HOST 2
kono
parents:
diff changeset
173 /* #define GOMP_DEVICE_HOST_NONSHM 3 removed. */
kono
parents:
diff changeset
174 #define GOMP_DEVICE_NOT_HOST 4
kono
parents:
diff changeset
175 #define GOMP_DEVICE_NVIDIA_PTX 5
kono
parents:
diff changeset
176 #define GOMP_DEVICE_INTEL_MIC 6
kono
parents:
diff changeset
177 #define GOMP_DEVICE_HSA 7
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 #define GOMP_DEVICE_ICV -1
kono
parents:
diff changeset
180 #define GOMP_DEVICE_HOST_FALLBACK -2
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 /* GOMP_task/GOMP_taskloop* flags argument. */
kono
parents:
diff changeset
183 #define GOMP_TASK_FLAG_UNTIED (1 << 0)
kono
parents:
diff changeset
184 #define GOMP_TASK_FLAG_FINAL (1 << 1)
kono
parents:
diff changeset
185 #define GOMP_TASK_FLAG_MERGEABLE (1 << 2)
kono
parents:
diff changeset
186 #define GOMP_TASK_FLAG_DEPEND (1 << 3)
kono
parents:
diff changeset
187 #define GOMP_TASK_FLAG_PRIORITY (1 << 4)
kono
parents:
diff changeset
188 #define GOMP_TASK_FLAG_UP (1 << 8)
kono
parents:
diff changeset
189 #define GOMP_TASK_FLAG_GRAINSIZE (1 << 9)
kono
parents:
diff changeset
190 #define GOMP_TASK_FLAG_IF (1 << 10)
kono
parents:
diff changeset
191 #define GOMP_TASK_FLAG_NOGROUP (1 << 11)
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 /* GOMP_target{_ext,update_ext,enter_exit_data} flags argument. */
kono
parents:
diff changeset
194 #define GOMP_TARGET_FLAG_NOWAIT (1 << 0)
kono
parents:
diff changeset
195 #define GOMP_TARGET_FLAG_EXIT_DATA (1 << 1)
kono
parents:
diff changeset
196 /* Internal to libgomp. */
kono
parents:
diff changeset
197 #define GOMP_TARGET_FLAG_UPDATE (1U << 31)
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 /* Versions of libgomp and device-specific plugins. GOMP_VERSION
kono
parents:
diff changeset
200 should be incremented whenever an ABI-incompatible change is introduced
kono
parents:
diff changeset
201 to the plugin interface defined in libgomp/libgomp.h. */
kono
parents:
diff changeset
202 #define GOMP_VERSION 1
kono
parents:
diff changeset
203 #define GOMP_VERSION_NVIDIA_PTX 1
kono
parents:
diff changeset
204 #define GOMP_VERSION_INTEL_MIC 0
kono
parents:
diff changeset
205 #define GOMP_VERSION_HSA 0
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 #define GOMP_VERSION_PACK(LIB, DEV) (((LIB) << 16) | (DEV))
kono
parents:
diff changeset
208 #define GOMP_VERSION_LIB(PACK) (((PACK) >> 16) & 0xffff)
kono
parents:
diff changeset
209 #define GOMP_VERSION_DEV(PACK) ((PACK) & 0xffff)
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 #define GOMP_DIM_GANG 0
kono
parents:
diff changeset
212 #define GOMP_DIM_WORKER 1
kono
parents:
diff changeset
213 #define GOMP_DIM_VECTOR 2
kono
parents:
diff changeset
214 #define GOMP_DIM_MAX 3
kono
parents:
diff changeset
215 #define GOMP_DIM_MASK(X) (1u << (X))
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 /* Varadic launch arguments. End of list is marked by a zero. */
kono
parents:
diff changeset
218 #define GOMP_LAUNCH_DIM 1 /* Launch dimensions, op = mask */
kono
parents:
diff changeset
219 #define GOMP_LAUNCH_ASYNC 2 /* Async, op = cst val if not MAX */
kono
parents:
diff changeset
220 #define GOMP_LAUNCH_WAIT 3 /* Waits, op = num waits. */
kono
parents:
diff changeset
221 #define GOMP_LAUNCH_CODE_SHIFT 28
kono
parents:
diff changeset
222 #define GOMP_LAUNCH_DEVICE_SHIFT 16
kono
parents:
diff changeset
223 #define GOMP_LAUNCH_OP_SHIFT 0
kono
parents:
diff changeset
224 #define GOMP_LAUNCH_PACK(CODE,DEVICE,OP) \
kono
parents:
diff changeset
225 (((CODE) << GOMP_LAUNCH_CODE_SHIFT) \
kono
parents:
diff changeset
226 | ((DEVICE) << GOMP_LAUNCH_DEVICE_SHIFT) \
kono
parents:
diff changeset
227 | ((OP) << GOMP_LAUNCH_OP_SHIFT))
kono
parents:
diff changeset
228 #define GOMP_LAUNCH_CODE(X) (((X) >> GOMP_LAUNCH_CODE_SHIFT) & 0xf)
kono
parents:
diff changeset
229 #define GOMP_LAUNCH_DEVICE(X) (((X) >> GOMP_LAUNCH_DEVICE_SHIFT) & 0xfff)
kono
parents:
diff changeset
230 #define GOMP_LAUNCH_OP(X) (((X) >> GOMP_LAUNCH_OP_SHIFT) & 0xffff)
kono
parents:
diff changeset
231 #define GOMP_LAUNCH_OP_MAX 0xffff
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 /* Bitmask to apply in order to find out the intended device of a target
kono
parents:
diff changeset
234 argument. */
kono
parents:
diff changeset
235 #define GOMP_TARGET_ARG_DEVICE_MASK ((1 << 7) - 1)
kono
parents:
diff changeset
236 /* The target argument is significant for all devices. */
kono
parents:
diff changeset
237 #define GOMP_TARGET_ARG_DEVICE_ALL 0
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 /* Flag set when the subsequent element in the device-specific argument
kono
parents:
diff changeset
240 values. */
kono
parents:
diff changeset
241 #define GOMP_TARGET_ARG_SUBSEQUENT_PARAM (1 << 7)
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 /* Bitmask to apply to a target argument to find out the value identifier. */
kono
parents:
diff changeset
244 #define GOMP_TARGET_ARG_ID_MASK (((1 << 8) - 1) << 8)
kono
parents:
diff changeset
245 /* Target argument index of NUM_TEAMS. */
kono
parents:
diff changeset
246 #define GOMP_TARGET_ARG_NUM_TEAMS (1 << 8)
kono
parents:
diff changeset
247 /* Target argument index of THREAD_LIMIT. */
kono
parents:
diff changeset
248 #define GOMP_TARGET_ARG_THREAD_LIMIT (2 << 8)
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 /* If the value is directly embeded in target argument, it should be a 16-bit
kono
parents:
diff changeset
251 at most and shifted by this many bits. */
kono
parents:
diff changeset
252 #define GOMP_TARGET_ARG_VALUE_SHIFT 16
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 /* HSA specific data structures. */
kono
parents:
diff changeset
255
kono
parents:
diff changeset
256 /* Identifiers of device-specific target arguments. */
kono
parents:
diff changeset
257 #define GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES (1 << 8)
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 #endif