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