Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * kmp_omp.h -- OpenMP definition for kmp_omp_struct_info_t. |
| 3 | * This is for information about runtime library structures. |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // The LLVM Compiler Infrastructure |
| 10 | // |
| 11 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 12 | // Source Licenses. See LICENSE.txt for details. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | |
| 17 | /* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE |
| 18 | * It should instead be modified in the OpenMP runtime and copied |
| 19 | * to the interface library code. This way we can minimize the |
| 20 | * problems that this is sure to cause having two copies of the |
| 21 | * same file. |
| 22 | * |
| 23 | * files live in libomp and libomp_db/src/include |
| 24 | */ |
| 25 | |
| 26 | /* CHANGE THIS WHEN STRUCTURES BELOW CHANGE |
| 27 | * Before we release this to a customer, please don't change this value. After it is released and |
| 28 | * stable, then any new updates to the structures or data structure traversal algorithms need to |
| 29 | * change this value. |
| 30 | */ |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 31 | #define KMP_OMP_VERSION 9 |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 32 | |
| 33 | typedef struct { |
| 34 | kmp_int32 offset; |
| 35 | kmp_int32 size; |
| 36 | } offset_and_size_t; |
| 37 | |
| 38 | typedef struct { |
| 39 | kmp_uint64 addr; |
| 40 | kmp_int32 size; |
| 41 | kmp_int32 padding; |
| 42 | } addr_and_size_t; |
| 43 | |
| 44 | typedef struct { |
| 45 | kmp_uint64 flags; // Flags for future extensions. |
| 46 | kmp_uint64 file; // Pointer to name of source file where the parallel region is. |
| 47 | kmp_uint64 func; // Pointer to name of routine where the parallel region is. |
| 48 | kmp_int32 begin; // Beginning of source line range. |
| 49 | kmp_int32 end; // End of source line range. |
| 50 | kmp_int32 num_threads; // Specified number of threads. |
| 51 | } kmp_omp_nthr_item_t; |
| 52 | |
| 53 | typedef struct { |
| 54 | kmp_int32 num; // Number of items in the arrray. |
| 55 | kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t. |
| 56 | } kmp_omp_nthr_info_t; |
| 57 | |
| 58 | |
| 59 | /* This structure is known to the idb interface library */ |
| 60 | typedef struct { |
| 61 | |
| 62 | /* Change this only if you make a fundamental data structure change here */ |
| 63 | kmp_int32 lib_version; |
| 64 | |
| 65 | /* sanity check. Only should be checked if versions are identical |
| 66 | * This is also used for backward compatibility to get the runtime |
| 67 | * structure size if it the runtime is older than the interface */ |
| 68 | kmp_int32 sizeof_this_structure; |
| 69 | |
| 70 | /* OpenMP RTL version info. */ |
| 71 | addr_and_size_t major; |
| 72 | addr_and_size_t minor; |
| 73 | addr_and_size_t build; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 74 | addr_and_size_t openmp_version; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 75 | addr_and_size_t banner; |
| 76 | |
| 77 | /* Various globals. */ |
| 78 | addr_and_size_t threads; // Pointer to __kmp_threads. |
| 79 | addr_and_size_t roots; // Pointer to __kmp_root. |
| 80 | addr_and_size_t capacity; // Pointer to __kmp_threads_capacity. |
| 81 | addr_and_size_t monitor; // Pointer to __kmp_monitor. |
Andrey Churbanov | 5c56fb5 | 2015-02-20 18:05:17 +0000 | [diff] [blame^] | 82 | #if ! KMP_USE_DYNAMIC_LOCK |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 83 | addr_and_size_t lock_table; // Pointer to __kmp_lock_table. |
Andrey Churbanov | 5c56fb5 | 2015-02-20 18:05:17 +0000 | [diff] [blame^] | 84 | #endif |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 85 | addr_and_size_t func_microtask; |
| 86 | addr_and_size_t func_fork; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 87 | addr_and_size_t func_fork_teams; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 88 | addr_and_size_t team_counter; |
| 89 | addr_and_size_t task_counter; |
| 90 | addr_and_size_t nthr_info; |
| 91 | kmp_int32 address_width; |
| 92 | kmp_int32 indexed_locks; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 93 | kmp_int32 last_barrier; // The end in enum barrier_type |
| 94 | kmp_int32 deque_size; // TASK_DEQUE_SIZE |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 95 | |
| 96 | /* thread structure information. */ |
| 97 | kmp_int32 th_sizeof_struct; |
| 98 | offset_and_size_t th_info; // descriptor for thread |
| 99 | offset_and_size_t th_team; // team for this thread |
| 100 | offset_and_size_t th_root; // root for this thread |
| 101 | offset_and_size_t th_serial_team; // serial team under this thread |
| 102 | offset_and_size_t th_ident; // location for this thread (if available) |
| 103 | offset_and_size_t th_spin_here; // is thread waiting for lock (if available) |
| 104 | offset_and_size_t th_next_waiting; // next thread waiting for lock (if available) |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 105 | offset_and_size_t th_task_team; // task team struct |
| 106 | offset_and_size_t th_current_task; // innermost task being executed |
| 107 | offset_and_size_t th_task_state; // alternating 0/1 for task team identification |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 108 | offset_and_size_t th_bar; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 109 | offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier |
| 110 | |
| 111 | /* teams information */ |
| 112 | offset_and_size_t th_teams_microtask;// entry address for teams construct |
| 113 | offset_and_size_t th_teams_level; // initial level of teams construct |
| 114 | offset_and_size_t th_teams_nteams; // number of teams in a league |
| 115 | offset_and_size_t th_teams_nth; // number of threads in each team of the league |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 116 | |
| 117 | /* kmp_desc structure (for info field above) */ |
| 118 | kmp_int32 ds_sizeof_struct; |
| 119 | offset_and_size_t ds_tid; // team thread id |
| 120 | offset_and_size_t ds_gtid; // global thread id |
| 121 | offset_and_size_t ds_thread; // native thread id |
| 122 | |
| 123 | /* team structure information */ |
| 124 | kmp_int32 t_sizeof_struct; |
| 125 | offset_and_size_t t_master_tid; // tid of master in parent team |
| 126 | offset_and_size_t t_ident; // location of parallel region |
| 127 | offset_and_size_t t_parent; // parent team |
| 128 | offset_and_size_t t_nproc; // # team threads |
| 129 | offset_and_size_t t_threads; // array of threads |
| 130 | offset_and_size_t t_serialized; // # levels of serialized teams |
| 131 | offset_and_size_t t_id; // unique team id |
| 132 | offset_and_size_t t_pkfn; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 133 | offset_and_size_t t_task_team; // task team structure |
| 134 | offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task |
| 135 | offset_and_size_t t_cancel_request; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 136 | offset_and_size_t t_bar; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 137 | offset_and_size_t t_b_master_arrived; // increased by 1 when master arrives to a barrier |
| 138 | offset_and_size_t t_b_team_arrived; // increased by one when all the threads arrived |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 139 | |
| 140 | /* root structure information */ |
| 141 | kmp_int32 r_sizeof_struct; |
| 142 | offset_and_size_t r_root_team; // team at root |
| 143 | offset_and_size_t r_hot_team; // hot team for this root |
| 144 | offset_and_size_t r_uber_thread; // root thread |
| 145 | offset_and_size_t r_root_id; // unique root id (if available) |
| 146 | |
| 147 | /* ident structure information */ |
| 148 | kmp_int32 id_sizeof_struct; |
| 149 | offset_and_size_t id_psource; /* address of string ";file;func;line1;line2;;". */ |
| 150 | offset_and_size_t id_flags; |
| 151 | |
| 152 | /* lock structure information */ |
| 153 | kmp_int32 lk_sizeof_struct; |
| 154 | offset_and_size_t lk_initialized; |
| 155 | offset_and_size_t lk_location; |
| 156 | offset_and_size_t lk_tail_id; |
| 157 | offset_and_size_t lk_head_id; |
| 158 | offset_and_size_t lk_next_ticket; |
| 159 | offset_and_size_t lk_now_serving; |
| 160 | offset_and_size_t lk_owner_id; |
| 161 | offset_and_size_t lk_depth_locked; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 162 | offset_and_size_t lk_lock_flags; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 163 | |
Andrey Churbanov | 5c56fb5 | 2015-02-20 18:05:17 +0000 | [diff] [blame^] | 164 | #if ! KMP_USE_DYNAMIC_LOCK |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 165 | /* lock_table_t */ |
| 166 | kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */ |
| 167 | offset_and_size_t lt_used; |
| 168 | offset_and_size_t lt_allocated; |
| 169 | offset_and_size_t lt_table; |
Andrey Churbanov | 5c56fb5 | 2015-02-20 18:05:17 +0000 | [diff] [blame^] | 170 | #endif |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 171 | |
| 172 | /* task_team_t */ |
| 173 | kmp_int32 tt_sizeof_struct; |
| 174 | offset_and_size_t tt_threads_data; |
| 175 | offset_and_size_t tt_found_tasks; |
| 176 | offset_and_size_t tt_nproc; |
| 177 | offset_and_size_t tt_unfinished_threads; |
| 178 | offset_and_size_t tt_active; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 179 | |
| 180 | /* kmp_taskdata_t */ |
| 181 | kmp_int32 td_sizeof_struct; |
Andrey Churbanov | 440af7e | 2015-02-10 19:53:13 +0000 | [diff] [blame] | 182 | offset_and_size_t td_task_id; // task id |
| 183 | offset_and_size_t td_flags; // task flags |
| 184 | offset_and_size_t td_team; // team for this task |
| 185 | offset_and_size_t td_parent; // parent task |
| 186 | offset_and_size_t td_level; // task testing level |
| 187 | offset_and_size_t td_ident; // task identifier |
| 188 | offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task) not yet deallocated |
| 189 | offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete |
| 190 | |
| 191 | /* Taskwait */ |
| 192 | offset_and_size_t td_taskwait_ident; |
| 193 | offset_and_size_t td_taskwait_counter; |
| 194 | offset_and_size_t td_taskwait_thread; // gtid + 1 of thread encountered taskwait |
| 195 | |
| 196 | /* Taskgroup */ |
| 197 | offset_and_size_t td_taskgroup; // pointer to the current taskgroup |
| 198 | offset_and_size_t td_task_count; // number of allocated and not yet complete tasks |
| 199 | offset_and_size_t td_cancel; // request for cancellation of this taskgroup |
| 200 | |
| 201 | /* Task dependency */ |
| 202 | offset_and_size_t td_depnode; // pointer to graph node if the task has dependencies |
| 203 | offset_and_size_t dn_successors; |
| 204 | offset_and_size_t dn_node; |
| 205 | offset_and_size_t dn_next; |
| 206 | offset_and_size_t dn_task; |
| 207 | offset_and_size_t dn_npredecessors; |
| 208 | offset_and_size_t dn_nrefs; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 209 | |
| 210 | /* kmp_thread_data_t */ |
| 211 | kmp_int32 hd_sizeof_struct; |
| 212 | offset_and_size_t hd_deque; |
| 213 | offset_and_size_t hd_deque_head; |
| 214 | offset_and_size_t hd_deque_tail; |
| 215 | offset_and_size_t hd_deque_ntasks; |
| 216 | offset_and_size_t hd_deque_last_stolen; |
| 217 | |
| 218 | // The last field of stable version. |
| 219 | kmp_uint64 last_field; |
Jim Cownie | 5e8470a | 2013-09-27 10:38:44 +0000 | [diff] [blame] | 220 | |
| 221 | } kmp_omp_struct_info_t; |
| 222 | |
| 223 | |
| 224 | /* end of file */ |