2019-10-16 01:15:26 +08:00
|
|
|
//===------- interface.h - OpenMP interface definitions ---------- CUDA -*-===//
|
2018-01-29 21:59:35 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-01-29 21:59:35 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains all the definitions that are relevant to
|
|
|
|
// the interface. The first section contains the interface as
|
2019-07-12 04:12:51 +08:00
|
|
|
// declared by OpenMP. The second section includes the compiler
|
2018-01-29 21:59:35 +08:00
|
|
|
// specific interfaces.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _INTERFACES_H_
|
|
|
|
#define _INTERFACES_H_
|
|
|
|
|
2019-10-27 13:01:24 +08:00
|
|
|
#include <stddef.h>
|
2019-10-16 01:15:26 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-11-01 22:58:39 +08:00
|
|
|
#ifdef __AMDGCN__
|
|
|
|
#include "amdgcn/src/amdgcn_interface.h"
|
|
|
|
#endif
|
2019-10-16 01:15:26 +08:00
|
|
|
#ifdef __CUDACC__
|
|
|
|
#include "nvptx/src/nvptx_interface.h"
|
|
|
|
#endif
|
2018-09-04 23:13:17 +08:00
|
|
|
|
2018-01-29 21:59:35 +08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// OpenMP interface
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef uint64_t omp_nest_lock_t; /* arbitrary type of the right length */
|
|
|
|
|
|
|
|
typedef enum omp_sched_t {
|
|
|
|
omp_sched_static = 1, /* chunkSize >0 */
|
|
|
|
omp_sched_dynamic = 2, /* chunkSize >0 */
|
|
|
|
omp_sched_guided = 3, /* chunkSize >0 */
|
|
|
|
omp_sched_auto = 4, /* no chunkSize */
|
|
|
|
} omp_sched_t;
|
|
|
|
|
|
|
|
typedef enum omp_proc_bind_t {
|
|
|
|
omp_proc_bind_false = 0,
|
|
|
|
omp_proc_bind_true = 1,
|
|
|
|
omp_proc_bind_master = 2,
|
|
|
|
omp_proc_bind_close = 3,
|
|
|
|
omp_proc_bind_spread = 4
|
|
|
|
} omp_proc_bind_t;
|
|
|
|
|
|
|
|
EXTERN double omp_get_wtick(void);
|
|
|
|
EXTERN double omp_get_wtime(void);
|
|
|
|
|
|
|
|
EXTERN void omp_set_num_threads(int num);
|
|
|
|
EXTERN int omp_get_num_threads(void);
|
|
|
|
EXTERN int omp_get_max_threads(void);
|
|
|
|
EXTERN int omp_get_thread_limit(void);
|
|
|
|
EXTERN int omp_get_thread_num(void);
|
|
|
|
EXTERN int omp_get_num_procs(void);
|
|
|
|
EXTERN int omp_in_parallel(void);
|
|
|
|
EXTERN int omp_in_final(void);
|
|
|
|
EXTERN void omp_set_dynamic(int flag);
|
|
|
|
EXTERN int omp_get_dynamic(void);
|
|
|
|
EXTERN void omp_set_nested(int flag);
|
|
|
|
EXTERN int omp_get_nested(void);
|
|
|
|
EXTERN void omp_set_max_active_levels(int level);
|
|
|
|
EXTERN int omp_get_max_active_levels(void);
|
|
|
|
EXTERN int omp_get_level(void);
|
|
|
|
EXTERN int omp_get_active_level(void);
|
|
|
|
EXTERN int omp_get_ancestor_thread_num(int level);
|
|
|
|
EXTERN int omp_get_team_size(int level);
|
|
|
|
|
|
|
|
EXTERN void omp_init_lock(omp_lock_t *lock);
|
|
|
|
EXTERN void omp_init_nest_lock(omp_nest_lock_t *lock);
|
|
|
|
EXTERN void omp_destroy_lock(omp_lock_t *lock);
|
|
|
|
EXTERN void omp_destroy_nest_lock(omp_nest_lock_t *lock);
|
|
|
|
EXTERN void omp_set_lock(omp_lock_t *lock);
|
|
|
|
EXTERN void omp_set_nest_lock(omp_nest_lock_t *lock);
|
|
|
|
EXTERN void omp_unset_lock(omp_lock_t *lock);
|
|
|
|
EXTERN void omp_unset_nest_lock(omp_nest_lock_t *lock);
|
|
|
|
EXTERN int omp_test_lock(omp_lock_t *lock);
|
|
|
|
EXTERN int omp_test_nest_lock(omp_nest_lock_t *lock);
|
|
|
|
|
|
|
|
EXTERN void omp_get_schedule(omp_sched_t *kind, int *modifier);
|
|
|
|
EXTERN void omp_set_schedule(omp_sched_t kind, int modifier);
|
|
|
|
EXTERN omp_proc_bind_t omp_get_proc_bind(void);
|
|
|
|
EXTERN int omp_get_cancellation(void);
|
|
|
|
EXTERN void omp_set_default_device(int deviceId);
|
|
|
|
EXTERN int omp_get_default_device(void);
|
|
|
|
EXTERN int omp_get_num_devices(void);
|
|
|
|
EXTERN int omp_get_num_teams(void);
|
|
|
|
EXTERN int omp_get_team_num(void);
|
|
|
|
EXTERN int omp_get_initial_device(void);
|
|
|
|
EXTERN int omp_get_max_task_priority(void);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// file below is swiped from kmpc host interface
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2020-04-04 11:06:29 +08:00
|
|
|
// kmp specific types
|
2018-01-29 21:59:35 +08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef enum kmp_sched_t {
|
|
|
|
kmp_sched_static_chunk = 33,
|
|
|
|
kmp_sched_static_nochunk = 34,
|
|
|
|
kmp_sched_dynamic = 35,
|
|
|
|
kmp_sched_guided = 36,
|
|
|
|
kmp_sched_runtime = 37,
|
|
|
|
kmp_sched_auto = 38,
|
|
|
|
|
2018-08-30 01:35:09 +08:00
|
|
|
kmp_sched_static_balanced_chunk = 45,
|
|
|
|
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_sched_static_ordered = 65,
|
|
|
|
kmp_sched_static_nochunk_ordered = 66,
|
|
|
|
kmp_sched_dynamic_ordered = 67,
|
|
|
|
kmp_sched_guided_ordered = 68,
|
|
|
|
kmp_sched_runtime_ordered = 69,
|
|
|
|
kmp_sched_auto_ordered = 70,
|
|
|
|
|
|
|
|
kmp_sched_distr_static_chunk = 91,
|
|
|
|
kmp_sched_distr_static_nochunk = 92,
|
|
|
|
kmp_sched_distr_static_chunk_sched_static_chunkone = 93,
|
|
|
|
|
|
|
|
kmp_sched_default = kmp_sched_static_nochunk,
|
|
|
|
kmp_sched_unordered_first = kmp_sched_static_chunk,
|
|
|
|
kmp_sched_unordered_last = kmp_sched_auto,
|
|
|
|
kmp_sched_ordered_first = kmp_sched_static_ordered,
|
|
|
|
kmp_sched_ordered_last = kmp_sched_auto_ordered,
|
|
|
|
kmp_sched_distribute_first = kmp_sched_distr_static_chunk,
|
|
|
|
kmp_sched_distribute_last =
|
|
|
|
kmp_sched_distr_static_chunk_sched_static_chunkone,
|
|
|
|
|
|
|
|
/* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers.
|
|
|
|
* Since we need to distinguish the three possible cases (no modifier,
|
|
|
|
* monotonic modifier, nonmonotonic modifier), we need separate bits for
|
|
|
|
* each modifier. The absence of monotonic does not imply nonmonotonic,
|
|
|
|
* especially since 4.5 says that the behaviour of the "no modifier" case
|
|
|
|
* is implementation defined in 4.5, but will become "nonmonotonic" in 5.0.
|
|
|
|
*
|
|
|
|
* Since we're passing a full 32 bit value, we can use a couple of high
|
|
|
|
* bits for these flags; out of paranoia we avoid the sign bit.
|
|
|
|
*
|
|
|
|
* These modifiers can be or-ed into non-static schedules by the compiler
|
|
|
|
* to pass the additional information. They will be stripped early in the
|
|
|
|
* processing in __kmp_dispatch_init when setting up schedules, so
|
|
|
|
* most of the code won't ever see schedules with these bits set.
|
|
|
|
*/
|
|
|
|
kmp_sched_modifier_monotonic = (1 << 29),
|
|
|
|
/**< Set if the monotonic schedule modifier was present */
|
|
|
|
kmp_sched_modifier_nonmonotonic = (1 << 30),
|
|
|
|
/**< Set if the nonmonotonic schedule modifier was present */
|
|
|
|
|
|
|
|
#define SCHEDULE_WITHOUT_MODIFIERS(s) \
|
|
|
|
(enum kmp_sched_t)( \
|
|
|
|
(s) & ~(kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic))
|
|
|
|
#define SCHEDULE_HAS_MONOTONIC(s) (((s)&kmp_sched_modifier_monotonic) != 0)
|
|
|
|
#define SCHEDULE_HAS_NONMONOTONIC(s) \
|
|
|
|
(((s)&kmp_sched_modifier_nonmonotonic) != 0)
|
|
|
|
#define SCHEDULE_HAS_NO_MODIFIERS(s) \
|
|
|
|
(((s) & (kmp_sched_modifier_nonmonotonic | kmp_sched_modifier_monotonic)) == \
|
|
|
|
0)
|
|
|
|
|
|
|
|
} kmp_sched_t;
|
|
|
|
|
2018-11-28 03:45:10 +08:00
|
|
|
/*!
|
|
|
|
* Enum for accesseing the reserved_2 field of the ident_t struct below.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
/*! Bit set to 1 when in SPMD mode. */
|
|
|
|
KMP_IDENT_SPMD_MODE = 0x01,
|
|
|
|
/*! Bit set to 1 when a simplified runtime is used. */
|
|
|
|
KMP_IDENT_SIMPLE_RT_MODE = 0x02,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* The ident structure that describes a source location.
|
|
|
|
* The struct is identical to the one in the kmp.h file.
|
|
|
|
* We maintain the same data structure for compatibility.
|
|
|
|
*/
|
2021-04-22 02:41:31 +08:00
|
|
|
typedef short kmp_int16;
|
2018-11-28 03:45:10 +08:00
|
|
|
typedef int kmp_int32;
|
|
|
|
typedef struct ident {
|
|
|
|
kmp_int32 reserved_1; /**< might be used in Fortran; see above */
|
2021-02-21 01:46:04 +08:00
|
|
|
kmp_int32 flags; /**< also f.flags; KMP_IDENT_xxx flags; KMP_IDENT_KMPC
|
|
|
|
identifies this union member */
|
2018-11-28 03:45:10 +08:00
|
|
|
kmp_int32 reserved_2; /**< not really used in Fortran any more; see above */
|
|
|
|
kmp_int32 reserved_3; /**< source[4] in Fortran, do not use for C++ */
|
2021-02-21 01:46:04 +08:00
|
|
|
char const *psource; /**< String describing the source location.
|
|
|
|
The string is composed of semi-colon separated fields
|
|
|
|
which describe the source file, the function and a pair
|
|
|
|
of line numbers that delimit the construct. */
|
2018-11-28 03:45:10 +08:00
|
|
|
} ident_t;
|
|
|
|
|
2018-01-29 21:59:35 +08:00
|
|
|
// parallel defs
|
2018-11-28 03:45:10 +08:00
|
|
|
typedef ident_t kmp_Ident;
|
2018-01-29 21:59:35 +08:00
|
|
|
typedef void (*kmp_InterWarpCopyFctPtr)(void *src, int32_t warp_num);
|
|
|
|
typedef void (*kmp_ShuffleReductFctPtr)(void *rhsData, int16_t lane_id,
|
|
|
|
int16_t lane_offset,
|
|
|
|
int16_t shortCircuit);
|
2019-02-20 22:55:55 +08:00
|
|
|
typedef void (*kmp_ListGlobalFctPtr)(void *buffer, int idx, void *reduce_data);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// task defs
|
|
|
|
typedef struct kmp_TaskDescr kmp_TaskDescr;
|
|
|
|
typedef int32_t (*kmp_TaskFctPtr)(int32_t global_tid, kmp_TaskDescr *taskDescr);
|
|
|
|
typedef struct kmp_TaskDescr {
|
|
|
|
void *sharedPointerTable; // ptr to a table of shared var ptrs
|
|
|
|
kmp_TaskFctPtr sub; // task subroutine
|
|
|
|
int32_t partId; // unused
|
|
|
|
kmp_TaskFctPtr destructors; // destructor of c++ first private
|
|
|
|
} kmp_TaskDescr;
|
|
|
|
|
|
|
|
// sync defs
|
|
|
|
typedef int32_t kmp_CriticalName[8];
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// external interface
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// parallel
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_global_thread_num(kmp_Ident *loc);
|
|
|
|
EXTERN void __kmpc_push_num_threads(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t num_threads);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_serialized_parallel(kmp_Ident *loc, uint32_t global_tid);
|
2021-02-21 01:46:04 +08:00
|
|
|
EXTERN void __kmpc_end_serialized_parallel(kmp_Ident *loc, uint32_t global_tid);
|
2021-07-27 10:45:52 +08:00
|
|
|
NOINLINE EXTERN uint8_t __kmpc_parallel_level();
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// proc bind
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_push_proc_bind(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int proc_bind);
|
|
|
|
EXTERN int omp_get_num_places(void);
|
|
|
|
EXTERN int omp_get_place_num_procs(int place_num);
|
|
|
|
EXTERN void omp_get_place_proc_ids(int place_num, int *ids);
|
|
|
|
EXTERN int omp_get_place_num(void);
|
|
|
|
EXTERN int omp_get_partition_num_places(void);
|
|
|
|
EXTERN void omp_get_partition_place_nums(int *place_nums);
|
|
|
|
|
|
|
|
// for static (no chunk or chunk)
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_for_static_init_4(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int32_t *plower, int32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_for_static_init_4u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
uint32_t *plower, uint32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_for_static_init_8(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int64_t *plower, int64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_for_static_init_8u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter1,
|
|
|
|
uint64_t *plower, uint64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
2021-09-24 23:53:31 +08:00
|
|
|
// distribute static (no chunk or chunk)
|
|
|
|
EXTERN void __kmpc_distribute_static_init_4(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int32_t *plower, int32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN void __kmpc_distribute_static_init_4u(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
uint32_t *plower, uint32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN void __kmpc_distribute_static_init_8(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int64_t *plower, int64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
EXTERN void __kmpc_distribute_static_init_8u(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter1,
|
|
|
|
uint64_t *plower, uint64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
2018-01-29 21:59:35 +08:00
|
|
|
EXTERN
|
2018-11-28 03:45:10 +08:00
|
|
|
void __kmpc_for_static_init_4_simple_spmd(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int32_t *plower, int32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN
|
2018-11-28 03:45:10 +08:00
|
|
|
void __kmpc_for_static_init_4u_simple_spmd(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
uint32_t *plower, uint32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN
|
2018-11-28 03:45:10 +08:00
|
|
|
void __kmpc_for_static_init_8_simple_spmd(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter,
|
|
|
|
int64_t *plower, int64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
EXTERN
|
2018-11-28 03:45:10 +08:00
|
|
|
void __kmpc_for_static_init_8u_simple_spmd(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t *plastiter1,
|
|
|
|
uint64_t *plower, uint64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
EXTERN
|
2021-02-21 01:46:04 +08:00
|
|
|
void __kmpc_for_static_init_4_simple_generic(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t *plower, int32_t *pupper,
|
|
|
|
int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN
|
|
|
|
void __kmpc_for_static_init_4u_simple_generic(
|
2018-11-28 03:45:10 +08:00
|
|
|
kmp_Ident *loc, int32_t global_tid, int32_t sched, int32_t *plastiter,
|
2018-01-29 21:59:35 +08:00
|
|
|
uint32_t *plower, uint32_t *pupper, int32_t *pstride, int32_t incr,
|
|
|
|
int32_t chunk);
|
|
|
|
EXTERN
|
2021-02-21 01:46:04 +08:00
|
|
|
void __kmpc_for_static_init_8_simple_generic(kmp_Ident *loc, int32_t global_tid,
|
|
|
|
int32_t sched, int32_t *plastiter,
|
2018-01-29 21:59:35 +08:00
|
|
|
int64_t *plower, int64_t *pupper,
|
|
|
|
int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
EXTERN
|
|
|
|
void __kmpc_for_static_init_8u_simple_generic(
|
2018-11-28 03:45:10 +08:00
|
|
|
kmp_Ident *loc, int32_t global_tid, int32_t sched, int32_t *plastiter1,
|
2018-01-29 21:59:35 +08:00
|
|
|
uint64_t *plower, uint64_t *pupper, int64_t *pstride, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_for_static_fini(kmp_Ident *loc, int32_t global_tid);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
2021-09-24 23:53:31 +08:00
|
|
|
EXTERN void __kmpc_distribute_static_fini(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
|
2018-01-29 21:59:35 +08:00
|
|
|
// for dynamic
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_dispatch_init_4(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int32_t lower, int32_t upper,
|
|
|
|
int32_t incr, int32_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_dispatch_init_4u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, uint32_t lower,
|
|
|
|
uint32_t upper, int32_t incr,
|
|
|
|
int32_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_dispatch_init_8(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, int64_t lower, int64_t upper,
|
|
|
|
int64_t incr, int64_t chunk);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_dispatch_init_8u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t sched, uint64_t lower,
|
|
|
|
uint64_t upper, int64_t incr,
|
|
|
|
int64_t chunk);
|
|
|
|
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int __kmpc_dispatch_next_4(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t *plastiter, int32_t *plower,
|
|
|
|
int32_t *pupper, int32_t *pstride);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int __kmpc_dispatch_next_4u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t *plastiter, uint32_t *plower,
|
|
|
|
uint32_t *pupper, int32_t *pstride);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int __kmpc_dispatch_next_8(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t *plastiter, int64_t *plower,
|
|
|
|
int64_t *pupper, int64_t *pstride);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int __kmpc_dispatch_next_8u(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t *plastiter, uint64_t *plower,
|
|
|
|
uint64_t *pupper, int64_t *pstride);
|
|
|
|
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_dispatch_fini_4(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_dispatch_fini_4u(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_dispatch_fini_8(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_dispatch_fini_8u(kmp_Ident *loc, int32_t global_tid);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// reduction
|
|
|
|
EXTERN void __kmpc_nvptx_end_reduce(int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_nvptx_end_reduce_nowait(int32_t global_tid);
|
2019-01-05 01:09:12 +08:00
|
|
|
EXTERN int32_t __kmpc_nvptx_parallel_reduce_nowait_v2(
|
|
|
|
kmp_Ident *loc, int32_t global_tid, int32_t num_vars, size_t reduce_size,
|
|
|
|
void *reduce_data, kmp_ShuffleReductFctPtr shflFct,
|
|
|
|
kmp_InterWarpCopyFctPtr cpyFct);
|
2019-02-20 22:55:55 +08:00
|
|
|
EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
|
|
|
|
kmp_Ident *loc, int32_t global_tid, void *global_buffer,
|
|
|
|
int32_t num_of_records, void *reduce_data, kmp_ShuffleReductFctPtr shflFct,
|
|
|
|
kmp_InterWarpCopyFctPtr cpyFct, kmp_ListGlobalFctPtr lgcpyFct,
|
|
|
|
kmp_ListGlobalFctPtr lgredFct, kmp_ListGlobalFctPtr glcpyFct,
|
|
|
|
kmp_ListGlobalFctPtr glredFct);
|
2018-01-29 21:59:35 +08:00
|
|
|
EXTERN int32_t __kmpc_shuffle_int32(int32_t val, int16_t delta, int16_t size);
|
|
|
|
EXTERN int64_t __kmpc_shuffle_int64(int64_t val, int16_t delta, int16_t size);
|
|
|
|
|
|
|
|
// sync barrier
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_barrier(kmp_Ident *loc_ref, int32_t tid);
|
|
|
|
EXTERN void __kmpc_barrier_simple_spmd(kmp_Ident *loc_ref, int32_t tid);
|
|
|
|
EXTERN int32_t __kmpc_cancel_barrier(kmp_Ident *loc, int32_t global_tid);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// single
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_single(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_end_single(kmp_Ident *loc, int32_t global_tid);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// sync
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_master(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_end_master(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_ordered(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_end_ordered(kmp_Ident *loc, int32_t global_tid);
|
|
|
|
EXTERN void __kmpc_critical(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_CriticalName *crit);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_end_critical(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_CriticalName *crit);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_flush(kmp_Ident *loc);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// vote
|
2021-08-19 03:47:33 +08:00
|
|
|
EXTERN uint64_t __kmpc_warp_active_thread_mask(void);
|
2019-08-27 01:32:45 +08:00
|
|
|
// syncwarp
|
2021-08-19 03:47:33 +08:00
|
|
|
EXTERN void __kmpc_syncwarp(uint64_t);
|
2018-01-29 21:59:35 +08:00
|
|
|
|
|
|
|
// tasks
|
2021-02-21 01:46:04 +08:00
|
|
|
EXTERN kmp_TaskDescr *__kmpc_omp_task_alloc(kmp_Ident *loc, uint32_t global_tid,
|
|
|
|
int32_t flag,
|
2018-01-29 21:59:35 +08:00
|
|
|
size_t sizeOfTaskInclPrivate,
|
|
|
|
size_t sizeOfSharedTable,
|
|
|
|
kmp_TaskFctPtr sub);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_omp_task(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_TaskDescr *newLegacyTaskDescr);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_omp_task_with_deps(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_TaskDescr *newLegacyTaskDescr,
|
|
|
|
int32_t depNum, void *depList,
|
|
|
|
int32_t noAliasDepNum,
|
|
|
|
void *noAliasDepList);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_omp_task_begin_if0(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_TaskDescr *newLegacyTaskDescr);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_omp_task_complete_if0(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_TaskDescr *newLegacyTaskDescr);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_omp_wait_deps(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t depNum, void *depList,
|
|
|
|
int32_t noAliasDepNum, void *noAliasDepList);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN void __kmpc_taskgroup(kmp_Ident *loc, uint32_t global_tid);
|
|
|
|
EXTERN void __kmpc_end_taskgroup(kmp_Ident *loc, uint32_t global_tid);
|
|
|
|
EXTERN int32_t __kmpc_omp_taskyield(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int end_part);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_omp_taskwait(kmp_Ident *loc, uint32_t global_tid);
|
|
|
|
EXTERN void __kmpc_taskloop(kmp_Ident *loc, uint32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
kmp_TaskDescr *newKmpTaskDescr, int if_val,
|
|
|
|
uint64_t *lb, uint64_t *ub, int64_t st, int nogroup,
|
|
|
|
int32_t sched, uint64_t grainsize, void *task_dup);
|
|
|
|
|
|
|
|
// cancel
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_cancellationpoint(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t cancelVal);
|
2018-11-28 03:45:10 +08:00
|
|
|
EXTERN int32_t __kmpc_cancel(kmp_Ident *loc, int32_t global_tid,
|
2018-01-29 21:59:35 +08:00
|
|
|
int32_t cancelVal);
|
|
|
|
|
|
|
|
// non standard
|
2021-09-23 05:16:28 +08:00
|
|
|
EXTERN int32_t __kmpc_target_init(ident_t *Ident, int8_t Mode,
|
2021-09-18 00:54:40 +08:00
|
|
|
bool UseGenericStateMachine,
|
|
|
|
bool RequiresFullRuntime);
|
2021-09-23 05:16:28 +08:00
|
|
|
EXTERN void __kmpc_target_deinit(ident_t *Ident, int8_t Mode,
|
2021-09-18 00:54:40 +08:00
|
|
|
bool RequiresFullRuntime);
|
2020-07-07 08:13:37 +08:00
|
|
|
EXTERN void __kmpc_kernel_prepare_parallel(void *WorkFn);
|
|
|
|
EXTERN bool __kmpc_kernel_parallel(void **WorkFn);
|
2018-01-29 21:59:35 +08:00
|
|
|
EXTERN void __kmpc_kernel_end_parallel();
|
2018-03-14 03:44:53 +08:00
|
|
|
|
|
|
|
EXTERN void __kmpc_data_sharing_init_stack();
|
|
|
|
EXTERN void __kmpc_begin_sharing_variables(void ***GlobalArgs, size_t nArgs);
|
|
|
|
EXTERN void __kmpc_end_sharing_variables();
|
|
|
|
EXTERN void __kmpc_get_shared_variables(void ***GlobalArgs);
|
|
|
|
|
2021-04-22 02:41:31 +08:00
|
|
|
/// Entry point to start a new parallel region.
|
|
|
|
///
|
|
|
|
/// \param ident The source identifier.
|
|
|
|
/// \param global_tid The global thread ID.
|
|
|
|
/// \param if_expr The if(expr), or 1 if none given.
|
|
|
|
/// \param num_threads The num_threads(expr), or -1 if none given.
|
|
|
|
/// \param proc_bind The proc_bind, or `proc_bind_default` if none given.
|
|
|
|
/// \param fn The outlined parallel region function.
|
|
|
|
/// \param wrapper_fn The worker wrapper function of fn.
|
|
|
|
/// \param args The pointer array of arguments to fn.
|
|
|
|
/// \param nargs The number of arguments to fn.
|
2021-07-27 10:45:52 +08:00
|
|
|
NOINLINE EXTERN void __kmpc_parallel_51(ident_t *ident, kmp_int32 global_tid,
|
|
|
|
kmp_int32 if_expr,
|
|
|
|
kmp_int32 num_threads, int proc_bind,
|
|
|
|
void *fn, void *wrapper_fn, void **args,
|
|
|
|
size_t nargs);
|
2021-04-22 02:41:31 +08:00
|
|
|
|
2018-05-15 23:16:43 +08:00
|
|
|
// SPMD execution mode interrogation function.
|
|
|
|
EXTERN int8_t __kmpc_is_spmd_exec_mode();
|
2018-11-02 22:43:23 +08:00
|
|
|
|
2021-07-01 13:21:26 +08:00
|
|
|
/// Return true if the hardware thread id \p Tid represents the OpenMP main
|
|
|
|
/// thread in generic mode outside of a parallel region.
|
|
|
|
EXTERN int8_t __kmpc_is_generic_main_thread(kmp_int32 Tid);
|
|
|
|
|
2021-07-21 04:07:52 +08:00
|
|
|
/// Return true if the hardware thread id \p Tid represents the OpenMP main
|
|
|
|
/// thread in generic mode.
|
|
|
|
EXTERN int8_t __kmpc_is_generic_main_thread_id(kmp_int32 Tid);
|
|
|
|
|
2019-01-05 01:09:12 +08:00
|
|
|
EXTERN void __kmpc_get_team_static_memory(int16_t isSPMDExecutionMode,
|
|
|
|
const void *buf, size_t size,
|
2018-11-02 22:43:23 +08:00
|
|
|
int16_t is_shared, const void **res);
|
|
|
|
|
2019-01-05 01:09:12 +08:00
|
|
|
EXTERN void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode,
|
|
|
|
int16_t is_shared);
|
2018-11-02 22:43:23 +08:00
|
|
|
|
2021-06-16 05:09:50 +08:00
|
|
|
/// Allocate \p Bytes in "shareable" memory and return the address. Needs to be
|
|
|
|
/// called balanced with __kmpc_free_shared like a stack (push/pop). Can be
|
|
|
|
/// called by any thread, allocation happens per-thread.
|
|
|
|
EXTERN void *__kmpc_alloc_shared(uint64_t Bytes);
|
|
|
|
|
|
|
|
/// Deallocate \p Ptr. Needs to be called balanced with __kmpc_alloc_shared like
|
|
|
|
/// a stack (push/pop). Can be called by any thread. \p Ptr must be allocated by
|
2021-07-22 05:13:46 +08:00
|
|
|
/// __kmpc_alloc_shared by the same thread. \p Bytes contains the size of the
|
|
|
|
/// paired allocation to make memory management easier.
|
|
|
|
EXTERN void __kmpc_free_shared(void *Ptr, size_t Bytes);
|
2021-06-16 05:09:50 +08:00
|
|
|
|
2018-01-29 21:59:35 +08:00
|
|
|
#endif
|