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. |
| 4 | * $Revision: 42105 $ |
| 5 | * $Date: 2013-03-11 14:51:34 -0500 (Mon, 11 Mar 2013) $ |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
| 11 | // The LLVM Compiler Infrastructure |
| 12 | // |
| 13 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 14 | // Source Licenses. See LICENSE.txt for details. |
| 15 | // |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | |
| 19 | /* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE |
| 20 | * It should instead be modified in the OpenMP runtime and copied |
| 21 | * to the interface library code. This way we can minimize the |
| 22 | * problems that this is sure to cause having two copies of the |
| 23 | * same file. |
| 24 | * |
| 25 | * files live in libomp and libomp_db/src/include |
| 26 | */ |
| 27 | |
| 28 | /* CHANGE THIS WHEN STRUCTURES BELOW CHANGE |
| 29 | * Before we release this to a customer, please don't change this value. After it is released and |
| 30 | * stable, then any new updates to the structures or data structure traversal algorithms need to |
| 31 | * change this value. |
| 32 | */ |
| 33 | #define KMP_OMP_VERSION 8 |
| 34 | |
| 35 | typedef struct { |
| 36 | kmp_int32 offset; |
| 37 | kmp_int32 size; |
| 38 | } offset_and_size_t; |
| 39 | |
| 40 | typedef struct { |
| 41 | kmp_uint64 addr; |
| 42 | kmp_int32 size; |
| 43 | kmp_int32 padding; |
| 44 | } addr_and_size_t; |
| 45 | |
| 46 | typedef struct { |
| 47 | kmp_uint64 flags; // Flags for future extensions. |
| 48 | kmp_uint64 file; // Pointer to name of source file where the parallel region is. |
| 49 | kmp_uint64 func; // Pointer to name of routine where the parallel region is. |
| 50 | kmp_int32 begin; // Beginning of source line range. |
| 51 | kmp_int32 end; // End of source line range. |
| 52 | kmp_int32 num_threads; // Specified number of threads. |
| 53 | } kmp_omp_nthr_item_t; |
| 54 | |
| 55 | typedef struct { |
| 56 | kmp_int32 num; // Number of items in the arrray. |
| 57 | kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t. |
| 58 | } kmp_omp_nthr_info_t; |
| 59 | |
| 60 | |
| 61 | /* This structure is known to the idb interface library */ |
| 62 | typedef struct { |
| 63 | |
| 64 | /* Change this only if you make a fundamental data structure change here */ |
| 65 | kmp_int32 lib_version; |
| 66 | |
| 67 | /* sanity check. Only should be checked if versions are identical |
| 68 | * This is also used for backward compatibility to get the runtime |
| 69 | * structure size if it the runtime is older than the interface */ |
| 70 | kmp_int32 sizeof_this_structure; |
| 71 | |
| 72 | /* OpenMP RTL version info. */ |
| 73 | addr_and_size_t major; |
| 74 | addr_and_size_t minor; |
| 75 | addr_and_size_t build; |
| 76 | addr_and_size_t banner; |
| 77 | |
| 78 | /* Various globals. */ |
| 79 | addr_and_size_t threads; // Pointer to __kmp_threads. |
| 80 | addr_and_size_t roots; // Pointer to __kmp_root. |
| 81 | addr_and_size_t capacity; // Pointer to __kmp_threads_capacity. |
| 82 | addr_and_size_t monitor; // Pointer to __kmp_monitor. |
| 83 | addr_and_size_t lock_table; // Pointer to __kmp_lock_table. |
| 84 | addr_and_size_t func_microtask; |
| 85 | addr_and_size_t func_fork; |
| 86 | addr_and_size_t team_counter; |
| 87 | addr_and_size_t task_counter; |
| 88 | addr_and_size_t nthr_info; |
| 89 | kmp_int32 address_width; |
| 90 | kmp_int32 indexed_locks; |
| 91 | kmp_int32 last_barrier; |
| 92 | kmp_int32 deque_size; |
| 93 | |
| 94 | /* thread structure information. */ |
| 95 | kmp_int32 th_sizeof_struct; |
| 96 | offset_and_size_t th_info; // descriptor for thread |
| 97 | offset_and_size_t th_team; // team for this thread |
| 98 | offset_and_size_t th_root; // root for this thread |
| 99 | offset_and_size_t th_serial_team; // serial team under this thread |
| 100 | offset_and_size_t th_ident; // location for this thread (if available) |
| 101 | offset_and_size_t th_spin_here; // is thread waiting for lock (if available) |
| 102 | offset_and_size_t th_next_waiting; // next thread waiting for lock (if available) |
| 103 | offset_and_size_t th_task_team; |
| 104 | offset_and_size_t th_current_task; |
| 105 | offset_and_size_t th_task_state; |
| 106 | offset_and_size_t th_bar; |
| 107 | offset_and_size_t th_b_worker_arrived; |
| 108 | |
| 109 | /* kmp_desc structure (for info field above) */ |
| 110 | kmp_int32 ds_sizeof_struct; |
| 111 | offset_and_size_t ds_tid; // team thread id |
| 112 | offset_and_size_t ds_gtid; // global thread id |
| 113 | offset_and_size_t ds_thread; // native thread id |
| 114 | |
| 115 | /* team structure information */ |
| 116 | kmp_int32 t_sizeof_struct; |
| 117 | offset_and_size_t t_master_tid; // tid of master in parent team |
| 118 | offset_and_size_t t_ident; // location of parallel region |
| 119 | offset_and_size_t t_parent; // parent team |
| 120 | offset_and_size_t t_nproc; // # team threads |
| 121 | offset_and_size_t t_threads; // array of threads |
| 122 | offset_and_size_t t_serialized; // # levels of serialized teams |
| 123 | offset_and_size_t t_id; // unique team id |
| 124 | offset_and_size_t t_pkfn; |
| 125 | offset_and_size_t t_task_team; |
| 126 | offset_and_size_t t_implicit_task; |
| 127 | offset_and_size_t t_bar; |
| 128 | offset_and_size_t t_b_master_arrived; |
| 129 | offset_and_size_t t_b_team_arrived; |
| 130 | |
| 131 | /* root structure information */ |
| 132 | kmp_int32 r_sizeof_struct; |
| 133 | offset_and_size_t r_root_team; // team at root |
| 134 | offset_and_size_t r_hot_team; // hot team for this root |
| 135 | offset_and_size_t r_uber_thread; // root thread |
| 136 | offset_and_size_t r_root_id; // unique root id (if available) |
| 137 | |
| 138 | /* ident structure information */ |
| 139 | kmp_int32 id_sizeof_struct; |
| 140 | offset_and_size_t id_psource; /* address of string ";file;func;line1;line2;;". */ |
| 141 | offset_and_size_t id_flags; |
| 142 | |
| 143 | /* lock structure information */ |
| 144 | kmp_int32 lk_sizeof_struct; |
| 145 | offset_and_size_t lk_initialized; |
| 146 | offset_and_size_t lk_location; |
| 147 | offset_and_size_t lk_tail_id; |
| 148 | offset_and_size_t lk_head_id; |
| 149 | offset_and_size_t lk_next_ticket; |
| 150 | offset_and_size_t lk_now_serving; |
| 151 | offset_and_size_t lk_owner_id; |
| 152 | offset_and_size_t lk_depth_locked; |
| 153 | |
| 154 | /* lock_table_t */ |
| 155 | kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */ |
| 156 | offset_and_size_t lt_used; |
| 157 | offset_and_size_t lt_allocated; |
| 158 | offset_and_size_t lt_table; |
| 159 | |
| 160 | /* task_team_t */ |
| 161 | kmp_int32 tt_sizeof_struct; |
| 162 | offset_and_size_t tt_threads_data; |
| 163 | offset_and_size_t tt_found_tasks; |
| 164 | offset_and_size_t tt_nproc; |
| 165 | offset_and_size_t tt_unfinished_threads; |
| 166 | offset_and_size_t tt_active; |
| 167 | offset_and_size_t tt_state; |
| 168 | |
| 169 | /* kmp_taskdata_t */ |
| 170 | kmp_int32 td_sizeof_struct; |
| 171 | offset_and_size_t td_task_id; |
| 172 | offset_and_size_t td_flags; |
| 173 | offset_and_size_t td_team; |
| 174 | offset_and_size_t td_parent; |
| 175 | offset_and_size_t td_ident; |
| 176 | offset_and_size_t td_allocated_child_tasks; |
| 177 | offset_and_size_t td_incomplete_child_tasks; |
| 178 | |
| 179 | /* kmp_thread_data_t */ |
| 180 | kmp_int32 hd_sizeof_struct; |
| 181 | offset_and_size_t hd_deque; |
| 182 | offset_and_size_t hd_deque_head; |
| 183 | offset_and_size_t hd_deque_tail; |
| 184 | offset_and_size_t hd_deque_ntasks; |
| 185 | offset_and_size_t hd_deque_last_stolen; |
| 186 | |
| 187 | // The last field of stable version. |
| 188 | kmp_uint64 last_field; |
| 189 | // Extensions. |
| 190 | // When KMP_OMP_VERSION is bumped, move these fields up to appropriate location, |
| 191 | // to let last_field be actually last. |
| 192 | addr_and_size_t openmp_version; |
| 193 | offset_and_size_t td_taskwait_ident; |
| 194 | offset_and_size_t td_taskwait_counter; |
| 195 | offset_and_size_t td_taskwait_thread; |
| 196 | |
| 197 | offset_and_size_t lk_lock_flags; |
| 198 | |
| 199 | } kmp_omp_struct_info_t; |
| 200 | |
| 201 | |
| 202 | /* end of file */ |