[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / tasking / hidden_helper_task / common.h
blob402ecf3ed553c93f794d0792ac53c8ceef19a7cf
1 #include <cassert>
2 #include <cstdint>
3 #include <iostream>
4 #include <string>
6 extern "C" {
7 struct ident_t;
9 using kmp_int32 = int32_t;
10 using kmp_int64 = int64_t;
11 using kmp_routine_entry_t = kmp_int32 (*)(kmp_int32, void *);
12 using kmp_intptr_t = intptr_t;
14 typedef struct kmp_depend_info {
15 kmp_intptr_t base_addr;
16 size_t len;
17 union {
18 unsigned char flag;
19 struct {
20 bool in : 1;
21 bool out : 1;
22 bool mtx : 1;
23 } flags;
25 } kmp_depend_info_t;
27 typedef union kmp_cmplrdata {
28 kmp_int32 priority;
29 kmp_routine_entry_t destructors;
30 } kmp_cmplrdata_t;
32 typedef struct kmp_task {
33 void *shareds;
34 kmp_routine_entry_t routine;
35 kmp_int32 part_id;
36 kmp_cmplrdata_t data1;
37 kmp_cmplrdata_t data2;
38 } kmp_task_t;
40 int32_t __kmpc_global_thread_num(void *);
41 kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32, kmp_int32, size_t,
42 size_t, kmp_routine_entry_t);
43 kmp_task_t *__kmpc_omp_target_task_alloc(ident_t *, kmp_int32, kmp_int32,
44 size_t, size_t, kmp_routine_entry_t,
45 kmp_int64);
46 kmp_int32 __kmpc_omp_taskwait(ident_t *, kmp_int32);
47 kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32, kmp_task_t *);
48 kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
49 kmp_task_t *new_task, kmp_int32 ndeps,
50 kmp_depend_info_t *dep_list,
51 kmp_int32 ndeps_noalias,
52 kmp_depend_info_t *noalias_dep_list);
53 void __kmpc_taskgroup(ident_t *, kmp_int32);
54 void __kmpc_end_taskgroup(ident_t *, kmp_int32);
57 static kmp_int32 get_num_hidden_helper_threads() {
58 static kmp_int32 __kmp_hidden_helper_threads_num = 8;
59 if (const char *env = std::getenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS")) {
60 return std::stoi(env);
62 return __kmp_hidden_helper_threads_num;