xref: /freebsd-src/contrib/llvm-project/openmp/runtime/src/kmp_omp.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
10b57cec5SDimitry Andric #if USE_DEBUGGER
20b57cec5SDimitry Andric /*
30b57cec5SDimitry Andric  * kmp_omp.h -- OpenMP definition for kmp_omp_struct_info_t.
40b57cec5SDimitry Andric  *              This is for information about runtime library structures.
50b57cec5SDimitry Andric  */
60b57cec5SDimitry Andric 
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
100b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
110b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
120b57cec5SDimitry Andric //
130b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric /* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE
160b57cec5SDimitry Andric    It should instead be modified in the OpenMP runtime and copied to the
170b57cec5SDimitry Andric    interface library code.  This way we can minimize the problems that this is
180b57cec5SDimitry Andric    sure to cause having two copies of the same file.
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric    Files live in libomp and libomp_db/src/include  */
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric /* CHANGE THIS WHEN STRUCTURES BELOW CHANGE
230b57cec5SDimitry Andric    Before we release this to a customer, please don't change this value.  After
240b57cec5SDimitry Andric    it is released and stable, then any new updates to the structures or data
250b57cec5SDimitry Andric    structure traversal algorithms need to change this value. */
260b57cec5SDimitry Andric #define KMP_OMP_VERSION 9
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric typedef struct {
290b57cec5SDimitry Andric   kmp_int32 offset;
300b57cec5SDimitry Andric   kmp_int32 size;
310b57cec5SDimitry Andric } offset_and_size_t;
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric typedef struct {
340b57cec5SDimitry Andric   kmp_uint64 addr;
350b57cec5SDimitry Andric   kmp_int32 size;
360b57cec5SDimitry Andric   kmp_int32 padding;
370b57cec5SDimitry Andric } addr_and_size_t;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric typedef struct {
400b57cec5SDimitry Andric   kmp_uint64 flags; // Flags for future extensions.
410b57cec5SDimitry Andric   kmp_uint64
420b57cec5SDimitry Andric       file; // Pointer to name of source file where the parallel region is.
430b57cec5SDimitry Andric   kmp_uint64 func; // Pointer to name of routine where the parallel region is.
440b57cec5SDimitry Andric   kmp_int32 begin; // Beginning of source line range.
450b57cec5SDimitry Andric   kmp_int32 end; // End of source line range.
460b57cec5SDimitry Andric   kmp_int32 num_threads; // Specified number of threads.
470b57cec5SDimitry Andric } kmp_omp_nthr_item_t;
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric typedef struct {
505ffd83dbSDimitry Andric   kmp_int32 num; // Number of items in the array.
510b57cec5SDimitry Andric   kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t.
520b57cec5SDimitry Andric } kmp_omp_nthr_info_t;
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric /* This structure is known to the idb interface library */
550b57cec5SDimitry Andric typedef struct {
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric   /* Change this only if you make a fundamental data structure change here */
580b57cec5SDimitry Andric   kmp_int32 lib_version;
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric   /* sanity check.  Only should be checked if versions are identical
610b57cec5SDimitry Andric    * This is also used for backward compatibility to get the runtime
620b57cec5SDimitry Andric    * structure size if it the runtime is older than the interface */
630b57cec5SDimitry Andric   kmp_int32 sizeof_this_structure;
640b57cec5SDimitry Andric 
650b57cec5SDimitry Andric   /* OpenMP RTL version info. */
660b57cec5SDimitry Andric   addr_and_size_t major;
670b57cec5SDimitry Andric   addr_and_size_t minor;
680b57cec5SDimitry Andric   addr_and_size_t build;
690b57cec5SDimitry Andric   addr_and_size_t openmp_version;
700b57cec5SDimitry Andric   addr_and_size_t banner;
710b57cec5SDimitry Andric 
720b57cec5SDimitry Andric   /* Various globals. */
730b57cec5SDimitry Andric   addr_and_size_t threads; // Pointer to __kmp_threads.
740b57cec5SDimitry Andric   addr_and_size_t roots; // Pointer to __kmp_root.
750b57cec5SDimitry Andric   addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
760b57cec5SDimitry Andric #if KMP_USE_MONITOR
770b57cec5SDimitry Andric   addr_and_size_t monitor; // Pointer to __kmp_monitor.
780b57cec5SDimitry Andric #endif
790b57cec5SDimitry Andric #if !KMP_USE_DYNAMIC_LOCK
800b57cec5SDimitry Andric   addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
810b57cec5SDimitry Andric #endif
820b57cec5SDimitry Andric   addr_and_size_t func_microtask;
830b57cec5SDimitry Andric   addr_and_size_t func_fork;
840b57cec5SDimitry Andric   addr_and_size_t func_fork_teams;
850b57cec5SDimitry Andric   addr_and_size_t team_counter;
860b57cec5SDimitry Andric   addr_and_size_t task_counter;
870b57cec5SDimitry Andric   addr_and_size_t nthr_info;
880b57cec5SDimitry Andric   kmp_int32 address_width;
890b57cec5SDimitry Andric   kmp_int32 indexed_locks;
900b57cec5SDimitry Andric   kmp_int32 last_barrier; // The end in enum barrier_type
910b57cec5SDimitry Andric   kmp_int32 deque_size; // TASK_DEQUE_SIZE
920b57cec5SDimitry Andric 
930b57cec5SDimitry Andric   /* thread structure information. */
940b57cec5SDimitry Andric   kmp_int32 th_sizeof_struct;
950b57cec5SDimitry Andric   offset_and_size_t th_info; // descriptor for thread
960b57cec5SDimitry Andric   offset_and_size_t th_team; // team for this thread
970b57cec5SDimitry Andric   offset_and_size_t th_root; // root for this thread
980b57cec5SDimitry Andric   offset_and_size_t th_serial_team; // serial team under this thread
990b57cec5SDimitry Andric   offset_and_size_t th_ident; // location for this thread (if available)
1000b57cec5SDimitry Andric   offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
1010b57cec5SDimitry Andric   offset_and_size_t
1020b57cec5SDimitry Andric       th_next_waiting; // next thread waiting for lock (if available)
1030b57cec5SDimitry Andric   offset_and_size_t th_task_team; // task team struct
1040b57cec5SDimitry Andric   offset_and_size_t th_current_task; // innermost task being executed
1050b57cec5SDimitry Andric   offset_and_size_t
1060b57cec5SDimitry Andric       th_task_state; // alternating 0/1 for task team identification
1070b57cec5SDimitry Andric   offset_and_size_t th_bar;
1080b57cec5SDimitry Andric   offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it
1090b57cec5SDimitry Andric   // arrives to the barrier
1100b57cec5SDimitry Andric 
1110b57cec5SDimitry Andric   /* teams information */
1120b57cec5SDimitry Andric   offset_and_size_t th_teams_microtask; // entry address for teams construct
1130b57cec5SDimitry Andric   offset_and_size_t th_teams_level; // initial level of teams construct
1140b57cec5SDimitry Andric   offset_and_size_t th_teams_nteams; // number of teams in a league
1150b57cec5SDimitry Andric   offset_and_size_t
1160b57cec5SDimitry Andric       th_teams_nth; // number of threads in each team of the league
1170b57cec5SDimitry Andric 
1180b57cec5SDimitry Andric   /* kmp_desc structure (for info field above) */
1190b57cec5SDimitry Andric   kmp_int32 ds_sizeof_struct;
1200b57cec5SDimitry Andric   offset_and_size_t ds_tid; // team thread id
1210b57cec5SDimitry Andric   offset_and_size_t ds_gtid; // global thread id
1220b57cec5SDimitry Andric   offset_and_size_t ds_thread; // native thread id
1230b57cec5SDimitry Andric 
1240b57cec5SDimitry Andric   /* team structure information */
1250b57cec5SDimitry Andric   kmp_int32 t_sizeof_struct;
126*fe6060f1SDimitry Andric   offset_and_size_t t_master_tid; // tid of primary thread in parent team
1270b57cec5SDimitry Andric   offset_and_size_t t_ident; // location of parallel region
1280b57cec5SDimitry Andric   offset_and_size_t t_parent; // parent team
1290b57cec5SDimitry Andric   offset_and_size_t t_nproc; // # team threads
1300b57cec5SDimitry Andric   offset_and_size_t t_threads; // array of threads
1310b57cec5SDimitry Andric   offset_and_size_t t_serialized; // # levels of serialized teams
1320b57cec5SDimitry Andric   offset_and_size_t t_id; // unique team id
1330b57cec5SDimitry Andric   offset_and_size_t t_pkfn;
1340b57cec5SDimitry Andric   offset_and_size_t t_task_team; // task team structure
1350b57cec5SDimitry Andric   offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
1360b57cec5SDimitry Andric   offset_and_size_t t_cancel_request;
1370b57cec5SDimitry Andric   offset_and_size_t t_bar;
1380b57cec5SDimitry Andric   offset_and_size_t
139*fe6060f1SDimitry Andric       t_b_master_arrived; // incremented when primary thread reaches barrier
1400b57cec5SDimitry Andric   offset_and_size_t
1410b57cec5SDimitry Andric       t_b_team_arrived; // increased by one when all the threads arrived
1420b57cec5SDimitry Andric 
1430b57cec5SDimitry Andric   /* root structure information */
1440b57cec5SDimitry Andric   kmp_int32 r_sizeof_struct;
1450b57cec5SDimitry Andric   offset_and_size_t r_root_team; // team at root
1460b57cec5SDimitry Andric   offset_and_size_t r_hot_team; // hot team for this root
1470b57cec5SDimitry Andric   offset_and_size_t r_uber_thread; // root thread
1480b57cec5SDimitry Andric   offset_and_size_t r_root_id; // unique root id (if available)
1490b57cec5SDimitry Andric 
1500b57cec5SDimitry Andric   /* ident structure information */
1510b57cec5SDimitry Andric   kmp_int32 id_sizeof_struct;
1520b57cec5SDimitry Andric   offset_and_size_t
1530b57cec5SDimitry Andric       id_psource; /* address of string ";file;func;line1;line2;;". */
1540b57cec5SDimitry Andric   offset_and_size_t id_flags;
1550b57cec5SDimitry Andric 
1560b57cec5SDimitry Andric   /* lock structure information */
1570b57cec5SDimitry Andric   kmp_int32 lk_sizeof_struct;
1580b57cec5SDimitry Andric   offset_and_size_t lk_initialized;
1590b57cec5SDimitry Andric   offset_and_size_t lk_location;
1600b57cec5SDimitry Andric   offset_and_size_t lk_tail_id;
1610b57cec5SDimitry Andric   offset_and_size_t lk_head_id;
1620b57cec5SDimitry Andric   offset_and_size_t lk_next_ticket;
1630b57cec5SDimitry Andric   offset_and_size_t lk_now_serving;
1640b57cec5SDimitry Andric   offset_and_size_t lk_owner_id;
1650b57cec5SDimitry Andric   offset_and_size_t lk_depth_locked;
1660b57cec5SDimitry Andric   offset_and_size_t lk_lock_flags;
1670b57cec5SDimitry Andric 
1680b57cec5SDimitry Andric #if !KMP_USE_DYNAMIC_LOCK
1690b57cec5SDimitry Andric   /* lock_table_t */
1700b57cec5SDimitry Andric   kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
1710b57cec5SDimitry Andric   offset_and_size_t lt_used;
1720b57cec5SDimitry Andric   offset_and_size_t lt_allocated;
1730b57cec5SDimitry Andric   offset_and_size_t lt_table;
1740b57cec5SDimitry Andric #endif
1750b57cec5SDimitry Andric 
1760b57cec5SDimitry Andric   /* task_team_t */
1770b57cec5SDimitry Andric   kmp_int32 tt_sizeof_struct;
1780b57cec5SDimitry Andric   offset_and_size_t tt_threads_data;
1790b57cec5SDimitry Andric   offset_and_size_t tt_found_tasks;
1800b57cec5SDimitry Andric   offset_and_size_t tt_nproc;
1810b57cec5SDimitry Andric   offset_and_size_t tt_unfinished_threads;
1820b57cec5SDimitry Andric   offset_and_size_t tt_active;
1830b57cec5SDimitry Andric 
1840b57cec5SDimitry Andric   /* kmp_taskdata_t */
1850b57cec5SDimitry Andric   kmp_int32 td_sizeof_struct;
1860b57cec5SDimitry Andric   offset_and_size_t td_task_id; // task id
1870b57cec5SDimitry Andric   offset_and_size_t td_flags; // task flags
1880b57cec5SDimitry Andric   offset_and_size_t td_team; // team for this task
1890b57cec5SDimitry Andric   offset_and_size_t td_parent; // parent task
1900b57cec5SDimitry Andric   offset_and_size_t td_level; // task testing level
1910b57cec5SDimitry Andric   offset_and_size_t td_ident; // task identifier
1920b57cec5SDimitry Andric   offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task)
1930b57cec5SDimitry Andric   // not yet deallocated
1940b57cec5SDimitry Andric   offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
1950b57cec5SDimitry Andric 
1960b57cec5SDimitry Andric   /* Taskwait */
1970b57cec5SDimitry Andric   offset_and_size_t td_taskwait_ident;
1980b57cec5SDimitry Andric   offset_and_size_t td_taskwait_counter;
1990b57cec5SDimitry Andric   offset_and_size_t
2000b57cec5SDimitry Andric       td_taskwait_thread; // gtid + 1 of thread encountered taskwait
2010b57cec5SDimitry Andric 
2020b57cec5SDimitry Andric   /* Taskgroup */
2030b57cec5SDimitry Andric   offset_and_size_t td_taskgroup; // pointer to the current taskgroup
2040b57cec5SDimitry Andric   offset_and_size_t
2050b57cec5SDimitry Andric       td_task_count; // number of allocated and not yet complete tasks
2060b57cec5SDimitry Andric   offset_and_size_t td_cancel; // request for cancellation of this taskgroup
2070b57cec5SDimitry Andric 
2080b57cec5SDimitry Andric   /* Task dependency */
2090b57cec5SDimitry Andric   offset_and_size_t
2100b57cec5SDimitry Andric       td_depnode; // pointer to graph node if the task has dependencies
2110b57cec5SDimitry Andric   offset_and_size_t dn_node;
2120b57cec5SDimitry Andric   offset_and_size_t dn_next;
2130b57cec5SDimitry Andric   offset_and_size_t dn_successors;
2140b57cec5SDimitry Andric   offset_and_size_t dn_task;
2150b57cec5SDimitry Andric   offset_and_size_t dn_npredecessors;
2160b57cec5SDimitry Andric   offset_and_size_t dn_nrefs;
2170b57cec5SDimitry Andric   offset_and_size_t dn_routine;
2180b57cec5SDimitry Andric 
2190b57cec5SDimitry Andric   /* kmp_thread_data_t */
2200b57cec5SDimitry Andric   kmp_int32 hd_sizeof_struct;
2210b57cec5SDimitry Andric   offset_and_size_t hd_deque;
2220b57cec5SDimitry Andric   offset_and_size_t hd_deque_size;
2230b57cec5SDimitry Andric   offset_and_size_t hd_deque_head;
2240b57cec5SDimitry Andric   offset_and_size_t hd_deque_tail;
2250b57cec5SDimitry Andric   offset_and_size_t hd_deque_ntasks;
2260b57cec5SDimitry Andric   offset_and_size_t hd_deque_last_stolen;
2270b57cec5SDimitry Andric 
2280b57cec5SDimitry Andric   // The last field of stable version.
2290b57cec5SDimitry Andric   kmp_uint64 last_field;
2300b57cec5SDimitry Andric 
2310b57cec5SDimitry Andric } kmp_omp_struct_info_t;
2320b57cec5SDimitry Andric 
2330b57cec5SDimitry Andric #endif /* USE_DEBUGGER */
2340b57cec5SDimitry Andric 
2350b57cec5SDimitry Andric /* end of file */
236