Skip to content

snRuntime/src/omp/kmp.h

Classes

Name
struct ident

Types

Name
enum kmp_int32 sched_type { kmp_sch_lower = 32, kmp_sch_static_chunked = 33, kmp_sch_static = 34, kmp_sch_dynamic_chunked = 35, kmp_sch_guided_chunked = 36, kmp_sch_runtime = 37, kmp_sch_auto = 38, kmp_sch_trapezoidal = 39, kmp_sch_static_greedy = 40, kmp_sch_static_balanced = 41, kmp_sch_guided_iterative_chunked = 42, kmp_sch_guided_analytical_chunked = 43, kmp_sch_static_steal = 44, kmp_sch_static_balanced_chunked = 45, kmp_sch_guided_simd = 46, kmp_sch_runtime_simd = 47, kmp_sch_upper, kmp_ord_lower =
64, kmp_ord_static_chunked = 65, kmp_ord_static = 66, kmp_ord_dynamic_chunked = 67, kmp_ord_guided_chunked = 68, kmp_ord_runtime = 69, kmp_ord_auto = 70, kmp_ord_trapezoidal = 71, kmp_ord_upper, kmp_distribute_static_chunked = 91, kmp_distribute_static = 92, kmp_nm_lower = 160, kmp_nm_static_chunked =
(kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower), kmp_nm_static = 162, kmp_nm_dynamic_chunked = 163, kmp_nm_guided_chunked = 164, kmp_nm_runtime = 165, kmp_nm_auto = 166, kmp_nm_trapezoidal = 167, kmp_nm_static_greedy = 168, kmp_nm_static_balanced = 169, kmp_nm_guided_iterative_chunked = 170, kmp_nm_guided_analytical_chunked = 171, kmp_nm_static_steal =
172, kmp_nm_ord_static_chunked = 193, kmp_nm_ord_static = 194, kmp_nm_ord_dynamic_chunked = 195, kmp_nm_ord_guided_chunked = 196, kmp_nm_ord_runtime = 197, kmp_nm_ord_auto = 198, kmp_nm_ord_trapezoidal = 199, kmp_nm_upper, kmp_sch_modifier_monotonic =
(1 << 29), kmp_sch_modifier_nonmonotonic =
(1 << 30), kmp_sch_default = kmp_sch_static, kmp_sch_lower = 32, kmp_sch_static_chunked = 33, kmp_sch_static = 34, kmp_sch_dynamic_chunked = 35, kmp_sch_guided_chunked = 36, kmp_sch_runtime = 37, kmp_sch_auto = 38, kmp_sch_trapezoidal = 39, kmp_sch_static_greedy = 40, kmp_sch_static_balanced = 41, kmp_sch_guided_iterative_chunked = 42, kmp_sch_guided_analytical_chunked = 43, kmp_sch_static_steal = 44, kmp_sch_static_balanced_chunked = 45, kmp_sch_guided_simd = 46, kmp_sch_runtime_simd = 47, kmp_sch_upper, kmp_ord_lower =
64, kmp_ord_static_chunked = 65, kmp_ord_static = 66, kmp_ord_dynamic_chunked = 67, kmp_ord_guided_chunked = 68, kmp_ord_runtime = 69, kmp_ord_auto = 70, kmp_ord_trapezoidal = 71, kmp_ord_upper, kmp_distribute_static_chunked = 91, kmp_distribute_static = 92, kmp_nm_lower = 160, kmp_nm_static_chunked =
(kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower), kmp_nm_static = 162, kmp_nm_dynamic_chunked = 163, kmp_nm_guided_chunked = 164, kmp_nm_runtime = 165, kmp_nm_auto = 166, kmp_nm_trapezoidal = 167, kmp_nm_static_greedy = 168, kmp_nm_static_balanced = 169, kmp_nm_guided_iterative_chunked = 170, kmp_nm_guided_analytical_chunked = 171, kmp_nm_static_steal =
172, kmp_nm_ord_static_chunked = 193, kmp_nm_ord_static = 194, kmp_nm_ord_dynamic_chunked = 195, kmp_nm_ord_guided_chunked = 196, kmp_nm_ord_runtime = 197, kmp_nm_ord_auto = 198, kmp_nm_ord_trapezoidal = 199, kmp_nm_upper, kmp_sch_modifier_monotonic =
(1 << 29), kmp_sch_modifier_nonmonotonic =
(1 << 30), kmp_sch_default = kmp_sch_static}
typedef int32_t kmp_int32
typedef uint32_t kmp_uint32
typedef int64_t kmp_int64
typedef uint64_t kmp_uint64
typedef kmp_uint64 _kmp_ptr64
typedef kmp_uint32 _kmp_ptr32
typedef struct ident ident_t
typedef void()(kmp_int32 global_tid, kmp_int32 *bound_tid,...) kmpc_micro

