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