Snitch Runtime
Loading...
Searching...
No Matches
interface.h
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2// See https://llvm.org/LICENSE.txt for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INTERFACE_H
6#define INTERFACE_H
7
8#include <stdint.h>
9
11// kmp specific types
12// Code taken from
13// https://github.com/llvm/llvm-project/blob/main/openmp/runtime/src/kmp.h
15
21typedef int32_t kmp_int32;
22typedef uint32_t kmp_uint32;
23typedef int64_t kmp_int64;
24typedef uint64_t kmp_uint64;
25typedef kmp_uint64 _kmp_ptr64;
26typedef kmp_uint32 _kmp_ptr32;
27
28typedef struct ident {
29 kmp_int32 reserved_1;
30 kmp_int32 flags;
32 kmp_int32
34 kmp_int32 reserved_3;
35 char const *psource;
39} ident_t;
40
45enum sched_type : kmp_int32 {
46 kmp_sch_lower = 32,
47 kmp_sch_static_chunked = 33,
48 kmp_sch_static = 34,
49 kmp_sch_dynamic_chunked = 35,
50 kmp_sch_guided_chunked = 36,
51 kmp_sch_runtime = 37,
52 kmp_sch_auto = 38,
53 kmp_sch_trapezoidal = 39,
54
55 /* accessible only through KMP_SCHEDULE environment variable */
56 kmp_sch_static_greedy = 40,
57 kmp_sch_static_balanced = 41,
58 /* accessible only through KMP_SCHEDULE environment variable */
59 kmp_sch_guided_iterative_chunked = 42,
60 kmp_sch_guided_analytical_chunked = 43,
61 /* accessible only through KMP_SCHEDULE environment variable */
62 kmp_sch_static_steal = 44,
63
64 /* static with chunk adjustment (e.g., simd) */
65 kmp_sch_static_balanced_chunked = 45,
66 kmp_sch_guided_simd = 46,
67 kmp_sch_runtime_simd = 47,
69 /* accessible only through KMP_SCHEDULE environment variable */
70 kmp_sch_upper,
72 kmp_ord_lower =
73 64,
74 kmp_ord_static_chunked = 65,
75 kmp_ord_static = 66,
76 kmp_ord_dynamic_chunked = 67,
77 kmp_ord_guided_chunked = 68,
78 kmp_ord_runtime = 69,
79 kmp_ord_auto = 70,
80 kmp_ord_trapezoidal = 71,
81 kmp_ord_upper,
83 /* Schedules for Distribute construct */
84 kmp_distribute_static_chunked = 91,
85 kmp_distribute_static = 92,
87 /* For the "nomerge" versions, kmp_dispatch_next*() will always return a
88 single iteration/chunk, even if the loop is serialized. For the schedule
89 types listed above, the entire iteration vector is returned if the loop
90 is serialized. This doesn't work for gcc/gcomp sections. */
91 kmp_nm_lower = 160,
93 kmp_nm_static_chunked =
94 (kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower),
95 kmp_nm_static = 162,
96 kmp_nm_dynamic_chunked = 163,
97 kmp_nm_guided_chunked = 164,
98 kmp_nm_runtime = 165,
99 kmp_nm_auto = 166,
100 kmp_nm_trapezoidal = 167,
101
102 /* accessible only through KMP_SCHEDULE environment variable */
103 kmp_nm_static_greedy = 168,
104 kmp_nm_static_balanced = 169,
105 /* accessible only through KMP_SCHEDULE environment variable */
106 kmp_nm_guided_iterative_chunked = 170,
107 kmp_nm_guided_analytical_chunked = 171,
108 kmp_nm_static_steal =
109 172, /* accessible only through OMP_SCHEDULE environment variable */
110
111 kmp_nm_ord_static_chunked = 193,
112 kmp_nm_ord_static = 194,
113 kmp_nm_ord_dynamic_chunked = 195,
114 kmp_nm_ord_guided_chunked = 196,
115 kmp_nm_ord_runtime = 197,
116 kmp_nm_ord_auto = 198,
117 kmp_nm_ord_trapezoidal = 199,
118 kmp_nm_upper,
120 /* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers.
121 Since we need to distinguish the three possible cases (no modifier,
122 monotonic modifier, nonmonotonic modifier), we need separate bits for
123 each modifier. The absence of monotonic does not imply nonmonotonic,
124 especially since 4.5 says that the behaviour of the "no modifier" case is
125 implementation defined in 4.5, but will become "nonmonotonic" in 5.0.
126
127 Since we're passing a full 32 bit value, we can use a couple of high bits
128 for these flags; out of paranoia we avoid the sign bit.
129
130 These modifiers can be or-ed into non-static schedules by the compiler to
131 pass the additional information. They will be stripped early in the
132 processing in __kmp_dispatch_init when setting up schedules, so most of
133 the code won't ever see schedules with these bits set. */
134 kmp_sch_modifier_monotonic =
135 (1 << 29),
136 kmp_sch_modifier_nonmonotonic =
137 (1 << 30),
139#define SCHEDULE_WITHOUT_MODIFIERS(s) \
140 (enum sched_type)( \
141 (s) & ~(kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic))
142#define SCHEDULE_HAS_MONOTONIC(s) (((s)&kmp_sch_modifier_monotonic) != 0)
143#define SCHEDULE_HAS_NONMONOTONIC(s) (((s)&kmp_sch_modifier_nonmonotonic) != 0)
144#define SCHEDULE_HAS_NO_MODIFIERS(s) \
145 (((s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)) == 0)
146#define SCHEDULE_GET_MODIFIERS(s) \
147 ((enum sched_type)( \
148 (s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)))
149#define SCHEDULE_SET_MODIFIERS(s, m) \
150 (s = (enum sched_type)((kmp_int32)s | (kmp_int32)m))
151#define SCHEDULE_NONMONOTONIC 0
152#define SCHEDULE_MONOTONIC 1
153
154 kmp_sch_default = kmp_sch_static
155};
156
157#endif
Definition interface.h:28
char const * psource
Definition interface.h:35
kmp_int32 reserved_1
Definition interface.h:29
kmp_int32 reserved_2
Definition interface.h:33
kmp_int32 reserved_3
Definition interface.h:34
kmp_int32 flags
Definition interface.h:30