1 /* Copyright (C) 2005-2022 Free Software Foundation, Inc.
2 Contributed by Richard Henderson <rth@redhat.com>.
4 This file is part of the GNU Offloading and Multi Processing Library
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)
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
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.
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/>. */
29 #if defined(__GNUC__) && _OPENMP >= 201811
30 # define __GOMP_DEPRECATED_5_0 __attribute__((__deprecated__))
32 # define __GOMP_DEPRECATED_5_0
35 #if defined(__GNUC__) && _OPENMP >= 202011
36 # define __GOMP_DEPRECATED_5_1 __attribute__((__deprecated__))
38 # define __GOMP_DEPRECATED_5_1
41 #ifndef _LIBGOMP_OMP_LOCK_DEFINED
42 #define _LIBGOMP_OMP_LOCK_DEFINED 1
43 /* These two structures get edited by the libgomp build process to
44 reflect the shape of the two types. Their internals are private
49 unsigned char _x
[@OMP_LOCK_SIZE@
]
50 __attribute__((__aligned__(@OMP_LOCK_ALIGN@
)));
55 unsigned char _x
[@OMP_NEST_LOCK_SIZE@
]
56 __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@
)));
60 typedef enum omp_sched_t
63 omp_sched_dynamic
= 2,
66 omp_sched_monotonic
= 0x80000000U
69 typedef enum omp_proc_bind_t
71 omp_proc_bind_false
= 0,
72 omp_proc_bind_true
= 1,
73 omp_proc_bind_primary
= 2,
74 omp_proc_bind_master __GOMP_DEPRECATED_5_1
75 = omp_proc_bind_primary
,
76 omp_proc_bind_close
= 3,
77 omp_proc_bind_spread
= 4
80 typedef enum omp_sync_hint_t
82 omp_sync_hint_none
= 0,
83 omp_lock_hint_none __GOMP_DEPRECATED_5_0
= omp_sync_hint_none
,
84 omp_sync_hint_uncontended
= 1,
85 omp_lock_hint_uncontended __GOMP_DEPRECATED_5_0
= omp_sync_hint_uncontended
,
86 omp_sync_hint_contended
= 2,
87 omp_lock_hint_contended __GOMP_DEPRECATED_5_0
= omp_sync_hint_contended
,
88 omp_sync_hint_nonspeculative
= 4,
89 omp_lock_hint_nonspeculative __GOMP_DEPRECATED_5_0
90 = omp_sync_hint_nonspeculative
,
91 omp_sync_hint_speculative
= 8,
92 omp_lock_hint_speculative __GOMP_DEPRECATED_5_0
= omp_sync_hint_speculative
95 typedef __GOMP_DEPRECATED_5_0 omp_sync_hint_t omp_lock_hint_t
;
97 typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t
99 char __omp_depend_t__
[2 * sizeof (void *)];
102 typedef enum omp_pause_resource_t
106 } omp_pause_resource_t
;
108 typedef __UINTPTR_TYPE__ omp_uintptr_t
;
110 #if __cplusplus >= 201103L
111 # define __GOMP_UINTPTR_T_ENUM : omp_uintptr_t
113 # define __GOMP_UINTPTR_T_ENUM
116 typedef enum omp_memspace_handle_t __GOMP_UINTPTR_T_ENUM
118 omp_default_mem_space
= 0,
119 omp_large_cap_mem_space
= 1,
120 omp_const_mem_space
= 2,
121 omp_high_bw_mem_space
= 3,
122 omp_low_lat_mem_space
= 4,
123 __omp_memspace_handle_t_max__
= __UINTPTR_MAX__
124 } omp_memspace_handle_t
;
126 typedef enum omp_allocator_handle_t __GOMP_UINTPTR_T_ENUM
128 omp_null_allocator
= 0,
129 omp_default_mem_alloc
= 1,
130 omp_large_cap_mem_alloc
= 2,
131 omp_const_mem_alloc
= 3,
132 omp_high_bw_mem_alloc
= 4,
133 omp_low_lat_mem_alloc
= 5,
134 omp_cgroup_mem_alloc
= 6,
135 omp_pteam_mem_alloc
= 7,
136 omp_thread_mem_alloc
= 8,
137 __omp_allocator_handle_t_max__
= __UINTPTR_MAX__
138 } omp_allocator_handle_t
;
140 typedef enum omp_alloctrait_key_t
142 omp_atk_sync_hint
= 1,
143 omp_atk_alignment
= 2,
145 omp_atk_pool_size
= 4,
146 omp_atk_fallback
= 5,
149 omp_atk_partition
= 8
150 } omp_alloctrait_key_t
;
152 typedef enum omp_alloctrait_value_t
154 omp_atv_default
= (__UINTPTR_TYPE__
) -1,
157 omp_atv_contended
= 3,
158 omp_atv_uncontended
= 4,
159 omp_atv_serialized
= 5,
160 omp_atv_sequential __GOMP_DEPRECATED_5_1
= omp_atv_serialized
,
166 omp_atv_default_mem_fb
= 11,
167 omp_atv_null_fb
= 12,
168 omp_atv_abort_fb
= 13,
169 omp_atv_allocator_fb
= 14,
170 omp_atv_environment
= 15,
171 omp_atv_nearest
= 16,
172 omp_atv_blocked
= 17,
173 omp_atv_interleaved
= 18
174 } omp_alloctrait_value_t
;
176 typedef struct omp_alloctrait_t
178 omp_alloctrait_key_t key
;
182 typedef enum omp_event_handle_t __GOMP_UINTPTR_T_ENUM
184 __omp_event_handle_t_max__
= __UINTPTR_MAX__
185 } omp_event_handle_t
;
189 omp_initial_device
= -1,
190 omp_invalid_device
= -4
195 # define __GOMP_NOTHROW throw ()
196 # define __GOMP_DEFAULT_NULL_ALLOCATOR = omp_null_allocator
198 # define __GOMP_NOTHROW __attribute__((__nothrow__))
199 # define __GOMP_DEFAULT_NULL_ALLOCATOR
202 extern void omp_set_num_threads (int) __GOMP_NOTHROW
;
203 extern int omp_get_num_threads (void) __GOMP_NOTHROW
;
204 extern int omp_get_max_threads (void) __GOMP_NOTHROW
;
205 extern int omp_get_thread_num (void) __GOMP_NOTHROW
;
206 extern int omp_get_num_procs (void) __GOMP_NOTHROW
;
208 extern int omp_in_parallel (void) __GOMP_NOTHROW
;
210 extern void omp_set_dynamic (int) __GOMP_NOTHROW
;
211 extern int omp_get_dynamic (void) __GOMP_NOTHROW
;
213 extern void omp_set_nested (int) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0
;
214 extern int omp_get_nested (void) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0
;
216 extern void omp_init_lock (omp_lock_t
*) __GOMP_NOTHROW
;
217 extern void omp_init_lock_with_hint (omp_lock_t
*, omp_sync_hint_t
)
219 extern void omp_destroy_lock (omp_lock_t
*) __GOMP_NOTHROW
;
220 extern void omp_set_lock (omp_lock_t
*) __GOMP_NOTHROW
;
221 extern void omp_unset_lock (omp_lock_t
*) __GOMP_NOTHROW
;
222 extern int omp_test_lock (omp_lock_t
*) __GOMP_NOTHROW
;
224 extern void omp_init_nest_lock (omp_nest_lock_t
*) __GOMP_NOTHROW
;
225 extern void omp_init_nest_lock_with_hint (omp_nest_lock_t
*, omp_sync_hint_t
)
227 extern void omp_destroy_nest_lock (omp_nest_lock_t
*) __GOMP_NOTHROW
;
228 extern void omp_set_nest_lock (omp_nest_lock_t
*) __GOMP_NOTHROW
;
229 extern void omp_unset_nest_lock (omp_nest_lock_t
*) __GOMP_NOTHROW
;
230 extern int omp_test_nest_lock (omp_nest_lock_t
*) __GOMP_NOTHROW
;
232 extern double omp_get_wtime (void) __GOMP_NOTHROW
;
233 extern double omp_get_wtick (void) __GOMP_NOTHROW
;
235 extern void omp_set_schedule (omp_sched_t
, int) __GOMP_NOTHROW
;
236 extern void omp_get_schedule (omp_sched_t
*, int *) __GOMP_NOTHROW
;
237 extern int omp_get_thread_limit (void) __GOMP_NOTHROW
;
238 extern void omp_set_max_active_levels (int) __GOMP_NOTHROW
;
239 extern int omp_get_max_active_levels (void) __GOMP_NOTHROW
;
240 extern int omp_get_supported_active_levels (void) __GOMP_NOTHROW
;
241 extern int omp_get_level (void) __GOMP_NOTHROW
;
242 extern int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW
;
243 extern int omp_get_team_size (int) __GOMP_NOTHROW
;
244 extern int omp_get_active_level (void) __GOMP_NOTHROW
;
246 extern int omp_in_final (void) __GOMP_NOTHROW
;
247 extern int omp_in_explicit_task (void) __GOMP_NOTHROW
;
249 extern int omp_get_cancellation (void) __GOMP_NOTHROW
;
250 extern omp_proc_bind_t
omp_get_proc_bind (void) __GOMP_NOTHROW
;
251 extern int omp_get_num_places (void) __GOMP_NOTHROW
;
252 extern int omp_get_place_num_procs (int) __GOMP_NOTHROW
;
253 extern void omp_get_place_proc_ids (int, int *) __GOMP_NOTHROW
;
254 extern int omp_get_place_num (void) __GOMP_NOTHROW
;
255 extern int omp_get_partition_num_places (void) __GOMP_NOTHROW
;
256 extern void omp_get_partition_place_nums (int *) __GOMP_NOTHROW
;
258 extern void omp_set_default_device (int) __GOMP_NOTHROW
;
259 extern int omp_get_default_device (void) __GOMP_NOTHROW
;
260 extern int omp_get_num_devices (void) __GOMP_NOTHROW
;
261 extern int omp_get_device_num (void) __GOMP_NOTHROW
;
262 extern int omp_get_num_teams (void) __GOMP_NOTHROW
;
263 extern int omp_get_team_num (void) __GOMP_NOTHROW
;
265 extern int omp_is_initial_device (void) __GOMP_NOTHROW
;
266 extern int omp_get_initial_device (void) __GOMP_NOTHROW
;
267 extern int omp_get_max_task_priority (void) __GOMP_NOTHROW
;
269 extern void omp_fulfill_event (omp_event_handle_t
) __GOMP_NOTHROW
;
271 extern void omp_set_num_teams (int) __GOMP_NOTHROW
;
272 extern int omp_get_max_teams (void) __GOMP_NOTHROW
;
273 extern void omp_set_teams_thread_limit (int) __GOMP_NOTHROW
;
274 extern int omp_get_teams_thread_limit (void) __GOMP_NOTHROW
;
276 extern void *omp_target_alloc (__SIZE_TYPE__
, int) __GOMP_NOTHROW
;
277 extern void omp_target_free (void *, int) __GOMP_NOTHROW
;
278 extern int omp_target_is_present (const void *, int) __GOMP_NOTHROW
;
279 extern int omp_target_memcpy (void *, const void *, __SIZE_TYPE__
,
280 __SIZE_TYPE__
, __SIZE_TYPE__
, int, int)
282 extern int omp_target_memcpy_async (void *, const void *, __SIZE_TYPE__
,
283 __SIZE_TYPE__
, __SIZE_TYPE__
, int, int,
286 extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__
, int,
287 const __SIZE_TYPE__
*,
288 const __SIZE_TYPE__
*,
289 const __SIZE_TYPE__
*,
290 const __SIZE_TYPE__
*,
291 const __SIZE_TYPE__
*, int, int)
293 extern int omp_target_memcpy_rect_async (void *, const void *, __SIZE_TYPE__
,
294 int, const __SIZE_TYPE__
*,
295 const __SIZE_TYPE__
*,
296 const __SIZE_TYPE__
*,
297 const __SIZE_TYPE__
*,
298 const __SIZE_TYPE__
*, int, int, int,
301 extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__
,
302 __SIZE_TYPE__
, int) __GOMP_NOTHROW
;
303 extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW
;
304 extern void *omp_get_mapped_ptr (const void *, int) __GOMP_NOTHROW
;
305 extern int omp_target_is_accessible (const void *, __SIZE_TYPE__
, int)
308 extern void omp_set_affinity_format (const char *) __GOMP_NOTHROW
;
309 extern __SIZE_TYPE__
omp_get_affinity_format (char *, __SIZE_TYPE__
)
311 extern void omp_display_affinity (const char *) __GOMP_NOTHROW
;
312 extern __SIZE_TYPE__
omp_capture_affinity (char *, __SIZE_TYPE__
, const char *)
315 extern int omp_pause_resource (omp_pause_resource_t
, int) __GOMP_NOTHROW
;
316 extern int omp_pause_resource_all (omp_pause_resource_t
) __GOMP_NOTHROW
;
318 extern omp_allocator_handle_t
omp_init_allocator (omp_memspace_handle_t
,
320 const omp_alloctrait_t
[])
322 extern void omp_destroy_allocator (omp_allocator_handle_t
) __GOMP_NOTHROW
;
323 extern void omp_set_default_allocator (omp_allocator_handle_t
) __GOMP_NOTHROW
;
324 extern omp_allocator_handle_t
omp_get_default_allocator (void) __GOMP_NOTHROW
;
325 extern void omp_free (void *,
326 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR
)
328 extern void *omp_alloc (__SIZE_TYPE__
,
329 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR
)
330 __GOMP_NOTHROW
__attribute__((__malloc__
, __malloc__ (omp_free
),
331 __alloc_size__ (1)));
332 extern void *omp_aligned_alloc (__SIZE_TYPE__
, __SIZE_TYPE__
,
333 omp_allocator_handle_t
334 __GOMP_DEFAULT_NULL_ALLOCATOR
)
335 __GOMP_NOTHROW
__attribute__((__malloc__
, __malloc__ (omp_free
),
336 __alloc_size__ (2), __alloc_align__ (1)));
337 extern void *omp_calloc (__SIZE_TYPE__
, __SIZE_TYPE__
,
338 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR
)
339 __GOMP_NOTHROW
__attribute__((__malloc__
, __malloc__ (omp_free
),
340 __alloc_size__ (1, 2)));
341 extern void *omp_aligned_calloc (__SIZE_TYPE__
, __SIZE_TYPE__
, __SIZE_TYPE__
,
342 omp_allocator_handle_t
343 __GOMP_DEFAULT_NULL_ALLOCATOR
)
344 __GOMP_NOTHROW
__attribute__((__malloc__
, __malloc__ (omp_free
),
345 __alloc_size__ (2, 3), __alloc_align__ (1)));
346 extern void *omp_realloc (void *, __SIZE_TYPE__
,
347 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR
,
348 omp_allocator_handle_t __GOMP_DEFAULT_NULL_ALLOCATOR
)
349 __GOMP_NOTHROW
__attribute__((__malloc__ (omp_free
), __alloc_size__ (2)));
351 extern void omp_display_env (int) __GOMP_NOTHROW
;