Attributes

Name
_kmp_ptr32 * kmpc_args

Defines

Name
KMP_PRINTF(d, ...)
SCHEDULE_WITHOUT_MODIFIERS(s)
SCHEDULE_HAS_MONOTONIC(s)
SCHEDULE_HAS_NONMONOTONIC(s)
SCHEDULE_HAS_NO_MODIFIERS(s)
SCHEDULE_GET_MODIFIERS(s)
SCHEDULE_SET_MODIFIERS(s, m)
SCHEDULE_NONMONOTONIC
SCHEDULE_MONOTONIC

Types Documentation

enum sched_type

Enumerator Value Description
kmp_sch_lower 32 lower bound for unordered values
kmp_sch_static_chunked 33
kmp_sch_static 34 static unspecialized
kmp_sch_dynamic_chunked 35
kmp_sch_guided_chunked 36 guided unspecialized
kmp_sch_runtime 37
kmp_sch_auto 38 auto
kmp_sch_trapezoidal 39
kmp_sch_static_greedy 40
kmp_sch_static_balanced 41
kmp_sch_guided_iterative_chunked 42
kmp_sch_guided_analytical_chunked 43
kmp_sch_static_steal 44
kmp_sch_static_balanced_chunked 45
kmp_sch_guided_simd 46 guided with chunk adjustment
kmp_sch_runtime_simd 47 runtime with chunk adjustment
kmp_sch_upper upper bound for unordered values
kmp_ord_lower =
64 lower bound for ordered values, must be power of 2
kmp_ord_static_chunked 65
kmp_ord_static 66 ordered static unspecialized
kmp_ord_dynamic_chunked 67
kmp_ord_guided_chunked 68
kmp_ord_runtime 69
kmp_ord_auto 70 ordered auto
kmp_ord_trapezoidal 71
kmp_ord_upper upper bound for ordered values
kmp_distribute_static_chunked 91 distribute static chunked
kmp_distribute_static 92 distribute static unspecialized
kmp_nm_lower 160 lower bound for nomerge values
kmp_nm_static_chunked =
(kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower)
kmp_nm_static 162 static unspecialized
kmp_nm_dynamic_chunked 163
kmp_nm_guided_chunked 164 guided unspecialized
kmp_nm_runtime 165
kmp_nm_auto 166 auto
kmp_nm_trapezoidal 167
kmp_nm_static_greedy 168
kmp_nm_static_balanced 169
kmp_nm_guided_iterative_chunked 170
kmp_nm_guided_analytical_chunked 171
kmp_nm_static_steal =
172
kmp_nm_ord_static_chunked 193
kmp_nm_ord_static 194 ordered static unspecialized
kmp_nm_ord_dynamic_chunked 195
kmp_nm_ord_guided_chunked 196
kmp_nm_ord_runtime 197
kmp_nm_ord_auto 198 auto
kmp_nm_ord_trapezoidal 199
kmp_nm_upper upper bound for nomerge values
kmp_sch_modifier_monotonic =
(1 << 29) Set if the monotonic schedule modifier was present
kmp_sch_modifier_nonmonotonic =
(1 << 30) Set if the nonmonotonic schedule modifier was present
kmp_sch_default kmp_sch_static default scheduling algorithm
kmp_sch_lower 32 lower bound for unordered values
kmp_sch_static_chunked 33
kmp_sch_static 34 static unspecialized
kmp_sch_dynamic_chunked 35
kmp_sch_guided_chunked 36 guided unspecialized
kmp_sch_runtime 37
kmp_sch_auto 38 auto
kmp_sch_trapezoidal 39
kmp_sch_static_greedy 40
kmp_sch_static_balanced 41
kmp_sch_guided_iterative_chunked 42
kmp_sch_guided_analytical_chunked 43
kmp_sch_static_steal 44
kmp_sch_static_balanced_chunked 45
kmp_sch_guided_simd 46 guided with chunk adjustment
kmp_sch_runtime_simd 47 runtime with chunk adjustment
kmp_sch_upper upper bound for unordered values
kmp_ord_lower =
64 lower bound for ordered values, must be power of 2
kmp_ord_static_chunked 65
kmp_ord_static 66 ordered static unspecialized
kmp_ord_dynamic_chunked 67
kmp_ord_guided_chunked 68
kmp_ord_runtime 69
kmp_ord_auto 70 ordered auto
kmp_ord_trapezoidal 71
kmp_ord_upper upper bound for ordered values
kmp_distribute_static_chunked 91 distribute static chunked
kmp_distribute_static 92 distribute static unspecialized
kmp_nm_lower 160 lower bound for nomerge values
kmp_nm_static_chunked =
(kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower)
kmp_nm_static 162 static unspecialized
kmp_nm_dynamic_chunked 163
kmp_nm_guided_chunked 164 guided unspecialized
kmp_nm_runtime 165
kmp_nm_auto 166 auto
kmp_nm_trapezoidal 167
kmp_nm_static_greedy 168
kmp_nm_static_balanced 169
kmp_nm_guided_iterative_chunked 170
kmp_nm_guided_analytical_chunked 171
kmp_nm_static_steal =
172
kmp_nm_ord_static_chunked 193
kmp_nm_ord_static 194 ordered static unspecialized
kmp_nm_ord_dynamic_chunked 195
kmp_nm_ord_guided_chunked 196
kmp_nm_ord_runtime 197
kmp_nm_ord_auto 198 auto
kmp_nm_ord_trapezoidal 199
kmp_nm_upper upper bound for nomerge values
kmp_sch_modifier_monotonic =
(1 << 29) Set if the monotonic schedule modifier was present
kmp_sch_modifier_nonmonotonic =
(1 << 30) Set if the nonmonotonic schedule modifier was present
kmp_sch_default kmp_sch_static default scheduling algorithm

