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