1 //===------- interface.h - OpenMP interface definitions ---------- CUDA -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains all the definitions that are relevant to
10 // the interface. The first section contains the interface as
11 // declared by OpenMP. The second section includes the compiler
12 // specific interfaces.
14 //===----------------------------------------------------------------------===//
16 #ifndef _INTERFACES_H_
17 #define _INTERFACES_H_
23 #include "amdgcn/src/amdgcn_interface.h"
26 #include "nvptx/src/nvptx_interface.h"
29 ////////////////////////////////////////////////////////////////////////////////
31 ////////////////////////////////////////////////////////////////////////////////
33 typedef uint64_t omp_nest_lock_t
; /* arbitrary type of the right length */
35 typedef enum omp_sched_t
{
36 omp_sched_static
= 1, /* chunkSize >0 */
37 omp_sched_dynamic
= 2, /* chunkSize >0 */
38 omp_sched_guided
= 3, /* chunkSize >0 */
39 omp_sched_auto
= 4, /* no chunkSize */
42 typedef enum omp_proc_bind_t
{
43 omp_proc_bind_false
= 0,
44 omp_proc_bind_true
= 1,
45 omp_proc_bind_master
= 2,
46 omp_proc_bind_close
= 3,
47 omp_proc_bind_spread
= 4
50 EXTERN
double omp_get_wtick(void);
51 EXTERN
double omp_get_wtime(void);
53 EXTERN
void omp_set_num_threads(int num
);
54 EXTERN
int omp_get_num_threads(void);
55 EXTERN
int omp_get_max_threads(void);
56 EXTERN
int omp_get_thread_limit(void);
57 EXTERN
int omp_get_thread_num(void);
58 EXTERN
int omp_get_num_procs(void);
59 EXTERN
int omp_in_parallel(void);
60 EXTERN
int omp_in_final(void);
61 EXTERN
void omp_set_dynamic(int flag
);
62 EXTERN
int omp_get_dynamic(void);
63 EXTERN
void omp_set_nested(int flag
);
64 EXTERN
int omp_get_nested(void);
65 EXTERN
void omp_set_max_active_levels(int level
);
66 EXTERN
int omp_get_max_active_levels(void);
67 EXTERN
int omp_get_level(void);
68 EXTERN
int omp_get_active_level(void);
69 EXTERN
int omp_get_ancestor_thread_num(int level
);
70 EXTERN
int omp_get_team_size(int level
);
72 EXTERN
void omp_init_lock(omp_lock_t
*lock
);
73 EXTERN
void omp_init_nest_lock(omp_nest_lock_t
*lock
);
74 EXTERN
void omp_destroy_lock(omp_lock_t
*lock
);
75 EXTERN
void omp_destroy_nest_lock(omp_nest_lock_t
*lock
);
76 EXTERN
void omp_set_lock(omp_lock_t
*lock
);
77 EXTERN
void omp_set_nest_lock(omp_nest_lock_t
*lock
);
78 EXTERN
void omp_unset_lock(omp_lock_t
*lock
);
79 EXTERN
void omp_unset_nest_lock(omp_nest_lock_t
*lock
);
80 EXTERN
int omp_test_lock(omp_lock_t
*lock
);
81 EXTERN
int omp_test_nest_lock(omp_nest_lock_t
*lock
);
83 EXTERN
void omp_get_schedule(omp_sched_t
*kind
, int *modifier
);
84 EXTERN
void omp_set_schedule(omp_sched_t kind
, int modifier
);
85 EXTERN omp_proc_bind_t
omp_get_proc_bind(void);
86 EXTERN
int omp_get_cancellation(void);
87 EXTERN
void omp_set_default_device(int deviceId
);
88 EXTERN
int omp_get_default_device(void);
89 EXTERN
int omp_get_num_devices(void);
90 EXTERN
int omp_get_num_teams(void);
91 EXTERN
int omp_get_team_num(void);
92 EXTERN
int omp_get_initial_device(void);
93 EXTERN
int omp_get_max_task_priority(void);
95 EXTERN
void *llvm_omp_get_dynamic_shared();
97 ////////////////////////////////////////////////////////////////////////////////
98 // file below is swiped from kmpc host interface
99 ////////////////////////////////////////////////////////////////////////////////
101 ////////////////////////////////////////////////////////////////////////////////
102 // kmp specific types
103 ////////////////////////////////////////////////////////////////////////////////
105 typedef enum kmp_sched_t
{
106 kmp_sched_static_chunk
= 33,
107 kmp_sched_static_nochunk
= 34,
108 kmp_sched_dynamic
= 35,
109 kmp_sched_guided
= 36,
110 kmp_sched_runtime
= 37,
113 kmp_sched_static_balanced_chunk
= 45,
115 kmp_sched_static_ordered
= 65,
116 kmp_sched_static_nochunk_ordered
= 66,
117 kmp_sched_dynamic_ordered
= 67,
118 kmp_sched_guided_ordered
= 68,
119 kmp_sched_runtime_ordered
= 69,
120 kmp_sched_auto_ordered
= 70,
122 kmp_sched_distr_static_chunk
= 91,
123 kmp_sched_distr_static_nochunk
= 92,
124 kmp_sched_distr_static_chunk_sched_static_chunkone
= 93,
126 kmp_sched_default
= kmp_sched_static_nochunk
,
127 kmp_sched_unordered_first
= kmp_sched_static_chunk
,
128 kmp_sched_unordered_last
= kmp_sched_auto
,
129 kmp_sched_ordered_first
= kmp_sched_static_ordered
,
130 kmp_sched_ordered_last
= kmp_sched_auto_ordered
,
131 kmp_sched_distribute_first
= kmp_sched_distr_static_chunk
,
132 kmp_sched_distribute_last
=
133 kmp_sched_distr_static_chunk_sched_static_chunkone
,
135 /* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers.
136 * Since we need to distinguish the three possible cases (no modifier,
137 * monotonic modifier, nonmonotonic modifier), we need separate bits for
138 * each modifier. The absence of monotonic does not imply nonmonotonic,
139 * especially since 4.5 says that the behaviour of the "no modifier" case
140 * is implementation defined in 4.5, but will become "nonmonotonic" in 5.0.
142 * Since we're passing a full 32 bit value, we can use a couple of high
143 * bits for these flags; out of paranoia we avoid the sign bit.
145 * These modifiers can be or-ed into non-static schedules by the compiler
146 * to pass the additional information. They will be stripped early in the
147 * processing in __kmp_dispatch_init when setting up schedules, so
148 * most of the code won't ever see schedules with these bits set.
150 kmp_sched_modifier_monotonic
= (1 << 29),
151 /**< Set if the monotonic schedule modifier was present */
152 kmp_sched_modifier_nonmonotonic
= (1 << 30),
153 /**< Set if the nonmonotonic schedule modifier was present */
155 #define SCHEDULE_WITHOUT_MODIFIERS(s) \
156 (enum kmp_sched_t)( \
157 (s) & ~(kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic))
158 #define SCHEDULE_HAS_MONOTONIC(s) (((s)&kmp_sched_modifier_monotonic) != 0)
159 #define SCHEDULE_HAS_NONMONOTONIC(s) \
160 (((s)&kmp_sched_modifier_nonmonotonic) != 0)
161 #define SCHEDULE_HAS_NO_MODIFIERS(s) \
162 (((s) & (kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic)) == \
168 * Enum for accesseing the reserved_2 field of the ident_t struct below.
171 /*! Bit set to 1 when in SPMD mode. */
172 KMP_IDENT_SPMD_MODE
= 0x01,
173 /*! Bit set to 1 when a simplified runtime is used. */
174 KMP_IDENT_SIMPLE_RT_MODE
= 0x02,
178 * The ident structure that describes a source location.
179 * The struct is identical to the one in the kmp.h file.
180 * We maintain the same data structure for compatibility.
182 typedef short kmp_int16
;
183 typedef int kmp_int32
;
184 typedef struct ident
{
185 kmp_int32 reserved_1
; /**< might be used in Fortran; see above */
186 kmp_int32 flags
; /**< also f.flags; KMP_IDENT_xxx flags; KMP_IDENT_KMPC
187 identifies this union member */
188 kmp_int32 reserved_2
; /**< not really used in Fortran any more; see above */
189 kmp_int32 reserved_3
; /**< source[4] in Fortran, do not use for C++ */
190 char const *psource
; /**< String describing the source location.
191 The string is composed of semi-colon separated fields
192 which describe the source file, the function and a pair
193 of line numbers that delimit the construct. */
197 typedef ident_t kmp_Ident
;
198 typedef void (*kmp_InterWarpCopyFctPtr
)(void *src
, int32_t warp_num
);
199 typedef void (*kmp_ShuffleReductFctPtr
)(void *rhsData
, int16_t lane_id
,
201 int16_t shortCircuit
);
202 typedef void (*kmp_ListGlobalFctPtr
)(void *buffer
, int idx
, void *reduce_data
);
205 typedef struct kmp_TaskDescr kmp_TaskDescr
;
206 typedef int32_t (*kmp_TaskFctPtr
)(int32_t global_tid
, kmp_TaskDescr
*taskDescr
);
207 typedef struct kmp_TaskDescr
{
208 void *sharedPointerTable
; // ptr to a table of shared var ptrs
209 kmp_TaskFctPtr sub
; // task subroutine
210 int32_t partId
; // unused
211 kmp_TaskFctPtr destructors
; // destructor of c++ first private
215 typedef int32_t kmp_CriticalName
[8];
217 ////////////////////////////////////////////////////////////////////////////////
218 // external interface
219 ////////////////////////////////////////////////////////////////////////////////
222 EXTERN
int32_t __kmpc_global_thread_num(kmp_Ident
*loc
);
223 NOINLINE EXTERN
uint8_t __kmpc_parallel_level();
226 EXTERN
void __kmpc_push_proc_bind(kmp_Ident
*loc
, uint32_t global_tid
,
228 EXTERN
int omp_get_num_places(void);
229 EXTERN
int omp_get_place_num_procs(int place_num
);
230 EXTERN
void omp_get_place_proc_ids(int place_num
, int *ids
);
231 EXTERN
int omp_get_place_num(void);
232 EXTERN
int omp_get_partition_num_places(void);
233 EXTERN
void omp_get_partition_place_nums(int *place_nums
);
235 // for static (no chunk or chunk)
236 EXTERN
void __kmpc_for_static_init_4(kmp_Ident
*loc
, int32_t global_tid
,
237 int32_t sched
, int32_t *plastiter
,
238 int32_t *plower
, int32_t *pupper
,
239 int32_t *pstride
, int32_t incr
,
241 EXTERN
void __kmpc_for_static_init_4u(kmp_Ident
*loc
, int32_t global_tid
,
242 int32_t sched
, int32_t *plastiter
,
243 uint32_t *plower
, uint32_t *pupper
,
244 int32_t *pstride
, int32_t incr
,
246 EXTERN
void __kmpc_for_static_init_8(kmp_Ident
*loc
, int32_t global_tid
,
247 int32_t sched
, int32_t *plastiter
,
248 int64_t *plower
, int64_t *pupper
,
249 int64_t *pstride
, int64_t incr
,
251 EXTERN
void __kmpc_for_static_init_8u(kmp_Ident
*loc
, int32_t global_tid
,
252 int32_t sched
, int32_t *plastiter1
,
253 uint64_t *plower
, uint64_t *pupper
,
254 int64_t *pstride
, int64_t incr
,
256 // distribute static (no chunk or chunk)
257 EXTERN
void __kmpc_distribute_static_init_4(kmp_Ident
*loc
, int32_t global_tid
,
258 int32_t sched
, int32_t *plastiter
,
259 int32_t *plower
, int32_t *pupper
,
260 int32_t *pstride
, int32_t incr
,
262 EXTERN
void __kmpc_distribute_static_init_4u(kmp_Ident
*loc
, int32_t global_tid
,
263 int32_t sched
, int32_t *plastiter
,
264 uint32_t *plower
, uint32_t *pupper
,
265 int32_t *pstride
, int32_t incr
,
267 EXTERN
void __kmpc_distribute_static_init_8(kmp_Ident
*loc
, int32_t global_tid
,
268 int32_t sched
, int32_t *plastiter
,
269 int64_t *plower
, int64_t *pupper
,
270 int64_t *pstride
, int64_t incr
,
272 EXTERN
void __kmpc_distribute_static_init_8u(kmp_Ident
*loc
, int32_t global_tid
,
273 int32_t sched
, int32_t *plastiter1
,
274 uint64_t *plower
, uint64_t *pupper
,
275 int64_t *pstride
, int64_t incr
,
278 void __kmpc_for_static_init_4_simple_spmd(kmp_Ident
*loc
, int32_t global_tid
,
279 int32_t sched
, int32_t *plastiter
,
280 int32_t *plower
, int32_t *pupper
,
281 int32_t *pstride
, int32_t incr
,
284 void __kmpc_for_static_init_4u_simple_spmd(kmp_Ident
*loc
, int32_t global_tid
,
285 int32_t sched
, int32_t *plastiter
,
286 uint32_t *plower
, uint32_t *pupper
,
287 int32_t *pstride
, int32_t incr
,
290 void __kmpc_for_static_init_8_simple_spmd(kmp_Ident
*loc
, int32_t global_tid
,
291 int32_t sched
, int32_t *plastiter
,
292 int64_t *plower
, int64_t *pupper
,
293 int64_t *pstride
, int64_t incr
,
296 void __kmpc_for_static_init_8u_simple_spmd(kmp_Ident
*loc
, int32_t global_tid
,
297 int32_t sched
, int32_t *plastiter1
,
298 uint64_t *plower
, uint64_t *pupper
,
299 int64_t *pstride
, int64_t incr
,
302 void __kmpc_for_static_init_4_simple_generic(kmp_Ident
*loc
, int32_t global_tid
,
303 int32_t sched
, int32_t *plastiter
,
304 int32_t *plower
, int32_t *pupper
,
305 int32_t *pstride
, int32_t incr
,
308 void __kmpc_for_static_init_4u_simple_generic(
309 kmp_Ident
*loc
, int32_t global_tid
, int32_t sched
, int32_t *plastiter
,
310 uint32_t *plower
, uint32_t *pupper
, int32_t *pstride
, int32_t incr
,
313 void __kmpc_for_static_init_8_simple_generic(kmp_Ident
*loc
, int32_t global_tid
,
314 int32_t sched
, int32_t *plastiter
,
315 int64_t *plower
, int64_t *pupper
,
316 int64_t *pstride
, int64_t incr
,
319 void __kmpc_for_static_init_8u_simple_generic(
320 kmp_Ident
*loc
, int32_t global_tid
, int32_t sched
, int32_t *plastiter1
,
321 uint64_t *plower
, uint64_t *pupper
, int64_t *pstride
, int64_t incr
,
324 EXTERN
void __kmpc_for_static_fini(kmp_Ident
*loc
, int32_t global_tid
);
326 EXTERN
void __kmpc_distribute_static_fini(kmp_Ident
*loc
, int32_t global_tid
);
329 EXTERN
void __kmpc_dispatch_init_4(kmp_Ident
*loc
, int32_t global_tid
,
330 int32_t sched
, int32_t lower
, int32_t upper
,
331 int32_t incr
, int32_t chunk
);
332 EXTERN
void __kmpc_dispatch_init_4u(kmp_Ident
*loc
, int32_t global_tid
,
333 int32_t sched
, uint32_t lower
,
334 uint32_t upper
, int32_t incr
,
336 EXTERN
void __kmpc_dispatch_init_8(kmp_Ident
*loc
, int32_t global_tid
,
337 int32_t sched
, int64_t lower
, int64_t upper
,
338 int64_t incr
, int64_t chunk
);
339 EXTERN
void __kmpc_dispatch_init_8u(kmp_Ident
*loc
, int32_t global_tid
,
340 int32_t sched
, uint64_t lower
,
341 uint64_t upper
, int64_t incr
,
344 EXTERN
int __kmpc_dispatch_next_4(kmp_Ident
*loc
, int32_t global_tid
,
345 int32_t *plastiter
, int32_t *plower
,
346 int32_t *pupper
, int32_t *pstride
);
347 EXTERN
int __kmpc_dispatch_next_4u(kmp_Ident
*loc
, int32_t global_tid
,
348 int32_t *plastiter
, uint32_t *plower
,
349 uint32_t *pupper
, int32_t *pstride
);
350 EXTERN
int __kmpc_dispatch_next_8(kmp_Ident
*loc
, int32_t global_tid
,
351 int32_t *plastiter
, int64_t *plower
,
352 int64_t *pupper
, int64_t *pstride
);
353 EXTERN
int __kmpc_dispatch_next_8u(kmp_Ident
*loc
, int32_t global_tid
,
354 int32_t *plastiter
, uint64_t *plower
,
355 uint64_t *pupper
, int64_t *pstride
);
357 EXTERN
void __kmpc_dispatch_fini_4(kmp_Ident
*loc
, int32_t global_tid
);
358 EXTERN
void __kmpc_dispatch_fini_4u(kmp_Ident
*loc
, int32_t global_tid
);
359 EXTERN
void __kmpc_dispatch_fini_8(kmp_Ident
*loc
, int32_t global_tid
);
360 EXTERN
void __kmpc_dispatch_fini_8u(kmp_Ident
*loc
, int32_t global_tid
);
363 EXTERN
void __kmpc_nvptx_end_reduce(int32_t global_tid
);
364 EXTERN
void __kmpc_nvptx_end_reduce_nowait(int32_t global_tid
);
365 EXTERN
int32_t __kmpc_nvptx_parallel_reduce_nowait_v2(
366 kmp_Ident
*loc
, int32_t global_tid
, int32_t num_vars
, size_t reduce_size
,
367 void *reduce_data
, kmp_ShuffleReductFctPtr shflFct
,
368 kmp_InterWarpCopyFctPtr cpyFct
);
369 EXTERN
int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
370 kmp_Ident
*loc
, int32_t global_tid
, void *global_buffer
,
371 int32_t num_of_records
, void *reduce_data
, kmp_ShuffleReductFctPtr shflFct
,
372 kmp_InterWarpCopyFctPtr cpyFct
, kmp_ListGlobalFctPtr lgcpyFct
,
373 kmp_ListGlobalFctPtr lgredFct
, kmp_ListGlobalFctPtr glcpyFct
,
374 kmp_ListGlobalFctPtr glredFct
);
375 EXTERN
int32_t __kmpc_shuffle_int32(int32_t val
, int16_t delta
, int16_t size
);
376 EXTERN
int64_t __kmpc_shuffle_int64(int64_t val
, int16_t delta
, int16_t size
);
379 EXTERN
void __kmpc_barrier(kmp_Ident
*loc_ref
, int32_t tid
);
380 EXTERN
void __kmpc_barrier_simple_spmd(kmp_Ident
*loc_ref
, int32_t tid
);
381 EXTERN
void __kmpc_barrier_simple_generic(kmp_Ident
*loc_ref
, int32_t tid
);
382 EXTERN
int32_t __kmpc_cancel_barrier(kmp_Ident
*loc
, int32_t global_tid
);
385 EXTERN
int32_t __kmpc_single(kmp_Ident
*loc
, int32_t global_tid
);
386 EXTERN
void __kmpc_end_single(kmp_Ident
*loc
, int32_t global_tid
);
389 EXTERN
int32_t __kmpc_master(kmp_Ident
*loc
, int32_t global_tid
);
390 EXTERN
void __kmpc_end_master(kmp_Ident
*loc
, int32_t global_tid
);
391 EXTERN
void __kmpc_ordered(kmp_Ident
*loc
, int32_t global_tid
);
392 EXTERN
void __kmpc_end_ordered(kmp_Ident
*loc
, int32_t global_tid
);
393 EXTERN
void __kmpc_critical(kmp_Ident
*loc
, int32_t global_tid
,
394 kmp_CriticalName
*crit
);
395 EXTERN
void __kmpc_end_critical(kmp_Ident
*loc
, int32_t global_tid
,
396 kmp_CriticalName
*crit
);
397 EXTERN
void __kmpc_flush(kmp_Ident
*loc
);
400 EXTERN
uint64_t __kmpc_warp_active_thread_mask(void);
402 EXTERN
void __kmpc_syncwarp(uint64_t);
405 EXTERN kmp_TaskDescr
*__kmpc_omp_task_alloc(kmp_Ident
*loc
, uint32_t global_tid
,
407 size_t sizeOfTaskInclPrivate
,
408 size_t sizeOfSharedTable
,
410 EXTERN
int32_t __kmpc_omp_task(kmp_Ident
*loc
, uint32_t global_tid
,
411 kmp_TaskDescr
*newLegacyTaskDescr
);
412 EXTERN
int32_t __kmpc_omp_task_with_deps(kmp_Ident
*loc
, uint32_t global_tid
,
413 kmp_TaskDescr
*newLegacyTaskDescr
,
414 int32_t depNum
, void *depList
,
415 int32_t noAliasDepNum
,
416 void *noAliasDepList
);
417 EXTERN
void __kmpc_omp_task_begin_if0(kmp_Ident
*loc
, uint32_t global_tid
,
418 kmp_TaskDescr
*newLegacyTaskDescr
);
419 EXTERN
void __kmpc_omp_task_complete_if0(kmp_Ident
*loc
, uint32_t global_tid
,
420 kmp_TaskDescr
*newLegacyTaskDescr
);
421 EXTERN
void __kmpc_omp_wait_deps(kmp_Ident
*loc
, uint32_t global_tid
,
422 int32_t depNum
, void *depList
,
423 int32_t noAliasDepNum
, void *noAliasDepList
);
424 EXTERN
void __kmpc_taskgroup(kmp_Ident
*loc
, uint32_t global_tid
);
425 EXTERN
void __kmpc_end_taskgroup(kmp_Ident
*loc
, uint32_t global_tid
);
426 EXTERN
int32_t __kmpc_omp_taskyield(kmp_Ident
*loc
, uint32_t global_tid
,
428 EXTERN
int32_t __kmpc_omp_taskwait(kmp_Ident
*loc
, uint32_t global_tid
);
429 EXTERN
void __kmpc_taskloop(kmp_Ident
*loc
, uint32_t global_tid
,
430 kmp_TaskDescr
*newKmpTaskDescr
, int if_val
,
431 uint64_t *lb
, uint64_t *ub
, int64_t st
, int nogroup
,
432 int32_t sched
, uint64_t grainsize
, void *task_dup
);
435 EXTERN
int32_t __kmpc_cancellationpoint(kmp_Ident
*loc
, int32_t global_tid
,
437 EXTERN
int32_t __kmpc_cancel(kmp_Ident
*loc
, int32_t global_tid
,
441 EXTERN
int32_t __kmpc_target_init(ident_t
*Ident
, int8_t Mode
,
442 bool UseGenericStateMachine
,
443 bool RequiresFullRuntime
);
444 EXTERN
void __kmpc_target_deinit(ident_t
*Ident
, int8_t Mode
,
445 bool RequiresFullRuntime
);
446 EXTERN
void __kmpc_kernel_prepare_parallel(void *WorkFn
,
447 int32_t NumThreadsClause
);
448 EXTERN
bool __kmpc_kernel_parallel(void **WorkFn
);
449 EXTERN
void __kmpc_kernel_end_parallel();
451 EXTERN
void __kmpc_data_sharing_init_stack();
452 EXTERN
void __kmpc_begin_sharing_variables(void ***GlobalArgs
, size_t nArgs
);
453 EXTERN
void __kmpc_end_sharing_variables();
454 EXTERN
void __kmpc_get_shared_variables(void ***GlobalArgs
);
456 /// Entry point to start a new parallel region.
458 /// \param ident The source identifier.
459 /// \param global_tid The global thread ID.
460 /// \param if_expr The if(expr), or 1 if none given.
461 /// \param num_threads The num_threads(expr), or -1 if none given.
462 /// \param proc_bind The proc_bind, or `proc_bind_default` if none given.
463 /// \param fn The outlined parallel region function.
464 /// \param wrapper_fn The worker wrapper function of fn.
465 /// \param args The pointer array of arguments to fn.
466 /// \param nargs The number of arguments to fn.
467 NOINLINE EXTERN
void __kmpc_parallel_51(ident_t
*ident
, kmp_int32 global_tid
,
469 kmp_int32 num_threads
, int proc_bind
,
470 void *fn
, void *wrapper_fn
, void **args
,
473 // SPMD execution mode interrogation function.
474 EXTERN
int8_t __kmpc_is_spmd_exec_mode();
476 /// Return true if the hardware thread id \p Tid represents the OpenMP main
477 /// thread in generic mode outside of a parallel region.
478 EXTERN
int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid
);
480 /// Return true if the hardware thread id \p Tid represents the OpenMP main
481 /// thread in generic mode.
482 EXTERN
int8_t __kmpc_is_generic_main_thread_id(kmp_int32 Tid
);
484 EXTERN
void __kmpc_get_team_static_memory(int16_t isSPMDExecutionMode
,
485 const void *buf
, size_t size
,
486 int16_t is_shared
, const void **res
);
488 EXTERN
void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode
,
491 /// Allocate \p Bytes in "shareable" memory and return the address. Needs to be
492 /// called balanced with __kmpc_free_shared like a stack (push/pop). Can be
493 /// called by any thread, allocation happens per-thread.
494 EXTERN
void *__kmpc_alloc_shared(uint64_t Bytes
);
496 /// Deallocate \p Ptr. Needs to be called balanced with __kmpc_alloc_shared like
497 /// a stack (push/pop). Can be called by any thread. \p Ptr must be allocated by
498 /// __kmpc_alloc_shared by the same thread. \p Bytes contains the size of the
499 /// paired allocation to make memory management easier.
500 EXTERN
void __kmpc_free_shared(void *Ptr
, size_t Bytes
);
502 /// Get a pointer to the dynamic shared memory buffer in the device.
503 EXTERN
void *__kmpc_get_dynamic_shared();