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