Describes the loop schedule to be used for a parallel for loop.

typedef kmp_int32

typedef int32_t kmp_int32;

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.

typedef kmp_uint32

typedef uint32_t kmp_uint32;

typedef kmp_int64

typedef int64_t kmp_int64;

typedef kmp_uint64

typedef uint64_t kmp_uint64;

typedef _kmp_ptr64

typedef kmp_uint64 _kmp_ptr64;

typedef _kmp_ptr32

typedef kmp_uint32 _kmp_ptr32;

typedef ident_t

typedef struct ident ident_t;

typedef kmpc_micro

typedef void(* kmpc_micro) (kmp_int32 *global_tid, kmp_int32 *bound_tid,...);

Attributes Documentation

variable kmpc_args

_kmp_ptr32 * kmpc_args;

Macros Documentation

define KMP_PRINTF

#define KMP_PRINTF(
    d,
    ...
)

define SCHEDULE_WITHOUT_MODIFIERS

#define SCHEDULE_WITHOUT_MODIFIERS(
    s
)
    (enum sched_type)(                \
        (s) & ~(kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic))

define SCHEDULE_HAS_MONOTONIC

#define SCHEDULE_HAS_MONOTONIC(
    s
)
(((s)&kmp_sch_modifier_monotonic) != 0)

define SCHEDULE_HAS_NONMONOTONIC

#define SCHEDULE_HAS_NONMONOTONIC(
    s
)
(((s)&kmp_sch_modifier_nonmonotonic) != 0)

define SCHEDULE_HAS_NO_MODIFIERS

#define SCHEDULE_HAS_NO_MODIFIERS(
    s
)
    (((s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)) == 0)

define SCHEDULE_GET_MODIFIERS

#define SCHEDULE_GET_MODIFIERS(
    s
)
    ((enum sched_type)(           \
        (s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)))

define SCHEDULE_SET_MODIFIERS

#define SCHEDULE_SET_MODIFIERS(
    s,
    m
)
    (s = (enum sched_type)((kmp_int32)s | (kmp_int32)m))

define SCHEDULE_NONMONOTONIC

#define SCHEDULE_NONMONOTONIC 0

define SCHEDULE_MONOTONIC

#define SCHEDULE_MONOTONIC 1

Source code

// Copyright 2021 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifndef KMP_H
#define KMP_H

// debug

#ifdef KMP_DEBUG_LEVEL
#include "encoding.h"
#include "printf.h"
#define _KMP_PRINTF(...)             \
    if (1) {                         \
        printf("[kmc] "__VA_ARGS__); \
    }
#define KMP_PRINTF(d, ...)        \
    if (KMP_DEBUG_LEVEL >= d) {   \
        _KMP_PRINTF(__VA_ARGS__); \
    }
#else
#define KMP_PRINTF(d, ...)
#endif

// kmp specific types
// Code taken from
//     https://github.com/llvm/llvm-project/blob/main/openmp/runtime/src/kmp.h

