File: common.h

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (75 lines) | stat: -rw-r--r-- 2,260 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <cassert>
#include <cstdint>
#include <iostream>
#include <string>

extern "C" {
struct ident_t;

using kmp_int32 = int32_t;
using kmp_int64 = int64_t;
using kmp_routine_entry_t = kmp_int32 (*)(kmp_int32, void *);
using kmp_intptr_t = intptr_t;

typedef struct kmp_depend_info {
  kmp_intptr_t base_addr;
  size_t len;
  union {
    unsigned char flag;
    struct {
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
      unsigned all : 1;
      unsigned unused : 3;
      unsigned set : 1;
      unsigned mtx : 1;
      unsigned out : 1;
      unsigned in : 1;
#else
      unsigned in : 1;
      unsigned out : 1;
      unsigned mtx : 1;
      unsigned set : 1;
      unsigned unused : 3;
      unsigned all : 1;
#endif
    } flags;
  };
} kmp_depend_info_t;

typedef union kmp_cmplrdata {
  kmp_int32 priority;
  kmp_routine_entry_t destructors;
} kmp_cmplrdata_t;

typedef struct kmp_task {
  void *shareds;
  kmp_routine_entry_t routine;
  kmp_int32 part_id;
  kmp_cmplrdata_t data1;
  kmp_cmplrdata_t data2;
} kmp_task_t;

int32_t __kmpc_global_thread_num(void *);
kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32, kmp_int32, size_t,
                                  size_t, kmp_routine_entry_t);
kmp_task_t *__kmpc_omp_target_task_alloc(ident_t *, kmp_int32, kmp_int32,
                                         size_t, size_t, kmp_routine_entry_t,
                                         kmp_int64);
kmp_int32 __kmpc_omp_taskwait(ident_t *, kmp_int32);
kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32, kmp_task_t *);
kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
                                    kmp_task_t *new_task, kmp_int32 ndeps,
                                    kmp_depend_info_t *dep_list,
                                    kmp_int32 ndeps_noalias,
                                    kmp_depend_info_t *noalias_dep_list);
void __kmpc_taskgroup(ident_t *, kmp_int32);
void __kmpc_end_taskgroup(ident_t *, kmp_int32);
}

static kmp_int32 get_num_hidden_helper_threads() {
  static kmp_int32 __kmp_hidden_helper_threads_num = 8;
  if (const char *env = std::getenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS")) {
    return std::stoi(env);
  }
  return __kmp_hidden_helper_threads_num;
}