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 #ifdef DEPRECATION_WARNINGS
26 # define DEPRECATED_51 [[deprecated("as of 5.1")]]
28 # define DEPRECATED_51 __attribute__((deprecated("as of 5.1")))
34 /*****************************************************************************
36 *****************************************************************************/
38 #define FOREACH_OMPT_INQUIRY_FN(macro) \
39 macro (ompt_enumerate_states) \
40 macro (ompt_enumerate_mutex_impls) \
42 macro (ompt_set_callback) \
43 macro (ompt_get_callback) \
45 macro (ompt_get_state) \
47 macro (ompt_get_parallel_info) \
48 macro (ompt_get_task_info) \
49 macro (ompt_get_task_memory) \
50 macro (ompt_get_thread_data) \
51 macro (ompt_get_unique_id) \
52 macro (ompt_finalize_tool) \
54 macro(ompt_get_num_procs) \
55 macro(ompt_get_num_places) \
56 macro(ompt_get_place_proc_ids) \
57 macro(ompt_get_place_num) \
58 macro(ompt_get_partition_place_nums) \
59 macro(ompt_get_proc_id) \
61 macro(ompt_get_target_info) \
62 macro(ompt_get_num_devices)
64 #define FOREACH_OMPT_STATE(macro) \
66 /* first available state */ \
67 macro (ompt_state_undefined, 0x102) /* undefined thread state */ \
69 /* work states (0..15) */ \
70 macro (ompt_state_work_serial, 0x000) /* working outside parallel */ \
71 macro (ompt_state_work_parallel, 0x001) /* working within parallel */ \
72 macro (ompt_state_work_reduction, 0x002) /* performing a reduction */ \
74 /* barrier wait states (16..31) */ \
75 macro (ompt_state_wait_barrier, 0x010) /* waiting at a barrier */ \
76 macro (ompt_state_wait_barrier_implicit_parallel, 0x011) \
77 /* implicit barrier at the end of parallel region */\
78 macro (ompt_state_wait_barrier_implicit_workshare, 0x012) \
79 /* implicit barrier at the end of worksharing */ \
80 macro (ompt_state_wait_barrier_implicit, 0x013) /* implicit barrier */ \
81 macro (ompt_state_wait_barrier_explicit, 0x014) /* explicit barrier */ \
83 /* task wait states (32..63) */ \
84 macro (ompt_state_wait_taskwait, 0x020) /* waiting at a taskwait */ \
85 macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */ \
87 /* mutex wait states (64..127) */ \
88 macro (ompt_state_wait_mutex, 0x040) \
89 macro (ompt_state_wait_lock, 0x041) /* waiting for lock */ \
90 macro (ompt_state_wait_critical, 0x042) /* waiting for critical */ \
91 macro (ompt_state_wait_atomic, 0x043) /* waiting for atomic */ \
92 macro (ompt_state_wait_ordered, 0x044) /* waiting for ordered */ \
94 /* target wait states (128..255) */ \
95 macro (ompt_state_wait_target, 0x080) /* waiting for target region */ \
96 macro (ompt_state_wait_target_map, 0x081) /* waiting for target data mapping operation */ \
97 macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */ \
99 /* misc (256..511) */ \
100 macro (ompt_state_idle, 0x100) /* waiting for work */ \
101 macro (ompt_state_overhead, 0x101) /* overhead excluding wait states */ \
103 /* implementation-specific states (512..) */
106 #define FOREACH_KMP_MUTEX_IMPL(macro) \
107 macro (kmp_mutex_impl_none, 0) /* unknown implementation */ \
108 macro (kmp_mutex_impl_spin, 1) /* based on spin */ \
109 macro (kmp_mutex_impl_queuing, 2) /* based on some fair policy */ \
110 macro (kmp_mutex_impl_speculative, 3) /* based on HW-supported speculation */
112 #define FOREACH_OMPT_EVENT(macro) \
114 /*--- Mandatory Events ---*/ \
115 macro (ompt_callback_thread_begin, ompt_callback_thread_begin_t, 1) /* thread begin */ \
116 macro (ompt_callback_thread_end, ompt_callback_thread_end_t, 2) /* thread end */ \
118 macro (ompt_callback_parallel_begin, ompt_callback_parallel_begin_t, 3) /* parallel begin */ \
119 macro (ompt_callback_parallel_end, ompt_callback_parallel_end_t, 4) /* parallel end */ \
121 macro (ompt_callback_task_create, ompt_callback_task_create_t, 5) /* task begin */ \
122 macro (ompt_callback_task_schedule, ompt_callback_task_schedule_t, 6) /* task schedule */ \
123 macro (ompt_callback_implicit_task, ompt_callback_implicit_task_t, 7) /* implicit task */ \
125 macro (ompt_callback_target, ompt_callback_target_t, 8) /* target */ \
126 macro (ompt_callback_target_data_op, ompt_callback_target_data_op_t, 9) /* target data op */ \
127 macro (ompt_callback_target_submit, ompt_callback_target_submit_t, 10) /* target submit */ \
129 macro (ompt_callback_control_tool, ompt_callback_control_tool_t, 11) /* control tool */ \
131 macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize */ \
132 macro (ompt_callback_device_finalize, ompt_callback_device_finalize_t, 13) /* device finalize */ \
134 macro (ompt_callback_device_load, ompt_callback_device_load_t, 14) /* device load */ \
135 macro (ompt_callback_device_unload, ompt_callback_device_unload_t, 15) /* device unload */ \
137 /* Optional Events */ \
138 macro (ompt_callback_sync_region_wait, ompt_callback_sync_region_t, 16) /* sync region wait begin or end */ \
140 macro (ompt_callback_mutex_released, ompt_callback_mutex_t, 17) /* mutex released */ \
142 macro (ompt_callback_dependences, ompt_callback_dependences_t, 18) /* report task dependences */ \
143 macro (ompt_callback_task_dependence, ompt_callback_task_dependence_t, 19) /* report task dependence */ \
145 macro (ompt_callback_work, ompt_callback_work_t, 20) /* task at work begin or end */ \
147 macro (ompt_callback_masked, ompt_callback_masked_t, 21) /* task at masked begin or end */ \
149 macro (ompt_callback_target_map, ompt_callback_target_map_t, 22) /* target map */ \
151 macro (ompt_callback_sync_region, ompt_callback_sync_region_t, 23) /* sync region begin or end */ \
153 macro (ompt_callback_lock_init, ompt_callback_mutex_acquire_t, 24) /* lock init */ \
154 macro (ompt_callback_lock_destroy, ompt_callback_mutex_t, 25) /* lock destroy */ \
156 macro (ompt_callback_mutex_acquire, ompt_callback_mutex_acquire_t, 26) /* mutex acquire */ \
157 macro (ompt_callback_mutex_acquired, ompt_callback_mutex_t, 27) /* mutex acquired */ \
159 macro (ompt_callback_nest_lock, ompt_callback_nest_lock_t, 28) /* nest lock */ \
161 macro (ompt_callback_flush, ompt_callback_flush_t, 29) /* after executing flush */ \
163 macro (ompt_callback_cancel, ompt_callback_cancel_t, 30) /* cancel innermost binding region */ \
165 macro (ompt_callback_reduction, ompt_callback_sync_region_t, 31) /* reduction */ \
167 macro (ompt_callback_dispatch, ompt_callback_dispatch_t, 32) /* dispatch of work */ \
168 macro (ompt_callback_target_emi, ompt_callback_target_emi_t, 33) /* target */ \
169 macro (ompt_callback_target_data_op_emi,ompt_callback_target_data_op_emi_t,34) /* target data op */ \
170 macro (ompt_callback_target_submit_emi, ompt_callback_target_submit_emi_t, 35) /* target submit */ \
171 macro (ompt_callback_target_map_emi, ompt_callback_target_map_emi_t, 36) /* target map */ \
172 macro (ompt_callback_error, ompt_callback_error_t, 37) /* error */
174 /*****************************************************************************
175 * implementation specific types
176 *****************************************************************************/
178 typedef enum kmp_mutex_impl_t {
179 #define kmp_mutex_impl_macro(impl, code) impl = code,
180 FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
181 #undef kmp_mutex_impl_macro
184 /*****************************************************************************
185 * definitions generated from spec
186 *****************************************************************************/
188 typedef enum ompt_callbacks_t {
189 ompt_callback_thread_begin = 1,
190 ompt_callback_thread_end = 2,
191 ompt_callback_parallel_begin = 3,
192 ompt_callback_parallel_end = 4,
193 ompt_callback_task_create = 5,
194 ompt_callback_task_schedule = 6,
195 ompt_callback_implicit_task = 7,
196 ompt_callback_target = 8,
197 ompt_callback_target_data_op = 9,
198 ompt_callback_target_submit = 10,
199 ompt_callback_control_tool = 11,
200 ompt_callback_device_initialize = 12,
201 ompt_callback_device_finalize = 13,
202 ompt_callback_device_load = 14,
203 ompt_callback_device_unload = 15,
204 ompt_callback_sync_region_wait = 16,
205 ompt_callback_mutex_released = 17,
206 ompt_callback_dependences = 18,
207 ompt_callback_task_dependence = 19,
208 ompt_callback_work = 20,
209 ompt_callback_master DEPRECATED_51 = 21,
210 ompt_callback_masked = 21,
211 ompt_callback_target_map = 22,
212 ompt_callback_sync_region = 23,
213 ompt_callback_lock_init = 24,
214 ompt_callback_lock_destroy = 25,
215 ompt_callback_mutex_acquire = 26,
216 ompt_callback_mutex_acquired = 27,
217 ompt_callback_nest_lock = 28,
218 ompt_callback_flush = 29,
219 ompt_callback_cancel = 30,
220 ompt_callback_reduction = 31,
221 ompt_callback_dispatch = 32,
222 ompt_callback_target_emi = 33,
223 ompt_callback_target_data_op_emi = 34,
224 ompt_callback_target_submit_emi = 35,
225 ompt_callback_target_map_emi = 36,
226 ompt_callback_error = 37
229 typedef enum ompt_record_t {
230 ompt_record_ompt = 1,
231 ompt_record_native = 2,
232 ompt_record_invalid = 3
235 typedef enum ompt_record_native_t {
236 ompt_record_native_info = 1,
237 ompt_record_native_event = 2
238 } ompt_record_native_t;
240 typedef enum ompt_set_result_t {
243 ompt_set_impossible = 2,
244 ompt_set_sometimes = 3,
245 ompt_set_sometimes_paired = 4,
249 typedef uint64_t ompt_id_t;
251 typedef uint64_t ompt_device_time_t;
253 typedef uint64_t ompt_buffer_cursor_t;
255 typedef enum ompt_thread_t {
256 ompt_thread_initial = 1,
257 ompt_thread_worker = 2,
258 ompt_thread_other = 3,
259 ompt_thread_unknown = 4
262 typedef enum ompt_scope_endpoint_t {
263 ompt_scope_begin = 1,
265 ompt_scope_beginend = 3
266 } ompt_scope_endpoint_t;
268 typedef enum ompt_dispatch_t {
269 ompt_dispatch_iteration = 1,
270 ompt_dispatch_section = 2
273 typedef enum ompt_sync_region_t {
274 ompt_sync_region_barrier DEPRECATED_51 = 1,
275 ompt_sync_region_barrier_implicit DEPRECATED_51 = 2,
276 ompt_sync_region_barrier_explicit = 3,
277 ompt_sync_region_barrier_implementation = 4,
278 ompt_sync_region_taskwait = 5,
279 ompt_sync_region_taskgroup = 6,
280 ompt_sync_region_reduction = 7,
281 ompt_sync_region_barrier_implicit_workshare = 8,
282 ompt_sync_region_barrier_implicit_parallel = 9,
283 ompt_sync_region_barrier_teams = 10
284 } ompt_sync_region_t;
286 typedef enum ompt_target_data_op_t {
287 ompt_target_data_alloc = 1,
288 ompt_target_data_transfer_to_device = 2,
289 ompt_target_data_transfer_from_device = 3,
290 ompt_target_data_delete = 4,
291 ompt_target_data_associate = 5,
292 ompt_target_data_disassociate = 6,
293 ompt_target_data_alloc_async = 17,
294 ompt_target_data_transfer_to_device_async = 18,
295 ompt_target_data_transfer_from_device_async = 19,
296 ompt_target_data_delete_async = 20
297 } ompt_target_data_op_t;
299 typedef enum ompt_work_t {
301 ompt_work_sections = 2,
302 ompt_work_single_executor = 3,
303 ompt_work_single_other = 4,
304 ompt_work_workshare = 5,
305 ompt_work_distribute = 6,
306 ompt_work_taskloop = 7,
310 typedef enum ompt_mutex_t {
312 ompt_mutex_test_lock = 2,
313 ompt_mutex_nest_lock = 3,
314 ompt_mutex_test_nest_lock = 4,
315 ompt_mutex_critical = 5,
316 ompt_mutex_atomic = 6,
317 ompt_mutex_ordered = 7
320 typedef enum ompt_native_mon_flag_t {
321 ompt_native_data_motion_explicit = 0x01,
322 ompt_native_data_motion_implicit = 0x02,
323 ompt_native_kernel_invocation = 0x04,
324 ompt_native_kernel_execution = 0x08,
325 ompt_native_driver = 0x10,
326 ompt_native_runtime = 0x20,
327 ompt_native_overhead = 0x40,
328 ompt_native_idleness = 0x80
329 } ompt_native_mon_flag_t;
331 typedef enum ompt_task_flag_t {
332 ompt_task_initial = 0x00000001,
333 ompt_task_implicit = 0x00000002,
334 ompt_task_explicit = 0x00000004,
335 ompt_task_target = 0x00000008,
336 ompt_task_taskwait = 0x00000010,
337 ompt_task_undeferred = 0x08000000,
338 ompt_task_untied = 0x10000000,
339 ompt_task_final = 0x20000000,
340 ompt_task_mergeable = 0x40000000,
341 ompt_task_merged = 0x80000000
344 typedef enum ompt_task_status_t {
345 ompt_task_complete = 1,
347 ompt_task_cancel = 3,
348 ompt_task_detach = 4,
349 ompt_task_early_fulfill = 5,
350 ompt_task_late_fulfill = 6,
351 ompt_task_switch = 7,
352 ompt_taskwait_complete = 8
353 } ompt_task_status_t;
355 typedef enum ompt_target_t {
357 ompt_target_enter_data = 2,
358 ompt_target_exit_data = 3,
359 ompt_target_update = 4,
360 ompt_target_nowait = 9,
361 ompt_target_enter_data_nowait = 10,
362 ompt_target_exit_data_nowait = 11,
363 ompt_target_update_nowait = 12
366 typedef enum ompt_parallel_flag_t {
367 ompt_parallel_invoker_program = 0x00000001,
368 ompt_parallel_invoker_runtime = 0x00000002,
369 ompt_parallel_league = 0x40000000,
370 ompt_parallel_team = 0x80000000
371 } ompt_parallel_flag_t;
373 typedef enum ompt_target_map_flag_t {
374 ompt_target_map_flag_to = 0x01,
375 ompt_target_map_flag_from = 0x02,
376 ompt_target_map_flag_alloc = 0x04,
377 ompt_target_map_flag_release = 0x08,
378 ompt_target_map_flag_delete = 0x10,
379 ompt_target_map_flag_implicit = 0x20
380 } ompt_target_map_flag_t;
382 typedef enum ompt_dependence_type_t {
383 ompt_dependence_type_in = 1,
384 ompt_dependence_type_out = 2,
385 ompt_dependence_type_inout = 3,
386 ompt_dependence_type_mutexinoutset = 4,
387 ompt_dependence_type_source = 5,
388 ompt_dependence_type_sink = 6,
389 ompt_dependence_type_inoutset = 7
390 } ompt_dependence_type_t;
392 typedef enum ompt_severity_t {
397 typedef enum ompt_cancel_flag_t {
398 ompt_cancel_parallel = 0x01,
399 ompt_cancel_sections = 0x02,
400 ompt_cancel_loop = 0x04,
401 ompt_cancel_taskgroup = 0x08,
402 ompt_cancel_activated = 0x10,
403 ompt_cancel_detected = 0x20,
404 ompt_cancel_discarded_task = 0x40
405 } ompt_cancel_flag_t;
407 typedef uint64_t ompt_hwid_t;
409 typedef uint64_t ompt_wait_id_t;
411 typedef enum ompt_frame_flag_t {
412 ompt_frame_runtime = 0x00,
413 ompt_frame_application = 0x01,
414 ompt_frame_cfa = 0x10,
415 ompt_frame_framepointer = 0x20,
416 ompt_frame_stackaddress = 0x30
419 typedef enum ompt_state_t {
420 ompt_state_work_serial = 0x000,
421 ompt_state_work_parallel = 0x001,
422 ompt_state_work_reduction = 0x002,
424 ompt_state_wait_barrier DEPRECATED_51 = 0x010,
425 ompt_state_wait_barrier_implicit_parallel = 0x011,
426 ompt_state_wait_barrier_implicit_workshare = 0x012,
427 ompt_state_wait_barrier_implicit DEPRECATED_51 = 0x013,
428 ompt_state_wait_barrier_explicit = 0x014,
429 ompt_state_wait_barrier_implementation = 0x015,
430 ompt_state_wait_barrier_teams = 0x016,
432 ompt_state_wait_taskwait = 0x020,
433 ompt_state_wait_taskgroup = 0x021,
435 ompt_state_wait_mutex = 0x040,
436 ompt_state_wait_lock = 0x041,
437 ompt_state_wait_critical = 0x042,
438 ompt_state_wait_atomic = 0x043,
439 ompt_state_wait_ordered = 0x044,
441 ompt_state_wait_target = 0x080,
442 ompt_state_wait_target_map = 0x081,
443 ompt_state_wait_target_update = 0x082,
445 ompt_state_idle = 0x100,
446 ompt_state_overhead = 0x101,
447 ompt_state_undefined = 0x102
450 typedef uint64_t (*ompt_get_unique_id_t) (void);
452 typedef uint64_t ompd_size_t;
454 typedef uint64_t ompd_wait_id_t;
456 typedef uint64_t ompd_addr_t;
457 typedef int64_t ompd_word_t;
458 typedef uint64_t ompd_seg_t;
460 typedef uint64_t ompd_device_t;
462 typedef uint64_t ompd_thread_id_t;
464 typedef enum ompd_scope_t {
465 ompd_scope_global = 1,
466 ompd_scope_address_space = 2,
467 ompd_scope_thread = 3,
468 ompd_scope_parallel = 4,
469 ompd_scope_implicit_task = 5,
473 typedef uint64_t ompd_icv_id_t;
475 typedef enum ompd_rc_t {
477 ompd_rc_unavailable = 1,
478 ompd_rc_stale_handle = 2,
479 ompd_rc_bad_input = 3,
481 ompd_rc_unsupported = 5,
482 ompd_rc_needs_state_tracking = 6,
483 ompd_rc_incompatible = 7,
484 ompd_rc_device_read_error = 8,
485 ompd_rc_device_write_error = 9,
489 typedef void (*ompt_interface_fn_t) (void);
491 typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
492 const char *interface_function_name
495 typedef union ompt_data_t {
500 typedef struct ompt_frame_t {
501 ompt_data_t exit_frame;
502 ompt_data_t enter_frame;
503 int exit_frame_flags;
504 int enter_frame_flags;
507 typedef void (*ompt_callback_t) (void);
509 typedef void ompt_device_t;
511 typedef void ompt_buffer_t;
513 typedef void (*ompt_callback_buffer_request_t) (
515 ompt_buffer_t **buffer,
519 typedef void (*ompt_callback_buffer_complete_t) (
521 ompt_buffer_t *buffer,
523 ompt_buffer_cursor_t begin,
527 typedef void (*ompt_finalize_t) (
528 ompt_data_t *tool_data
531 typedef int (*ompt_initialize_t) (
532 ompt_function_lookup_t lookup,
533 int initial_device_num,
534 ompt_data_t *tool_data
537 typedef struct ompt_start_tool_result_t {
538 ompt_initialize_t initialize;
539 ompt_finalize_t finalize;
540 ompt_data_t tool_data;
541 } ompt_start_tool_result_t;
543 typedef struct ompt_record_abstract_t {
544 ompt_record_native_t rclass;
546 ompt_device_time_t start_time;
547 ompt_device_time_t end_time;
549 } ompt_record_abstract_t;
551 typedef struct ompt_dependence_t {
552 ompt_data_t variable;
553 ompt_dependence_type_t dependence_type;
556 typedef int (*ompt_enumerate_states_t) (
559 const char **next_state_name
562 typedef int (*ompt_enumerate_mutex_impls_t) (
565 const char **next_impl_name
568 typedef ompt_set_result_t (*ompt_set_callback_t) (
569 ompt_callbacks_t event,
570 ompt_callback_t callback
573 typedef int (*ompt_get_callback_t) (
574 ompt_callbacks_t event,
575 ompt_callback_t *callback
578 typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
580 typedef int (*ompt_get_num_procs_t) (void);
582 typedef int (*ompt_get_num_places_t) (void);
584 typedef int (*ompt_get_place_proc_ids_t) (
590 typedef int (*ompt_get_place_num_t) (void);
592 typedef int (*ompt_get_partition_place_nums_t) (
597 typedef int (*ompt_get_proc_id_t) (void);
599 typedef int (*ompt_get_state_t) (
600 ompt_wait_id_t *wait_id
603 typedef int (*ompt_get_parallel_info_t) (
605 ompt_data_t **parallel_data,
609 typedef int (*ompt_get_task_info_t) (
612 ompt_data_t **task_data,
613 ompt_frame_t **task_frame,
614 ompt_data_t **parallel_data,
618 typedef int (*ompt_get_task_memory_t)(
624 typedef int (*ompt_get_target_info_t) (
625 uint64_t *device_num,
626 ompt_id_t *target_id,
627 ompt_id_t *host_op_id
630 typedef int (*ompt_get_num_devices_t) (void);
632 typedef void (*ompt_finalize_tool_t) (void);
634 typedef int (*ompt_get_device_num_procs_t) (
635 ompt_device_t *device
638 typedef ompt_device_time_t (*ompt_get_device_time_t) (
639 ompt_device_t *device
642 typedef double (*ompt_translate_time_t) (
643 ompt_device_t *device,
644 ompt_device_time_t time
647 typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
648 ompt_device_t *device,
653 typedef ompt_set_result_t (*ompt_set_trace_native_t) (
654 ompt_device_t *device,
659 typedef int (*ompt_start_trace_t) (
660 ompt_device_t *device,
661 ompt_callback_buffer_request_t request,
662 ompt_callback_buffer_complete_t complete
665 typedef int (*ompt_pause_trace_t) (
666 ompt_device_t *device,
670 typedef int (*ompt_flush_trace_t) (
671 ompt_device_t *device
674 typedef int (*ompt_stop_trace_t) (
675 ompt_device_t *device
678 typedef int (*ompt_advance_buffer_cursor_t) (
679 ompt_device_t *device,
680 ompt_buffer_t *buffer,
682 ompt_buffer_cursor_t current,
683 ompt_buffer_cursor_t *next
686 typedef ompt_record_t (*ompt_get_record_type_t) (
687 ompt_buffer_t *buffer,
688 ompt_buffer_cursor_t current
691 typedef void *(*ompt_get_record_native_t) (
692 ompt_buffer_t *buffer,
693 ompt_buffer_cursor_t current,
694 ompt_id_t *host_op_id
697 typedef ompt_record_abstract_t *
698 (*ompt_get_record_abstract_t) (
702 typedef void (*ompt_callback_thread_begin_t) (
703 ompt_thread_t thread_type,
704 ompt_data_t *thread_data
707 typedef struct ompt_record_thread_begin_t {
708 ompt_thread_t thread_type;
709 } ompt_record_thread_begin_t;
711 typedef void (*ompt_callback_thread_end_t) (
712 ompt_data_t *thread_data
715 typedef void (*ompt_callback_parallel_begin_t) (
716 ompt_data_t *encountering_task_data,
717 const ompt_frame_t *encountering_task_frame,
718 ompt_data_t *parallel_data,
719 unsigned int requested_parallelism,
721 const void *codeptr_ra
724 typedef struct ompt_record_parallel_begin_t {
725 ompt_id_t encountering_task_id;
726 ompt_id_t parallel_id;
727 unsigned int requested_parallelism;
729 const void *codeptr_ra;
730 } ompt_record_parallel_begin_t;
732 typedef void (*ompt_callback_parallel_end_t) (
733 ompt_data_t *parallel_data,
734 ompt_data_t *encountering_task_data,
736 const void *codeptr_ra
739 typedef struct ompt_record_parallel_end_t {
740 ompt_id_t parallel_id;
741 ompt_id_t encountering_task_id;
743 const void *codeptr_ra;
744 } ompt_record_parallel_end_t;
746 typedef void (*ompt_callback_work_t) (
748 ompt_scope_endpoint_t endpoint,
749 ompt_data_t *parallel_data,
750 ompt_data_t *task_data,
752 const void *codeptr_ra
755 typedef struct ompt_record_work_t {
757 ompt_scope_endpoint_t endpoint;
758 ompt_id_t parallel_id;
761 const void *codeptr_ra;
762 } ompt_record_work_t;
764 typedef void (*ompt_callback_dispatch_t) (
765 ompt_data_t *parallel_data,
766 ompt_data_t *task_data,
767 ompt_dispatch_t kind,
771 typedef struct ompt_record_dispatch_t {
772 ompt_id_t parallel_id;
774 ompt_dispatch_t kind;
775 ompt_data_t instance;
776 } ompt_record_dispatch_t;
778 typedef void (*ompt_callback_task_create_t) (
779 ompt_data_t *encountering_task_data,
780 const ompt_frame_t *encountering_task_frame,
781 ompt_data_t *new_task_data,
784 const void *codeptr_ra
787 typedef struct ompt_record_task_create_t {
788 ompt_id_t encountering_task_id;
789 ompt_id_t new_task_id;
792 const void *codeptr_ra;
793 } ompt_record_task_create_t;
795 typedef void (*ompt_callback_dependences_t) (
796 ompt_data_t *task_data,
797 const ompt_dependence_t *deps,
801 typedef struct ompt_record_dependences_t {
803 ompt_dependence_t dep;
805 } ompt_record_dependences_t;
807 typedef void (*ompt_callback_task_dependence_t) (
808 ompt_data_t *src_task_data,
809 ompt_data_t *sink_task_data
812 typedef struct ompt_record_task_dependence_t {
813 ompt_id_t src_task_id;
814 ompt_id_t sink_task_id;
815 } ompt_record_task_dependence_t;
817 typedef void (*ompt_callback_task_schedule_t) (
818 ompt_data_t *prior_task_data,
819 ompt_task_status_t prior_task_status,
820 ompt_data_t *next_task_data
823 typedef struct ompt_record_task_schedule_t {
824 ompt_id_t prior_task_id;
825 ompt_task_status_t prior_task_status;
826 ompt_id_t next_task_id;
827 } ompt_record_task_schedule_t;
829 typedef void (*ompt_callback_implicit_task_t) (
830 ompt_scope_endpoint_t endpoint,
831 ompt_data_t *parallel_data,
832 ompt_data_t *task_data,
833 unsigned int actual_parallelism,
838 typedef struct ompt_record_implicit_task_t {
839 ompt_scope_endpoint_t endpoint;
840 ompt_id_t parallel_id;
842 unsigned int actual_parallelism;
845 } ompt_record_implicit_task_t;
847 typedef void (*ompt_callback_masked_t) (
848 ompt_scope_endpoint_t endpoint,
849 ompt_data_t *parallel_data,
850 ompt_data_t *task_data,
851 const void *codeptr_ra
854 typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51;
856 typedef struct ompt_record_masked_t {
857 ompt_scope_endpoint_t endpoint;
858 ompt_id_t parallel_id;
860 const void *codeptr_ra;
861 } ompt_record_masked_t;
863 typedef void (*ompt_callback_sync_region_t) (
864 ompt_sync_region_t kind,
865 ompt_scope_endpoint_t endpoint,
866 ompt_data_t *parallel_data,
867 ompt_data_t *task_data,
868 const void *codeptr_ra
871 typedef struct ompt_record_sync_region_t {
872 ompt_sync_region_t kind;
873 ompt_scope_endpoint_t endpoint;
874 ompt_id_t parallel_id;
876 const void *codeptr_ra;
877 } ompt_record_sync_region_t;
879 typedef void (*ompt_callback_mutex_acquire_t) (
883 ompt_wait_id_t wait_id,
884 const void *codeptr_ra
887 typedef struct ompt_record_mutex_acquire_t {
891 ompt_wait_id_t wait_id;
892 const void *codeptr_ra;
893 } ompt_record_mutex_acquire_t;
895 typedef void (*ompt_callback_mutex_t) (
897 ompt_wait_id_t wait_id,
898 const void *codeptr_ra
901 typedef struct ompt_record_mutex_t {
903 ompt_wait_id_t wait_id;
904 const void *codeptr_ra;
905 } ompt_record_mutex_t;
907 typedef void (*ompt_callback_nest_lock_t) (
908 ompt_scope_endpoint_t endpoint,
909 ompt_wait_id_t wait_id,
910 const void *codeptr_ra
913 typedef struct ompt_record_nest_lock_t {
914 ompt_scope_endpoint_t endpoint;
915 ompt_wait_id_t wait_id;
916 const void *codeptr_ra;
917 } ompt_record_nest_lock_t;
919 typedef void (*ompt_callback_flush_t) (
920 ompt_data_t *thread_data,
921 const void *codeptr_ra
924 typedef struct ompt_record_flush_t {
925 const void *codeptr_ra;
926 } ompt_record_flush_t;
928 typedef void (*ompt_callback_cancel_t) (
929 ompt_data_t *task_data,
931 const void *codeptr_ra
934 typedef struct ompt_record_cancel_t {
937 const void *codeptr_ra;
938 } ompt_record_cancel_t;
940 typedef void (*ompt_callback_device_initialize_t) (
943 ompt_device_t *device,
944 ompt_function_lookup_t lookup,
945 const char *documentation
948 typedef void (*ompt_callback_device_finalize_t) (
952 typedef void (*ompt_callback_device_load_t) (
954 const char *filename,
955 int64_t offset_in_file,
963 typedef void (*ompt_callback_device_unload_t) (
968 typedef void (*ompt_callback_target_data_op_emi_t) (
969 ompt_scope_endpoint_t endpoint,
970 ompt_data_t *target_task_data,
971 ompt_data_t *target_data,
972 ompt_id_t *host_op_id,
973 ompt_target_data_op_t optype,
979 const void *codeptr_ra
982 typedef void (*ompt_callback_target_data_op_t) (
984 ompt_id_t host_op_id,
985 ompt_target_data_op_t optype,
991 const void *codeptr_ra
994 typedef struct ompt_record_target_data_op_t {
995 ompt_id_t host_op_id;
996 ompt_target_data_op_t optype;
1000 int dest_device_num;
1002 ompt_device_time_t end_time;
1003 const void *codeptr_ra;
1004 } ompt_record_target_data_op_t;
1006 typedef void (*ompt_callback_target_emi_t) (
1008 ompt_scope_endpoint_t endpoint,
1010 ompt_data_t *task_data,
1011 ompt_data_t *target_task_data,
1012 ompt_data_t *target_data,
1013 const void *codeptr_ra
1016 typedef void (*ompt_callback_target_t) (
1018 ompt_scope_endpoint_t endpoint,
1020 ompt_data_t *task_data,
1021 ompt_id_t target_id,
1022 const void *codeptr_ra
1025 typedef struct ompt_record_target_t {
1027 ompt_scope_endpoint_t endpoint;
1030 ompt_id_t target_id;
1031 const void *codeptr_ra;
1032 } ompt_record_target_t;
1034 typedef void (*ompt_callback_target_map_emi_t) (
1035 ompt_data_t *target_data,
1036 unsigned int nitems,
1040 unsigned int *mapping_flags,
1041 const void *codeptr_ra
1044 typedef void (*ompt_callback_target_map_t) (
1045 ompt_id_t target_id,
1046 unsigned int nitems,
1050 unsigned int *mapping_flags,
1051 const void *codeptr_ra
1054 typedef struct ompt_record_target_map_t {
1055 ompt_id_t target_id;
1056 unsigned int nitems;
1060 unsigned int *mapping_flags;
1061 const void *codeptr_ra;
1062 } ompt_record_target_map_t;
1064 typedef void (*ompt_callback_target_submit_emi_t) (
1065 ompt_scope_endpoint_t endpoint,
1066 ompt_data_t *target_data,
1067 ompt_id_t *host_op_id,
1068 unsigned int requested_num_teams
1071 typedef void (*ompt_callback_target_submit_t) (
1072 ompt_id_t target_id,
1073 ompt_id_t host_op_id,
1074 unsigned int requested_num_teams
1077 typedef struct ompt_record_target_kernel_t {
1078 ompt_id_t host_op_id;
1079 unsigned int requested_num_teams;
1080 unsigned int granted_num_teams;
1081 ompt_device_time_t end_time;
1082 } ompt_record_target_kernel_t;
1084 typedef int (*ompt_callback_control_tool_t) (
1088 const void *codeptr_ra
1091 typedef struct ompt_record_control_tool_t {
1094 const void *codeptr_ra;
1095 } ompt_record_control_tool_t;
1097 typedef void (*ompt_callback_error_t) (
1098 ompt_severity_t severity,
1099 const char *message, size_t length,
1100 const void *codeptr_ra
1103 typedef struct ompd_address_t {
1105 ompd_addr_t address;
1108 typedef struct ompd_frame_info_t {
1109 ompd_address_t frame_address;
1110 ompd_word_t frame_flag;
1111 } ompd_frame_info_t;
1113 typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
1114 typedef struct _ompd_thread_handle ompd_thread_handle_t;
1115 typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
1116 typedef struct _ompd_task_handle ompd_task_handle_t;
1118 typedef struct _ompd_aspace_cont ompd_address_space_context_t;
1119 typedef struct _ompd_thread_cont ompd_thread_context_t;
1121 typedef struct ompd_device_type_sizes_t {
1122 uint8_t sizeof_char;
1123 uint8_t sizeof_short;
1125 uint8_t sizeof_long;
1126 uint8_t sizeof_long_long;
1127 uint8_t sizeof_pointer;
1128 } ompd_device_type_sizes_t;
1130 typedef struct ompt_record_ompt_t {
1131 ompt_callbacks_t type;
1132 ompt_device_time_t time;
1133 ompt_id_t thread_id;
1134 ompt_id_t target_id;
1136 ompt_record_thread_begin_t thread_begin;
1137 ompt_record_parallel_begin_t parallel_begin;
1138 ompt_record_parallel_end_t parallel_end;
1139 ompt_record_work_t work;
1140 ompt_record_dispatch_t dispatch;
1141 ompt_record_task_create_t task_create;
1142 ompt_record_dependences_t dependences;
1143 ompt_record_task_dependence_t task_dependence;
1144 ompt_record_task_schedule_t task_schedule;
1145 ompt_record_implicit_task_t implicit_task;
1146 ompt_record_masked_t masked;
1147 ompt_record_sync_region_t sync_region;
1148 ompt_record_mutex_acquire_t mutex_acquire;
1149 ompt_record_mutex_t mutex;
1150 ompt_record_nest_lock_t nest_lock;
1151 ompt_record_flush_t flush;
1152 ompt_record_cancel_t cancel;
1153 ompt_record_target_t target;
1154 ompt_record_target_data_op_t target_data_op;
1155 ompt_record_target_map_t target_map;
1156 ompt_record_target_kernel_t target_kernel;
1157 ompt_record_control_tool_t control_tool;
1159 } ompt_record_ompt_t;
1161 typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
1162 ompt_buffer_t *buffer,
1163 ompt_buffer_cursor_t current
1166 #define ompt_id_none 0
1167 #define ompt_data_none {0}
1168 #define ompt_time_none 0
1169 #define ompt_hwid_none 0
1170 #define ompt_addr_none ~0
1171 #define ompt_mutex_impl_none 0
1172 #define ompt_wait_id_none 0
1174 #define ompd_segment_none 0
1176 #endif /* __OMPT__ */