typedef int32_t kmp_int32;
typedef uint32_t kmp_uint32;
typedef int64_t kmp_int64;
typedef uint64_t kmp_uint64;
typedef kmp_uint64 _kmp_ptr64;
typedef kmp_uint32 _kmp_ptr32;

typedef struct ident {
    kmp_int32 reserved_1; 
    kmp_int32 flags; 
    kmp_int32
        reserved_2; 
    kmp_int32 reserved_3; 
    char const *psource;  
} ident_t;

enum sched_type : kmp_int32 {
    kmp_sch_lower = 32, 
    kmp_sch_static_chunked = 33,
    kmp_sch_static = 34, 
    kmp_sch_dynamic_chunked = 35,
    kmp_sch_guided_chunked = 36, 
    kmp_sch_runtime = 37,
    kmp_sch_auto = 38, 
    kmp_sch_trapezoidal = 39,

    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_sch_static_greedy = 40,
    kmp_sch_static_balanced = 41,
    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_sch_guided_iterative_chunked = 42,
    kmp_sch_guided_analytical_chunked = 43,
    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_sch_static_steal = 44,

    /* static with chunk adjustment (e.g., simd) */
    kmp_sch_static_balanced_chunked = 45,
    kmp_sch_guided_simd = 46,  
    kmp_sch_runtime_simd = 47, 
    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_sch_upper, 
    kmp_ord_lower =
        64, 
    kmp_ord_static_chunked = 65,
    kmp_ord_static = 66, 
    kmp_ord_dynamic_chunked = 67,
    kmp_ord_guided_chunked = 68,
    kmp_ord_runtime = 69,
    kmp_ord_auto = 70, 
    kmp_ord_trapezoidal = 71,
    kmp_ord_upper, 
    /* Schedules for Distribute construct */
    kmp_distribute_static_chunked = 91, 
    kmp_distribute_static = 92,         
    /* For the "nomerge" versions, kmp_dispatch_next*() will always return a
       single iteration/chunk, even if the loop is serialized. For the schedule
       types listed above, the entire iteration vector is returned if the loop
       is serialized. This doesn't work for gcc/gcomp sections. */
    kmp_nm_lower = 160, 
    kmp_nm_static_chunked =
        (kmp_sch_static_chunked - kmp_sch_lower + kmp_nm_lower),
    kmp_nm_static = 162, 
    kmp_nm_dynamic_chunked = 163,
    kmp_nm_guided_chunked = 164, 
    kmp_nm_runtime = 165,
    kmp_nm_auto = 166, 
    kmp_nm_trapezoidal = 167,

    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_nm_static_greedy = 168,
    kmp_nm_static_balanced = 169,
    /* accessible only through KMP_SCHEDULE environment variable */
    kmp_nm_guided_iterative_chunked = 170,
    kmp_nm_guided_analytical_chunked = 171,
    kmp_nm_static_steal =
        172, /* accessible only through OMP_SCHEDULE environment variable */

    kmp_nm_ord_static_chunked = 193,
    kmp_nm_ord_static = 194, 
    kmp_nm_ord_dynamic_chunked = 195,
    kmp_nm_ord_guided_chunked = 196,
    kmp_nm_ord_runtime = 197,
    kmp_nm_ord_auto = 198, 
    kmp_nm_ord_trapezoidal = 199,
    kmp_nm_upper, 
    /* 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_sch_modifier_monotonic =
        (1 << 29), 
    kmp_sch_modifier_nonmonotonic =
        (1 << 30), 
#define SCHEDULE_WITHOUT_MODIFIERS(s) \
    (enum sched_type)(                \
        (s) & ~(kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic))
#define SCHEDULE_HAS_MONOTONIC(s) (((s)&kmp_sch_modifier_monotonic) != 0)
#define SCHEDULE_HAS_NONMONOTONIC(s) (((s)&kmp_sch_modifier_nonmonotonic) != 0)
#define SCHEDULE_HAS_NO_MODIFIERS(s) \
    (((s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)) == 0)
#define SCHEDULE_GET_MODIFIERS(s) \
    ((enum sched_type)(           \
        (s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)))
#define SCHEDULE_SET_MODIFIERS(s, m) \
    (s = (enum sched_type)((kmp_int32)s | (kmp_int32)m))
#define SCHEDULE_NONMONOTONIC 0
#define SCHEDULE_MONOTONIC 1

    kmp_sch_default = kmp_sch_static 
};

typedef void (*kmpc_micro)(kmp_int32 *global_tid, kmp_int32 *bound_tid, ...);

// data

extern _kmp_ptr32 *kmpc_args;

#endif /* KMP_H */

Updated on 2023-06-19 at 09:43:56 +0000