Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | //===-- OpenMP/InternalTypes.h -- Internal OpenMP Types ------------- C++ -===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Private type declarations and helper macros for OpenMP. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef OMPTARGET_OPENMP_INTERNAL_TYPES_H |
| 14 | #define OMPTARGET_OPENMP_INTERNAL_TYPES_H |
| 15 | |
| 16 | #include <cstddef> |
| 17 | #include <cstdint> |
| 18 | |
| 19 | extern "C" { |
| 20 | |
| 21 | // Compiler sends us this info: |
| 22 | typedef struct kmp_depend_info { |
| 23 | intptr_t base_addr; |
| 24 | size_t len; |
| 25 | struct { |
| 26 | bool in : 1; |
| 27 | bool out : 1; |
| 28 | bool mtx : 1; |
| 29 | } flags; |
| 30 | } kmp_depend_info_t; |
| 31 | |
| 32 | typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */ |
| 33 | /* Compiler flags */ /* Total compiler flags must be 16 bits */ |
| 34 | unsigned tiedness : 1; /* task is either tied (1) or untied (0) */ |
| 35 | unsigned final : 1; /* task is final(1) so execute immediately */ |
| 36 | unsigned merged_if0 : 1; /* no __kmpc_task_{begin/complete}_if0 calls in if0 |
| 37 | code path */ |
| 38 | unsigned destructors_thunk : 1; /* set if the compiler creates a thunk to |
| 39 | invoke destructors from the runtime */ |
| 40 | unsigned proxy : 1; /* task is a proxy task (it will be executed outside the |
| 41 | context of the RTL) */ |
| 42 | unsigned priority_specified : 1; /* set if the compiler provides priority |
| 43 | setting for the task */ |
| 44 | unsigned detachable : 1; /* 1 == can detach */ |
| 45 | unsigned hidden_helper : 1; /* 1 == hidden helper task */ |
| 46 | unsigned reserved : 8; /* reserved for compiler use */ |
| 47 | |
| 48 | /* Library flags */ /* Total library flags must be 16 bits */ |
| 49 | unsigned tasktype : 1; /* task is either explicit(1) or implicit (0) */ |
| 50 | unsigned task_serial : 1; // task is executed immediately (1) or deferred (0) |
| 51 | unsigned tasking_ser : 1; // all tasks in team are either executed immediately |
| 52 | // (1) or may be deferred (0) |
| 53 | unsigned team_serial : 1; // entire team is serial (1) [1 thread] or parallel |
| 54 | // (0) [>= 2 threads] |
| 55 | /* If either team_serial or tasking_ser is set, task team may be NULL */ |
| 56 | /* Task State Flags: */ |
| 57 | unsigned started : 1; /* 1==started, 0==not started */ |
| 58 | unsigned executing : 1; /* 1==executing, 0==not executing */ |
| 59 | unsigned complete : 1; /* 1==complete, 0==not complete */ |
| 60 | unsigned freed : 1; /* 1==freed, 0==allocated */ |
| 61 | unsigned native : 1; /* 1==gcc-compiled task, 0==intel */ |
| 62 | unsigned reserved31 : 7; /* reserved for library use */ |
| 63 | } kmp_tasking_flags_t; |
| 64 | |
| 65 | struct kmp_task; |
| 66 | typedef int32_t (*kmp_routine_entry_t)(int32_t, struct kmp_task *); |
| 67 | typedef struct kmp_task { |
| 68 | void *shareds; |
| 69 | kmp_routine_entry_t routine; |
| 70 | int32_t part_id; |
| 71 | } kmp_task_t; |
| 72 | |
| 73 | int32_t __kmpc_global_thread_num(void *) __attribute__((weak)); |
| 74 | bool __kmpc_omp_has_task_team(int32_t gtid) __attribute__((weak)); |
| 75 | void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid) |
| 76 | __attribute__((weak)); |
| 77 | |
| 78 | /** |
| 79 | * The argument set that is passed from asynchronous memory copy to block |
| 80 | * version of memory copy invoked in helper task |
| 81 | */ |
| 82 | struct TargetMemcpyArgsTy { |
| 83 | /** |
| 84 | * Common attribuutes |
| 85 | */ |
| 86 | void *Dst; |
| 87 | const void *Src; |
| 88 | int DstDevice; |
| 89 | int SrcDevice; |
| 90 | |
| 91 | /** |
| 92 | * The flag that denotes single dimensional or rectangle dimensional copy |
| 93 | */ |
| 94 | bool IsRectMemcpy; |
| 95 | |
| 96 | /** |
| 97 | * Arguments for single dimensional copy |
| 98 | */ |
| 99 | size_t Length; |
| 100 | size_t DstOffset; |
| 101 | size_t SrcOffset; |
| 102 | |
| 103 | /** |
| 104 | * Arguments for rectangle dimensional copy |
| 105 | */ |
| 106 | size_t ElementSize; |
| 107 | int NumDims; |
| 108 | const size_t *Volume; |
| 109 | const size_t *DstOffsets; |
| 110 | const size_t *SrcOffsets; |
| 111 | const size_t *DstDimensions; |
| 112 | const size_t *SrcDimensions; |
| 113 | |
| 114 | /** |
| 115 | * Constructor for single dimensional copy |
| 116 | */ |
| 117 | TargetMemcpyArgsTy(void *Dst, const void *Src, size_t Length, |
| 118 | size_t DstOffset, size_t SrcOffset, int DstDevice, |
| 119 | int SrcDevice) |
| 120 | : Dst(Dst), Src(Src), DstDevice(DstDevice), SrcDevice(SrcDevice), |
| 121 | IsRectMemcpy(false), Length(Length), DstOffset(DstOffset), |
| 122 | SrcOffset(SrcOffset), ElementSize(0), NumDims(0), Volume(0), |
| 123 | DstOffsets(0), SrcOffsets(0), DstDimensions(0), SrcDimensions(0){}; |
| 124 | |
| 125 | /** |
| 126 | * Constructor for rectangle dimensional copy |
| 127 | */ |
| 128 | TargetMemcpyArgsTy(void *Dst, const void *Src, size_t ElementSize, |
| 129 | int NumDims, const size_t *Volume, |
| 130 | const size_t *DstOffsets, const size_t *SrcOffsets, |
| 131 | const size_t *DstDimensions, const size_t *SrcDimensions, |
| 132 | int DstDevice, int SrcDevice) |
| 133 | : Dst(Dst), Src(Src), DstDevice(DstDevice), SrcDevice(SrcDevice), |
| 134 | IsRectMemcpy(true), Length(0), DstOffset(0), SrcOffset(0), |
| 135 | ElementSize(ElementSize), NumDims(NumDims), Volume(Volume), |
| 136 | DstOffsets(DstOffsets), SrcOffsets(SrcOffsets), |
| 137 | DstDimensions(DstDimensions), SrcDimensions(SrcDimensions){}; |
| 138 | }; |
| 139 | |
| 140 | struct TargetMemsetArgsTy { |
| 141 | // Common attributes of a memset operation |
| 142 | void *Ptr; |
| 143 | int C; |
| 144 | size_t N; |
| 145 | int DeviceNum; |
| 146 | |
| 147 | // no constructors defined, because this is a PoD |
| 148 | }; |
| 149 | |
| 150 | } // extern "C" |
| 151 | |
| 152 | #endif // OMPTARGET_OPENMP_INTERNAL_TYPES_H |
| 153 |
Warning: This file is not a C or C++ file. It does not have highlighting.
