openmp: Change omp_atv_default value and rename omp_atv_sequential to omp_atv_serialized.
[platform/upstream/gcc.git] / libgomp / omp.h.in
1 /* Copyright (C) 2005-2020 Free Software Foundation, Inc.
2    Contributed by Richard Henderson <rth@redhat.com>.
3
4    This file is part of the GNU Offloading and Multi Processing Library
5    (libgomp).
6
7    Libgomp is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
13    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15    more details.
16
17    Under Section 7 of GPL version 3, you are granted additional
18    permissions described in the GCC Runtime Library Exception, version
19    3.1, as published by the Free Software Foundation.
20
21    You should have received a copy of the GNU General Public License and
22    a copy of the GCC Runtime Library Exception along with this program;
23    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24    <http://www.gnu.org/licenses/>.  */
25
26 #ifndef _OMP_H
27 #define _OMP_H 1
28
29 #ifndef _LIBGOMP_OMP_LOCK_DEFINED
30 #define _LIBGOMP_OMP_LOCK_DEFINED 1
31 /* These two structures get edited by the libgomp build process to 
32    reflect the shape of the two types.  Their internals are private
33    to the library.  */
34
35 typedef struct
36 {
37   unsigned char _x[@OMP_LOCK_SIZE@] 
38     __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
39 } omp_lock_t;
40
41 typedef struct
42 {
43   unsigned char _x[@OMP_NEST_LOCK_SIZE@] 
44     __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
45 } omp_nest_lock_t;
46 #endif
47
48 typedef enum omp_sched_t
49 {
50   omp_sched_static = 1,
51   omp_sched_dynamic = 2,
52   omp_sched_guided = 3,
53   omp_sched_auto = 4,
54   omp_sched_monotonic = 0x80000000U
55 } omp_sched_t;
56
57 typedef enum omp_proc_bind_t
58 {
59   omp_proc_bind_false = 0,
60   omp_proc_bind_true = 1,
61   omp_proc_bind_master = 2,
62   omp_proc_bind_close = 3,
63   omp_proc_bind_spread = 4
64 } omp_proc_bind_t;
65
66 typedef enum omp_sync_hint_t
67 {
68   omp_sync_hint_none = 0,
69   omp_lock_hint_none = omp_sync_hint_none,
70   omp_sync_hint_uncontended = 1,
71   omp_lock_hint_uncontended = omp_sync_hint_uncontended,
72   omp_sync_hint_contended = 2,
73   omp_lock_hint_contended = omp_sync_hint_contended,
74   omp_sync_hint_nonspeculative = 4,
75   omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
76   omp_sync_hint_speculative = 8,
77   omp_lock_hint_speculative = omp_sync_hint_speculative
78 } omp_sync_hint_t;
79
80 typedef omp_sync_hint_t omp_lock_hint_t;
81
82 typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t
83 {
84   char __omp_depend_t__[2 * sizeof (void *)];
85 } omp_depend_t;
86
87 typedef enum omp_pause_resource_t
88 {
89   omp_pause_soft = 1,
90   omp_pause_hard = 2
91 } omp_pause_resource_t;
92
93 typedef __UINTPTR_TYPE__ omp_uintptr_t;
94
95 #if __cplusplus >= 201103L
96 # define __GOMP_UINTPTR_T_ENUM : omp_uintptr_t
97 #else
98 # define __GOMP_UINTPTR_T_ENUM
99 #endif
100
101 typedef enum omp_memspace_handle_t __GOMP_UINTPTR_T_ENUM
102 {
103   omp_default_mem_space = 0,
104   omp_large_cap_mem_space = 1,
105   omp_const_mem_space = 2,
106   omp_high_bw_mem_space = 3,
107   omp_low_lat_mem_space = 4,
108   __omp_memspace_handle_t_max__ = __UINTPTR_MAX__
109 } omp_memspace_handle_t;
110
111 typedef enum omp_allocator_handle_t __GOMP_UINTPTR_T_ENUM
112 {
113   omp_null_allocator = 0,
114   omp_default_mem_alloc = 1,
115   omp_large_cap_mem_alloc = 2,
116   omp_const_mem_alloc = 3,
117   omp_high_bw_mem_alloc = 4,
118   omp_low_lat_mem_alloc = 5,
119   omp_cgroup_mem_alloc = 6,
120   omp_pteam_mem_alloc = 7,
121   omp_thread_mem_alloc = 8,
122   __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
123 } omp_allocator_handle_t;
124
125 typedef enum omp_alloctrait_key_t
126 {
127   omp_atk_sync_hint = 1,
128   omp_atk_alignment = 2,
129   omp_atk_access = 3,
130   omp_atk_pool_size = 4,
131   omp_atk_fallback = 5,
132   omp_atk_fb_data = 6,
133   omp_atk_pinned = 7,
134   omp_atk_partition = 8
135 } omp_alloctrait_key_t;
136
137 typedef enum omp_alloctrait_value_t
138 {
139   omp_atv_default = (__UINTPTR_TYPE__) -1,
140   omp_atv_false = 0,
141   omp_atv_true = 1,
142   omp_atv_contended = 3,
143   omp_atv_uncontended = 4,
144   omp_atv_serialized = 5,
145   omp_atv_sequential = omp_atv_serialized,
146   omp_atv_private = 6,
147   omp_atv_all = 7,
148   omp_atv_thread = 8,
149   omp_atv_pteam = 9,
150   omp_atv_cgroup = 10,
151   omp_atv_default_mem_fb = 11,
152   omp_atv_null_fb = 12,
153   omp_atv_abort_fb = 13,
154   omp_atv_allocator_fb = 14,
155   omp_atv_environment = 15,
156   omp_atv_nearest = 16,
157   omp_atv_blocked = 17,
158   omp_atv_interleaved = 18
159 } omp_alloctrait_value_t;
160
161 typedef struct omp_alloctrait_t
162 {
163   omp_alloctrait_key_t key;
164   omp_uintptr_t value;
165 } omp_alloctrait_t;
166
167 #ifdef __cplusplus
168 extern "C" {
169 # define __GOMP_NOTHROW throw ()
170 # define __GOMP_DEFAULT_NULL_ALLOCATOR = omp_null_allocator
171 #else
172 # define __GOMP_NOTHROW __attribute__((__nothrow__))
173 # define __GOMP_DEFAULT_NULL_ALLOCATOR
174 #endif
175
176 extern void omp_set_num_threads (int) __GOMP_NOTHROW;
177 extern int omp_get_num_threads (void) __GOMP_NOTHROW;
178 extern int omp_get_max_threads (void) __GOMP_NOTHROW;
179 extern int omp_get_thread_num (void) __GOMP_NOTHROW;
180 extern int omp_get_num_procs (void) __GOMP_NOTHROW;
181
182 extern int omp_in_parallel (void) __GOMP_NOTHROW;
183
184 extern void omp_set_dynamic (int) __GOMP_NOTHROW;
185 extern int omp_get_dynamic (void) __GOMP_NOTHROW;
186
187 extern void omp_set_nested (int) __GOMP_NOTHROW;
188 extern int omp_get_nested (void) __GOMP_NOTHROW;
189
190 extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
191 extern void omp_init_lock_with_hint (omp_lock_t *, omp_sync_hint_t)
192   __GOMP_NOTHROW;
193 extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW;
194 extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW;
195 extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
196 extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;
197
198 extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
199 extern void omp_init_nest_lock_with_hint (omp_nest_lock_t *, omp_sync_hint_t)
200   __GOMP_NOTHROW;
201 extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
202 extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
203 extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
204 extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
205
206 extern double omp_get_wtime (void) __GOMP_NOTHROW;
207 extern double omp_get_wtick (void) __GOMP_NOTHROW;
208
209 extern void omp_set_schedule (omp_sched_t, int) __GOMP_NOTHROW;
210 extern void omp_get_schedule (omp_sched_t *, int *) __GOMP_NOTHROW;
211 extern int omp_get_thread_limit (void) __GOMP_NOTHROW;
212 extern void omp_set_max_active_levels (int) __GOMP_NOTHROW;
213 extern int omp_get_max_active_levels (void) __GOMP_NOTHROW;
214 extern int omp_get_level (void) __GOMP_NOTHROW;
215 extern int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW;
216 extern int omp_get_team_size (int) __GOMP_NOTHROW;
217 extern int omp_get_active_level (void) __GOMP_NOTHROW;
218
219 extern int omp_in_final (void) __GOMP_NOTHROW;
220
221 extern int omp_get_cancellation (void) __GOMP_NOTHROW;
222 extern omp_proc_bind_t omp_get_proc_bind (void) __GOMP_NOTHROW;
223 extern int omp_get_num_places (void) __GOMP_NOTHROW;
224 extern int omp_get_place_num_procs (int) __GOMP_NOTHROW;
225 extern void omp_get_place_proc_ids (int, int *) __GOMP_NOTHROW;
226 extern int omp_get_place_num (void) __GOMP_NOTHROW;
227 extern int omp_get_partition_num_places (void) __GOMP_NOTHROW;
228 extern void omp_get_partition_place_nums (int *) __GOMP_NOTHROW;
229
230 extern void omp_set_default_device (int) __GOMP_NOTHROW;
231 extern int omp_get_default_device (void) __GOMP_NOTHROW;
232 extern int omp_get_num_devices (void) __GOMP_NOTHROW;
233 extern int omp_get_num_teams (void) __GOMP_NOTHROW;
234 extern int omp_get_team_num (void) __GOMP_NOTHROW;
235
236 extern int omp_is_initial_device (void) __GOMP_NOTHROW;
237 extern int omp_get_initial_device (void) __GOMP_NOTHROW;
238 extern int omp_get_max_task_priority (void) __GOMP_NOTHROW;
239
240 extern void *omp_target_alloc (__SIZE_TYPE__, int) __GOMP_NOTHROW;
241 extern void omp_target_free (void *, int) __GOMP_NOTHROW;
242 extern int omp_target_is_present (const void *, int) __GOMP_NOTHROW;
243 extern int omp_target_memcpy (void *, const void *, __SIZE_TYPE__,
244                               __SIZE_TYPE__, __SIZE_TYPE__, int, int)
245   __GOMP_NOTHROW;
246 extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__, int,
247                                    const __SIZE_TYPE__ *,
248                                    const __SIZE_TYPE__ *,
249                                    const __SIZE_TYPE__ *,
250                                    const __SIZE_TYPE__ *,
251                                    const __SIZE_TYPE__ *, int, int)
252   __GOMP_NOTHROW;
253 extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__,
254                                      __SIZE_TYPE__, int) __GOMP_NOTHROW;
255 extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW;
256
257 extern void omp_set_affinity_format (const char *) __GOMP_NOTHROW;
258 extern __SIZE_TYPE__ omp_get_affinity_format (char *, __SIZE_TYPE__)
259   __GOMP_NOTHROW;
260 extern void omp_display_affinity (const char *) __GOMP_NOTHROW;
261 extern __SIZE_TYPE__ omp_capture_affinity (char *, __SIZE_TYPE__, const char *)
262   __GOMP_NOTHROW;
263
264 extern int omp_pause_resource (omp_pause_resource_t, int) __GOMP_NOTHROW;
265 extern int omp_pause_resource_all (omp_pause_resource_t) __GOMP_NOTHROW;
266
267 extern omp_allocator_handle_t omp_init_allocator (omp_memspace_handle_t,
268                                                   int,
269                                                   const omp_alloctrait_t [])
270   __GOMP_NOTHROW;
271 extern void omp_destroy_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
272 extern void omp_set_default_allocator (omp_allocator_handle_t) __GOMP_NOTHROW;
273 extern omp_allocator_handle_t omp_get_default_allocator (void) __GOMP_NOTHROW;
274 extern void *omp_alloc (__SIZE_TYPE__,
275                         omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
276   __GOMP_NOTHROW;
277 extern void omp_free (void *,
278                       omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR)
279   __GOMP_NOTHROW;
280
281 #ifdef __cplusplus
282 }
283 #endif
284
285 #endif /* _OMP_H */