xref: /freebsd/lib/libomp/omp-tools.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
13c6bb671SDimitry Andric /*
2dac87cc0SDimitry Andric  * include/omp-tools.h.var
33c6bb671SDimitry Andric  */
43c6bb671SDimitry Andric 
53c6bb671SDimitry Andric //===----------------------------------------------------------------------===//
63c6bb671SDimitry Andric //
7dac87cc0SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8dac87cc0SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
9dac87cc0SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
103c6bb671SDimitry Andric //
113c6bb671SDimitry Andric //===----------------------------------------------------------------------===//
123c6bb671SDimitry Andric 
133c6bb671SDimitry Andric #ifndef __OMPT__
143c6bb671SDimitry Andric #define __OMPT__
153c6bb671SDimitry Andric 
163c6bb671SDimitry Andric /*****************************************************************************
173c6bb671SDimitry Andric  * system include files
183c6bb671SDimitry Andric  *****************************************************************************/
193c6bb671SDimitry Andric 
203c6bb671SDimitry Andric #include <stdint.h>
213c6bb671SDimitry Andric #include <stddef.h>
223c6bb671SDimitry Andric 
23d409305fSDimitry Andric #ifdef DEPRECATION_WARNINGS
24d409305fSDimitry Andric # ifdef __cplusplus
25d409305fSDimitry Andric # define DEPRECATED_51 [[deprecated("as of 5.1")]]
26d409305fSDimitry Andric # else
27d409305fSDimitry Andric # define DEPRECATED_51 __attribute__((deprecated("as of 5.1")))
28d409305fSDimitry Andric #endif
29d409305fSDimitry Andric #else
30d409305fSDimitry Andric #define DEPRECATED_51
31d409305fSDimitry Andric #endif
32d409305fSDimitry Andric 
333c6bb671SDimitry Andric /*****************************************************************************
343c6bb671SDimitry Andric  * iteration macros
353c6bb671SDimitry Andric  *****************************************************************************/
363c6bb671SDimitry Andric 
373c6bb671SDimitry Andric #define FOREACH_OMPT_INQUIRY_FN(macro)      \
383c6bb671SDimitry Andric     macro (ompt_enumerate_states)           \
393c6bb671SDimitry Andric     macro (ompt_enumerate_mutex_impls)      \
403c6bb671SDimitry Andric                                             \
413c6bb671SDimitry Andric     macro (ompt_set_callback)               \
423c6bb671SDimitry Andric     macro (ompt_get_callback)               \
433c6bb671SDimitry Andric                                             \
443c6bb671SDimitry Andric     macro (ompt_get_state)                  \
453c6bb671SDimitry Andric                                             \
463c6bb671SDimitry Andric     macro (ompt_get_parallel_info)          \
473c6bb671SDimitry Andric     macro (ompt_get_task_info)              \
483c6bb671SDimitry Andric     macro (ompt_get_task_memory)            \
493c6bb671SDimitry Andric     macro (ompt_get_thread_data)            \
503c6bb671SDimitry Andric     macro (ompt_get_unique_id)              \
513c6bb671SDimitry Andric     macro (ompt_finalize_tool)              \
523c6bb671SDimitry Andric                                             \
533c6bb671SDimitry Andric     macro(ompt_get_num_procs)               \
543c6bb671SDimitry Andric     macro(ompt_get_num_places)              \
553c6bb671SDimitry Andric     macro(ompt_get_place_proc_ids)          \
563c6bb671SDimitry Andric     macro(ompt_get_place_num)               \
573c6bb671SDimitry Andric     macro(ompt_get_partition_place_nums)    \
583c6bb671SDimitry Andric     macro(ompt_get_proc_id)                 \
593c6bb671SDimitry Andric                                             \
603c6bb671SDimitry Andric     macro(ompt_get_target_info)             \
613c6bb671SDimitry Andric     macro(ompt_get_num_devices)
623c6bb671SDimitry Andric 
633c6bb671SDimitry Andric #define FOREACH_OMPT_STATE(macro)                                                                \
643c6bb671SDimitry Andric                                                                                                 \
653c6bb671SDimitry Andric     /* first available state */                                                                 \
663c6bb671SDimitry Andric     macro (ompt_state_undefined, 0x102)      /* undefined thread state */                        \
673c6bb671SDimitry Andric                                                                                                 \
683c6bb671SDimitry Andric     /* work states (0..15) */                                                                   \
693c6bb671SDimitry Andric     macro (ompt_state_work_serial, 0x000)    /* working outside parallel */                      \
703c6bb671SDimitry Andric     macro (ompt_state_work_parallel, 0x001)  /* working within parallel */                       \
713c6bb671SDimitry Andric     macro (ompt_state_work_reduction, 0x002) /* performing a reduction */                        \
723c6bb671SDimitry Andric                                                                                                 \
733c6bb671SDimitry Andric     /* barrier wait states (16..31) */                                                          \
743c6bb671SDimitry Andric     macro (ompt_state_wait_barrier, 0x010)   /* waiting at a barrier */                          \
753c6bb671SDimitry Andric     macro (ompt_state_wait_barrier_implicit_parallel, 0x011)                                     \
763c6bb671SDimitry Andric                                             /* implicit barrier at the end of parallel region */\
773c6bb671SDimitry Andric     macro (ompt_state_wait_barrier_implicit_workshare, 0x012)                                    \
783c6bb671SDimitry Andric                                             /* implicit barrier at the end of worksharing */    \
793c6bb671SDimitry Andric     macro (ompt_state_wait_barrier_implicit, 0x013)  /* implicit barrier */                      \
803c6bb671SDimitry Andric     macro (ompt_state_wait_barrier_explicit, 0x014)  /* explicit barrier */                      \
81*0fca6ea1SDimitry Andric     macro (ompt_state_wait_barrier_implementation, 0x015) /* implementation barrier */           \
82*0fca6ea1SDimitry Andric     macro (ompt_state_wait_barrier_teams, 0x016)          /* teams barrier */                    \
833c6bb671SDimitry Andric                                                                                                 \
843c6bb671SDimitry Andric     /* task wait states (32..63) */                                                             \
853c6bb671SDimitry Andric     macro (ompt_state_wait_taskwait, 0x020)  /* waiting at a taskwait */                         \
863c6bb671SDimitry Andric     macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */                        \
873c6bb671SDimitry Andric                                                                                                 \
883c6bb671SDimitry Andric     /* mutex wait states (64..127) */                                                           \
893c6bb671SDimitry Andric     macro (ompt_state_wait_mutex, 0x040)                                                         \
903c6bb671SDimitry Andric     macro (ompt_state_wait_lock, 0x041)      /* waiting for lock */                              \
913c6bb671SDimitry Andric     macro (ompt_state_wait_critical, 0x042)  /* waiting for critical */                          \
923c6bb671SDimitry Andric     macro (ompt_state_wait_atomic, 0x043)    /* waiting for atomic */                            \
933c6bb671SDimitry Andric     macro (ompt_state_wait_ordered, 0x044)   /* waiting for ordered */                           \
943c6bb671SDimitry Andric                                                                                                 \
953c6bb671SDimitry Andric     /* target wait states (128..255) */                                                         \
963c6bb671SDimitry Andric     macro (ompt_state_wait_target, 0x080)        /* waiting for target region */                 \
973c6bb671SDimitry Andric     macro (ompt_state_wait_target_map, 0x081)    /* waiting for target data mapping operation */ \
983c6bb671SDimitry Andric     macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */       \
993c6bb671SDimitry Andric                                                                                                 \
1003c6bb671SDimitry Andric     /* misc (256..511) */                                                                       \
1013c6bb671SDimitry Andric     macro (ompt_state_idle, 0x100)           /* waiting for work */                              \
1023c6bb671SDimitry Andric     macro (ompt_state_overhead, 0x101)       /* overhead excluding wait states */                \
1033c6bb671SDimitry Andric                                                                                                 \
1043c6bb671SDimitry Andric     /* implementation-specific states (512..) */
1053c6bb671SDimitry Andric 
1063c6bb671SDimitry Andric 
1073c6bb671SDimitry Andric #define FOREACH_KMP_MUTEX_IMPL(macro)                                                \
1083c6bb671SDimitry Andric     macro (kmp_mutex_impl_none, 0)         /* unknown implementation */              \
1093c6bb671SDimitry Andric     macro (kmp_mutex_impl_spin, 1)         /* based on spin */                       \
1103c6bb671SDimitry Andric     macro (kmp_mutex_impl_queuing, 2)      /* based on some fair policy */           \
1113c6bb671SDimitry Andric     macro (kmp_mutex_impl_speculative, 3)  /* based on HW-supported speculation */
1123c6bb671SDimitry Andric 
113bdd1243dSDimitry Andric #define FOREACH_OMPT_HOST_EVENT(macro)                                                                                   \
1143c6bb671SDimitry Andric                                                                                                                          \
1153c6bb671SDimitry Andric     /*--- Mandatory Events ---*/                                                                                         \
1163c6bb671SDimitry Andric     macro (ompt_callback_thread_begin,      ompt_callback_thread_begin_t,       1) /* thread begin                    */ \
1173c6bb671SDimitry Andric     macro (ompt_callback_thread_end,        ompt_callback_thread_end_t,         2) /* thread end                      */ \
1183c6bb671SDimitry Andric                                                                                                                          \
1193c6bb671SDimitry Andric     macro (ompt_callback_parallel_begin,    ompt_callback_parallel_begin_t,     3) /* parallel begin                  */ \
1203c6bb671SDimitry Andric     macro (ompt_callback_parallel_end,      ompt_callback_parallel_end_t,       4) /* parallel end                    */ \
1213c6bb671SDimitry Andric                                                                                                                          \
1223c6bb671SDimitry Andric     macro (ompt_callback_task_create,       ompt_callback_task_create_t,        5) /* task begin                      */ \
1233c6bb671SDimitry Andric     macro (ompt_callback_task_schedule,     ompt_callback_task_schedule_t,      6) /* task schedule                   */ \
1243c6bb671SDimitry Andric     macro (ompt_callback_implicit_task,     ompt_callback_implicit_task_t,      7) /* implicit task                   */ \
1253c6bb671SDimitry Andric                                                                                                                          \
1263c6bb671SDimitry Andric     macro (ompt_callback_control_tool,      ompt_callback_control_tool_t,      11) /* control tool                    */ \
1273c6bb671SDimitry Andric                                                                                                                          \
1283c6bb671SDimitry Andric     /* Optional Events */                                                                                                \
1293c6bb671SDimitry Andric     macro (ompt_callback_sync_region_wait,  ompt_callback_sync_region_t,       16) /* sync region wait begin or end   */ \
1303c6bb671SDimitry Andric                                                                                                                          \
1313c6bb671SDimitry Andric     macro (ompt_callback_mutex_released,    ompt_callback_mutex_t,             17) /* mutex released                  */ \
1323c6bb671SDimitry Andric                                                                                                                          \
1333c6bb671SDimitry Andric     macro (ompt_callback_dependences,       ompt_callback_dependences_t,       18) /* report task dependences         */ \
1343c6bb671SDimitry Andric     macro (ompt_callback_task_dependence,   ompt_callback_task_dependence_t,   19) /* report task dependence          */ \
1353c6bb671SDimitry Andric                                                                                                                          \
1363c6bb671SDimitry Andric     macro (ompt_callback_work,              ompt_callback_work_t,              20) /* task at work begin or end       */ \
1373c6bb671SDimitry Andric                                                                                                                          \
138d409305fSDimitry Andric     macro (ompt_callback_masked,            ompt_callback_masked_t,            21) /* task at masked begin or end     */ \
1393c6bb671SDimitry Andric                                                                                                                          \
1403c6bb671SDimitry Andric     macro (ompt_callback_sync_region,       ompt_callback_sync_region_t,       23) /* sync region begin or end        */ \
1413c6bb671SDimitry Andric                                                                                                                          \
1423c6bb671SDimitry Andric     macro (ompt_callback_lock_init,         ompt_callback_mutex_acquire_t,     24) /* lock init                       */ \
1433c6bb671SDimitry Andric     macro (ompt_callback_lock_destroy,      ompt_callback_mutex_t,             25) /* lock destroy                    */ \
1443c6bb671SDimitry Andric                                                                                                                          \
1453c6bb671SDimitry Andric     macro (ompt_callback_mutex_acquire,     ompt_callback_mutex_acquire_t,     26) /* mutex acquire                   */ \
1463c6bb671SDimitry Andric     macro (ompt_callback_mutex_acquired,    ompt_callback_mutex_t,             27) /* mutex acquired                  */ \
1473c6bb671SDimitry Andric                                                                                                                          \
1483c6bb671SDimitry Andric     macro (ompt_callback_nest_lock,         ompt_callback_nest_lock_t,         28) /* nest lock                       */ \
1493c6bb671SDimitry Andric                                                                                                                          \
1503c6bb671SDimitry Andric     macro (ompt_callback_flush,             ompt_callback_flush_t,             29) /* after executing flush           */ \
1513c6bb671SDimitry Andric                                                                                                                          \
1523c6bb671SDimitry Andric     macro (ompt_callback_cancel,            ompt_callback_cancel_t,            30) /* cancel innermost binding region */ \
1533c6bb671SDimitry Andric                                                                                                                          \
1543c6bb671SDimitry Andric     macro (ompt_callback_reduction,         ompt_callback_sync_region_t,       31) /* reduction                       */ \
1553c6bb671SDimitry Andric                                                                                                                          \
156d409305fSDimitry Andric     macro (ompt_callback_dispatch,          ompt_callback_dispatch_t,          32) /* dispatch of work                */ \
157bdd1243dSDimitry Andric     macro (ompt_callback_error,             ompt_callback_error_t,             37) /* error                           */
158bdd1243dSDimitry Andric 
159bdd1243dSDimitry Andric #define FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                 \
160bdd1243dSDimitry Andric     /*--- Mandatory Events ---*/                                                                                         \
161bdd1243dSDimitry Andric     macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize               */ \
162bdd1243dSDimitry Andric     macro (ompt_callback_device_finalize,   ompt_callback_device_finalize_t,   13) /* device finalize                 */ \
163bdd1243dSDimitry Andric                                                                                                                          \
164bdd1243dSDimitry Andric     macro (ompt_callback_device_load,       ompt_callback_device_load_t,       14) /* device load                     */ \
165bdd1243dSDimitry Andric     macro (ompt_callback_device_unload,     ompt_callback_device_unload_t,     15) /* device unload                   */
166bdd1243dSDimitry Andric 
167bdd1243dSDimitry Andric #define FOREACH_OMPT_NOEMI_EVENT(macro)                                                                                  \
168bdd1243dSDimitry Andric     /*--- Mandatory Events ---*/                                                                                         \
169bdd1243dSDimitry Andric     macro (ompt_callback_target,            ompt_callback_target_t,             8) /* target                          */ \
170bdd1243dSDimitry Andric     macro (ompt_callback_target_data_op,    ompt_callback_target_data_op_t,     9) /* target data op                  */ \
171bdd1243dSDimitry Andric     macro (ompt_callback_target_submit,     ompt_callback_target_submit_t,     10) /* target  submit                  */ \
172bdd1243dSDimitry Andric     /* Optional Events */                                                                                                \
173bdd1243dSDimitry Andric     macro (ompt_callback_target_map,        ompt_callback_target_map_t,        22) /* target map                      */
174bdd1243dSDimitry Andric 
175bdd1243dSDimitry Andric #define FOREACH_OMPT_EMI_EVENT(macro)                                                                                    \
176bdd1243dSDimitry Andric     /*--- Mandatory Events ---*/                                                                                         \
177d409305fSDimitry Andric     macro (ompt_callback_target_emi,        ompt_callback_target_emi_t,        33) /* target                          */ \
178d409305fSDimitry Andric     macro (ompt_callback_target_data_op_emi,ompt_callback_target_data_op_emi_t,34) /* target data op                  */ \
179d409305fSDimitry Andric     macro (ompt_callback_target_submit_emi, ompt_callback_target_submit_emi_t, 35) /* target submit                   */ \
180bdd1243dSDimitry Andric     /* Optional Events */                                                                                                \
181bdd1243dSDimitry Andric     macro (ompt_callback_target_map_emi,    ompt_callback_target_map_emi_t,    36) /* target map                      */
182bdd1243dSDimitry Andric 
183bdd1243dSDimitry Andric #define FOREACH_OMPT_50_TARGET_EVENT(macro)                                                                              \
184bdd1243dSDimitry Andric     FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
185bdd1243dSDimitry Andric     FOREACH_OMPT_NOEMI_EVENT(macro)
186bdd1243dSDimitry Andric 
187bdd1243dSDimitry Andric #define FOREACH_OMPT_51_TARGET_EVENT(macro)                                                                              \
188bdd1243dSDimitry Andric     FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
189bdd1243dSDimitry Andric     FOREACH_OMPT_EMI_EVENT(macro)
190bdd1243dSDimitry Andric 
191bdd1243dSDimitry Andric #define FOREACH_OMPT_EVENT(macro)                                                                                        \
192bdd1243dSDimitry Andric     FOREACH_OMPT_HOST_EVENT(macro)                                                                                       \
193bdd1243dSDimitry Andric     FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
194bdd1243dSDimitry Andric     FOREACH_OMPT_NOEMI_EVENT(macro)                                                                                      \
195bdd1243dSDimitry Andric     FOREACH_OMPT_EMI_EVENT(macro)
196bdd1243dSDimitry Andric 
197bdd1243dSDimitry Andric #define FOREACH_OMPT_51_EVENT(macro)                                                                                     \
198bdd1243dSDimitry Andric     FOREACH_OMPT_HOST_EVENT(macro)                                                                                       \
199bdd1243dSDimitry Andric     FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
200bdd1243dSDimitry Andric     FOREACH_OMPT_EMI_EVENT(macro)
2013c6bb671SDimitry Andric 
2023c6bb671SDimitry Andric /*****************************************************************************
2033c6bb671SDimitry Andric  * implementation specific types
2043c6bb671SDimitry Andric  *****************************************************************************/
2053c6bb671SDimitry Andric 
2063c6bb671SDimitry Andric typedef enum kmp_mutex_impl_t {
2073c6bb671SDimitry Andric #define kmp_mutex_impl_macro(impl, code) impl = code,
2083c6bb671SDimitry Andric     FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
2093c6bb671SDimitry Andric #undef kmp_mutex_impl_macro
2103c6bb671SDimitry Andric } kmp_mutex_impl_t;
2113c6bb671SDimitry Andric 
2123c6bb671SDimitry Andric /*****************************************************************************
2133c6bb671SDimitry Andric  * definitions generated from spec
2143c6bb671SDimitry Andric  *****************************************************************************/
2153c6bb671SDimitry Andric 
216*0fca6ea1SDimitry Andric #if defined(__cplusplus)
217*0fca6ea1SDimitry Andric extern "C" {
218*0fca6ea1SDimitry Andric #endif
219*0fca6ea1SDimitry Andric 
2203c6bb671SDimitry Andric typedef enum ompt_callbacks_t {
2213c6bb671SDimitry Andric   ompt_callback_thread_begin             = 1,
2223c6bb671SDimitry Andric   ompt_callback_thread_end               = 2,
2233c6bb671SDimitry Andric   ompt_callback_parallel_begin           = 3,
2243c6bb671SDimitry Andric   ompt_callback_parallel_end             = 4,
2253c6bb671SDimitry Andric   ompt_callback_task_create              = 5,
2263c6bb671SDimitry Andric   ompt_callback_task_schedule            = 6,
2273c6bb671SDimitry Andric   ompt_callback_implicit_task            = 7,
2283c6bb671SDimitry Andric   ompt_callback_target                   = 8,
2293c6bb671SDimitry Andric   ompt_callback_target_data_op           = 9,
2303c6bb671SDimitry Andric   ompt_callback_target_submit            = 10,
2313c6bb671SDimitry Andric   ompt_callback_control_tool             = 11,
2323c6bb671SDimitry Andric   ompt_callback_device_initialize        = 12,
2333c6bb671SDimitry Andric   ompt_callback_device_finalize          = 13,
2343c6bb671SDimitry Andric   ompt_callback_device_load              = 14,
2353c6bb671SDimitry Andric   ompt_callback_device_unload            = 15,
2363c6bb671SDimitry Andric   ompt_callback_sync_region_wait         = 16,
2373c6bb671SDimitry Andric   ompt_callback_mutex_released           = 17,
2383c6bb671SDimitry Andric   ompt_callback_dependences              = 18,
2393c6bb671SDimitry Andric   ompt_callback_task_dependence          = 19,
2403c6bb671SDimitry Andric   ompt_callback_work                     = 20,
241d409305fSDimitry Andric   ompt_callback_master     DEPRECATED_51 = 21,
242d409305fSDimitry Andric   ompt_callback_masked                   = 21,
2433c6bb671SDimitry Andric   ompt_callback_target_map               = 22,
2443c6bb671SDimitry Andric   ompt_callback_sync_region              = 23,
2453c6bb671SDimitry Andric   ompt_callback_lock_init                = 24,
2463c6bb671SDimitry Andric   ompt_callback_lock_destroy             = 25,
2473c6bb671SDimitry Andric   ompt_callback_mutex_acquire            = 26,
2483c6bb671SDimitry Andric   ompt_callback_mutex_acquired           = 27,
2493c6bb671SDimitry Andric   ompt_callback_nest_lock                = 28,
2503c6bb671SDimitry Andric   ompt_callback_flush                    = 29,
2513c6bb671SDimitry Andric   ompt_callback_cancel                   = 30,
2523c6bb671SDimitry Andric   ompt_callback_reduction                = 31,
253d409305fSDimitry Andric   ompt_callback_dispatch                 = 32,
254d409305fSDimitry Andric   ompt_callback_target_emi               = 33,
255d409305fSDimitry Andric   ompt_callback_target_data_op_emi       = 34,
256d409305fSDimitry Andric   ompt_callback_target_submit_emi        = 35,
257d409305fSDimitry Andric   ompt_callback_target_map_emi           = 36,
258d409305fSDimitry Andric   ompt_callback_error                    = 37
2593c6bb671SDimitry Andric } ompt_callbacks_t;
2603c6bb671SDimitry Andric 
2613c6bb671SDimitry Andric typedef enum ompt_record_t {
2623c6bb671SDimitry Andric   ompt_record_ompt               = 1,
2633c6bb671SDimitry Andric   ompt_record_native             = 2,
2643c6bb671SDimitry Andric   ompt_record_invalid            = 3
2653c6bb671SDimitry Andric } ompt_record_t;
2663c6bb671SDimitry Andric 
2673c6bb671SDimitry Andric typedef enum ompt_record_native_t {
2683c6bb671SDimitry Andric   ompt_record_native_info  = 1,
2693c6bb671SDimitry Andric   ompt_record_native_event = 2
2703c6bb671SDimitry Andric } ompt_record_native_t;
2713c6bb671SDimitry Andric 
2723c6bb671SDimitry Andric typedef enum ompt_set_result_t {
2733c6bb671SDimitry Andric   ompt_set_error            = 0,
2743c6bb671SDimitry Andric   ompt_set_never            = 1,
2753c6bb671SDimitry Andric   ompt_set_impossible       = 2,
2763c6bb671SDimitry Andric   ompt_set_sometimes        = 3,
2773c6bb671SDimitry Andric   ompt_set_sometimes_paired = 4,
2783c6bb671SDimitry Andric   ompt_set_always           = 5
2793c6bb671SDimitry Andric } ompt_set_result_t;
2803c6bb671SDimitry Andric 
2813c6bb671SDimitry Andric typedef uint64_t ompt_id_t;
2823c6bb671SDimitry Andric 
2833c6bb671SDimitry Andric typedef uint64_t ompt_device_time_t;
2843c6bb671SDimitry Andric 
2853c6bb671SDimitry Andric typedef uint64_t ompt_buffer_cursor_t;
2863c6bb671SDimitry Andric 
2873c6bb671SDimitry Andric typedef enum ompt_thread_t {
2883c6bb671SDimitry Andric   ompt_thread_initial                 = 1,
2893c6bb671SDimitry Andric   ompt_thread_worker                  = 2,
2903c6bb671SDimitry Andric   ompt_thread_other                   = 3,
2913c6bb671SDimitry Andric   ompt_thread_unknown                 = 4
2923c6bb671SDimitry Andric } ompt_thread_t;
2933c6bb671SDimitry Andric 
2943c6bb671SDimitry Andric typedef enum ompt_scope_endpoint_t {
2953c6bb671SDimitry Andric   ompt_scope_begin                    = 1,
296d409305fSDimitry Andric   ompt_scope_end                      = 2,
297d409305fSDimitry Andric   ompt_scope_beginend                 = 3
2983c6bb671SDimitry Andric } ompt_scope_endpoint_t;
2993c6bb671SDimitry Andric 
3003c6bb671SDimitry Andric typedef enum ompt_dispatch_t {
3013c6bb671SDimitry Andric   ompt_dispatch_iteration             = 1,
30281ad6265SDimitry Andric   ompt_dispatch_section               = 2,
30381ad6265SDimitry Andric   ompt_dispatch_ws_loop_chunk         = 3,
30481ad6265SDimitry Andric   ompt_dispatch_taskloop_chunk        = 4,
30581ad6265SDimitry Andric   ompt_dispatch_distribute_chunk      = 5
3063c6bb671SDimitry Andric } ompt_dispatch_t;
3073c6bb671SDimitry Andric 
3083c6bb671SDimitry Andric typedef enum ompt_sync_region_t {
309d409305fSDimitry Andric   ompt_sync_region_barrier                DEPRECATED_51 = 1,
310d409305fSDimitry Andric   ompt_sync_region_barrier_implicit       DEPRECATED_51 = 2,
3113c6bb671SDimitry Andric   ompt_sync_region_barrier_explicit       = 3,
3123c6bb671SDimitry Andric   ompt_sync_region_barrier_implementation = 4,
3133c6bb671SDimitry Andric   ompt_sync_region_taskwait               = 5,
3143c6bb671SDimitry Andric   ompt_sync_region_taskgroup              = 6,
315d409305fSDimitry Andric   ompt_sync_region_reduction              = 7,
316d409305fSDimitry Andric   ompt_sync_region_barrier_implicit_workshare = 8,
317d409305fSDimitry Andric   ompt_sync_region_barrier_implicit_parallel = 9,
318d409305fSDimitry Andric   ompt_sync_region_barrier_teams = 10
3193c6bb671SDimitry Andric } ompt_sync_region_t;
3203c6bb671SDimitry Andric 
3213c6bb671SDimitry Andric typedef enum ompt_target_data_op_t {
3223c6bb671SDimitry Andric   ompt_target_data_alloc                      = 1,
3233c6bb671SDimitry Andric   ompt_target_data_transfer_to_device         = 2,
3243c6bb671SDimitry Andric   ompt_target_data_transfer_from_device       = 3,
3253c6bb671SDimitry Andric   ompt_target_data_delete                     = 4,
3263c6bb671SDimitry Andric   ompt_target_data_associate                  = 5,
327d409305fSDimitry Andric   ompt_target_data_disassociate               = 6,
328d409305fSDimitry Andric   ompt_target_data_alloc_async                = 17,
329d409305fSDimitry Andric   ompt_target_data_transfer_to_device_async   = 18,
330d409305fSDimitry Andric   ompt_target_data_transfer_from_device_async = 19,
331d409305fSDimitry Andric   ompt_target_data_delete_async               = 20
3323c6bb671SDimitry Andric } ompt_target_data_op_t;
3333c6bb671SDimitry Andric 
3343c6bb671SDimitry Andric typedef enum ompt_work_t {
3353c6bb671SDimitry Andric   ompt_work_loop               = 1,
3363c6bb671SDimitry Andric   ompt_work_sections           = 2,
3373c6bb671SDimitry Andric   ompt_work_single_executor    = 3,
3383c6bb671SDimitry Andric   ompt_work_single_other       = 4,
3393c6bb671SDimitry Andric   ompt_work_workshare          = 5,
3403c6bb671SDimitry Andric   ompt_work_distribute         = 6,
341d409305fSDimitry Andric   ompt_work_taskloop           = 7,
34281ad6265SDimitry Andric   ompt_work_scope              = 8,
34381ad6265SDimitry Andric   ompt_work_loop_static        = 10,
34481ad6265SDimitry Andric   ompt_work_loop_dynamic       = 11,
34581ad6265SDimitry Andric   ompt_work_loop_guided        = 12,
34681ad6265SDimitry Andric   ompt_work_loop_other         = 13
3473c6bb671SDimitry Andric } ompt_work_t;
3483c6bb671SDimitry Andric 
3493c6bb671SDimitry Andric typedef enum ompt_mutex_t {
3503c6bb671SDimitry Andric   ompt_mutex_lock                     = 1,
3513c6bb671SDimitry Andric   ompt_mutex_test_lock                = 2,
3523c6bb671SDimitry Andric   ompt_mutex_nest_lock                = 3,
3533c6bb671SDimitry Andric   ompt_mutex_test_nest_lock           = 4,
3543c6bb671SDimitry Andric   ompt_mutex_critical                 = 5,
3553c6bb671SDimitry Andric   ompt_mutex_atomic                   = 6,
3563c6bb671SDimitry Andric   ompt_mutex_ordered                  = 7
3573c6bb671SDimitry Andric } ompt_mutex_t;
3583c6bb671SDimitry Andric 
3593c6bb671SDimitry Andric typedef enum ompt_native_mon_flag_t {
3603c6bb671SDimitry Andric   ompt_native_data_motion_explicit    = 0x01,
3613c6bb671SDimitry Andric   ompt_native_data_motion_implicit    = 0x02,
3623c6bb671SDimitry Andric   ompt_native_kernel_invocation       = 0x04,
3633c6bb671SDimitry Andric   ompt_native_kernel_execution        = 0x08,
3643c6bb671SDimitry Andric   ompt_native_driver                  = 0x10,
3653c6bb671SDimitry Andric   ompt_native_runtime                 = 0x20,
3663c6bb671SDimitry Andric   ompt_native_overhead                = 0x40,
3673c6bb671SDimitry Andric   ompt_native_idleness                = 0x80
3683c6bb671SDimitry Andric } ompt_native_mon_flag_t;
3693c6bb671SDimitry Andric 
3703c6bb671SDimitry Andric typedef enum ompt_task_flag_t {
3713c6bb671SDimitry Andric   ompt_task_initial                   = 0x00000001,
3723c6bb671SDimitry Andric   ompt_task_implicit                  = 0x00000002,
3733c6bb671SDimitry Andric   ompt_task_explicit                  = 0x00000004,
3743c6bb671SDimitry Andric   ompt_task_target                    = 0x00000008,
375d409305fSDimitry Andric   ompt_task_taskwait                  = 0x00000010,
3763c6bb671SDimitry Andric   ompt_task_undeferred                = 0x08000000,
3773c6bb671SDimitry Andric   ompt_task_untied                    = 0x10000000,
3783c6bb671SDimitry Andric   ompt_task_final                     = 0x20000000,
3793c6bb671SDimitry Andric   ompt_task_mergeable                 = 0x40000000,
3803c6bb671SDimitry Andric   ompt_task_merged                    = 0x80000000
3813c6bb671SDimitry Andric } ompt_task_flag_t;
3823c6bb671SDimitry Andric 
3833c6bb671SDimitry Andric typedef enum ompt_task_status_t {
3843c6bb671SDimitry Andric   ompt_task_complete      = 1,
3853c6bb671SDimitry Andric   ompt_task_yield         = 2,
3863c6bb671SDimitry Andric   ompt_task_cancel        = 3,
3873c6bb671SDimitry Andric   ompt_task_detach        = 4,
3883c6bb671SDimitry Andric   ompt_task_early_fulfill = 5,
3893c6bb671SDimitry Andric   ompt_task_late_fulfill  = 6,
390d409305fSDimitry Andric   ompt_task_switch        = 7,
391d409305fSDimitry Andric   ompt_taskwait_complete  = 8
3923c6bb671SDimitry Andric } ompt_task_status_t;
3933c6bb671SDimitry Andric 
3943c6bb671SDimitry Andric typedef enum ompt_target_t {
3953c6bb671SDimitry Andric   ompt_target                         = 1,
3963c6bb671SDimitry Andric   ompt_target_enter_data              = 2,
3973c6bb671SDimitry Andric   ompt_target_exit_data               = 3,
398d409305fSDimitry Andric   ompt_target_update                  = 4,
399d409305fSDimitry Andric   ompt_target_nowait                  = 9,
400d409305fSDimitry Andric   ompt_target_enter_data_nowait       = 10,
401d409305fSDimitry Andric   ompt_target_exit_data_nowait        = 11,
402d409305fSDimitry Andric   ompt_target_update_nowait           = 12
4033c6bb671SDimitry Andric } ompt_target_t;
4043c6bb671SDimitry Andric 
4053c6bb671SDimitry Andric typedef enum ompt_parallel_flag_t {
4063c6bb671SDimitry Andric   ompt_parallel_invoker_program = 0x00000001,
4073c6bb671SDimitry Andric   ompt_parallel_invoker_runtime = 0x00000002,
4083c6bb671SDimitry Andric   ompt_parallel_league          = 0x40000000,
4093c6bb671SDimitry Andric   ompt_parallel_team            = 0x80000000
4103c6bb671SDimitry Andric } ompt_parallel_flag_t;
4113c6bb671SDimitry Andric 
4123c6bb671SDimitry Andric typedef enum ompt_target_map_flag_t {
4133c6bb671SDimitry Andric   ompt_target_map_flag_to             = 0x01,
4143c6bb671SDimitry Andric   ompt_target_map_flag_from           = 0x02,
4153c6bb671SDimitry Andric   ompt_target_map_flag_alloc          = 0x04,
4163c6bb671SDimitry Andric   ompt_target_map_flag_release        = 0x08,
4173c6bb671SDimitry Andric   ompt_target_map_flag_delete         = 0x10,
4183c6bb671SDimitry Andric   ompt_target_map_flag_implicit       = 0x20
4193c6bb671SDimitry Andric } ompt_target_map_flag_t;
4203c6bb671SDimitry Andric 
4213c6bb671SDimitry Andric typedef enum ompt_dependence_type_t {
4223c6bb671SDimitry Andric   ompt_dependence_type_in               = 1,
4233c6bb671SDimitry Andric   ompt_dependence_type_out              = 2,
4243c6bb671SDimitry Andric   ompt_dependence_type_inout            = 3,
4253c6bb671SDimitry Andric   ompt_dependence_type_mutexinoutset    = 4,
4263c6bb671SDimitry Andric   ompt_dependence_type_source           = 5,
427d409305fSDimitry Andric   ompt_dependence_type_sink             = 6,
42806c3fb27SDimitry Andric   ompt_dependence_type_inoutset         = 7,
42906c3fb27SDimitry Andric   ompt_dependence_type_out_all_memory   = 34,
43006c3fb27SDimitry Andric   ompt_dependence_type_inout_all_memory = 35
4313c6bb671SDimitry Andric } ompt_dependence_type_t;
4323c6bb671SDimitry Andric 
433d409305fSDimitry Andric typedef enum ompt_severity_t {
434d409305fSDimitry Andric   ompt_warning                         = 1,
435d409305fSDimitry Andric   ompt_fatal                           = 2
436d409305fSDimitry Andric } ompt_severity_t;
437d409305fSDimitry Andric 
4383c6bb671SDimitry Andric typedef enum ompt_cancel_flag_t {
4393c6bb671SDimitry Andric   ompt_cancel_parallel       = 0x01,
4403c6bb671SDimitry Andric   ompt_cancel_sections       = 0x02,
4413c6bb671SDimitry Andric   ompt_cancel_loop           = 0x04,
4423c6bb671SDimitry Andric   ompt_cancel_taskgroup      = 0x08,
4433c6bb671SDimitry Andric   ompt_cancel_activated      = 0x10,
4443c6bb671SDimitry Andric   ompt_cancel_detected       = 0x20,
4453c6bb671SDimitry Andric   ompt_cancel_discarded_task = 0x40
4463c6bb671SDimitry Andric } ompt_cancel_flag_t;
4473c6bb671SDimitry Andric 
4483c6bb671SDimitry Andric typedef uint64_t ompt_hwid_t;
4493c6bb671SDimitry Andric 
4503c6bb671SDimitry Andric typedef uint64_t ompt_wait_id_t;
4513c6bb671SDimitry Andric 
4523c6bb671SDimitry Andric typedef enum ompt_frame_flag_t {
4533c6bb671SDimitry Andric   ompt_frame_runtime        = 0x00,
4543c6bb671SDimitry Andric   ompt_frame_application    = 0x01,
4553c6bb671SDimitry Andric   ompt_frame_cfa            = 0x10,
4563c6bb671SDimitry Andric   ompt_frame_framepointer   = 0x20,
4573c6bb671SDimitry Andric   ompt_frame_stackaddress   = 0x30
4583c6bb671SDimitry Andric } ompt_frame_flag_t;
4593c6bb671SDimitry Andric 
4603c6bb671SDimitry Andric typedef enum ompt_state_t {
4613c6bb671SDimitry Andric   ompt_state_work_serial                      = 0x000,
4623c6bb671SDimitry Andric   ompt_state_work_parallel                    = 0x001,
4633c6bb671SDimitry Andric   ompt_state_work_reduction                   = 0x002,
4643c6bb671SDimitry Andric 
465d409305fSDimitry Andric   ompt_state_wait_barrier                     DEPRECATED_51 = 0x010,
4663c6bb671SDimitry Andric   ompt_state_wait_barrier_implicit_parallel   = 0x011,
4673c6bb671SDimitry Andric   ompt_state_wait_barrier_implicit_workshare  = 0x012,
468d409305fSDimitry Andric   ompt_state_wait_barrier_implicit            DEPRECATED_51 = 0x013,
4693c6bb671SDimitry Andric   ompt_state_wait_barrier_explicit            = 0x014,
470d409305fSDimitry Andric   ompt_state_wait_barrier_implementation      = 0x015,
471d409305fSDimitry Andric   ompt_state_wait_barrier_teams               = 0x016,
4723c6bb671SDimitry Andric 
4733c6bb671SDimitry Andric   ompt_state_wait_taskwait                    = 0x020,
4743c6bb671SDimitry Andric   ompt_state_wait_taskgroup                   = 0x021,
4753c6bb671SDimitry Andric 
4763c6bb671SDimitry Andric   ompt_state_wait_mutex                       = 0x040,
4773c6bb671SDimitry Andric   ompt_state_wait_lock                        = 0x041,
4783c6bb671SDimitry Andric   ompt_state_wait_critical                    = 0x042,
4793c6bb671SDimitry Andric   ompt_state_wait_atomic                      = 0x043,
4803c6bb671SDimitry Andric   ompt_state_wait_ordered                     = 0x044,
4813c6bb671SDimitry Andric 
4823c6bb671SDimitry Andric   ompt_state_wait_target                      = 0x080,
4833c6bb671SDimitry Andric   ompt_state_wait_target_map                  = 0x081,
4843c6bb671SDimitry Andric   ompt_state_wait_target_update               = 0x082,
4853c6bb671SDimitry Andric 
4863c6bb671SDimitry Andric   ompt_state_idle                             = 0x100,
4873c6bb671SDimitry Andric   ompt_state_overhead                         = 0x101,
4883c6bb671SDimitry Andric   ompt_state_undefined                        = 0x102
4893c6bb671SDimitry Andric } ompt_state_t;
4903c6bb671SDimitry Andric 
4913c6bb671SDimitry Andric typedef uint64_t (*ompt_get_unique_id_t) (void);
4923c6bb671SDimitry Andric 
4933c6bb671SDimitry Andric typedef uint64_t ompd_size_t;
4943c6bb671SDimitry Andric 
4953c6bb671SDimitry Andric typedef uint64_t ompd_wait_id_t;
4963c6bb671SDimitry Andric 
4973c6bb671SDimitry Andric typedef uint64_t ompd_addr_t;
4983c6bb671SDimitry Andric typedef int64_t  ompd_word_t;
4993c6bb671SDimitry Andric typedef uint64_t ompd_seg_t;
5003c6bb671SDimitry Andric 
5013c6bb671SDimitry Andric typedef uint64_t ompd_device_t;
5023c6bb671SDimitry Andric 
5033c6bb671SDimitry Andric typedef uint64_t ompd_thread_id_t;
5043c6bb671SDimitry Andric 
5053c6bb671SDimitry Andric typedef enum ompd_scope_t {
5063c6bb671SDimitry Andric   ompd_scope_global = 1,
5073c6bb671SDimitry Andric   ompd_scope_address_space = 2,
5083c6bb671SDimitry Andric   ompd_scope_thread = 3,
5093c6bb671SDimitry Andric   ompd_scope_parallel = 4,
5103c6bb671SDimitry Andric   ompd_scope_implicit_task = 5,
5113c6bb671SDimitry Andric   ompd_scope_task = 6
5123c6bb671SDimitry Andric } ompd_scope_t;
5133c6bb671SDimitry Andric 
5143c6bb671SDimitry Andric typedef uint64_t ompd_icv_id_t;
5153c6bb671SDimitry Andric 
5163c6bb671SDimitry Andric typedef enum ompd_rc_t {
5173c6bb671SDimitry Andric   ompd_rc_ok = 0,
5183c6bb671SDimitry Andric   ompd_rc_unavailable = 1,
5193c6bb671SDimitry Andric   ompd_rc_stale_handle = 2,
5203c6bb671SDimitry Andric   ompd_rc_bad_input = 3,
5213c6bb671SDimitry Andric   ompd_rc_error = 4,
5223c6bb671SDimitry Andric   ompd_rc_unsupported = 5,
5233c6bb671SDimitry Andric   ompd_rc_needs_state_tracking = 6,
5243c6bb671SDimitry Andric   ompd_rc_incompatible = 7,
5253c6bb671SDimitry Andric   ompd_rc_device_read_error = 8,
5263c6bb671SDimitry Andric   ompd_rc_device_write_error = 9,
5273c6bb671SDimitry Andric   ompd_rc_nomem = 10,
5286e75b2fbSDimitry Andric   ompd_rc_incomplete = 11,
5296e75b2fbSDimitry Andric   ompd_rc_callback_error = 12
5303c6bb671SDimitry Andric } ompd_rc_t;
5313c6bb671SDimitry Andric 
5323c6bb671SDimitry Andric typedef void (*ompt_interface_fn_t) (void);
5333c6bb671SDimitry Andric 
5343c6bb671SDimitry Andric typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
5353c6bb671SDimitry Andric   const char *interface_function_name
5363c6bb671SDimitry Andric );
5373c6bb671SDimitry Andric 
5383c6bb671SDimitry Andric typedef union ompt_data_t {
5393c6bb671SDimitry Andric   uint64_t value;
5403c6bb671SDimitry Andric   void *ptr;
5413c6bb671SDimitry Andric } ompt_data_t;
5423c6bb671SDimitry Andric 
5433c6bb671SDimitry Andric typedef struct ompt_frame_t {
5443c6bb671SDimitry Andric   ompt_data_t exit_frame;
5453c6bb671SDimitry Andric   ompt_data_t enter_frame;
5463c6bb671SDimitry Andric   int exit_frame_flags;
5473c6bb671SDimitry Andric   int enter_frame_flags;
5483c6bb671SDimitry Andric } ompt_frame_t;
5493c6bb671SDimitry Andric 
5503c6bb671SDimitry Andric typedef void (*ompt_callback_t) (void);
5513c6bb671SDimitry Andric 
5523c6bb671SDimitry Andric typedef void ompt_device_t;
5533c6bb671SDimitry Andric 
5543c6bb671SDimitry Andric typedef void ompt_buffer_t;
5553c6bb671SDimitry Andric 
5563c6bb671SDimitry Andric typedef void (*ompt_callback_buffer_request_t) (
5573c6bb671SDimitry Andric   int device_num,
5583c6bb671SDimitry Andric   ompt_buffer_t **buffer,
5593c6bb671SDimitry Andric   size_t *bytes
5603c6bb671SDimitry Andric );
5613c6bb671SDimitry Andric 
5623c6bb671SDimitry Andric typedef void (*ompt_callback_buffer_complete_t) (
5633c6bb671SDimitry Andric   int device_num,
5643c6bb671SDimitry Andric   ompt_buffer_t *buffer,
5653c6bb671SDimitry Andric   size_t bytes,
5663c6bb671SDimitry Andric   ompt_buffer_cursor_t begin,
5673c6bb671SDimitry Andric   int buffer_owned
5683c6bb671SDimitry Andric );
5693c6bb671SDimitry Andric 
5703c6bb671SDimitry Andric typedef void (*ompt_finalize_t) (
5713c6bb671SDimitry Andric   ompt_data_t *tool_data
5723c6bb671SDimitry Andric );
5733c6bb671SDimitry Andric 
5743c6bb671SDimitry Andric typedef int (*ompt_initialize_t) (
5753c6bb671SDimitry Andric   ompt_function_lookup_t lookup,
5763c6bb671SDimitry Andric   int initial_device_num,
5773c6bb671SDimitry Andric   ompt_data_t *tool_data
5783c6bb671SDimitry Andric );
5793c6bb671SDimitry Andric 
5803c6bb671SDimitry Andric typedef struct ompt_start_tool_result_t {
5813c6bb671SDimitry Andric   ompt_initialize_t initialize;
5823c6bb671SDimitry Andric   ompt_finalize_t finalize;
5833c6bb671SDimitry Andric   ompt_data_t tool_data;
5843c6bb671SDimitry Andric } ompt_start_tool_result_t;
5853c6bb671SDimitry Andric 
5863c6bb671SDimitry Andric typedef struct ompt_record_abstract_t {
5873c6bb671SDimitry Andric   ompt_record_native_t rclass;
5883c6bb671SDimitry Andric   const char *type;
5893c6bb671SDimitry Andric   ompt_device_time_t start_time;
5903c6bb671SDimitry Andric   ompt_device_time_t end_time;
5913c6bb671SDimitry Andric   ompt_hwid_t hwid;
5923c6bb671SDimitry Andric } ompt_record_abstract_t;
5933c6bb671SDimitry Andric 
5943c6bb671SDimitry Andric typedef struct ompt_dependence_t {
5953c6bb671SDimitry Andric   ompt_data_t variable;
5963c6bb671SDimitry Andric   ompt_dependence_type_t dependence_type;
5973c6bb671SDimitry Andric } ompt_dependence_t;
5983c6bb671SDimitry Andric 
59981ad6265SDimitry Andric typedef struct ompt_dispatch_chunk_t {
60081ad6265SDimitry Andric   uint64_t start;
60181ad6265SDimitry Andric   uint64_t iterations;
60281ad6265SDimitry Andric } ompt_dispatch_chunk_t;
60381ad6265SDimitry Andric 
6043c6bb671SDimitry Andric typedef int (*ompt_enumerate_states_t) (
6053c6bb671SDimitry Andric   int current_state,
6063c6bb671SDimitry Andric   int *next_state,
6073c6bb671SDimitry Andric   const char **next_state_name
6083c6bb671SDimitry Andric );
6093c6bb671SDimitry Andric 
6103c6bb671SDimitry Andric typedef int (*ompt_enumerate_mutex_impls_t) (
6113c6bb671SDimitry Andric   int current_impl,
6123c6bb671SDimitry Andric   int *next_impl,
6133c6bb671SDimitry Andric   const char **next_impl_name
6143c6bb671SDimitry Andric );
6153c6bb671SDimitry Andric 
6163c6bb671SDimitry Andric typedef ompt_set_result_t (*ompt_set_callback_t) (
6173c6bb671SDimitry Andric   ompt_callbacks_t event,
6183c6bb671SDimitry Andric   ompt_callback_t callback
6193c6bb671SDimitry Andric );
6203c6bb671SDimitry Andric 
6213c6bb671SDimitry Andric typedef int (*ompt_get_callback_t) (
6223c6bb671SDimitry Andric   ompt_callbacks_t event,
6233c6bb671SDimitry Andric   ompt_callback_t *callback
6243c6bb671SDimitry Andric );
6253c6bb671SDimitry Andric 
6263c6bb671SDimitry Andric typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
6273c6bb671SDimitry Andric 
6283c6bb671SDimitry Andric typedef int (*ompt_get_num_procs_t) (void);
6293c6bb671SDimitry Andric 
6303c6bb671SDimitry Andric typedef int (*ompt_get_num_places_t) (void);
6313c6bb671SDimitry Andric 
6323c6bb671SDimitry Andric typedef int (*ompt_get_place_proc_ids_t) (
6333c6bb671SDimitry Andric   int place_num,
6343c6bb671SDimitry Andric   int ids_size,
6353c6bb671SDimitry Andric   int *ids
6363c6bb671SDimitry Andric );
6373c6bb671SDimitry Andric 
6383c6bb671SDimitry Andric typedef int (*ompt_get_place_num_t) (void);
6393c6bb671SDimitry Andric 
6403c6bb671SDimitry Andric typedef int (*ompt_get_partition_place_nums_t) (
6413c6bb671SDimitry Andric   int place_nums_size,
6423c6bb671SDimitry Andric   int *place_nums
6433c6bb671SDimitry Andric );
6443c6bb671SDimitry Andric 
6453c6bb671SDimitry Andric typedef int (*ompt_get_proc_id_t) (void);
6463c6bb671SDimitry Andric 
6473c6bb671SDimitry Andric typedef int (*ompt_get_state_t) (
6483c6bb671SDimitry Andric   ompt_wait_id_t *wait_id
6493c6bb671SDimitry Andric );
6503c6bb671SDimitry Andric 
6513c6bb671SDimitry Andric typedef int (*ompt_get_parallel_info_t) (
6523c6bb671SDimitry Andric   int ancestor_level,
6533c6bb671SDimitry Andric   ompt_data_t **parallel_data,
6543c6bb671SDimitry Andric   int *team_size
6553c6bb671SDimitry Andric );
6563c6bb671SDimitry Andric 
6573c6bb671SDimitry Andric typedef int (*ompt_get_task_info_t) (
6583c6bb671SDimitry Andric   int ancestor_level,
6593c6bb671SDimitry Andric   int *flags,
6603c6bb671SDimitry Andric   ompt_data_t **task_data,
6613c6bb671SDimitry Andric   ompt_frame_t **task_frame,
6623c6bb671SDimitry Andric   ompt_data_t **parallel_data,
6633c6bb671SDimitry Andric   int *thread_num
6643c6bb671SDimitry Andric );
6653c6bb671SDimitry Andric 
6663c6bb671SDimitry Andric typedef int (*ompt_get_task_memory_t)(
6673c6bb671SDimitry Andric   void **addr,
6683c6bb671SDimitry Andric   size_t *size,
6693c6bb671SDimitry Andric   int block
6703c6bb671SDimitry Andric );
6713c6bb671SDimitry Andric 
6723c6bb671SDimitry Andric typedef int (*ompt_get_target_info_t) (
6733c6bb671SDimitry Andric   uint64_t *device_num,
6743c6bb671SDimitry Andric   ompt_id_t *target_id,
6753c6bb671SDimitry Andric   ompt_id_t *host_op_id
6763c6bb671SDimitry Andric );
6773c6bb671SDimitry Andric 
6783c6bb671SDimitry Andric typedef int (*ompt_get_num_devices_t) (void);
6793c6bb671SDimitry Andric 
6803c6bb671SDimitry Andric typedef void (*ompt_finalize_tool_t) (void);
6813c6bb671SDimitry Andric 
6823c6bb671SDimitry Andric typedef int (*ompt_get_device_num_procs_t) (
6833c6bb671SDimitry Andric   ompt_device_t *device
6843c6bb671SDimitry Andric );
6853c6bb671SDimitry Andric 
6863c6bb671SDimitry Andric typedef ompt_device_time_t (*ompt_get_device_time_t) (
6873c6bb671SDimitry Andric   ompt_device_t *device
6883c6bb671SDimitry Andric );
6893c6bb671SDimitry Andric 
6903c6bb671SDimitry Andric typedef double (*ompt_translate_time_t) (
6913c6bb671SDimitry Andric   ompt_device_t *device,
6923c6bb671SDimitry Andric   ompt_device_time_t time
6933c6bb671SDimitry Andric );
6943c6bb671SDimitry Andric 
6953c6bb671SDimitry Andric typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
6963c6bb671SDimitry Andric   ompt_device_t *device,
6973c6bb671SDimitry Andric   unsigned int enable,
6983c6bb671SDimitry Andric   unsigned int etype
6993c6bb671SDimitry Andric );
7003c6bb671SDimitry Andric 
7013c6bb671SDimitry Andric typedef ompt_set_result_t (*ompt_set_trace_native_t) (
7023c6bb671SDimitry Andric   ompt_device_t *device,
7033c6bb671SDimitry Andric   int enable,
7043c6bb671SDimitry Andric   int flags
7053c6bb671SDimitry Andric );
7063c6bb671SDimitry Andric 
7073c6bb671SDimitry Andric typedef int (*ompt_start_trace_t) (
7083c6bb671SDimitry Andric   ompt_device_t *device,
7093c6bb671SDimitry Andric   ompt_callback_buffer_request_t request,
7103c6bb671SDimitry Andric   ompt_callback_buffer_complete_t complete
7113c6bb671SDimitry Andric );
7123c6bb671SDimitry Andric 
7133c6bb671SDimitry Andric typedef int (*ompt_pause_trace_t) (
7143c6bb671SDimitry Andric   ompt_device_t *device,
7153c6bb671SDimitry Andric   int begin_pause
7163c6bb671SDimitry Andric );
7173c6bb671SDimitry Andric 
7183c6bb671SDimitry Andric typedef int (*ompt_flush_trace_t) (
7193c6bb671SDimitry Andric   ompt_device_t *device
7203c6bb671SDimitry Andric );
7213c6bb671SDimitry Andric 
7223c6bb671SDimitry Andric typedef int (*ompt_stop_trace_t) (
7233c6bb671SDimitry Andric   ompt_device_t *device
7243c6bb671SDimitry Andric );
7253c6bb671SDimitry Andric 
7263c6bb671SDimitry Andric typedef int (*ompt_advance_buffer_cursor_t) (
7273c6bb671SDimitry Andric   ompt_device_t *device,
7283c6bb671SDimitry Andric   ompt_buffer_t *buffer,
7293c6bb671SDimitry Andric   size_t size,
7303c6bb671SDimitry Andric   ompt_buffer_cursor_t current,
7313c6bb671SDimitry Andric   ompt_buffer_cursor_t *next
7323c6bb671SDimitry Andric );
7333c6bb671SDimitry Andric 
7343c6bb671SDimitry Andric typedef ompt_record_t (*ompt_get_record_type_t) (
7353c6bb671SDimitry Andric   ompt_buffer_t *buffer,
7363c6bb671SDimitry Andric   ompt_buffer_cursor_t current
7373c6bb671SDimitry Andric );
7383c6bb671SDimitry Andric 
7393c6bb671SDimitry Andric typedef void *(*ompt_get_record_native_t) (
7403c6bb671SDimitry Andric   ompt_buffer_t *buffer,
7413c6bb671SDimitry Andric   ompt_buffer_cursor_t current,
7423c6bb671SDimitry Andric   ompt_id_t *host_op_id
7433c6bb671SDimitry Andric );
7443c6bb671SDimitry Andric 
7453c6bb671SDimitry Andric typedef ompt_record_abstract_t *
7463c6bb671SDimitry Andric (*ompt_get_record_abstract_t) (
7473c6bb671SDimitry Andric   void *native_record
7483c6bb671SDimitry Andric );
7493c6bb671SDimitry Andric 
7503c6bb671SDimitry Andric typedef void (*ompt_callback_thread_begin_t) (
7513c6bb671SDimitry Andric   ompt_thread_t thread_type,
7523c6bb671SDimitry Andric   ompt_data_t *thread_data
7533c6bb671SDimitry Andric );
7543c6bb671SDimitry Andric 
7553c6bb671SDimitry Andric typedef struct ompt_record_thread_begin_t {
7563c6bb671SDimitry Andric   ompt_thread_t thread_type;
7573c6bb671SDimitry Andric } ompt_record_thread_begin_t;
7583c6bb671SDimitry Andric 
7593c6bb671SDimitry Andric typedef void (*ompt_callback_thread_end_t) (
7603c6bb671SDimitry Andric   ompt_data_t *thread_data
7613c6bb671SDimitry Andric );
7623c6bb671SDimitry Andric 
7633c6bb671SDimitry Andric typedef void (*ompt_callback_parallel_begin_t) (
7643c6bb671SDimitry Andric   ompt_data_t *encountering_task_data,
7653c6bb671SDimitry Andric   const ompt_frame_t *encountering_task_frame,
7663c6bb671SDimitry Andric   ompt_data_t *parallel_data,
7673c6bb671SDimitry Andric   unsigned int requested_parallelism,
7683c6bb671SDimitry Andric   int flags,
7693c6bb671SDimitry Andric   const void *codeptr_ra
7703c6bb671SDimitry Andric );
7713c6bb671SDimitry Andric 
7723c6bb671SDimitry Andric typedef struct ompt_record_parallel_begin_t {
7733c6bb671SDimitry Andric   ompt_id_t encountering_task_id;
7743c6bb671SDimitry Andric   ompt_id_t parallel_id;
7753c6bb671SDimitry Andric   unsigned int requested_parallelism;
7763c6bb671SDimitry Andric   int flags;
7773c6bb671SDimitry Andric   const void *codeptr_ra;
7783c6bb671SDimitry Andric } ompt_record_parallel_begin_t;
7793c6bb671SDimitry Andric 
7803c6bb671SDimitry Andric typedef void (*ompt_callback_parallel_end_t) (
7813c6bb671SDimitry Andric   ompt_data_t *parallel_data,
7823c6bb671SDimitry Andric   ompt_data_t *encountering_task_data,
7833c6bb671SDimitry Andric   int flags,
7843c6bb671SDimitry Andric   const void *codeptr_ra
7853c6bb671SDimitry Andric );
7863c6bb671SDimitry Andric 
7873c6bb671SDimitry Andric typedef struct ompt_record_parallel_end_t {
7883c6bb671SDimitry Andric   ompt_id_t parallel_id;
7893c6bb671SDimitry Andric   ompt_id_t encountering_task_id;
7903c6bb671SDimitry Andric   int flags;
7913c6bb671SDimitry Andric   const void *codeptr_ra;
7923c6bb671SDimitry Andric } ompt_record_parallel_end_t;
7933c6bb671SDimitry Andric 
7943c6bb671SDimitry Andric typedef void (*ompt_callback_work_t) (
79581ad6265SDimitry Andric   ompt_work_t work_type,
7963c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
7973c6bb671SDimitry Andric   ompt_data_t *parallel_data,
7983c6bb671SDimitry Andric   ompt_data_t *task_data,
7993c6bb671SDimitry Andric   uint64_t count,
8003c6bb671SDimitry Andric   const void *codeptr_ra
8013c6bb671SDimitry Andric );
8023c6bb671SDimitry Andric 
8033c6bb671SDimitry Andric typedef struct ompt_record_work_t {
80481ad6265SDimitry Andric   ompt_work_t work_type;
8053c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
8063c6bb671SDimitry Andric   ompt_id_t parallel_id;
8073c6bb671SDimitry Andric   ompt_id_t task_id;
8083c6bb671SDimitry Andric   uint64_t count;
8093c6bb671SDimitry Andric   const void *codeptr_ra;
8103c6bb671SDimitry Andric } ompt_record_work_t;
8113c6bb671SDimitry Andric 
8123c6bb671SDimitry Andric typedef void (*ompt_callback_dispatch_t) (
8133c6bb671SDimitry Andric   ompt_data_t *parallel_data,
8143c6bb671SDimitry Andric   ompt_data_t *task_data,
8153c6bb671SDimitry Andric   ompt_dispatch_t kind,
8163c6bb671SDimitry Andric   ompt_data_t instance
8173c6bb671SDimitry Andric );
8183c6bb671SDimitry Andric 
8193c6bb671SDimitry Andric typedef struct ompt_record_dispatch_t {
8203c6bb671SDimitry Andric   ompt_id_t parallel_id;
8213c6bb671SDimitry Andric   ompt_id_t task_id;
8223c6bb671SDimitry Andric   ompt_dispatch_t kind;
8233c6bb671SDimitry Andric   ompt_data_t instance;
8243c6bb671SDimitry Andric } ompt_record_dispatch_t;
8253c6bb671SDimitry Andric 
8263c6bb671SDimitry Andric typedef void (*ompt_callback_task_create_t) (
8273c6bb671SDimitry Andric   ompt_data_t *encountering_task_data,
8283c6bb671SDimitry Andric   const ompt_frame_t *encountering_task_frame,
8293c6bb671SDimitry Andric   ompt_data_t *new_task_data,
8303c6bb671SDimitry Andric   int flags,
8313c6bb671SDimitry Andric   int has_dependences,
8323c6bb671SDimitry Andric   const void *codeptr_ra
8333c6bb671SDimitry Andric );
8343c6bb671SDimitry Andric 
8353c6bb671SDimitry Andric typedef struct ompt_record_task_create_t {
8363c6bb671SDimitry Andric   ompt_id_t encountering_task_id;
8373c6bb671SDimitry Andric   ompt_id_t new_task_id;
8383c6bb671SDimitry Andric   int flags;
8393c6bb671SDimitry Andric   int has_dependences;
8403c6bb671SDimitry Andric   const void *codeptr_ra;
8413c6bb671SDimitry Andric } ompt_record_task_create_t;
8423c6bb671SDimitry Andric 
8433c6bb671SDimitry Andric typedef void (*ompt_callback_dependences_t) (
8443c6bb671SDimitry Andric   ompt_data_t *task_data,
8453c6bb671SDimitry Andric   const ompt_dependence_t *deps,
8463c6bb671SDimitry Andric   int ndeps
8473c6bb671SDimitry Andric );
8483c6bb671SDimitry Andric 
8493c6bb671SDimitry Andric typedef struct ompt_record_dependences_t {
8503c6bb671SDimitry Andric   ompt_id_t task_id;
8513c6bb671SDimitry Andric   ompt_dependence_t dep;
8523c6bb671SDimitry Andric   int ndeps;
8533c6bb671SDimitry Andric } ompt_record_dependences_t;
8543c6bb671SDimitry Andric 
8553c6bb671SDimitry Andric typedef void (*ompt_callback_task_dependence_t) (
8563c6bb671SDimitry Andric   ompt_data_t *src_task_data,
8573c6bb671SDimitry Andric   ompt_data_t *sink_task_data
8583c6bb671SDimitry Andric );
8593c6bb671SDimitry Andric 
8603c6bb671SDimitry Andric typedef struct ompt_record_task_dependence_t {
8613c6bb671SDimitry Andric   ompt_id_t src_task_id;
8623c6bb671SDimitry Andric   ompt_id_t sink_task_id;
8633c6bb671SDimitry Andric } ompt_record_task_dependence_t;
8643c6bb671SDimitry Andric 
8653c6bb671SDimitry Andric typedef void (*ompt_callback_task_schedule_t) (
8663c6bb671SDimitry Andric   ompt_data_t *prior_task_data,
8673c6bb671SDimitry Andric   ompt_task_status_t prior_task_status,
8683c6bb671SDimitry Andric   ompt_data_t *next_task_data
8693c6bb671SDimitry Andric );
8703c6bb671SDimitry Andric 
8713c6bb671SDimitry Andric typedef struct ompt_record_task_schedule_t {
8723c6bb671SDimitry Andric   ompt_id_t prior_task_id;
8733c6bb671SDimitry Andric   ompt_task_status_t prior_task_status;
8743c6bb671SDimitry Andric   ompt_id_t next_task_id;
8753c6bb671SDimitry Andric } ompt_record_task_schedule_t;
8763c6bb671SDimitry Andric 
8773c6bb671SDimitry Andric typedef void (*ompt_callback_implicit_task_t) (
8783c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
8793c6bb671SDimitry Andric   ompt_data_t *parallel_data,
8803c6bb671SDimitry Andric   ompt_data_t *task_data,
8813c6bb671SDimitry Andric   unsigned int actual_parallelism,
8823c6bb671SDimitry Andric   unsigned int index,
8833c6bb671SDimitry Andric   int flags
8843c6bb671SDimitry Andric );
8853c6bb671SDimitry Andric 
8863c6bb671SDimitry Andric typedef struct ompt_record_implicit_task_t {
8873c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
8883c6bb671SDimitry Andric   ompt_id_t parallel_id;
8893c6bb671SDimitry Andric   ompt_id_t task_id;
8903c6bb671SDimitry Andric   unsigned int actual_parallelism;
8913c6bb671SDimitry Andric   unsigned int index;
8923c6bb671SDimitry Andric   int flags;
8933c6bb671SDimitry Andric } ompt_record_implicit_task_t;
8943c6bb671SDimitry Andric 
895d409305fSDimitry Andric typedef void (*ompt_callback_masked_t) (
8963c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
8973c6bb671SDimitry Andric   ompt_data_t *parallel_data,
8983c6bb671SDimitry Andric   ompt_data_t *task_data,
8993c6bb671SDimitry Andric   const void *codeptr_ra
9003c6bb671SDimitry Andric );
9013c6bb671SDimitry Andric 
902d409305fSDimitry Andric typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51;
903d409305fSDimitry Andric 
904d409305fSDimitry Andric typedef struct ompt_record_masked_t {
9053c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
9063c6bb671SDimitry Andric   ompt_id_t parallel_id;
9073c6bb671SDimitry Andric   ompt_id_t task_id;
9083c6bb671SDimitry Andric   const void *codeptr_ra;
909d409305fSDimitry Andric } ompt_record_masked_t;
9103c6bb671SDimitry Andric 
9113c6bb671SDimitry Andric typedef void (*ompt_callback_sync_region_t) (
9123c6bb671SDimitry Andric   ompt_sync_region_t kind,
9133c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
9143c6bb671SDimitry Andric   ompt_data_t *parallel_data,
9153c6bb671SDimitry Andric   ompt_data_t *task_data,
9163c6bb671SDimitry Andric   const void *codeptr_ra
9173c6bb671SDimitry Andric );
9183c6bb671SDimitry Andric 
9193c6bb671SDimitry Andric typedef struct ompt_record_sync_region_t {
9203c6bb671SDimitry Andric   ompt_sync_region_t kind;
9213c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
9223c6bb671SDimitry Andric   ompt_id_t parallel_id;
9233c6bb671SDimitry Andric   ompt_id_t task_id;
9243c6bb671SDimitry Andric   const void *codeptr_ra;
9253c6bb671SDimitry Andric } ompt_record_sync_region_t;
9263c6bb671SDimitry Andric 
9273c6bb671SDimitry Andric typedef void (*ompt_callback_mutex_acquire_t) (
9283c6bb671SDimitry Andric   ompt_mutex_t kind,
9293c6bb671SDimitry Andric   unsigned int hint,
9303c6bb671SDimitry Andric   unsigned int impl,
9313c6bb671SDimitry Andric   ompt_wait_id_t wait_id,
9323c6bb671SDimitry Andric   const void *codeptr_ra
9333c6bb671SDimitry Andric );
9343c6bb671SDimitry Andric 
9353c6bb671SDimitry Andric typedef struct ompt_record_mutex_acquire_t {
9363c6bb671SDimitry Andric   ompt_mutex_t kind;
9373c6bb671SDimitry Andric   unsigned int hint;
9383c6bb671SDimitry Andric   unsigned int impl;
9393c6bb671SDimitry Andric   ompt_wait_id_t wait_id;
9403c6bb671SDimitry Andric   const void *codeptr_ra;
9413c6bb671SDimitry Andric } ompt_record_mutex_acquire_t;
9423c6bb671SDimitry Andric 
9433c6bb671SDimitry Andric typedef void (*ompt_callback_mutex_t) (
9443c6bb671SDimitry Andric   ompt_mutex_t kind,
9453c6bb671SDimitry Andric   ompt_wait_id_t wait_id,
9463c6bb671SDimitry Andric   const void *codeptr_ra
9473c6bb671SDimitry Andric );
9483c6bb671SDimitry Andric 
9493c6bb671SDimitry Andric typedef struct ompt_record_mutex_t {
9503c6bb671SDimitry Andric   ompt_mutex_t kind;
9513c6bb671SDimitry Andric   ompt_wait_id_t wait_id;
9523c6bb671SDimitry Andric   const void *codeptr_ra;
9533c6bb671SDimitry Andric } ompt_record_mutex_t;
9543c6bb671SDimitry Andric 
9553c6bb671SDimitry Andric typedef void (*ompt_callback_nest_lock_t) (
9563c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
9573c6bb671SDimitry Andric   ompt_wait_id_t wait_id,
9583c6bb671SDimitry Andric   const void *codeptr_ra
9593c6bb671SDimitry Andric );
9603c6bb671SDimitry Andric 
9613c6bb671SDimitry Andric typedef struct ompt_record_nest_lock_t {
9623c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
9633c6bb671SDimitry Andric   ompt_wait_id_t wait_id;
9643c6bb671SDimitry Andric   const void *codeptr_ra;
9653c6bb671SDimitry Andric } ompt_record_nest_lock_t;
9663c6bb671SDimitry Andric 
9673c6bb671SDimitry Andric typedef void (*ompt_callback_flush_t) (
9683c6bb671SDimitry Andric   ompt_data_t *thread_data,
9693c6bb671SDimitry Andric   const void *codeptr_ra
9703c6bb671SDimitry Andric );
9713c6bb671SDimitry Andric 
9723c6bb671SDimitry Andric typedef struct ompt_record_flush_t {
9733c6bb671SDimitry Andric   const void *codeptr_ra;
9743c6bb671SDimitry Andric } ompt_record_flush_t;
9753c6bb671SDimitry Andric 
9763c6bb671SDimitry Andric typedef void (*ompt_callback_cancel_t) (
9773c6bb671SDimitry Andric   ompt_data_t *task_data,
9783c6bb671SDimitry Andric   int flags,
9793c6bb671SDimitry Andric   const void *codeptr_ra
9803c6bb671SDimitry Andric );
9813c6bb671SDimitry Andric 
9823c6bb671SDimitry Andric typedef struct ompt_record_cancel_t {
9833c6bb671SDimitry Andric   ompt_id_t task_id;
9843c6bb671SDimitry Andric   int flags;
9853c6bb671SDimitry Andric   const void *codeptr_ra;
9863c6bb671SDimitry Andric } ompt_record_cancel_t;
9873c6bb671SDimitry Andric 
9883c6bb671SDimitry Andric typedef void (*ompt_callback_device_initialize_t) (
9893c6bb671SDimitry Andric   int device_num,
9903c6bb671SDimitry Andric   const char *type,
9913c6bb671SDimitry Andric   ompt_device_t *device,
9923c6bb671SDimitry Andric   ompt_function_lookup_t lookup,
9933c6bb671SDimitry Andric   const char *documentation
9943c6bb671SDimitry Andric );
9953c6bb671SDimitry Andric 
9963c6bb671SDimitry Andric typedef void (*ompt_callback_device_finalize_t) (
9973c6bb671SDimitry Andric   int device_num
9983c6bb671SDimitry Andric );
9993c6bb671SDimitry Andric 
10003c6bb671SDimitry Andric typedef void (*ompt_callback_device_load_t) (
10013c6bb671SDimitry Andric   int device_num,
10023c6bb671SDimitry Andric   const char *filename,
10033c6bb671SDimitry Andric   int64_t offset_in_file,
10043c6bb671SDimitry Andric   void *vma_in_file,
10053c6bb671SDimitry Andric   size_t bytes,
10063c6bb671SDimitry Andric   void *host_addr,
10073c6bb671SDimitry Andric   void *device_addr,
10083c6bb671SDimitry Andric   uint64_t module_id
10093c6bb671SDimitry Andric );
10103c6bb671SDimitry Andric 
10113c6bb671SDimitry Andric typedef void (*ompt_callback_device_unload_t) (
10123c6bb671SDimitry Andric   int device_num,
10133c6bb671SDimitry Andric   uint64_t module_id
10143c6bb671SDimitry Andric );
10153c6bb671SDimitry Andric 
1016d409305fSDimitry Andric typedef void (*ompt_callback_target_data_op_emi_t) (
1017d409305fSDimitry Andric   ompt_scope_endpoint_t endpoint,
1018d409305fSDimitry Andric   ompt_data_t *target_task_data,
1019d409305fSDimitry Andric   ompt_data_t *target_data,
1020d409305fSDimitry Andric   ompt_id_t *host_op_id,
1021d409305fSDimitry Andric   ompt_target_data_op_t optype,
1022d409305fSDimitry Andric   void *src_addr,
1023d409305fSDimitry Andric   int src_device_num,
1024d409305fSDimitry Andric   void *dest_addr,
1025d409305fSDimitry Andric   int dest_device_num,
1026d409305fSDimitry Andric   size_t bytes,
1027d409305fSDimitry Andric   const void *codeptr_ra
1028d409305fSDimitry Andric );
1029d409305fSDimitry Andric 
10303c6bb671SDimitry Andric typedef void (*ompt_callback_target_data_op_t) (
10313c6bb671SDimitry Andric   ompt_id_t target_id,
10323c6bb671SDimitry Andric   ompt_id_t host_op_id,
10333c6bb671SDimitry Andric   ompt_target_data_op_t optype,
10343c6bb671SDimitry Andric   void *src_addr,
10353c6bb671SDimitry Andric   int src_device_num,
10363c6bb671SDimitry Andric   void *dest_addr,
10373c6bb671SDimitry Andric   int dest_device_num,
10383c6bb671SDimitry Andric   size_t bytes,
10393c6bb671SDimitry Andric   const void *codeptr_ra
10403c6bb671SDimitry Andric );
10413c6bb671SDimitry Andric 
10423c6bb671SDimitry Andric typedef struct ompt_record_target_data_op_t {
10433c6bb671SDimitry Andric   ompt_id_t host_op_id;
10443c6bb671SDimitry Andric   ompt_target_data_op_t optype;
10453c6bb671SDimitry Andric   void *src_addr;
10463c6bb671SDimitry Andric   int src_device_num;
10473c6bb671SDimitry Andric   void *dest_addr;
10483c6bb671SDimitry Andric   int dest_device_num;
10493c6bb671SDimitry Andric   size_t bytes;
10503c6bb671SDimitry Andric   ompt_device_time_t end_time;
10513c6bb671SDimitry Andric   const void *codeptr_ra;
10523c6bb671SDimitry Andric } ompt_record_target_data_op_t;
10533c6bb671SDimitry Andric 
1054d409305fSDimitry Andric typedef void (*ompt_callback_target_emi_t) (
1055d409305fSDimitry Andric   ompt_target_t kind,
1056d409305fSDimitry Andric   ompt_scope_endpoint_t endpoint,
1057d409305fSDimitry Andric   int device_num,
1058d409305fSDimitry Andric   ompt_data_t *task_data,
1059d409305fSDimitry Andric   ompt_data_t *target_task_data,
1060d409305fSDimitry Andric   ompt_data_t *target_data,
1061d409305fSDimitry Andric   const void *codeptr_ra
1062d409305fSDimitry Andric );
1063d409305fSDimitry Andric 
10643c6bb671SDimitry Andric typedef void (*ompt_callback_target_t) (
10653c6bb671SDimitry Andric   ompt_target_t kind,
10663c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint,
10673c6bb671SDimitry Andric   int device_num,
10683c6bb671SDimitry Andric   ompt_data_t *task_data,
10693c6bb671SDimitry Andric   ompt_id_t target_id,
10703c6bb671SDimitry Andric   const void *codeptr_ra
10713c6bb671SDimitry Andric );
10723c6bb671SDimitry Andric 
10733c6bb671SDimitry Andric typedef struct ompt_record_target_t {
10743c6bb671SDimitry Andric   ompt_target_t kind;
10753c6bb671SDimitry Andric   ompt_scope_endpoint_t endpoint;
10763c6bb671SDimitry Andric   int device_num;
10773c6bb671SDimitry Andric   ompt_id_t task_id;
10783c6bb671SDimitry Andric   ompt_id_t target_id;
10793c6bb671SDimitry Andric   const void *codeptr_ra;
10803c6bb671SDimitry Andric } ompt_record_target_t;
10813c6bb671SDimitry Andric 
1082d409305fSDimitry Andric typedef void (*ompt_callback_target_map_emi_t) (
1083d409305fSDimitry Andric   ompt_data_t *target_data,
1084d409305fSDimitry Andric   unsigned int nitems,
1085d409305fSDimitry Andric   void **host_addr,
1086d409305fSDimitry Andric   void **device_addr,
1087d409305fSDimitry Andric   size_t *bytes,
1088d409305fSDimitry Andric   unsigned int *mapping_flags,
1089d409305fSDimitry Andric   const void *codeptr_ra
1090d409305fSDimitry Andric );
1091d409305fSDimitry Andric 
10923c6bb671SDimitry Andric typedef void (*ompt_callback_target_map_t) (
10933c6bb671SDimitry Andric   ompt_id_t target_id,
10943c6bb671SDimitry Andric   unsigned int nitems,
10953c6bb671SDimitry Andric   void **host_addr,
10963c6bb671SDimitry Andric   void **device_addr,
10973c6bb671SDimitry Andric   size_t *bytes,
10983c6bb671SDimitry Andric   unsigned int *mapping_flags,
10993c6bb671SDimitry Andric   const void *codeptr_ra
11003c6bb671SDimitry Andric );
11013c6bb671SDimitry Andric 
11023c6bb671SDimitry Andric typedef struct ompt_record_target_map_t {
11033c6bb671SDimitry Andric   ompt_id_t target_id;
11043c6bb671SDimitry Andric   unsigned int nitems;
11053c6bb671SDimitry Andric   void **host_addr;
11063c6bb671SDimitry Andric   void **device_addr;
11073c6bb671SDimitry Andric   size_t *bytes;
11083c6bb671SDimitry Andric   unsigned int *mapping_flags;
11093c6bb671SDimitry Andric   const void *codeptr_ra;
11103c6bb671SDimitry Andric } ompt_record_target_map_t;
11113c6bb671SDimitry Andric 
1112d409305fSDimitry Andric typedef void (*ompt_callback_target_submit_emi_t) (
1113d409305fSDimitry Andric   ompt_scope_endpoint_t endpoint,
1114d409305fSDimitry Andric   ompt_data_t *target_data,
1115d409305fSDimitry Andric   ompt_id_t *host_op_id,
1116d409305fSDimitry Andric   unsigned int requested_num_teams
1117d409305fSDimitry Andric );
1118d409305fSDimitry Andric 
11193c6bb671SDimitry Andric typedef void (*ompt_callback_target_submit_t) (
11203c6bb671SDimitry Andric   ompt_id_t target_id,
11213c6bb671SDimitry Andric   ompt_id_t host_op_id,
11223c6bb671SDimitry Andric   unsigned int requested_num_teams
11233c6bb671SDimitry Andric );
11243c6bb671SDimitry Andric 
11253c6bb671SDimitry Andric typedef struct ompt_record_target_kernel_t {
11263c6bb671SDimitry Andric   ompt_id_t host_op_id;
11273c6bb671SDimitry Andric   unsigned int requested_num_teams;
11283c6bb671SDimitry Andric   unsigned int granted_num_teams;
11293c6bb671SDimitry Andric   ompt_device_time_t end_time;
11303c6bb671SDimitry Andric } ompt_record_target_kernel_t;
11313c6bb671SDimitry Andric 
11323c6bb671SDimitry Andric typedef int (*ompt_callback_control_tool_t) (
11333c6bb671SDimitry Andric   uint64_t command,
11343c6bb671SDimitry Andric   uint64_t modifier,
11353c6bb671SDimitry Andric   void *arg,
11363c6bb671SDimitry Andric   const void *codeptr_ra
11373c6bb671SDimitry Andric );
11383c6bb671SDimitry Andric 
11393c6bb671SDimitry Andric typedef struct ompt_record_control_tool_t {
11403c6bb671SDimitry Andric   uint64_t command;
11413c6bb671SDimitry Andric   uint64_t modifier;
11423c6bb671SDimitry Andric   const void *codeptr_ra;
11433c6bb671SDimitry Andric } ompt_record_control_tool_t;
11443c6bb671SDimitry Andric 
1145d409305fSDimitry Andric typedef void (*ompt_callback_error_t) (
1146d409305fSDimitry Andric   ompt_severity_t severity,
1147d409305fSDimitry Andric   const char *message, size_t length,
1148d409305fSDimitry Andric   const void *codeptr_ra
1149d409305fSDimitry Andric );
1150d409305fSDimitry Andric 
11516e75b2fbSDimitry Andric typedef struct ompt_record_error_t {
11526e75b2fbSDimitry Andric   ompt_severity_t severity;
11536e75b2fbSDimitry Andric   const char *message;
11546e75b2fbSDimitry Andric   size_t length;
11556e75b2fbSDimitry Andric   const void *codeptr_ra;
11566e75b2fbSDimitry Andric } ompt_record_error_t;
11576e75b2fbSDimitry Andric 
11583c6bb671SDimitry Andric typedef struct ompd_address_t {
11593c6bb671SDimitry Andric   ompd_seg_t segment;
11603c6bb671SDimitry Andric   ompd_addr_t address;
11613c6bb671SDimitry Andric } ompd_address_t;
11623c6bb671SDimitry Andric 
11633c6bb671SDimitry Andric typedef struct ompd_frame_info_t {
11643c6bb671SDimitry Andric   ompd_address_t frame_address;
11653c6bb671SDimitry Andric   ompd_word_t frame_flag;
11663c6bb671SDimitry Andric } ompd_frame_info_t;
11673c6bb671SDimitry Andric 
11683c6bb671SDimitry Andric typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
11693c6bb671SDimitry Andric typedef struct _ompd_thread_handle ompd_thread_handle_t;
11703c6bb671SDimitry Andric typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
11713c6bb671SDimitry Andric typedef struct _ompd_task_handle ompd_task_handle_t;
11723c6bb671SDimitry Andric 
11733c6bb671SDimitry Andric typedef struct _ompd_aspace_cont ompd_address_space_context_t;
11743c6bb671SDimitry Andric typedef struct _ompd_thread_cont ompd_thread_context_t;
11753c6bb671SDimitry Andric 
11763c6bb671SDimitry Andric typedef struct ompd_device_type_sizes_t {
11773c6bb671SDimitry Andric   uint8_t sizeof_char;
11783c6bb671SDimitry Andric   uint8_t sizeof_short;
11793c6bb671SDimitry Andric   uint8_t sizeof_int;
11803c6bb671SDimitry Andric   uint8_t sizeof_long;
11813c6bb671SDimitry Andric   uint8_t sizeof_long_long;
11823c6bb671SDimitry Andric   uint8_t sizeof_pointer;
11833c6bb671SDimitry Andric } ompd_device_type_sizes_t;
11843c6bb671SDimitry Andric 
11856e75b2fbSDimitry Andric void ompd_dll_locations_valid(void);
11866e75b2fbSDimitry Andric 
11876e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_memory_alloc_fn_t)(ompd_size_t nbytes,
11886e75b2fbSDimitry Andric                                                      void **ptr);
11896e75b2fbSDimitry Andric 
11906e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_memory_free_fn_t)(void *ptr);
11916e75b2fbSDimitry Andric 
11926e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_get_thread_context_for_thread_id_fn_t)(
11936e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context, ompd_thread_id_t kind,
11946e75b2fbSDimitry Andric     ompd_size_t sizeof_thread_id, const void *thread_id,
11956e75b2fbSDimitry Andric     ompd_thread_context_t **thread_context);
11966e75b2fbSDimitry Andric 
11976e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_sizeof_fn_t)(
11986e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context,
11996e75b2fbSDimitry Andric     ompd_device_type_sizes_t *sizes);
12006e75b2fbSDimitry Andric 
12016e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t)(
12026e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context,
12036e75b2fbSDimitry Andric     ompd_thread_context_t *thread_context, const char *symbol_name,
12046e75b2fbSDimitry Andric     ompd_address_t *symbol_addr, const char *file_name);
12056e75b2fbSDimitry Andric 
12066e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_memory_read_fn_t)(
12076e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context,
12086e75b2fbSDimitry Andric     ompd_thread_context_t *thread_context, const ompd_address_t *addr,
12096e75b2fbSDimitry Andric     ompd_size_t nbytes, void *buffer);
12106e75b2fbSDimitry Andric 
12116e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_memory_write_fn_t)(
12126e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context,
12136e75b2fbSDimitry Andric     ompd_thread_context_t *thread_context, const ompd_address_t *addr,
12146e75b2fbSDimitry Andric     ompd_size_t nbytes, const void *buffer);
12156e75b2fbSDimitry Andric 
12166e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_device_host_fn_t)(
12176e75b2fbSDimitry Andric     ompd_address_space_context_t *address_space_context, const void *input,
12186e75b2fbSDimitry Andric     ompd_size_t unit_size, ompd_size_t count, void *output);
12196e75b2fbSDimitry Andric 
12206e75b2fbSDimitry Andric typedef ompd_rc_t (*ompd_callback_print_string_fn_t)(const char *string,
12216e75b2fbSDimitry Andric                                                      int category);
12226e75b2fbSDimitry Andric 
12236e75b2fbSDimitry Andric typedef struct ompd_callbacks_t {
12246e75b2fbSDimitry Andric   ompd_callback_memory_alloc_fn_t alloc_memory;
12256e75b2fbSDimitry Andric   ompd_callback_memory_free_fn_t free_memory;
12266e75b2fbSDimitry Andric   ompd_callback_print_string_fn_t print_string;
12276e75b2fbSDimitry Andric   ompd_callback_sizeof_fn_t sizeof_type;
12286e75b2fbSDimitry Andric   ompd_callback_symbol_addr_fn_t symbol_addr_lookup;
12296e75b2fbSDimitry Andric   ompd_callback_memory_read_fn_t read_memory;
12306e75b2fbSDimitry Andric   ompd_callback_memory_write_fn_t write_memory;
12316e75b2fbSDimitry Andric   ompd_callback_memory_read_fn_t read_string;
12326e75b2fbSDimitry Andric   ompd_callback_device_host_fn_t device_to_host;
12336e75b2fbSDimitry Andric   ompd_callback_device_host_fn_t host_to_device;
12346e75b2fbSDimitry Andric   ompd_callback_get_thread_context_for_thread_id_fn_t
12356e75b2fbSDimitry Andric       get_thread_context_for_thread_id;
12366e75b2fbSDimitry Andric } ompd_callbacks_t;
12376e75b2fbSDimitry Andric 
12386e75b2fbSDimitry Andric void ompd_bp_parallel_begin(void);
12396e75b2fbSDimitry Andric 
12406e75b2fbSDimitry Andric void ompd_bp_parallel_end(void);
12416e75b2fbSDimitry Andric 
12426e75b2fbSDimitry Andric void ompd_bp_task_begin(void);
12436e75b2fbSDimitry Andric 
12446e75b2fbSDimitry Andric void ompd_bp_task_end(void);
12456e75b2fbSDimitry Andric 
12466e75b2fbSDimitry Andric void ompd_bp_thread_begin(void);
12476e75b2fbSDimitry Andric 
12486e75b2fbSDimitry Andric void ompd_bp_thread_end(void);
12496e75b2fbSDimitry Andric 
12506e75b2fbSDimitry Andric void ompd_bp_device_begin(void);
12516e75b2fbSDimitry Andric 
12526e75b2fbSDimitry Andric void ompd_bp_device_end(void);
12536e75b2fbSDimitry Andric 
12546e75b2fbSDimitry Andric ompd_rc_t ompd_initialize(ompd_word_t api_version,
12556e75b2fbSDimitry Andric                           const ompd_callbacks_t *callbacks);
12566e75b2fbSDimitry Andric 
12576e75b2fbSDimitry Andric ompd_rc_t ompd_get_api_version(ompd_word_t *version);
12586e75b2fbSDimitry Andric 
12596e75b2fbSDimitry Andric ompd_rc_t ompd_get_version_string(const char **string);
12606e75b2fbSDimitry Andric 
12616e75b2fbSDimitry Andric ompd_rc_t ompd_finalize(void);
12626e75b2fbSDimitry Andric 
12636e75b2fbSDimitry Andric ompd_rc_t ompd_process_initialize(ompd_address_space_context_t *context,
12646e75b2fbSDimitry Andric                                   ompd_address_space_handle_t **handle);
12656e75b2fbSDimitry Andric 
12666e75b2fbSDimitry Andric ompd_rc_t ompd_device_initialize(ompd_address_space_handle_t *process_handle,
12676e75b2fbSDimitry Andric                                  ompd_address_space_context_t *device_context,
12686e75b2fbSDimitry Andric                                  ompd_device_t kind, ompd_size_t sizeof_id,
12696e75b2fbSDimitry Andric                                  void *id,
12706e75b2fbSDimitry Andric                                  ompd_address_space_handle_t **device_handle);
12716e75b2fbSDimitry Andric 
12726e75b2fbSDimitry Andric ompd_rc_t ompd_rel_address_space_handle(ompd_address_space_handle_t *handle);
12736e75b2fbSDimitry Andric 
12746e75b2fbSDimitry Andric ompd_rc_t ompd_get_omp_version(ompd_address_space_handle_t *address_space,
12756e75b2fbSDimitry Andric                                ompd_word_t *omp_version);
12766e75b2fbSDimitry Andric 
12776e75b2fbSDimitry Andric ompd_rc_t
12786e75b2fbSDimitry Andric ompd_get_omp_version_string(ompd_address_space_handle_t *address_space,
12796e75b2fbSDimitry Andric                             const char **string);
12806e75b2fbSDimitry Andric 
12816e75b2fbSDimitry Andric ompd_rc_t ompd_get_thread_in_parallel(ompd_parallel_handle_t *parallel_handle,
12826e75b2fbSDimitry Andric                                       int thread_num,
12836e75b2fbSDimitry Andric                                       ompd_thread_handle_t **thread_handle);
12846e75b2fbSDimitry Andric 
12856e75b2fbSDimitry Andric ompd_rc_t ompd_get_thread_handle(ompd_address_space_handle_t *handle,
12866e75b2fbSDimitry Andric                                  ompd_thread_id_t kind,
12876e75b2fbSDimitry Andric                                  ompd_size_t sizeof_thread_id,
12886e75b2fbSDimitry Andric                                  const void *thread_id,
12896e75b2fbSDimitry Andric                                  ompd_thread_handle_t **thread_handle);
12906e75b2fbSDimitry Andric 
12916e75b2fbSDimitry Andric ompd_rc_t ompd_rel_thread_handle(ompd_thread_handle_t *thread_handle);
12926e75b2fbSDimitry Andric 
12936e75b2fbSDimitry Andric ompd_rc_t ompd_thread_handle_compare(ompd_thread_handle_t *thread_handle_1,
12946e75b2fbSDimitry Andric                                      ompd_thread_handle_t *thread_handle_2,
12956e75b2fbSDimitry Andric                                      int *cmp_value);
12966e75b2fbSDimitry Andric 
12976e75b2fbSDimitry Andric ompd_rc_t ompd_get_thread_id(ompd_thread_handle_t *thread_handle,
12986e75b2fbSDimitry Andric                              ompd_thread_id_t kind,
12996e75b2fbSDimitry Andric                              ompd_size_t sizeof_thread_id, void *thread_id);
13006e75b2fbSDimitry Andric 
13016e75b2fbSDimitry Andric ompd_rc_t
13026e75b2fbSDimitry Andric ompd_get_curr_parallel_handle(ompd_thread_handle_t *thread_handle,
13036e75b2fbSDimitry Andric                               ompd_parallel_handle_t **parallel_handle);
13046e75b2fbSDimitry Andric 
13056e75b2fbSDimitry Andric ompd_rc_t ompd_get_enclosing_parallel_handle(
13066e75b2fbSDimitry Andric     ompd_parallel_handle_t *parallel_handle,
13076e75b2fbSDimitry Andric     ompd_parallel_handle_t **enclosing_parallel_handle);
13086e75b2fbSDimitry Andric 
13096e75b2fbSDimitry Andric ompd_rc_t
13106e75b2fbSDimitry Andric ompd_get_task_parallel_handle(ompd_task_handle_t *task_handle,
13116e75b2fbSDimitry Andric                               ompd_parallel_handle_t **task_parallel_handle);
13126e75b2fbSDimitry Andric 
13136e75b2fbSDimitry Andric ompd_rc_t ompd_rel_parallel_handle(ompd_parallel_handle_t *parallel_handle);
13146e75b2fbSDimitry Andric 
13156e75b2fbSDimitry Andric ompd_rc_t
13166e75b2fbSDimitry Andric ompd_parallel_handle_compare(ompd_parallel_handle_t *parallel_handle_1,
13176e75b2fbSDimitry Andric                              ompd_parallel_handle_t *parallel_handle_2,
13186e75b2fbSDimitry Andric                              int *cmp_value);
13196e75b2fbSDimitry Andric 
13206e75b2fbSDimitry Andric ompd_rc_t ompd_get_curr_task_handle(ompd_thread_handle_t *thread_handle,
13216e75b2fbSDimitry Andric                                     ompd_task_handle_t **task_handle);
13226e75b2fbSDimitry Andric 
13236e75b2fbSDimitry Andric ompd_rc_t
13246e75b2fbSDimitry Andric ompd_get_generating_task_handle(ompd_task_handle_t *task_handle,
13256e75b2fbSDimitry Andric                                 ompd_task_handle_t **generating_task_handle);
13266e75b2fbSDimitry Andric 
13276e75b2fbSDimitry Andric ompd_rc_t
13286e75b2fbSDimitry Andric ompd_get_scheduling_task_handle(ompd_task_handle_t *task_handle,
13296e75b2fbSDimitry Andric                                 ompd_task_handle_t **scheduling_task_handle);
13306e75b2fbSDimitry Andric 
13316e75b2fbSDimitry Andric ompd_rc_t ompd_get_task_in_parallel(ompd_parallel_handle_t *parallel_handle,
13326e75b2fbSDimitry Andric                                     int thread_num,
13336e75b2fbSDimitry Andric                                     ompd_task_handle_t **task_handle);
13346e75b2fbSDimitry Andric 
13356e75b2fbSDimitry Andric ompd_rc_t ompd_rel_task_handle(ompd_task_handle_t *task_handle);
13366e75b2fbSDimitry Andric 
13376e75b2fbSDimitry Andric ompd_rc_t ompd_task_handle_compare(ompd_task_handle_t *task_handle_1,
13386e75b2fbSDimitry Andric                                    ompd_task_handle_t *task_handle_2,
13396e75b2fbSDimitry Andric                                    int *cmp_value);
13406e75b2fbSDimitry Andric 
13416e75b2fbSDimitry Andric ompd_rc_t ompd_get_task_function(ompd_task_handle_t *task_handle,
13426e75b2fbSDimitry Andric                                  ompd_address_t *entry_point);
13436e75b2fbSDimitry Andric 
13446e75b2fbSDimitry Andric ompd_rc_t ompd_get_task_frame(ompd_task_handle_t *task_handle,
13456e75b2fbSDimitry Andric                               ompd_frame_info_t *exit_frame,
13466e75b2fbSDimitry Andric                               ompd_frame_info_t *enter_frame);
13476e75b2fbSDimitry Andric 
13486e75b2fbSDimitry Andric ompd_rc_t
13496e75b2fbSDimitry Andric ompd_enumerate_states(ompd_address_space_handle_t *address_space_handle,
13506e75b2fbSDimitry Andric                       ompd_word_t current_state, ompd_word_t *next_state,
13516e75b2fbSDimitry Andric                       const char **next_state_name, ompd_word_t *more_enums);
13526e75b2fbSDimitry Andric 
13536e75b2fbSDimitry Andric ompd_rc_t ompd_get_state(ompd_thread_handle_t *thread_handle,
13546e75b2fbSDimitry Andric                          ompd_word_t *state, ompd_wait_id_t *wait_id);
13556e75b2fbSDimitry Andric 
13566e75b2fbSDimitry Andric ompd_rc_t
13576e75b2fbSDimitry Andric ompd_get_display_control_vars(ompd_address_space_handle_t *address_space_handle,
13586e75b2fbSDimitry Andric                               const char *const **control_vars);
13596e75b2fbSDimitry Andric 
13606e75b2fbSDimitry Andric ompd_rc_t ompd_rel_display_control_vars(const char *const **control_vars);
13616e75b2fbSDimitry Andric 
13626e75b2fbSDimitry Andric ompd_rc_t ompd_enumerate_icvs(ompd_address_space_handle_t *handle,
13636e75b2fbSDimitry Andric                               ompd_icv_id_t current, ompd_icv_id_t *next_id,
13646e75b2fbSDimitry Andric                               const char **next_icv_name,
13656e75b2fbSDimitry Andric                               ompd_scope_t *next_scope, int *more);
13666e75b2fbSDimitry Andric 
13676e75b2fbSDimitry Andric ompd_rc_t ompd_get_icv_from_scope(void *handle, ompd_scope_t scope,
13686e75b2fbSDimitry Andric                                   ompd_icv_id_t icv_id, ompd_word_t *icv_value);
13696e75b2fbSDimitry Andric 
13706e75b2fbSDimitry Andric ompd_rc_t ompd_get_icv_string_from_scope(void *handle, ompd_scope_t scope,
13716e75b2fbSDimitry Andric                                          ompd_icv_id_t icv_id,
13726e75b2fbSDimitry Andric                                          const char **icv_string);
13736e75b2fbSDimitry Andric 
13746e75b2fbSDimitry Andric ompd_rc_t ompd_get_tool_data(void *handle, ompd_scope_t scope,
13756e75b2fbSDimitry Andric                              ompd_word_t *value, ompd_address_t *ptr);
13766e75b2fbSDimitry Andric 
13773c6bb671SDimitry Andric typedef struct ompt_record_ompt_t {
13783c6bb671SDimitry Andric   ompt_callbacks_t type;
13793c6bb671SDimitry Andric   ompt_device_time_t time;
13803c6bb671SDimitry Andric   ompt_id_t thread_id;
13813c6bb671SDimitry Andric   ompt_id_t target_id;
13823c6bb671SDimitry Andric   union {
13833c6bb671SDimitry Andric     ompt_record_thread_begin_t thread_begin;
13843c6bb671SDimitry Andric     ompt_record_parallel_begin_t parallel_begin;
13853c6bb671SDimitry Andric     ompt_record_parallel_end_t parallel_end;
13863c6bb671SDimitry Andric     ompt_record_work_t work;
13873c6bb671SDimitry Andric     ompt_record_dispatch_t dispatch;
13883c6bb671SDimitry Andric     ompt_record_task_create_t task_create;
13893c6bb671SDimitry Andric     ompt_record_dependences_t dependences;
13903c6bb671SDimitry Andric     ompt_record_task_dependence_t task_dependence;
13913c6bb671SDimitry Andric     ompt_record_task_schedule_t task_schedule;
13923c6bb671SDimitry Andric     ompt_record_implicit_task_t implicit_task;
1393d409305fSDimitry Andric     ompt_record_masked_t masked;
13943c6bb671SDimitry Andric     ompt_record_sync_region_t sync_region;
13953c6bb671SDimitry Andric     ompt_record_mutex_acquire_t mutex_acquire;
13963c6bb671SDimitry Andric     ompt_record_mutex_t mutex;
13973c6bb671SDimitry Andric     ompt_record_nest_lock_t nest_lock;
13983c6bb671SDimitry Andric     ompt_record_flush_t flush;
13993c6bb671SDimitry Andric     ompt_record_cancel_t cancel;
14003c6bb671SDimitry Andric     ompt_record_target_t target;
14013c6bb671SDimitry Andric     ompt_record_target_data_op_t target_data_op;
14023c6bb671SDimitry Andric     ompt_record_target_map_t target_map;
14033c6bb671SDimitry Andric     ompt_record_target_kernel_t target_kernel;
14043c6bb671SDimitry Andric     ompt_record_control_tool_t control_tool;
14053c6bb671SDimitry Andric   } record;
14063c6bb671SDimitry Andric } ompt_record_ompt_t;
14073c6bb671SDimitry Andric 
14083c6bb671SDimitry Andric typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
14093c6bb671SDimitry Andric   ompt_buffer_t *buffer,
14103c6bb671SDimitry Andric   ompt_buffer_cursor_t current
14113c6bb671SDimitry Andric );
14123c6bb671SDimitry Andric 
1413*0fca6ea1SDimitry Andric #ifdef _WIN32
1414*0fca6ea1SDimitry Andric __declspec(dllexport)
1415*0fca6ea1SDimitry Andric #else
1416*0fca6ea1SDimitry Andric __attribute__((visibility("default")))
1417*0fca6ea1SDimitry Andric #endif
1418*0fca6ea1SDimitry Andric ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
1419*0fca6ea1SDimitry Andric                                           const char *runtime_version);
1420*0fca6ea1SDimitry Andric 
14213c6bb671SDimitry Andric #define ompt_id_none 0
14223c6bb671SDimitry Andric #define ompt_data_none {0}
14233c6bb671SDimitry Andric #define ompt_time_none 0
14243c6bb671SDimitry Andric #define ompt_hwid_none 0
14253c6bb671SDimitry Andric #define ompt_addr_none ~0
14263c6bb671SDimitry Andric #define ompt_mutex_impl_none 0
14273c6bb671SDimitry Andric #define ompt_wait_id_none 0
14283c6bb671SDimitry Andric 
14293c6bb671SDimitry Andric #define ompd_segment_none 0
14303c6bb671SDimitry Andric 
1431*0fca6ea1SDimitry Andric #if defined(__cplusplus)
1432*0fca6ea1SDimitry Andric } // extern "C"
1433*0fca6ea1SDimitry Andric #endif
1434*0fca6ea1SDimitry Andric 
14353c6bb671SDimitry Andric #endif /* __OMPT__ */
1436