1/*
2 * include/omp-tools.h.var
3 */
4
5//===----------------------------------------------------------------------===//
6//
7// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8// See https://llvm.org/LICENSE.txt for license information.
9// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef __OMPT__
14#define __OMPT__
15
16/*****************************************************************************
17 * system include files
18 *****************************************************************************/
19
20#include <stdint.h>
21#include <stddef.h>
22
23#ifdef DEPRECATION_WARNINGS
24# ifdef __cplusplus
25# define DEPRECATED_51 [[deprecated("as of 5.1")]]
26# else
27# define DEPRECATED_51 __attribute__((deprecated("as of 5.1")))
28#endif
29#else
30#define DEPRECATED_51
31#endif
32
33/*****************************************************************************
34 * iteration macros
35 *****************************************************************************/
36
37#define FOREACH_OMPT_INQUIRY_FN(macro)      \
38    macro (ompt_enumerate_states)           \
39    macro (ompt_enumerate_mutex_impls)      \
40                                            \
41    macro (ompt_set_callback)               \
42    macro (ompt_get_callback)               \
43                                            \
44    macro (ompt_get_state)                  \
45                                            \
46    macro (ompt_get_parallel_info)          \
47    macro (ompt_get_task_info)              \
48    macro (ompt_get_task_memory)            \
49    macro (ompt_get_thread_data)            \
50    macro (ompt_get_unique_id)              \
51    macro (ompt_finalize_tool)              \
52                                            \
53    macro(ompt_get_num_procs)               \
54    macro(ompt_get_num_places)              \
55    macro(ompt_get_place_proc_ids)          \
56    macro(ompt_get_place_num)               \
57    macro(ompt_get_partition_place_nums)    \
58    macro(ompt_get_proc_id)                 \
59                                            \
60    macro(ompt_get_target_info)             \
61    macro(ompt_get_num_devices)
62
63#define FOREACH_OMPT_STATE(macro)                                                                \
64                                                                                                \
65    /* first available state */                                                                 \
66    macro (ompt_state_undefined, 0x102)      /* undefined thread state */                        \
67                                                                                                \
68    /* work states (0..15) */                                                                   \
69    macro (ompt_state_work_serial, 0x000)    /* working outside parallel */                      \
70    macro (ompt_state_work_parallel, 0x001)  /* working within parallel */                       \
71    macro (ompt_state_work_reduction, 0x002) /* performing a reduction */                        \
72                                                                                                \
73    /* barrier wait states (16..31) */                                                          \
74    macro (ompt_state_wait_barrier, 0x010)   /* waiting at a barrier */                          \
75    macro (ompt_state_wait_barrier_implicit_parallel, 0x011)                                     \
76                                            /* implicit barrier at the end of parallel region */\
77    macro (ompt_state_wait_barrier_implicit_workshare, 0x012)                                    \
78                                            /* implicit barrier at the end of worksharing */    \
79    macro (ompt_state_wait_barrier_implicit, 0x013)  /* implicit barrier */                      \
80    macro (ompt_state_wait_barrier_explicit, 0x014)  /* explicit barrier */                      \
81                                                                                                \
82    /* task wait states (32..63) */                                                             \
83    macro (ompt_state_wait_taskwait, 0x020)  /* waiting at a taskwait */                         \
84    macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */                        \
85                                                                                                \
86    /* mutex wait states (64..127) */                                                           \
87    macro (ompt_state_wait_mutex, 0x040)                                                         \
88    macro (ompt_state_wait_lock, 0x041)      /* waiting for lock */                              \
89    macro (ompt_state_wait_critical, 0x042)  /* waiting for critical */                          \
90    macro (ompt_state_wait_atomic, 0x043)    /* waiting for atomic */                            \
91    macro (ompt_state_wait_ordered, 0x044)   /* waiting for ordered */                           \
92                                                                                                \
93    /* target wait states (128..255) */                                                         \
94    macro (ompt_state_wait_target, 0x080)        /* waiting for target region */                 \
95    macro (ompt_state_wait_target_map, 0x081)    /* waiting for target data mapping operation */ \
96    macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */       \
97                                                                                                \
98    /* misc (256..511) */                                                                       \
99    macro (ompt_state_idle, 0x100)           /* waiting for work */                              \
100    macro (ompt_state_overhead, 0x101)       /* overhead excluding wait states */                \
101                                                                                                \
102    /* implementation-specific states (512..) */
103
104
105#define FOREACH_KMP_MUTEX_IMPL(macro)                                                \
106    macro (kmp_mutex_impl_none, 0)         /* unknown implementation */              \
107    macro (kmp_mutex_impl_spin, 1)         /* based on spin */                       \
108    macro (kmp_mutex_impl_queuing, 2)      /* based on some fair policy */           \
109    macro (kmp_mutex_impl_speculative, 3)  /* based on HW-supported speculation */
110
111#define FOREACH_OMPT_HOST_EVENT(macro)                                                                                   \
112                                                                                                                         \
113    /*--- Mandatory Events ---*/                                                                                         \
114    macro (ompt_callback_thread_begin,      ompt_callback_thread_begin_t,       1) /* thread begin                    */ \
115    macro (ompt_callback_thread_end,        ompt_callback_thread_end_t,         2) /* thread end                      */ \
116                                                                                                                         \
117    macro (ompt_callback_parallel_begin,    ompt_callback_parallel_begin_t,     3) /* parallel begin                  */ \
118    macro (ompt_callback_parallel_end,      ompt_callback_parallel_end_t,       4) /* parallel end                    */ \
119                                                                                                                         \
120    macro (ompt_callback_task_create,       ompt_callback_task_create_t,        5) /* task begin                      */ \
121    macro (ompt_callback_task_schedule,     ompt_callback_task_schedule_t,      6) /* task schedule                   */ \
122    macro (ompt_callback_implicit_task,     ompt_callback_implicit_task_t,      7) /* implicit task                   */ \
123                                                                                                                         \
124                                                                                                                         \
125    macro (ompt_callback_control_tool,      ompt_callback_control_tool_t,      11) /* control tool                    */ \
126                                                                                                                         \
127                                                                                                                         \
128    /* Optional Events */                                                                                                \
129    macro (ompt_callback_sync_region_wait,  ompt_callback_sync_region_t,       16) /* sync region wait begin or end   */ \
130                                                                                                                         \
131    macro (ompt_callback_mutex_released,    ompt_callback_mutex_t,             17) /* mutex released                  */ \
132                                                                                                                         \
133    macro (ompt_callback_dependences,       ompt_callback_dependences_t,       18) /* report task dependences         */ \
134    macro (ompt_callback_task_dependence,   ompt_callback_task_dependence_t,   19) /* report task dependence          */ \
135                                                                                                                         \
136    macro (ompt_callback_work,              ompt_callback_work_t,              20) /* task at work begin or end       */ \
137                                                                                                                         \
138    macro (ompt_callback_masked,            ompt_callback_masked_t,            21) /* task at masked begin or end     */ \
139                                                                                                                         \
140                                                                                                                         \
141    macro (ompt_callback_sync_region,       ompt_callback_sync_region_t,       23) /* sync region begin or end        */ \
142                                                                                                                         \
143    macro (ompt_callback_lock_init,         ompt_callback_mutex_acquire_t,     24) /* lock init                       */ \
144    macro (ompt_callback_lock_destroy,      ompt_callback_mutex_t,             25) /* lock destroy                    */ \
145                                                                                                                         \
146    macro (ompt_callback_mutex_acquire,     ompt_callback_mutex_acquire_t,     26) /* mutex acquire                   */ \
147    macro (ompt_callback_mutex_acquired,    ompt_callback_mutex_t,             27) /* mutex acquired                  */ \
148                                                                                                                         \
149    macro (ompt_callback_nest_lock,         ompt_callback_nest_lock_t,         28) /* nest lock                       */ \
150                                                                                                                         \
151    macro (ompt_callback_flush,             ompt_callback_flush_t,             29) /* after executing flush           */ \
152                                                                                                                         \
153    macro (ompt_callback_cancel,            ompt_callback_cancel_t,            30) /* cancel innermost binding region */ \
154                                                                                                                         \
155    macro (ompt_callback_reduction,         ompt_callback_sync_region_t,       31) /* reduction                       */ \
156                                                                                                                         \
157    macro (ompt_callback_dispatch,          ompt_callback_dispatch_t,          32) /* dispatch of work                */ \
158    macro (ompt_callback_error,             ompt_callback_error_t,             37) /* error                           */
159
160
161#define FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                 \
162    macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize               */ \
163    macro (ompt_callback_device_finalize,   ompt_callback_device_finalize_t,   13) /* device finalize                 */ \
164                                                                                                                         \
165    macro (ompt_callback_device_load,       ompt_callback_device_load_t,       14) /* device load                     */ \
166    macro (ompt_callback_device_unload,     ompt_callback_device_unload_t,     15) /* device unload                   */ \
167
168
169#define FOREACH_OMPT_NOEMI_EVENT(macro)                                                                                  \
170    macro (ompt_callback_target,            ompt_callback_target_t,             8) /* target                          */ \
171    macro (ompt_callback_target_data_op,    ompt_callback_target_data_op_t,     9) /* target data op                  */ \
172    macro (ompt_callback_target_submit,     ompt_callback_target_submit_t,     10) /* target  submit                  */ \
173    macro (ompt_callback_target_map,        ompt_callback_target_map_t,        22) /* target map                      */ \
174
175
176#define FOREACH_OMPT_EMI_EVENT(macro)                                                                                    \
177    macro (ompt_callback_target_emi,        ompt_callback_target_emi_t,        33) /* target                          */ \
178    macro (ompt_callback_target_data_op_emi,ompt_callback_target_data_op_emi_t,34) /* target data op                  */ \
179    macro (ompt_callback_target_submit_emi, ompt_callback_target_submit_emi_t, 35) /* target submit                   */ \
180    macro (ompt_callback_target_map_emi,    ompt_callback_target_map_emi_t,    36) /* target map                      */ \
181
182#define FOREACH_OMPT_50_TARGET_EVENT(macro)                                                                              \
183    FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
184    FOREACH_OMPT_NOEMI_EVENT(macro)
185
186#define FOREACH_OMPT_51_TARGET_EVENT(macro)                                                                              \
187    FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
188    FOREACH_OMPT_EMI_EVENT(macro)
189
190#define FOREACH_OMPT_EVENT(macro)                                                                                        \
191    FOREACH_OMPT_HOST_EVENT(macro)                                                                                       \
192    FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
193    FOREACH_OMPT_NOEMI_EVENT(macro)                                                                                      \
194    FOREACH_OMPT_EMI_EVENT(macro)
195
196#define FOREACH_OMPT_51_EVENT(macro)                                                                                     \
197    FOREACH_OMPT_HOST_EVENT(macro)                                                                                       \
198    FOREACH_OMPT_DEVICE_EVENT(macro)                                                                                     \
199    FOREACH_OMPT_EMI_EVENT(macro)
200
201/*****************************************************************************
202 * implementation specific types
203 *****************************************************************************/
204
205typedef enum kmp_mutex_impl_t {
206#define kmp_mutex_impl_macro(impl, code) impl = code,
207    FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
208#undef kmp_mutex_impl_macro
209} kmp_mutex_impl_t;
210
211/*****************************************************************************
212 * definitions generated from spec
213 *****************************************************************************/
214
215typedef enum ompt_callbacks_t {
216  ompt_callback_thread_begin             = 1,
217  ompt_callback_thread_end               = 2,
218  ompt_callback_parallel_begin           = 3,
219  ompt_callback_parallel_end             = 4,
220  ompt_callback_task_create              = 5,
221  ompt_callback_task_schedule            = 6,
222  ompt_callback_implicit_task            = 7,
223  ompt_callback_target                   = 8,
224  ompt_callback_target_data_op           = 9,
225  ompt_callback_target_submit            = 10,
226  ompt_callback_control_tool             = 11,
227  ompt_callback_device_initialize        = 12,
228  ompt_callback_device_finalize          = 13,
229  ompt_callback_device_load              = 14,
230  ompt_callback_device_unload            = 15,
231  ompt_callback_sync_region_wait         = 16,
232  ompt_callback_mutex_released           = 17,
233  ompt_callback_dependences              = 18,
234  ompt_callback_task_dependence          = 19,
235  ompt_callback_work                     = 20,
236  ompt_callback_master     DEPRECATED_51 = 21,
237  ompt_callback_masked                   = 21,
238  ompt_callback_target_map               = 22,
239  ompt_callback_sync_region              = 23,
240  ompt_callback_lock_init                = 24,
241  ompt_callback_lock_destroy             = 25,
242  ompt_callback_mutex_acquire            = 26,
243  ompt_callback_mutex_acquired           = 27,
244  ompt_callback_nest_lock                = 28,
245  ompt_callback_flush                    = 29,
246  ompt_callback_cancel                   = 30,
247  ompt_callback_reduction                = 31,
248  ompt_callback_dispatch                 = 32,
249  ompt_callback_target_emi               = 33,
250  ompt_callback_target_data_op_emi       = 34,
251  ompt_callback_target_submit_emi        = 35,
252  ompt_callback_target_map_emi           = 36,
253  ompt_callback_error                    = 37
254} ompt_callbacks_t;
255
256typedef enum ompt_record_t {
257  ompt_record_ompt               = 1,
258  ompt_record_native             = 2,
259  ompt_record_invalid            = 3
260} ompt_record_t;
261
262typedef enum ompt_record_native_t {
263  ompt_record_native_info  = 1,
264  ompt_record_native_event = 2
265} ompt_record_native_t;
266
267typedef enum ompt_set_result_t {
268  ompt_set_error            = 0,
269  ompt_set_never            = 1,
270  ompt_set_impossible       = 2,
271  ompt_set_sometimes        = 3,
272  ompt_set_sometimes_paired = 4,
273  ompt_set_always           = 5
274} ompt_set_result_t;
275
276typedef uint64_t ompt_id_t;
277
278typedef uint64_t ompt_device_time_t;
279
280typedef uint64_t ompt_buffer_cursor_t;
281
282typedef enum ompt_thread_t {
283  ompt_thread_initial                 = 1,
284  ompt_thread_worker                  = 2,
285  ompt_thread_other                   = 3,
286  ompt_thread_unknown                 = 4
287} ompt_thread_t;
288
289typedef enum ompt_scope_endpoint_t {
290  ompt_scope_begin                    = 1,
291  ompt_scope_end                      = 2,
292  ompt_scope_beginend                 = 3
293} ompt_scope_endpoint_t;
294
295typedef enum ompt_dispatch_t {
296  ompt_dispatch_iteration             = 1,
297  ompt_dispatch_section               = 2
298} ompt_dispatch_t;
299
300typedef enum ompt_sync_region_t {
301  ompt_sync_region_barrier                DEPRECATED_51 = 1,
302  ompt_sync_region_barrier_implicit       DEPRECATED_51 = 2,
303  ompt_sync_region_barrier_explicit       = 3,
304  ompt_sync_region_barrier_implementation = 4,
305  ompt_sync_region_taskwait               = 5,
306  ompt_sync_region_taskgroup              = 6,
307  ompt_sync_region_reduction              = 7,
308  ompt_sync_region_barrier_implicit_workshare = 8,
309  ompt_sync_region_barrier_implicit_parallel = 9,
310  ompt_sync_region_barrier_teams = 10
311} ompt_sync_region_t;
312
313typedef enum ompt_target_data_op_t {
314  ompt_target_data_alloc                      = 1,
315  ompt_target_data_transfer_to_device         = 2,
316  ompt_target_data_transfer_from_device       = 3,
317  ompt_target_data_delete                     = 4,
318  ompt_target_data_associate                  = 5,
319  ompt_target_data_disassociate               = 6,
320  ompt_target_data_alloc_async                = 17,
321  ompt_target_data_transfer_to_device_async   = 18,
322  ompt_target_data_transfer_from_device_async = 19,
323  ompt_target_data_delete_async               = 20
324} ompt_target_data_op_t;
325
326typedef enum ompt_work_t {
327  ompt_work_loop               = 1,
328  ompt_work_sections           = 2,
329  ompt_work_single_executor    = 3,
330  ompt_work_single_other       = 4,
331  ompt_work_workshare          = 5,
332  ompt_work_distribute         = 6,
333  ompt_work_taskloop           = 7,
334  ompt_work_scope              = 8
335} ompt_work_t;
336
337typedef enum ompt_mutex_t {
338  ompt_mutex_lock                     = 1,
339  ompt_mutex_test_lock                = 2,
340  ompt_mutex_nest_lock                = 3,
341  ompt_mutex_test_nest_lock           = 4,
342  ompt_mutex_critical                 = 5,
343  ompt_mutex_atomic                   = 6,
344  ompt_mutex_ordered                  = 7
345} ompt_mutex_t;
346
347typedef enum ompt_native_mon_flag_t {
348  ompt_native_data_motion_explicit    = 0x01,
349  ompt_native_data_motion_implicit    = 0x02,
350  ompt_native_kernel_invocation       = 0x04,
351  ompt_native_kernel_execution        = 0x08,
352  ompt_native_driver                  = 0x10,
353  ompt_native_runtime                 = 0x20,
354  ompt_native_overhead                = 0x40,
355  ompt_native_idleness                = 0x80
356} ompt_native_mon_flag_t;
357
358typedef enum ompt_task_flag_t {
359  ompt_task_initial                   = 0x00000001,
360  ompt_task_implicit                  = 0x00000002,
361  ompt_task_explicit                  = 0x00000004,
362  ompt_task_target                    = 0x00000008,
363  ompt_task_taskwait                  = 0x00000010,
364  ompt_task_undeferred                = 0x08000000,
365  ompt_task_untied                    = 0x10000000,
366  ompt_task_final                     = 0x20000000,
367  ompt_task_mergeable                 = 0x40000000,
368  ompt_task_merged                    = 0x80000000
369} ompt_task_flag_t;
370
371typedef enum ompt_task_status_t {
372  ompt_task_complete      = 1,
373  ompt_task_yield         = 2,
374  ompt_task_cancel        = 3,
375  ompt_task_detach        = 4,
376  ompt_task_early_fulfill = 5,
377  ompt_task_late_fulfill  = 6,
378  ompt_task_switch        = 7,
379  ompt_taskwait_complete  = 8
380} ompt_task_status_t;
381
382typedef enum ompt_target_t {
383  ompt_target                         = 1,
384  ompt_target_enter_data              = 2,
385  ompt_target_exit_data               = 3,
386  ompt_target_update                  = 4,
387  ompt_target_nowait                  = 9,
388  ompt_target_enter_data_nowait       = 10,
389  ompt_target_exit_data_nowait        = 11,
390  ompt_target_update_nowait           = 12
391} ompt_target_t;
392
393typedef enum ompt_parallel_flag_t {
394  ompt_parallel_invoker_program = 0x00000001,
395  ompt_parallel_invoker_runtime = 0x00000002,
396  ompt_parallel_league          = 0x40000000,
397  ompt_parallel_team            = 0x80000000
398} ompt_parallel_flag_t;
399
400typedef enum ompt_target_map_flag_t {
401  ompt_target_map_flag_to             = 0x01,
402  ompt_target_map_flag_from           = 0x02,
403  ompt_target_map_flag_alloc          = 0x04,
404  ompt_target_map_flag_release        = 0x08,
405  ompt_target_map_flag_delete         = 0x10,
406  ompt_target_map_flag_implicit       = 0x20
407} ompt_target_map_flag_t;
408
409typedef enum ompt_dependence_type_t {
410  ompt_dependence_type_in              = 1,
411  ompt_dependence_type_out             = 2,
412  ompt_dependence_type_inout           = 3,
413  ompt_dependence_type_mutexinoutset   = 4,
414  ompt_dependence_type_source          = 5,
415  ompt_dependence_type_sink            = 6,
416  ompt_dependence_type_inoutset        = 7
417} ompt_dependence_type_t;
418
419typedef enum ompt_severity_t {
420  ompt_warning                         = 1,
421  ompt_fatal                           = 2
422} ompt_severity_t;
423
424typedef enum ompt_cancel_flag_t {
425  ompt_cancel_parallel       = 0x01,
426  ompt_cancel_sections       = 0x02,
427  ompt_cancel_loop           = 0x04,
428  ompt_cancel_taskgroup      = 0x08,
429  ompt_cancel_activated      = 0x10,
430  ompt_cancel_detected       = 0x20,
431  ompt_cancel_discarded_task = 0x40
432} ompt_cancel_flag_t;
433
434typedef uint64_t ompt_hwid_t;
435
436typedef uint64_t ompt_wait_id_t;
437
438typedef enum ompt_frame_flag_t {
439  ompt_frame_runtime        = 0x00,
440  ompt_frame_application    = 0x01,
441  ompt_frame_cfa            = 0x10,
442  ompt_frame_framepointer   = 0x20,
443  ompt_frame_stackaddress   = 0x30
444} ompt_frame_flag_t;
445
446typedef enum ompt_state_t {
447  ompt_state_work_serial                      = 0x000,
448  ompt_state_work_parallel                    = 0x001,
449  ompt_state_work_reduction                   = 0x002,
450
451  ompt_state_wait_barrier                     DEPRECATED_51 = 0x010,
452  ompt_state_wait_barrier_implicit_parallel   = 0x011,
453  ompt_state_wait_barrier_implicit_workshare  = 0x012,
454  ompt_state_wait_barrier_implicit            DEPRECATED_51 = 0x013,
455  ompt_state_wait_barrier_explicit            = 0x014,
456  ompt_state_wait_barrier_implementation      = 0x015,
457  ompt_state_wait_barrier_teams               = 0x016,
458
459  ompt_state_wait_taskwait                    = 0x020,
460  ompt_state_wait_taskgroup                   = 0x021,
461
462  ompt_state_wait_mutex                       = 0x040,
463  ompt_state_wait_lock                        = 0x041,
464  ompt_state_wait_critical                    = 0x042,
465  ompt_state_wait_atomic                      = 0x043,
466  ompt_state_wait_ordered                     = 0x044,
467
468  ompt_state_wait_target                      = 0x080,
469  ompt_state_wait_target_map                  = 0x081,
470  ompt_state_wait_target_update               = 0x082,
471
472  ompt_state_idle                             = 0x100,
473  ompt_state_overhead                         = 0x101,
474  ompt_state_undefined                        = 0x102
475} ompt_state_t;
476
477typedef uint64_t (*ompt_get_unique_id_t) (void);
478
479typedef uint64_t ompd_size_t;
480
481typedef uint64_t ompd_wait_id_t;
482
483typedef uint64_t ompd_addr_t;
484typedef int64_t  ompd_word_t;
485typedef uint64_t ompd_seg_t;
486
487typedef uint64_t ompd_device_t;
488
489typedef uint64_t ompd_thread_id_t;
490
491typedef enum ompd_scope_t {
492  ompd_scope_global = 1,
493  ompd_scope_address_space = 2,
494  ompd_scope_thread = 3,
495  ompd_scope_parallel = 4,
496  ompd_scope_implicit_task = 5,
497  ompd_scope_task = 6
498} ompd_scope_t;
499
500typedef uint64_t ompd_icv_id_t;
501
502typedef enum ompd_rc_t {
503  ompd_rc_ok = 0,
504  ompd_rc_unavailable = 1,
505  ompd_rc_stale_handle = 2,
506  ompd_rc_bad_input = 3,
507  ompd_rc_error = 4,
508  ompd_rc_unsupported = 5,
509  ompd_rc_needs_state_tracking = 6,
510  ompd_rc_incompatible = 7,
511  ompd_rc_device_read_error = 8,
512  ompd_rc_device_write_error = 9,
513  ompd_rc_nomem = 10,
514  ompd_rc_incomplete = 11,
515  ompd_rc_callback_error = 12
516} ompd_rc_t;
517
518typedef void (*ompt_interface_fn_t) (void);
519
520typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
521  const char *interface_function_name
522);
523
524typedef union ompt_data_t {
525  uint64_t value;
526  void *ptr;
527} ompt_data_t;
528
529typedef struct ompt_frame_t {
530  ompt_data_t exit_frame;
531  ompt_data_t enter_frame;
532  int exit_frame_flags;
533  int enter_frame_flags;
534} ompt_frame_t;
535
536typedef void (*ompt_callback_t) (void);
537
538typedef void ompt_device_t;
539
540typedef void ompt_buffer_t;
541
542typedef void (*ompt_callback_buffer_request_t) (
543  int device_num,
544  ompt_buffer_t **buffer,
545  size_t *bytes
546);
547
548typedef void (*ompt_callback_buffer_complete_t) (
549  int device_num,
550  ompt_buffer_t *buffer,
551  size_t bytes,
552  ompt_buffer_cursor_t begin,
553  int buffer_owned
554);
555
556typedef void (*ompt_finalize_t) (
557  ompt_data_t *tool_data
558);
559
560typedef int (*ompt_initialize_t) (
561  ompt_function_lookup_t lookup,
562  int initial_device_num,
563  ompt_data_t *tool_data
564);
565
566typedef struct ompt_start_tool_result_t {
567  ompt_initialize_t initialize;
568  ompt_finalize_t finalize;
569  ompt_data_t tool_data;
570} ompt_start_tool_result_t;
571
572typedef struct ompt_record_abstract_t {
573  ompt_record_native_t rclass;
574  const char *type;
575  ompt_device_time_t start_time;
576  ompt_device_time_t end_time;
577  ompt_hwid_t hwid;
578} ompt_record_abstract_t;
579
580typedef struct ompt_dependence_t {
581  ompt_data_t variable;
582  ompt_dependence_type_t dependence_type;
583} ompt_dependence_t;
584
585typedef int (*ompt_enumerate_states_t) (
586  int current_state,
587  int *next_state,
588  const char **next_state_name
589);
590
591typedef int (*ompt_enumerate_mutex_impls_t) (
592  int current_impl,
593  int *next_impl,
594  const char **next_impl_name
595);
596
597typedef ompt_set_result_t (*ompt_set_callback_t) (
598  ompt_callbacks_t event,
599  ompt_callback_t callback
600);
601
602typedef int (*ompt_get_callback_t) (
603  ompt_callbacks_t event,
604  ompt_callback_t *callback
605);
606
607typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
608
609typedef int (*ompt_get_num_procs_t) (void);
610
611typedef int (*ompt_get_num_places_t) (void);
612
613typedef int (*ompt_get_place_proc_ids_t) (
614  int place_num,
615  int ids_size,
616  int *ids
617);
618
619typedef int (*ompt_get_place_num_t) (void);
620
621typedef int (*ompt_get_partition_place_nums_t) (
622  int place_nums_size,
623  int *place_nums
624);
625
626typedef int (*ompt_get_proc_id_t) (void);
627
628typedef int (*ompt_get_state_t) (
629  ompt_wait_id_t *wait_id
630);
631
632typedef int (*ompt_get_parallel_info_t) (
633  int ancestor_level,
634  ompt_data_t **parallel_data,
635  int *team_size
636);
637
638typedef int (*ompt_get_task_info_t) (
639  int ancestor_level,
640  int *flags,
641  ompt_data_t **task_data,
642  ompt_frame_t **task_frame,
643  ompt_data_t **parallel_data,
644  int *thread_num
645);
646
647typedef int (*ompt_get_task_memory_t)(
648  void **addr,
649  size_t *size,
650  int block
651);
652
653typedef int (*ompt_get_target_info_t) (
654  uint64_t *device_num,
655  ompt_id_t *target_id,
656  ompt_id_t *host_op_id
657);
658
659typedef int (*ompt_get_num_devices_t) (void);
660
661typedef void (*ompt_finalize_tool_t) (void);
662
663typedef int (*ompt_get_device_num_procs_t) (
664  ompt_device_t *device
665);
666
667typedef ompt_device_time_t (*ompt_get_device_time_t) (
668  ompt_device_t *device
669);
670
671typedef double (*ompt_translate_time_t) (
672  ompt_device_t *device,
673  ompt_device_time_t time
674);
675
676typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
677  ompt_device_t *device,
678  unsigned int enable,
679  unsigned int etype
680);
681
682typedef ompt_set_result_t (*ompt_set_trace_native_t) (
683  ompt_device_t *device,
684  int enable,
685  int flags
686);
687
688typedef int (*ompt_start_trace_t) (
689  ompt_device_t *device,
690  ompt_callback_buffer_request_t request,
691  ompt_callback_buffer_complete_t complete
692);
693
694typedef int (*ompt_pause_trace_t) (
695  ompt_device_t *device,
696  int begin_pause
697);
698
699typedef int (*ompt_flush_trace_t) (
700  ompt_device_t *device
701);
702
703typedef int (*ompt_stop_trace_t) (
704  ompt_device_t *device
705);
706
707typedef int (*ompt_advance_buffer_cursor_t) (
708  ompt_device_t *device,
709  ompt_buffer_t *buffer,
710  size_t size,
711  ompt_buffer_cursor_t current,
712  ompt_buffer_cursor_t *next
713);
714
715typedef ompt_record_t (*ompt_get_record_type_t) (
716  ompt_buffer_t *buffer,
717  ompt_buffer_cursor_t current
718);
719
720typedef void *(*ompt_get_record_native_t) (
721  ompt_buffer_t *buffer,
722  ompt_buffer_cursor_t current,
723  ompt_id_t *host_op_id
724);
725
726typedef ompt_record_abstract_t *
727(*ompt_get_record_abstract_t) (
728  void *native_record
729);
730
731typedef void (*ompt_callback_thread_begin_t) (
732  ompt_thread_t thread_type,
733  ompt_data_t *thread_data
734);
735
736typedef struct ompt_record_thread_begin_t {
737  ompt_thread_t thread_type;
738} ompt_record_thread_begin_t;
739
740typedef void (*ompt_callback_thread_end_t) (
741  ompt_data_t *thread_data
742);
743
744typedef void (*ompt_callback_parallel_begin_t) (
745  ompt_data_t *encountering_task_data,
746  const ompt_frame_t *encountering_task_frame,
747  ompt_data_t *parallel_data,
748  unsigned int requested_parallelism,
749  int flags,
750  const void *codeptr_ra
751);
752
753typedef struct ompt_record_parallel_begin_t {
754  ompt_id_t encountering_task_id;
755  ompt_id_t parallel_id;
756  unsigned int requested_parallelism;
757  int flags;
758  const void *codeptr_ra;
759} ompt_record_parallel_begin_t;
760
761typedef void (*ompt_callback_parallel_end_t) (
762  ompt_data_t *parallel_data,
763  ompt_data_t *encountering_task_data,
764  int flags,
765  const void *codeptr_ra
766);
767
768typedef struct ompt_record_parallel_end_t {
769  ompt_id_t parallel_id;
770  ompt_id_t encountering_task_id;
771  int flags;
772  const void *codeptr_ra;
773} ompt_record_parallel_end_t;
774
775typedef void (*ompt_callback_work_t) (
776  ompt_work_t wstype,
777  ompt_scope_endpoint_t endpoint,
778  ompt_data_t *parallel_data,
779  ompt_data_t *task_data,
780  uint64_t count,
781  const void *codeptr_ra
782);
783
784typedef struct ompt_record_work_t {
785  ompt_work_t wstype;
786  ompt_scope_endpoint_t endpoint;
787  ompt_id_t parallel_id;
788  ompt_id_t task_id;
789  uint64_t count;
790  const void *codeptr_ra;
791} ompt_record_work_t;
792
793typedef void (*ompt_callback_dispatch_t) (
794  ompt_data_t *parallel_data,
795  ompt_data_t *task_data,
796  ompt_dispatch_t kind,
797  ompt_data_t instance
798);
799
800typedef struct ompt_record_dispatch_t {
801  ompt_id_t parallel_id;
802  ompt_id_t task_id;
803  ompt_dispatch_t kind;
804  ompt_data_t instance;
805} ompt_record_dispatch_t;
806
807typedef void (*ompt_callback_task_create_t) (
808  ompt_data_t *encountering_task_data,
809  const ompt_frame_t *encountering_task_frame,
810  ompt_data_t *new_task_data,
811  int flags,
812  int has_dependences,
813  const void *codeptr_ra
814);
815
816typedef struct ompt_record_task_create_t {
817  ompt_id_t encountering_task_id;
818  ompt_id_t new_task_id;
819  int flags;
820  int has_dependences;
821  const void *codeptr_ra;
822} ompt_record_task_create_t;
823
824typedef void (*ompt_callback_dependences_t) (
825  ompt_data_t *task_data,
826  const ompt_dependence_t *deps,
827  int ndeps
828);
829
830typedef struct ompt_record_dependences_t {
831  ompt_id_t task_id;
832  ompt_dependence_t dep;
833  int ndeps;
834} ompt_record_dependences_t;
835
836typedef void (*ompt_callback_task_dependence_t) (
837  ompt_data_t *src_task_data,
838  ompt_data_t *sink_task_data
839);
840
841typedef struct ompt_record_task_dependence_t {
842  ompt_id_t src_task_id;
843  ompt_id_t sink_task_id;
844} ompt_record_task_dependence_t;
845
846typedef void (*ompt_callback_task_schedule_t) (
847  ompt_data_t *prior_task_data,
848  ompt_task_status_t prior_task_status,
849  ompt_data_t *next_task_data
850);
851
852typedef struct ompt_record_task_schedule_t {
853  ompt_id_t prior_task_id;
854  ompt_task_status_t prior_task_status;
855  ompt_id_t next_task_id;
856} ompt_record_task_schedule_t;
857
858typedef void (*ompt_callback_implicit_task_t) (
859  ompt_scope_endpoint_t endpoint,
860  ompt_data_t *parallel_data,
861  ompt_data_t *task_data,
862  unsigned int actual_parallelism,
863  unsigned int index,
864  int flags
865);
866
867typedef struct ompt_record_implicit_task_t {
868  ompt_scope_endpoint_t endpoint;
869  ompt_id_t parallel_id;
870  ompt_id_t task_id;
871  unsigned int actual_parallelism;
872  unsigned int index;
873  int flags;
874} ompt_record_implicit_task_t;
875
876typedef void (*ompt_callback_masked_t) (
877  ompt_scope_endpoint_t endpoint,
878  ompt_data_t *parallel_data,
879  ompt_data_t *task_data,
880  const void *codeptr_ra
881);
882
883typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51;
884
885typedef struct ompt_record_masked_t {
886  ompt_scope_endpoint_t endpoint;
887  ompt_id_t parallel_id;
888  ompt_id_t task_id;
889  const void *codeptr_ra;
890} ompt_record_masked_t;
891
892typedef void (*ompt_callback_sync_region_t) (
893  ompt_sync_region_t kind,
894  ompt_scope_endpoint_t endpoint,
895  ompt_data_t *parallel_data,
896  ompt_data_t *task_data,
897  const void *codeptr_ra
898);
899
900typedef struct ompt_record_sync_region_t {
901  ompt_sync_region_t kind;
902  ompt_scope_endpoint_t endpoint;
903  ompt_id_t parallel_id;
904  ompt_id_t task_id;
905  const void *codeptr_ra;
906} ompt_record_sync_region_t;
907
908typedef void (*ompt_callback_mutex_acquire_t) (
909  ompt_mutex_t kind,
910  unsigned int hint,
911  unsigned int impl,
912  ompt_wait_id_t wait_id,
913  const void *codeptr_ra
914);
915
916typedef struct ompt_record_mutex_acquire_t {
917  ompt_mutex_t kind;
918  unsigned int hint;
919  unsigned int impl;
920  ompt_wait_id_t wait_id;
921  const void *codeptr_ra;
922} ompt_record_mutex_acquire_t;
923
924typedef void (*ompt_callback_mutex_t) (
925  ompt_mutex_t kind,
926  ompt_wait_id_t wait_id,
927  const void *codeptr_ra
928);
929
930typedef struct ompt_record_mutex_t {
931  ompt_mutex_t kind;
932  ompt_wait_id_t wait_id;
933  const void *codeptr_ra;
934} ompt_record_mutex_t;
935
936typedef void (*ompt_callback_nest_lock_t) (
937  ompt_scope_endpoint_t endpoint,
938  ompt_wait_id_t wait_id,
939  const void *codeptr_ra
940);
941
942typedef struct ompt_record_nest_lock_t {
943  ompt_scope_endpoint_t endpoint;
944  ompt_wait_id_t wait_id;
945  const void *codeptr_ra;
946} ompt_record_nest_lock_t;
947
948typedef void (*ompt_callback_flush_t) (
949  ompt_data_t *thread_data,
950  const void *codeptr_ra
951);
952
953typedef struct ompt_record_flush_t {
954  const void *codeptr_ra;
955} ompt_record_flush_t;
956
957typedef void (*ompt_callback_cancel_t) (
958  ompt_data_t *task_data,
959  int flags,
960  const void *codeptr_ra
961);
962
963typedef struct ompt_record_cancel_t {
964  ompt_id_t task_id;
965  int flags;
966  const void *codeptr_ra;
967} ompt_record_cancel_t;
968
969typedef void (*ompt_callback_device_initialize_t) (
970  int device_num,
971  const char *type,
972  ompt_device_t *device,
973  ompt_function_lookup_t lookup,
974  const char *documentation
975);
976
977typedef void (*ompt_callback_device_finalize_t) (
978  int device_num
979);
980
981typedef void (*ompt_callback_device_load_t) (
982  int device_num,
983  const char *filename,
984  int64_t offset_in_file,
985  void *vma_in_file,
986  size_t bytes,
987  void *host_addr,
988  void *device_addr,
989  uint64_t module_id
990);
991
992typedef void (*ompt_callback_device_unload_t) (
993  int device_num,
994  uint64_t module_id
995);
996
997typedef void (*ompt_callback_target_data_op_emi_t) (
998  ompt_scope_endpoint_t endpoint,
999  ompt_data_t *target_task_data,
1000  ompt_data_t *target_data,
1001  ompt_id_t *host_op_id,
1002  ompt_target_data_op_t optype,
1003  void *src_addr,
1004  int src_device_num,
1005  void *dest_addr,
1006  int dest_device_num,
1007  size_t bytes,
1008  const void *codeptr_ra
1009);
1010
1011typedef void (*ompt_callback_target_data_op_t) (
1012  ompt_id_t target_id,
1013  ompt_id_t host_op_id,
1014  ompt_target_data_op_t optype,
1015  void *src_addr,
1016  int src_device_num,
1017  void *dest_addr,
1018  int dest_device_num,
1019  size_t bytes,
1020  const void *codeptr_ra
1021);
1022
1023typedef struct ompt_record_target_data_op_t {
1024  ompt_id_t host_op_id;
1025  ompt_target_data_op_t optype;
1026  void *src_addr;
1027  int src_device_num;
1028  void *dest_addr;
1029  int dest_device_num;
1030  size_t bytes;
1031  ompt_device_time_t end_time;
1032  const void *codeptr_ra;
1033} ompt_record_target_data_op_t;
1034
1035typedef void (*ompt_callback_target_emi_t) (
1036  ompt_target_t kind,
1037  ompt_scope_endpoint_t endpoint,
1038  int device_num,
1039  ompt_data_t *task_data,
1040  ompt_data_t *target_task_data,
1041  ompt_data_t *target_data,
1042  const void *codeptr_ra
1043);
1044
1045typedef void (*ompt_callback_target_t) (
1046  ompt_target_t kind,
1047  ompt_scope_endpoint_t endpoint,
1048  int device_num,
1049  ompt_data_t *task_data,
1050  ompt_id_t target_id,
1051  const void *codeptr_ra
1052);
1053
1054typedef struct ompt_record_target_t {
1055  ompt_target_t kind;
1056  ompt_scope_endpoint_t endpoint;
1057  int device_num;
1058  ompt_id_t task_id;
1059  ompt_id_t target_id;
1060  const void *codeptr_ra;
1061} ompt_record_target_t;
1062
1063typedef void (*ompt_callback_target_map_emi_t) (
1064  ompt_data_t *target_data,
1065  unsigned int nitems,
1066  void **host_addr,
1067  void **device_addr,
1068  size_t *bytes,
1069  unsigned int *mapping_flags,
1070  const void *codeptr_ra
1071);
1072
1073typedef void (*ompt_callback_target_map_t) (
1074  ompt_id_t target_id,
1075  unsigned int nitems,
1076  void **host_addr,
1077  void **device_addr,
1078  size_t *bytes,
1079  unsigned int *mapping_flags,
1080  const void *codeptr_ra
1081);
1082
1083typedef struct ompt_record_target_map_t {
1084  ompt_id_t target_id;
1085  unsigned int nitems;
1086  void **host_addr;
1087  void **device_addr;
1088  size_t *bytes;
1089  unsigned int *mapping_flags;
1090  const void *codeptr_ra;
1091} ompt_record_target_map_t;
1092
1093typedef void (*ompt_callback_target_submit_emi_t) (
1094  ompt_scope_endpoint_t endpoint,
1095  ompt_data_t *target_data,
1096  ompt_id_t *host_op_id,
1097  unsigned int requested_num_teams
1098);
1099
1100typedef void (*ompt_callback_target_submit_t) (
1101  ompt_id_t target_id,
1102  ompt_id_t host_op_id,
1103  unsigned int requested_num_teams
1104);
1105
1106typedef struct ompt_record_target_kernel_t {
1107  ompt_id_t host_op_id;
1108  unsigned int requested_num_teams;
1109  unsigned int granted_num_teams;
1110  ompt_device_time_t end_time;
1111} ompt_record_target_kernel_t;
1112
1113typedef int (*ompt_callback_control_tool_t) (
1114  uint64_t command,
1115  uint64_t modifier,
1116  void *arg,
1117  const void *codeptr_ra
1118);
1119
1120typedef struct ompt_record_control_tool_t {
1121  uint64_t command;
1122  uint64_t modifier;
1123  const void *codeptr_ra;
1124} ompt_record_control_tool_t;
1125
1126typedef void (*ompt_callback_error_t) (
1127  ompt_severity_t severity,
1128  const char *message, size_t length,
1129  const void *codeptr_ra
1130);
1131
1132typedef struct ompt_record_error_t {
1133  ompt_severity_t severity;
1134  const char *message;
1135  size_t length;
1136  const void *codeptr_ra;
1137} ompt_record_error_t;
1138
1139typedef struct ompd_address_t {
1140  ompd_seg_t segment;
1141  ompd_addr_t address;
1142} ompd_address_t;
1143
1144typedef struct ompd_frame_info_t {
1145  ompd_address_t frame_address;
1146  ompd_word_t frame_flag;
1147} ompd_frame_info_t;
1148
1149typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
1150typedef struct _ompd_thread_handle ompd_thread_handle_t;
1151typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
1152typedef struct _ompd_task_handle ompd_task_handle_t;
1153
1154typedef struct _ompd_aspace_cont ompd_address_space_context_t;
1155typedef struct _ompd_thread_cont ompd_thread_context_t;
1156
1157typedef struct ompd_device_type_sizes_t {
1158  uint8_t sizeof_char;
1159  uint8_t sizeof_short;
1160  uint8_t sizeof_int;
1161  uint8_t sizeof_long;
1162  uint8_t sizeof_long_long;
1163  uint8_t sizeof_pointer;
1164} ompd_device_type_sizes_t;
1165
1166void ompd_dll_locations_valid(void);
1167
1168typedef ompd_rc_t (*ompd_callback_memory_alloc_fn_t)(ompd_size_t nbytes,
1169                                                     void **ptr);
1170
1171typedef ompd_rc_t (*ompd_callback_memory_free_fn_t)(void *ptr);
1172
1173typedef ompd_rc_t (*ompd_callback_get_thread_context_for_thread_id_fn_t)(
1174    ompd_address_space_context_t *address_space_context, ompd_thread_id_t kind,
1175    ompd_size_t sizeof_thread_id, const void *thread_id,
1176    ompd_thread_context_t **thread_context);
1177
1178typedef ompd_rc_t (*ompd_callback_sizeof_fn_t)(
1179    ompd_address_space_context_t *address_space_context,
1180    ompd_device_type_sizes_t *sizes);
1181
1182typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t)(
1183    ompd_address_space_context_t *address_space_context,
1184    ompd_thread_context_t *thread_context, const char *symbol_name,
1185    ompd_address_t *symbol_addr, const char *file_name);
1186
1187typedef ompd_rc_t (*ompd_callback_memory_read_fn_t)(
1188    ompd_address_space_context_t *address_space_context,
1189    ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1190    ompd_size_t nbytes, void *buffer);
1191
1192typedef ompd_rc_t (*ompd_callback_memory_write_fn_t)(
1193    ompd_address_space_context_t *address_space_context,
1194    ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1195    ompd_size_t nbytes, const void *buffer);
1196
1197typedef ompd_rc_t (*ompd_callback_device_host_fn_t)(
1198    ompd_address_space_context_t *address_space_context, const void *input,
1199    ompd_size_t unit_size, ompd_size_t count, void *output);
1200
1201typedef ompd_rc_t (*ompd_callback_print_string_fn_t)(const char *string,
1202                                                     int category);
1203
1204typedef struct ompd_callbacks_t {
1205  ompd_callback_memory_alloc_fn_t alloc_memory;
1206  ompd_callback_memory_free_fn_t free_memory;
1207  ompd_callback_print_string_fn_t print_string;
1208  ompd_callback_sizeof_fn_t sizeof_type;
1209  ompd_callback_symbol_addr_fn_t symbol_addr_lookup;
1210  ompd_callback_memory_read_fn_t read_memory;
1211  ompd_callback_memory_write_fn_t write_memory;
1212  ompd_callback_memory_read_fn_t read_string;
1213  ompd_callback_device_host_fn_t device_to_host;
1214  ompd_callback_device_host_fn_t host_to_device;
1215  ompd_callback_get_thread_context_for_thread_id_fn_t
1216      get_thread_context_for_thread_id;
1217} ompd_callbacks_t;
1218
1219void ompd_bp_parallel_begin(void);
1220
1221void ompd_bp_parallel_end(void);
1222
1223void ompd_bp_task_begin(void);
1224
1225void ompd_bp_task_end(void);
1226
1227void ompd_bp_thread_begin(void);
1228
1229void ompd_bp_thread_end(void);
1230
1231void ompd_bp_device_begin(void);
1232
1233void ompd_bp_device_end(void);
1234
1235ompd_rc_t ompd_initialize(ompd_word_t api_version,
1236                          const ompd_callbacks_t *callbacks);
1237
1238ompd_rc_t ompd_get_api_version(ompd_word_t *version);
1239
1240ompd_rc_t ompd_get_version_string(const char **string);
1241
1242ompd_rc_t ompd_finalize(void);
1243
1244ompd_rc_t ompd_process_initialize(ompd_address_space_context_t *context,
1245                                  ompd_address_space_handle_t **handle);
1246
1247ompd_rc_t ompd_device_initialize(ompd_address_space_handle_t *process_handle,
1248                                 ompd_address_space_context_t *device_context,
1249                                 ompd_device_t kind, ompd_size_t sizeof_id,
1250                                 void *id,
1251                                 ompd_address_space_handle_t **device_handle);
1252
1253ompd_rc_t ompd_rel_address_space_handle(ompd_address_space_handle_t *handle);
1254
1255ompd_rc_t ompd_get_omp_version(ompd_address_space_handle_t *address_space,
1256                               ompd_word_t *omp_version);
1257
1258ompd_rc_t
1259ompd_get_omp_version_string(ompd_address_space_handle_t *address_space,
1260                            const char **string);
1261
1262ompd_rc_t ompd_get_thread_in_parallel(ompd_parallel_handle_t *parallel_handle,
1263                                      int thread_num,
1264                                      ompd_thread_handle_t **thread_handle);
1265
1266ompd_rc_t ompd_get_thread_handle(ompd_address_space_handle_t *handle,
1267                                 ompd_thread_id_t kind,
1268                                 ompd_size_t sizeof_thread_id,
1269                                 const void *thread_id,
1270                                 ompd_thread_handle_t **thread_handle);
1271
1272ompd_rc_t ompd_rel_thread_handle(ompd_thread_handle_t *thread_handle);
1273
1274ompd_rc_t ompd_thread_handle_compare(ompd_thread_handle_t *thread_handle_1,
1275                                     ompd_thread_handle_t *thread_handle_2,
1276                                     int *cmp_value);
1277
1278ompd_rc_t ompd_get_thread_id(ompd_thread_handle_t *thread_handle,
1279                             ompd_thread_id_t kind,
1280                             ompd_size_t sizeof_thread_id, void *thread_id);
1281
1282ompd_rc_t
1283ompd_get_curr_parallel_handle(ompd_thread_handle_t *thread_handle,
1284                              ompd_parallel_handle_t **parallel_handle);
1285
1286ompd_rc_t ompd_get_enclosing_parallel_handle(
1287    ompd_parallel_handle_t *parallel_handle,
1288    ompd_parallel_handle_t **enclosing_parallel_handle);
1289
1290ompd_rc_t
1291ompd_get_task_parallel_handle(ompd_task_handle_t *task_handle,
1292                              ompd_parallel_handle_t **task_parallel_handle);
1293
1294ompd_rc_t ompd_rel_parallel_handle(ompd_parallel_handle_t *parallel_handle);
1295
1296ompd_rc_t
1297ompd_parallel_handle_compare(ompd_parallel_handle_t *parallel_handle_1,
1298                             ompd_parallel_handle_t *parallel_handle_2,
1299                             int *cmp_value);
1300
1301ompd_rc_t ompd_get_curr_task_handle(ompd_thread_handle_t *thread_handle,
1302                                    ompd_task_handle_t **task_handle);
1303
1304ompd_rc_t
1305ompd_get_generating_task_handle(ompd_task_handle_t *task_handle,
1306                                ompd_task_handle_t **generating_task_handle);
1307
1308ompd_rc_t
1309ompd_get_scheduling_task_handle(ompd_task_handle_t *task_handle,
1310                                ompd_task_handle_t **scheduling_task_handle);
1311
1312ompd_rc_t ompd_get_task_in_parallel(ompd_parallel_handle_t *parallel_handle,
1313                                    int thread_num,
1314                                    ompd_task_handle_t **task_handle);
1315
1316ompd_rc_t ompd_rel_task_handle(ompd_task_handle_t *task_handle);
1317
1318ompd_rc_t ompd_task_handle_compare(ompd_task_handle_t *task_handle_1,
1319                                   ompd_task_handle_t *task_handle_2,
1320                                   int *cmp_value);
1321
1322ompd_rc_t ompd_get_task_function(ompd_task_handle_t *task_handle,
1323                                 ompd_address_t *entry_point);
1324
1325ompd_rc_t ompd_get_task_frame(ompd_task_handle_t *task_handle,
1326                              ompd_frame_info_t *exit_frame,
1327                              ompd_frame_info_t *enter_frame);
1328
1329ompd_rc_t
1330ompd_enumerate_states(ompd_address_space_handle_t *address_space_handle,
1331                      ompd_word_t current_state, ompd_word_t *next_state,
1332                      const char **next_state_name, ompd_word_t *more_enums);
1333
1334ompd_rc_t ompd_get_state(ompd_thread_handle_t *thread_handle,
1335                         ompd_word_t *state, ompd_wait_id_t *wait_id);
1336
1337ompd_rc_t
1338ompd_get_display_control_vars(ompd_address_space_handle_t *address_space_handle,
1339                              const char *const **control_vars);
1340
1341ompd_rc_t ompd_rel_display_control_vars(const char *const **control_vars);
1342
1343ompd_rc_t ompd_enumerate_icvs(ompd_address_space_handle_t *handle,
1344                              ompd_icv_id_t current, ompd_icv_id_t *next_id,
1345                              const char **next_icv_name,
1346                              ompd_scope_t *next_scope, int *more);
1347
1348ompd_rc_t ompd_get_icv_from_scope(void *handle, ompd_scope_t scope,
1349                                  ompd_icv_id_t icv_id, ompd_word_t *icv_value);
1350
1351ompd_rc_t ompd_get_icv_string_from_scope(void *handle, ompd_scope_t scope,
1352                                         ompd_icv_id_t icv_id,
1353                                         const char **icv_string);
1354
1355ompd_rc_t ompd_get_tool_data(void *handle, ompd_scope_t scope,
1356                             ompd_word_t *value, ompd_address_t *ptr);
1357
1358typedef struct ompt_record_ompt_t {
1359  ompt_callbacks_t type;
1360  ompt_device_time_t time;
1361  ompt_id_t thread_id;
1362  ompt_id_t target_id;
1363  union {
1364    ompt_record_thread_begin_t thread_begin;
1365    ompt_record_parallel_begin_t parallel_begin;
1366    ompt_record_parallel_end_t parallel_end;
1367    ompt_record_work_t work;
1368    ompt_record_dispatch_t dispatch;
1369    ompt_record_task_create_t task_create;
1370    ompt_record_dependences_t dependences;
1371    ompt_record_task_dependence_t task_dependence;
1372    ompt_record_task_schedule_t task_schedule;
1373    ompt_record_implicit_task_t implicit_task;
1374    ompt_record_masked_t masked;
1375    ompt_record_sync_region_t sync_region;
1376    ompt_record_mutex_acquire_t mutex_acquire;
1377    ompt_record_mutex_t mutex;
1378    ompt_record_nest_lock_t nest_lock;
1379    ompt_record_flush_t flush;
1380    ompt_record_cancel_t cancel;
1381    ompt_record_target_t target;
1382    ompt_record_target_data_op_t target_data_op;
1383    ompt_record_target_map_t target_map;
1384    ompt_record_target_kernel_t target_kernel;
1385    ompt_record_control_tool_t control_tool;
1386  } record;
1387} ompt_record_ompt_t;
1388
1389typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
1390  ompt_buffer_t *buffer,
1391  ompt_buffer_cursor_t current
1392);
1393
1394#define ompt_id_none 0
1395#define ompt_data_none {0}
1396#define ompt_time_none 0
1397#define ompt_hwid_none 0
1398#define ompt_addr_none ~0
1399#define ompt_mutex_impl_none 0
1400#define ompt_wait_id_none 0
1401
1402#define ompd_segment_none 0
1403
1404#endif /* __OMPT__ */
1405