3 * include/omp-tools.h.var
6 //===----------------------------------------------------------------------===//
8 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See https://llvm.org/LICENSE.txt for license information.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12 //===----------------------------------------------------------------------===//
17 /*****************************************************************************
18 * system include files
19 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
28 #define FOREACH_OMPT_INQUIRY_FN(macro) \
29 macro (ompt_enumerate_states) \
30 macro (ompt_enumerate_mutex_impls) \
32 macro (ompt_set_callback) \
33 macro (ompt_get_callback) \
35 macro (ompt_get_state) \
37 macro (ompt_get_parallel_info) \
38 macro (ompt_get_task_info) \
39 macro (ompt_get_task_memory) \
40 macro (ompt_get_thread_data) \
41 macro (ompt_get_unique_id) \
42 macro (ompt_finalize_tool) \
44 macro(ompt_get_num_procs) \
45 macro(ompt_get_num_places) \
46 macro(ompt_get_place_proc_ids) \
47 macro(ompt_get_place_num) \
48 macro(ompt_get_partition_place_nums) \
49 macro(ompt_get_proc_id) \
51 macro(ompt_get_target_info) \
52 macro(ompt_get_num_devices)
54 #define FOREACH_OMPT_STATE(macro) \
56 /* first available state */ \
57 macro (ompt_state_undefined, 0x102) /* undefined thread state */ \
59 /* work states (0..15) */ \
60 macro (ompt_state_work_serial, 0x000) /* working outside parallel */ \
61 macro (ompt_state_work_parallel, 0x001) /* working within parallel */ \
62 macro (ompt_state_work_reduction, 0x002) /* performing a reduction */ \
64 /* barrier wait states (16..31) */ \
65 macro (ompt_state_wait_barrier, 0x010) /* waiting at a barrier */ \
66 macro (ompt_state_wait_barrier_implicit_parallel, 0x011) \
67 /* implicit barrier at the end of parallel region */\
68 macro (ompt_state_wait_barrier_implicit_workshare, 0x012) \
69 /* implicit barrier at the end of worksharing */ \
70 macro (ompt_state_wait_barrier_implicit, 0x013) /* implicit barrier */ \
71 macro (ompt_state_wait_barrier_explicit, 0x014) /* explicit barrier */ \
73 /* task wait states (32..63) */ \
74 macro (ompt_state_wait_taskwait, 0x020) /* waiting at a taskwait */ \
75 macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */ \
77 /* mutex wait states (64..127) */ \
78 macro (ompt_state_wait_mutex, 0x040) \
79 macro (ompt_state_wait_lock, 0x041) /* waiting for lock */ \
80 macro (ompt_state_wait_critical, 0x042) /* waiting for critical */ \
81 macro (ompt_state_wait_atomic, 0x043) /* waiting for atomic */ \
82 macro (ompt_state_wait_ordered, 0x044) /* waiting for ordered */ \
84 /* target wait states (128..255) */ \
85 macro (ompt_state_wait_target, 0x080) /* waiting for target region */ \
86 macro (ompt_state_wait_target_map, 0x081) /* waiting for target data mapping operation */ \
87 macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */ \
89 /* misc (256..511) */ \
90 macro (ompt_state_idle, 0x100) /* waiting for work */ \
91 macro (ompt_state_overhead, 0x101) /* overhead excluding wait states */ \
93 /* implementation-specific states (512..) */
96 #define FOREACH_KMP_MUTEX_IMPL(macro) \
97 macro (kmp_mutex_impl_none, 0) /* unknown implementation */ \
98 macro (kmp_mutex_impl_spin, 1) /* based on spin */ \
99 macro (kmp_mutex_impl_queuing, 2) /* based on some fair policy */ \
100 macro (kmp_mutex_impl_speculative, 3) /* based on HW-supported speculation */
102 #define FOREACH_OMPT_EVENT(macro) \
104 /*--- Mandatory Events ---*/ \
105 macro (ompt_callback_thread_begin, ompt_callback_thread_begin_t, 1) /* thread begin */ \
106 macro (ompt_callback_thread_end, ompt_callback_thread_end_t, 2) /* thread end */ \
108 macro (ompt_callback_parallel_begin, ompt_callback_parallel_begin_t, 3) /* parallel begin */ \
109 macro (ompt_callback_parallel_end, ompt_callback_parallel_end_t, 4) /* parallel end */ \
111 macro (ompt_callback_task_create, ompt_callback_task_create_t, 5) /* task begin */ \
112 macro (ompt_callback_task_schedule, ompt_callback_task_schedule_t, 6) /* task schedule */ \
113 macro (ompt_callback_implicit_task, ompt_callback_implicit_task_t, 7) /* implicit task */ \
115 macro (ompt_callback_target, ompt_callback_target_t, 8) /* target */ \
116 macro (ompt_callback_target_data_op, ompt_callback_target_data_op_t, 9) /* target data op */ \
117 macro (ompt_callback_target_submit, ompt_callback_target_submit_t, 10) /* target submit */ \
119 macro (ompt_callback_control_tool, ompt_callback_control_tool_t, 11) /* control tool */ \
121 macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize */ \
122 macro (ompt_callback_device_finalize, ompt_callback_device_finalize_t, 13) /* device finalize */ \
124 macro (ompt_callback_device_load, ompt_callback_device_load_t, 14) /* device load */ \
125 macro (ompt_callback_device_unload, ompt_callback_device_unload_t, 15) /* device unload */ \
127 /* Optional Events */ \
128 macro (ompt_callback_sync_region_wait, ompt_callback_sync_region_t, 16) /* sync region wait begin or end */ \
130 macro (ompt_callback_mutex_released, ompt_callback_mutex_t, 17) /* mutex released */ \
132 macro (ompt_callback_dependences, ompt_callback_dependences_t, 18) /* report task dependences */ \
133 macro (ompt_callback_task_dependence, ompt_callback_task_dependence_t, 19) /* report task dependence */ \
135 macro (ompt_callback_work, ompt_callback_work_t, 20) /* task at work begin or end */ \
137 macro (ompt_callback_master, ompt_callback_master_t, 21) /* task at master begin or end */ \
139 macro (ompt_callback_target_map, ompt_callback_target_map_t, 22) /* target map */ \
141 macro (ompt_callback_sync_region, ompt_callback_sync_region_t, 23) /* sync region begin or end */ \
143 macro (ompt_callback_lock_init, ompt_callback_mutex_acquire_t, 24) /* lock init */ \
144 macro (ompt_callback_lock_destroy, ompt_callback_mutex_t, 25) /* lock destroy */ \
146 macro (ompt_callback_mutex_acquire, ompt_callback_mutex_acquire_t, 26) /* mutex acquire */ \
147 macro (ompt_callback_mutex_acquired, ompt_callback_mutex_t, 27) /* mutex acquired */ \
149 macro (ompt_callback_nest_lock, ompt_callback_nest_lock_t, 28) /* nest lock */ \
151 macro (ompt_callback_flush, ompt_callback_flush_t, 29) /* after executing flush */ \
153 macro (ompt_callback_cancel, ompt_callback_cancel_t, 30) /* cancel innermost binding region */ \
155 macro (ompt_callback_reduction, ompt_callback_sync_region_t, 31) /* reduction */ \
157 macro (ompt_callback_dispatch, ompt_callback_dispatch_t, 32) /* dispatch of work */
159 /*****************************************************************************
160 * implementation specific types
161 *****************************************************************************/
163 typedef enum kmp_mutex_impl_t {
164 #define kmp_mutex_impl_macro(impl, code) impl = code,
165 FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
166 #undef kmp_mutex_impl_macro
169 /*****************************************************************************
170 * definitions generated from spec
171 *****************************************************************************/
173 typedef enum ompt_callbacks_t {
174 ompt_callback_thread_begin = 1,
175 ompt_callback_thread_end = 2,
176 ompt_callback_parallel_begin = 3,
177 ompt_callback_parallel_end = 4,
178 ompt_callback_task_create = 5,
179 ompt_callback_task_schedule = 6,
180 ompt_callback_implicit_task = 7,
181 ompt_callback_target = 8,
182 ompt_callback_target_data_op = 9,
183 ompt_callback_target_submit = 10,
184 ompt_callback_control_tool = 11,
185 ompt_callback_device_initialize = 12,
186 ompt_callback_device_finalize = 13,
187 ompt_callback_device_load = 14,
188 ompt_callback_device_unload = 15,
189 ompt_callback_sync_region_wait = 16,
190 ompt_callback_mutex_released = 17,
191 ompt_callback_dependences = 18,
192 ompt_callback_task_dependence = 19,
193 ompt_callback_work = 20,
194 ompt_callback_master = 21,
195 ompt_callback_target_map = 22,
196 ompt_callback_sync_region = 23,
197 ompt_callback_lock_init = 24,
198 ompt_callback_lock_destroy = 25,
199 ompt_callback_mutex_acquire = 26,
200 ompt_callback_mutex_acquired = 27,
201 ompt_callback_nest_lock = 28,
202 ompt_callback_flush = 29,
203 ompt_callback_cancel = 30,
204 ompt_callback_reduction = 31,
205 ompt_callback_dispatch = 32
208 typedef enum ompt_record_t {
209 ompt_record_ompt = 1,
210 ompt_record_native = 2,
211 ompt_record_invalid = 3
214 typedef enum ompt_record_native_t {
215 ompt_record_native_info = 1,
216 ompt_record_native_event = 2
217 } ompt_record_native_t;
219 typedef enum ompt_set_result_t {
222 ompt_set_impossible = 2,
223 ompt_set_sometimes = 3,
224 ompt_set_sometimes_paired = 4,
228 typedef uint64_t ompt_id_t;
230 typedef uint64_t ompt_device_time_t;
232 typedef uint64_t ompt_buffer_cursor_t;
234 typedef enum ompt_thread_t {
235 ompt_thread_initial = 1,
236 ompt_thread_worker = 2,
237 ompt_thread_other = 3,
238 ompt_thread_unknown = 4
241 typedef enum ompt_scope_endpoint_t {
242 ompt_scope_begin = 1,
244 } ompt_scope_endpoint_t;
246 typedef enum ompt_dispatch_t {
247 ompt_dispatch_iteration = 1,
248 ompt_dispatch_section = 2
251 typedef enum ompt_sync_region_t {
252 ompt_sync_region_barrier = 1,
253 ompt_sync_region_barrier_implicit = 2,
254 ompt_sync_region_barrier_explicit = 3,
255 ompt_sync_region_barrier_implementation = 4,
256 ompt_sync_region_taskwait = 5,
257 ompt_sync_region_taskgroup = 6,
258 ompt_sync_region_reduction = 7
259 } ompt_sync_region_t;
261 typedef enum ompt_target_data_op_t {
262 ompt_target_data_alloc = 1,
263 ompt_target_data_transfer_to_device = 2,
264 ompt_target_data_transfer_from_device = 3,
265 ompt_target_data_delete = 4,
266 ompt_target_data_associate = 5,
267 ompt_target_data_disassociate = 6
268 } ompt_target_data_op_t;
270 typedef enum ompt_work_t {
272 ompt_work_sections = 2,
273 ompt_work_single_executor = 3,
274 ompt_work_single_other = 4,
275 ompt_work_workshare = 5,
276 ompt_work_distribute = 6,
277 ompt_work_taskloop = 7
280 typedef enum ompt_mutex_t {
282 ompt_mutex_test_lock = 2,
283 ompt_mutex_nest_lock = 3,
284 ompt_mutex_test_nest_lock = 4,
285 ompt_mutex_critical = 5,
286 ompt_mutex_atomic = 6,
287 ompt_mutex_ordered = 7
290 typedef enum ompt_native_mon_flag_t {
291 ompt_native_data_motion_explicit = 0x01,
292 ompt_native_data_motion_implicit = 0x02,
293 ompt_native_kernel_invocation = 0x04,
294 ompt_native_kernel_execution = 0x08,
295 ompt_native_driver = 0x10,
296 ompt_native_runtime = 0x20,
297 ompt_native_overhead = 0x40,
298 ompt_native_idleness = 0x80
299 } ompt_native_mon_flag_t;
301 typedef enum ompt_task_flag_t {
302 ompt_task_initial = 0x00000001,
303 ompt_task_implicit = 0x00000002,
304 ompt_task_explicit = 0x00000004,
305 ompt_task_target = 0x00000008,
306 ompt_task_undeferred = 0x08000000,
307 ompt_task_untied = 0x10000000,
308 ompt_task_final = 0x20000000,
309 ompt_task_mergeable = 0x40000000,
310 ompt_task_merged = 0x80000000
313 typedef enum ompt_task_status_t {
314 ompt_task_complete = 1,
316 ompt_task_cancel = 3,
317 ompt_task_detach = 4,
318 ompt_task_early_fulfill = 5,
319 ompt_task_late_fulfill = 6,
321 } ompt_task_status_t;
323 typedef enum ompt_target_t {
325 ompt_target_enter_data = 2,
326 ompt_target_exit_data = 3,
327 ompt_target_update = 4
330 typedef enum ompt_parallel_flag_t {
331 ompt_parallel_invoker_program = 0x00000001,
332 ompt_parallel_invoker_runtime = 0x00000002,
333 ompt_parallel_league = 0x40000000,
334 ompt_parallel_team = 0x80000000
335 } ompt_parallel_flag_t;
337 typedef enum ompt_target_map_flag_t {
338 ompt_target_map_flag_to = 0x01,
339 ompt_target_map_flag_from = 0x02,
340 ompt_target_map_flag_alloc = 0x04,
341 ompt_target_map_flag_release = 0x08,
342 ompt_target_map_flag_delete = 0x10,
343 ompt_target_map_flag_implicit = 0x20
344 } ompt_target_map_flag_t;
346 typedef enum ompt_dependence_type_t {
347 ompt_dependence_type_in = 1,
348 ompt_dependence_type_out = 2,
349 ompt_dependence_type_inout = 3,
350 ompt_dependence_type_mutexinoutset = 4,
351 ompt_dependence_type_source = 5,
352 ompt_dependence_type_sink = 6
353 } ompt_dependence_type_t;
355 typedef enum ompt_cancel_flag_t {
356 ompt_cancel_parallel = 0x01,
357 ompt_cancel_sections = 0x02,
358 ompt_cancel_loop = 0x04,
359 ompt_cancel_taskgroup = 0x08,
360 ompt_cancel_activated = 0x10,
361 ompt_cancel_detected = 0x20,
362 ompt_cancel_discarded_task = 0x40
363 } ompt_cancel_flag_t;
365 typedef uint64_t ompt_hwid_t;
367 typedef uint64_t ompt_wait_id_t;
369 typedef enum ompt_frame_flag_t {
370 ompt_frame_runtime = 0x00,
371 ompt_frame_application = 0x01,
372 ompt_frame_cfa = 0x10,
373 ompt_frame_framepointer = 0x20,
374 ompt_frame_stackaddress = 0x30
377 typedef enum ompt_state_t {
378 ompt_state_work_serial = 0x000,
379 ompt_state_work_parallel = 0x001,
380 ompt_state_work_reduction = 0x002,
382 ompt_state_wait_barrier = 0x010,
383 ompt_state_wait_barrier_implicit_parallel = 0x011,
384 ompt_state_wait_barrier_implicit_workshare = 0x012,
385 ompt_state_wait_barrier_implicit = 0x013,
386 ompt_state_wait_barrier_explicit = 0x014,
388 ompt_state_wait_taskwait = 0x020,
389 ompt_state_wait_taskgroup = 0x021,
391 ompt_state_wait_mutex = 0x040,
392 ompt_state_wait_lock = 0x041,
393 ompt_state_wait_critical = 0x042,
394 ompt_state_wait_atomic = 0x043,
395 ompt_state_wait_ordered = 0x044,
397 ompt_state_wait_target = 0x080,
398 ompt_state_wait_target_map = 0x081,
399 ompt_state_wait_target_update = 0x082,
401 ompt_state_idle = 0x100,
402 ompt_state_overhead = 0x101,
403 ompt_state_undefined = 0x102
406 typedef uint64_t (*ompt_get_unique_id_t) (void);
408 typedef uint64_t ompd_size_t;
410 typedef uint64_t ompd_wait_id_t;
412 typedef uint64_t ompd_addr_t;
413 typedef int64_t ompd_word_t;
414 typedef uint64_t ompd_seg_t;
416 typedef uint64_t ompd_device_t;
418 typedef uint64_t ompd_thread_id_t;
420 typedef enum ompd_scope_t {
421 ompd_scope_global = 1,
422 ompd_scope_address_space = 2,
423 ompd_scope_thread = 3,
424 ompd_scope_parallel = 4,
425 ompd_scope_implicit_task = 5,
429 typedef uint64_t ompd_icv_id_t;
431 typedef enum ompd_rc_t {
433 ompd_rc_unavailable = 1,
434 ompd_rc_stale_handle = 2,
435 ompd_rc_bad_input = 3,
437 ompd_rc_unsupported = 5,
438 ompd_rc_needs_state_tracking = 6,
439 ompd_rc_incompatible = 7,
440 ompd_rc_device_read_error = 8,
441 ompd_rc_device_write_error = 9,
445 typedef void (*ompt_interface_fn_t) (void);
447 typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
448 const char *interface_function_name
451 typedef union ompt_data_t {
456 typedef struct ompt_frame_t {
457 ompt_data_t exit_frame;
458 ompt_data_t enter_frame;
459 int exit_frame_flags;
460 int enter_frame_flags;
463 typedef void (*ompt_callback_t) (void);
465 typedef void ompt_device_t;
467 typedef void ompt_buffer_t;
469 typedef void (*ompt_callback_buffer_request_t) (
471 ompt_buffer_t **buffer,
475 typedef void (*ompt_callback_buffer_complete_t) (
477 ompt_buffer_t *buffer,
479 ompt_buffer_cursor_t begin,
483 typedef void (*ompt_finalize_t) (
484 ompt_data_t *tool_data
487 typedef int (*ompt_initialize_t) (
488 ompt_function_lookup_t lookup,
489 int initial_device_num,
490 ompt_data_t *tool_data
493 typedef struct ompt_start_tool_result_t {
494 ompt_initialize_t initialize;
495 ompt_finalize_t finalize;
496 ompt_data_t tool_data;
497 } ompt_start_tool_result_t;
499 typedef struct ompt_record_abstract_t {
500 ompt_record_native_t rclass;
502 ompt_device_time_t start_time;
503 ompt_device_time_t end_time;
505 } ompt_record_abstract_t;
507 typedef struct ompt_dependence_t {
508 ompt_data_t variable;
509 ompt_dependence_type_t dependence_type;
512 typedef int (*ompt_enumerate_states_t) (
515 const char **next_state_name
518 typedef int (*ompt_enumerate_mutex_impls_t) (
521 const char **next_impl_name
524 typedef ompt_set_result_t (*ompt_set_callback_t) (
525 ompt_callbacks_t event,
526 ompt_callback_t callback
529 typedef int (*ompt_get_callback_t) (
530 ompt_callbacks_t event,
531 ompt_callback_t *callback
534 typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
536 typedef int (*ompt_get_num_procs_t) (void);
538 typedef int (*ompt_get_num_places_t) (void);
540 typedef int (*ompt_get_place_proc_ids_t) (
546 typedef int (*ompt_get_place_num_t) (void);
548 typedef int (*ompt_get_partition_place_nums_t) (
553 typedef int (*ompt_get_proc_id_t) (void);
555 typedef int (*ompt_get_state_t) (
556 ompt_wait_id_t *wait_id
559 typedef int (*ompt_get_parallel_info_t) (
561 ompt_data_t **parallel_data,
565 typedef int (*ompt_get_task_info_t) (
568 ompt_data_t **task_data,
569 ompt_frame_t **task_frame,
570 ompt_data_t **parallel_data,
574 typedef int (*ompt_get_task_memory_t)(
580 typedef int (*ompt_get_target_info_t) (
581 uint64_t *device_num,
582 ompt_id_t *target_id,
583 ompt_id_t *host_op_id
586 typedef int (*ompt_get_num_devices_t) (void);
588 typedef void (*ompt_finalize_tool_t) (void);
590 typedef int (*ompt_get_device_num_procs_t) (
591 ompt_device_t *device
594 typedef ompt_device_time_t (*ompt_get_device_time_t) (
595 ompt_device_t *device
598 typedef double (*ompt_translate_time_t) (
599 ompt_device_t *device,
600 ompt_device_time_t time
603 typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
604 ompt_device_t *device,
609 typedef ompt_set_result_t (*ompt_set_trace_native_t) (
610 ompt_device_t *device,
615 typedef int (*ompt_start_trace_t) (
616 ompt_device_t *device,
617 ompt_callback_buffer_request_t request,
618 ompt_callback_buffer_complete_t complete
621 typedef int (*ompt_pause_trace_t) (
622 ompt_device_t *device,
626 typedef int (*ompt_flush_trace_t) (
627 ompt_device_t *device
630 typedef int (*ompt_stop_trace_t) (
631 ompt_device_t *device
634 typedef int (*ompt_advance_buffer_cursor_t) (
635 ompt_device_t *device,
636 ompt_buffer_t *buffer,
638 ompt_buffer_cursor_t current,
639 ompt_buffer_cursor_t *next
642 typedef ompt_record_t (*ompt_get_record_type_t) (
643 ompt_buffer_t *buffer,
644 ompt_buffer_cursor_t current
647 typedef void *(*ompt_get_record_native_t) (
648 ompt_buffer_t *buffer,
649 ompt_buffer_cursor_t current,
650 ompt_id_t *host_op_id
653 typedef ompt_record_abstract_t *
654 (*ompt_get_record_abstract_t) (
658 typedef void (*ompt_callback_thread_begin_t) (
659 ompt_thread_t thread_type,
660 ompt_data_t *thread_data
663 typedef struct ompt_record_thread_begin_t {
664 ompt_thread_t thread_type;
665 } ompt_record_thread_begin_t;
667 typedef void (*ompt_callback_thread_end_t) (
668 ompt_data_t *thread_data
671 typedef void (*ompt_callback_parallel_begin_t) (
672 ompt_data_t *encountering_task_data,
673 const ompt_frame_t *encountering_task_frame,
674 ompt_data_t *parallel_data,
675 unsigned int requested_parallelism,
677 const void *codeptr_ra
680 typedef struct ompt_record_parallel_begin_t {
681 ompt_id_t encountering_task_id;
682 ompt_id_t parallel_id;
683 unsigned int requested_parallelism;
685 const void *codeptr_ra;
686 } ompt_record_parallel_begin_t;
688 typedef void (*ompt_callback_parallel_end_t) (
689 ompt_data_t *parallel_data,
690 ompt_data_t *encountering_task_data,
692 const void *codeptr_ra
695 typedef struct ompt_record_parallel_end_t {
696 ompt_id_t parallel_id;
697 ompt_id_t encountering_task_id;
699 const void *codeptr_ra;
700 } ompt_record_parallel_end_t;
702 typedef void (*ompt_callback_work_t) (
704 ompt_scope_endpoint_t endpoint,
705 ompt_data_t *parallel_data,
706 ompt_data_t *task_data,
708 const void *codeptr_ra
711 typedef struct ompt_record_work_t {
713 ompt_scope_endpoint_t endpoint;
714 ompt_id_t parallel_id;
717 const void *codeptr_ra;
718 } ompt_record_work_t;
720 typedef void (*ompt_callback_dispatch_t) (
721 ompt_data_t *parallel_data,
722 ompt_data_t *task_data,
723 ompt_dispatch_t kind,
727 typedef struct ompt_record_dispatch_t {
728 ompt_id_t parallel_id;
730 ompt_dispatch_t kind;
731 ompt_data_t instance;
732 } ompt_record_dispatch_t;
734 typedef void (*ompt_callback_task_create_t) (
735 ompt_data_t *encountering_task_data,
736 const ompt_frame_t *encountering_task_frame,
737 ompt_data_t *new_task_data,
740 const void *codeptr_ra
743 typedef struct ompt_record_task_create_t {
744 ompt_id_t encountering_task_id;
745 ompt_id_t new_task_id;
748 const void *codeptr_ra;
749 } ompt_record_task_create_t;
751 typedef void (*ompt_callback_dependences_t) (
752 ompt_data_t *task_data,
753 const ompt_dependence_t *deps,
757 typedef struct ompt_record_dependences_t {
759 ompt_dependence_t dep;
761 } ompt_record_dependences_t;
763 typedef void (*ompt_callback_task_dependence_t) (
764 ompt_data_t *src_task_data,
765 ompt_data_t *sink_task_data
768 typedef struct ompt_record_task_dependence_t {
769 ompt_id_t src_task_id;
770 ompt_id_t sink_task_id;
771 } ompt_record_task_dependence_t;
773 typedef void (*ompt_callback_task_schedule_t) (
774 ompt_data_t *prior_task_data,
775 ompt_task_status_t prior_task_status,
776 ompt_data_t *next_task_data
779 typedef struct ompt_record_task_schedule_t {
780 ompt_id_t prior_task_id;
781 ompt_task_status_t prior_task_status;
782 ompt_id_t next_task_id;
783 } ompt_record_task_schedule_t;
785 typedef void (*ompt_callback_implicit_task_t) (
786 ompt_scope_endpoint_t endpoint,
787 ompt_data_t *parallel_data,
788 ompt_data_t *task_data,
789 unsigned int actual_parallelism,
794 typedef struct ompt_record_implicit_task_t {
795 ompt_scope_endpoint_t endpoint;
796 ompt_id_t parallel_id;
798 unsigned int actual_parallelism;
801 } ompt_record_implicit_task_t;
803 typedef void (*ompt_callback_master_t) (
804 ompt_scope_endpoint_t endpoint,
805 ompt_data_t *parallel_data,
806 ompt_data_t *task_data,
807 const void *codeptr_ra
810 typedef struct ompt_record_master_t {
811 ompt_scope_endpoint_t endpoint;
812 ompt_id_t parallel_id;
814 const void *codeptr_ra;
815 } ompt_record_master_t;
817 typedef void (*ompt_callback_sync_region_t) (
818 ompt_sync_region_t kind,
819 ompt_scope_endpoint_t endpoint,
820 ompt_data_t *parallel_data,
821 ompt_data_t *task_data,
822 const void *codeptr_ra
825 typedef struct ompt_record_sync_region_t {
826 ompt_sync_region_t kind;
827 ompt_scope_endpoint_t endpoint;
828 ompt_id_t parallel_id;
830 const void *codeptr_ra;
831 } ompt_record_sync_region_t;
833 typedef void (*ompt_callback_mutex_acquire_t) (
837 ompt_wait_id_t wait_id,
838 const void *codeptr_ra
841 typedef struct ompt_record_mutex_acquire_t {
845 ompt_wait_id_t wait_id;
846 const void *codeptr_ra;
847 } ompt_record_mutex_acquire_t;
849 typedef void (*ompt_callback_mutex_t) (
851 ompt_wait_id_t wait_id,
852 const void *codeptr_ra
855 typedef struct ompt_record_mutex_t {
857 ompt_wait_id_t wait_id;
858 const void *codeptr_ra;
859 } ompt_record_mutex_t;
861 typedef void (*ompt_callback_nest_lock_t) (
862 ompt_scope_endpoint_t endpoint,
863 ompt_wait_id_t wait_id,
864 const void *codeptr_ra
867 typedef struct ompt_record_nest_lock_t {
868 ompt_scope_endpoint_t endpoint;
869 ompt_wait_id_t wait_id;
870 const void *codeptr_ra;
871 } ompt_record_nest_lock_t;
873 typedef void (*ompt_callback_flush_t) (
874 ompt_data_t *thread_data,
875 const void *codeptr_ra
878 typedef struct ompt_record_flush_t {
879 const void *codeptr_ra;
880 } ompt_record_flush_t;
882 typedef void (*ompt_callback_cancel_t) (
883 ompt_data_t *task_data,
885 const void *codeptr_ra
888 typedef struct ompt_record_cancel_t {
891 const void *codeptr_ra;
892 } ompt_record_cancel_t;
894 typedef void (*ompt_callback_device_initialize_t) (
897 ompt_device_t *device,
898 ompt_function_lookup_t lookup,
899 const char *documentation
902 typedef void (*ompt_callback_device_finalize_t) (
906 typedef void (*ompt_callback_device_load_t) (
908 const char *filename,
909 int64_t offset_in_file,
917 typedef void (*ompt_callback_device_unload_t) (
922 typedef void (*ompt_callback_target_data_op_t) (
924 ompt_id_t host_op_id,
925 ompt_target_data_op_t optype,
931 const void *codeptr_ra
934 typedef struct ompt_record_target_data_op_t {
935 ompt_id_t host_op_id;
936 ompt_target_data_op_t optype;
942 ompt_device_time_t end_time;
943 const void *codeptr_ra;
944 } ompt_record_target_data_op_t;
946 typedef void (*ompt_callback_target_t) (
948 ompt_scope_endpoint_t endpoint,
950 ompt_data_t *task_data,
952 const void *codeptr_ra
955 typedef struct ompt_record_target_t {
957 ompt_scope_endpoint_t endpoint;
961 const void *codeptr_ra;
962 } ompt_record_target_t;
964 typedef void (*ompt_callback_target_map_t) (
970 unsigned int *mapping_flags,
971 const void *codeptr_ra
974 typedef struct ompt_record_target_map_t {
980 unsigned int *mapping_flags;
981 const void *codeptr_ra;
982 } ompt_record_target_map_t;
984 typedef void (*ompt_callback_target_submit_t) (
986 ompt_id_t host_op_id,
987 unsigned int requested_num_teams
990 typedef struct ompt_record_target_kernel_t {
991 ompt_id_t host_op_id;
992 unsigned int requested_num_teams;
993 unsigned int granted_num_teams;
994 ompt_device_time_t end_time;
995 } ompt_record_target_kernel_t;
997 typedef int (*ompt_callback_control_tool_t) (
1001 const void *codeptr_ra
1004 typedef struct ompt_record_control_tool_t {
1007 const void *codeptr_ra;
1008 } ompt_record_control_tool_t;
1010 typedef struct ompd_address_t {
1012 ompd_addr_t address;
1015 typedef struct ompd_frame_info_t {
1016 ompd_address_t frame_address;
1017 ompd_word_t frame_flag;
1018 } ompd_frame_info_t;
1020 typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
1021 typedef struct _ompd_thread_handle ompd_thread_handle_t;
1022 typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
1023 typedef struct _ompd_task_handle ompd_task_handle_t;
1025 typedef struct _ompd_aspace_cont ompd_address_space_context_t;
1026 typedef struct _ompd_thread_cont ompd_thread_context_t;
1028 typedef struct ompd_device_type_sizes_t {
1029 uint8_t sizeof_char;
1030 uint8_t sizeof_short;
1032 uint8_t sizeof_long;
1033 uint8_t sizeof_long_long;
1034 uint8_t sizeof_pointer;
1035 } ompd_device_type_sizes_t;
1037 typedef struct ompt_record_ompt_t {
1038 ompt_callbacks_t type;
1039 ompt_device_time_t time;
1040 ompt_id_t thread_id;
1041 ompt_id_t target_id;
1043 ompt_record_thread_begin_t thread_begin;
1044 ompt_record_parallel_begin_t parallel_begin;
1045 ompt_record_parallel_end_t parallel_end;
1046 ompt_record_work_t work;
1047 ompt_record_dispatch_t dispatch;
1048 ompt_record_task_create_t task_create;
1049 ompt_record_dependences_t dependences;
1050 ompt_record_task_dependence_t task_dependence;
1051 ompt_record_task_schedule_t task_schedule;
1052 ompt_record_implicit_task_t implicit_task;
1053 ompt_record_master_t master;
1054 ompt_record_sync_region_t sync_region;
1055 ompt_record_mutex_acquire_t mutex_acquire;
1056 ompt_record_mutex_t mutex;
1057 ompt_record_nest_lock_t nest_lock;
1058 ompt_record_flush_t flush;
1059 ompt_record_cancel_t cancel;
1060 ompt_record_target_t target;
1061 ompt_record_target_data_op_t target_data_op;
1062 ompt_record_target_map_t target_map;
1063 ompt_record_target_kernel_t target_kernel;
1064 ompt_record_control_tool_t control_tool;
1066 } ompt_record_ompt_t;
1068 typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
1069 ompt_buffer_t *buffer,
1070 ompt_buffer_cursor_t current
1073 #define ompt_id_none 0
1074 #define ompt_data_none {0}
1075 #define ompt_time_none 0
1076 #define ompt_hwid_none 0
1077 #define ompt_addr_none ~0
1078 #define ompt_mutex_impl_none 0
1079 #define ompt_wait_id_none 0
1081 #define ompd_segment_none 0
1083 #endif /* __OMPT__ */