2 * include/omp-tools.h.var
5 //===----------------------------------------------------------------------===//
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
11 //===----------------------------------------------------------------------===//
16 /*****************************************************************************
17 * system include files
18 *****************************************************************************/
23 #ifdef DEPRECATION_WARNINGS
25 # define DEPRECATED_51 [[deprecated("as of 5.1")]]
27 # define DEPRECATED_51 __attribute__((deprecated("as of 5.1")))
33 /*****************************************************************************
35 *****************************************************************************/
37 #define FOREACH_OMPT_INQUIRY_FN(macro) \
38 macro (ompt_enumerate_states) \
39 macro (ompt_enumerate_mutex_impls) \
41 macro (ompt_set_callback) \
42 macro (ompt_get_callback) \
44 macro (ompt_get_state) \
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) \
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) \
60 macro(ompt_get_target_info) \
61 macro(ompt_get_num_devices)
63 #define FOREACH_OMPT_STATE(macro) \
65 /* first available state */ \
66 macro (ompt_state_undefined, 0x102) /* undefined thread state */ \
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 */ \
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 */ \
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 */ \
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 */ \
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 */ \
98 /* misc (256..511) */ \
99 macro (ompt_state_idle, 0x100) /* waiting for work */ \
100 macro (ompt_state_overhead, 0x101) /* overhead excluding wait states */ \
102 /* implementation-specific states (512..) */
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 */
111 #define FOREACH_OMPT_HOST_EVENT(macro) \
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 */ \
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 */ \
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 */ \
124 macro (ompt_callback_control_tool, ompt_callback_control_tool_t, 11) /* control tool */ \
126 /* Optional Events */ \
127 macro (ompt_callback_sync_region_wait, ompt_callback_sync_region_t, 16) /* sync region wait begin or end */ \
129 macro (ompt_callback_mutex_released, ompt_callback_mutex_t, 17) /* mutex released */ \
131 macro (ompt_callback_dependences, ompt_callback_dependences_t, 18) /* report task dependences */ \
132 macro (ompt_callback_task_dependence, ompt_callback_task_dependence_t, 19) /* report task dependence */ \
134 macro (ompt_callback_work, ompt_callback_work_t, 20) /* task at work begin or end */ \
136 macro (ompt_callback_masked, ompt_callback_masked_t, 21) /* task at masked begin or end */ \
138 macro (ompt_callback_sync_region, ompt_callback_sync_region_t, 23) /* sync region begin or end */ \
140 macro (ompt_callback_lock_init, ompt_callback_mutex_acquire_t, 24) /* lock init */ \
141 macro (ompt_callback_lock_destroy, ompt_callback_mutex_t, 25) /* lock destroy */ \
143 macro (ompt_callback_mutex_acquire, ompt_callback_mutex_acquire_t, 26) /* mutex acquire */ \
144 macro (ompt_callback_mutex_acquired, ompt_callback_mutex_t, 27) /* mutex acquired */ \
146 macro (ompt_callback_nest_lock, ompt_callback_nest_lock_t, 28) /* nest lock */ \
148 macro (ompt_callback_flush, ompt_callback_flush_t, 29) /* after executing flush */ \
150 macro (ompt_callback_cancel, ompt_callback_cancel_t, 30) /* cancel innermost binding region */ \
152 macro (ompt_callback_reduction, ompt_callback_sync_region_t, 31) /* reduction */ \
154 macro (ompt_callback_dispatch, ompt_callback_dispatch_t, 32) /* dispatch of work */ \
155 macro (ompt_callback_error, ompt_callback_error_t, 37) /* error */
157 #define FOREACH_OMPT_DEVICE_EVENT(macro) \
158 /*--- Mandatory Events ---*/ \
159 macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize */ \
160 macro (ompt_callback_device_finalize, ompt_callback_device_finalize_t, 13) /* device finalize */ \
162 macro (ompt_callback_device_load, ompt_callback_device_load_t, 14) /* device load */ \
163 macro (ompt_callback_device_unload, ompt_callback_device_unload_t, 15) /* device unload */
165 #define FOREACH_OMPT_NOEMI_EVENT(macro) \
166 /*--- Mandatory Events ---*/ \
167 macro (ompt_callback_target, ompt_callback_target_t, 8) /* target */ \
168 macro (ompt_callback_target_data_op, ompt_callback_target_data_op_t, 9) /* target data op */ \
169 macro (ompt_callback_target_submit, ompt_callback_target_submit_t, 10) /* target submit */ \
170 /* Optional Events */ \
171 macro (ompt_callback_target_map, ompt_callback_target_map_t, 22) /* target map */
173 #define FOREACH_OMPT_EMI_EVENT(macro) \
174 /*--- Mandatory Events ---*/ \
175 macro (ompt_callback_target_emi, ompt_callback_target_emi_t, 33) /* target */ \
176 macro (ompt_callback_target_data_op_emi,ompt_callback_target_data_op_emi_t,34) /* target data op */ \
177 macro (ompt_callback_target_submit_emi, ompt_callback_target_submit_emi_t, 35) /* target submit */ \
178 /* Optional Events */ \
179 macro (ompt_callback_target_map_emi, ompt_callback_target_map_emi_t, 36) /* target map */
181 #define FOREACH_OMPT_50_TARGET_EVENT(macro) \
182 FOREACH_OMPT_DEVICE_EVENT(macro) \
183 FOREACH_OMPT_NOEMI_EVENT(macro)
185 #define FOREACH_OMPT_51_TARGET_EVENT(macro) \
186 FOREACH_OMPT_DEVICE_EVENT(macro) \
187 FOREACH_OMPT_EMI_EVENT(macro)
189 #define FOREACH_OMPT_EVENT(macro) \
190 FOREACH_OMPT_HOST_EVENT(macro) \
191 FOREACH_OMPT_DEVICE_EVENT(macro) \
192 FOREACH_OMPT_NOEMI_EVENT(macro) \
193 FOREACH_OMPT_EMI_EVENT(macro)
195 #define FOREACH_OMPT_51_EVENT(macro) \
196 FOREACH_OMPT_HOST_EVENT(macro) \
197 FOREACH_OMPT_DEVICE_EVENT(macro) \
198 FOREACH_OMPT_EMI_EVENT(macro)
200 /*****************************************************************************
201 * implementation specific types
202 *****************************************************************************/
204 typedef enum kmp_mutex_impl_t {
205 #define kmp_mutex_impl_macro(impl, code) impl = code,
206 FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
207 #undef kmp_mutex_impl_macro
210 /*****************************************************************************
211 * definitions generated from spec
212 *****************************************************************************/
214 typedef enum ompt_callbacks_t {
215 ompt_callback_thread_begin = 1,
216 ompt_callback_thread_end = 2,
217 ompt_callback_parallel_begin = 3,
218 ompt_callback_parallel_end = 4,
219 ompt_callback_task_create = 5,
220 ompt_callback_task_schedule = 6,
221 ompt_callback_implicit_task = 7,
222 ompt_callback_target = 8,
223 ompt_callback_target_data_op = 9,
224 ompt_callback_target_submit = 10,
225 ompt_callback_control_tool = 11,
226 ompt_callback_device_initialize = 12,
227 ompt_callback_device_finalize = 13,
228 ompt_callback_device_load = 14,
229 ompt_callback_device_unload = 15,
230 ompt_callback_sync_region_wait = 16,
231 ompt_callback_mutex_released = 17,
232 ompt_callback_dependences = 18,
233 ompt_callback_task_dependence = 19,
234 ompt_callback_work = 20,
235 ompt_callback_master DEPRECATED_51 = 21,
236 ompt_callback_masked = 21,
237 ompt_callback_target_map = 22,
238 ompt_callback_sync_region = 23,
239 ompt_callback_lock_init = 24,
240 ompt_callback_lock_destroy = 25,
241 ompt_callback_mutex_acquire = 26,
242 ompt_callback_mutex_acquired = 27,
243 ompt_callback_nest_lock = 28,
244 ompt_callback_flush = 29,
245 ompt_callback_cancel = 30,
246 ompt_callback_reduction = 31,
247 ompt_callback_dispatch = 32,
248 ompt_callback_target_emi = 33,
249 ompt_callback_target_data_op_emi = 34,
250 ompt_callback_target_submit_emi = 35,
251 ompt_callback_target_map_emi = 36,
252 ompt_callback_error = 37
255 typedef enum ompt_record_t {
256 ompt_record_ompt = 1,
257 ompt_record_native = 2,
258 ompt_record_invalid = 3
261 typedef enum ompt_record_native_t {
262 ompt_record_native_info = 1,
263 ompt_record_native_event = 2
264 } ompt_record_native_t;
266 typedef enum ompt_set_result_t {
269 ompt_set_impossible = 2,
270 ompt_set_sometimes = 3,
271 ompt_set_sometimes_paired = 4,
275 typedef uint64_t ompt_id_t;
277 typedef uint64_t ompt_device_time_t;
279 typedef uint64_t ompt_buffer_cursor_t;
281 typedef enum ompt_thread_t {
282 ompt_thread_initial = 1,
283 ompt_thread_worker = 2,
284 ompt_thread_other = 3,
285 ompt_thread_unknown = 4
288 typedef enum ompt_scope_endpoint_t {
289 ompt_scope_begin = 1,
291 ompt_scope_beginend = 3
292 } ompt_scope_endpoint_t;
294 typedef enum ompt_dispatch_t {
295 ompt_dispatch_iteration = 1,
296 ompt_dispatch_section = 2,
297 ompt_dispatch_ws_loop_chunk = 3,
298 ompt_dispatch_taskloop_chunk = 4,
299 ompt_dispatch_distribute_chunk = 5
302 typedef enum ompt_sync_region_t {
303 ompt_sync_region_barrier DEPRECATED_51 = 1,
304 ompt_sync_region_barrier_implicit DEPRECATED_51 = 2,
305 ompt_sync_region_barrier_explicit = 3,
306 ompt_sync_region_barrier_implementation = 4,
307 ompt_sync_region_taskwait = 5,
308 ompt_sync_region_taskgroup = 6,
309 ompt_sync_region_reduction = 7,
310 ompt_sync_region_barrier_implicit_workshare = 8,
311 ompt_sync_region_barrier_implicit_parallel = 9,
312 ompt_sync_region_barrier_teams = 10
313 } ompt_sync_region_t;
315 typedef enum ompt_target_data_op_t {
316 ompt_target_data_alloc = 1,
317 ompt_target_data_transfer_to_device = 2,
318 ompt_target_data_transfer_from_device = 3,
319 ompt_target_data_delete = 4,
320 ompt_target_data_associate = 5,
321 ompt_target_data_disassociate = 6,
322 ompt_target_data_alloc_async = 17,
323 ompt_target_data_transfer_to_device_async = 18,
324 ompt_target_data_transfer_from_device_async = 19,
325 ompt_target_data_delete_async = 20
326 } ompt_target_data_op_t;
328 typedef enum ompt_work_t {
330 ompt_work_sections = 2,
331 ompt_work_single_executor = 3,
332 ompt_work_single_other = 4,
333 ompt_work_workshare = 5,
334 ompt_work_distribute = 6,
335 ompt_work_taskloop = 7,
337 ompt_work_loop_static = 10,
338 ompt_work_loop_dynamic = 11,
339 ompt_work_loop_guided = 12,
340 ompt_work_loop_other = 13
343 typedef enum ompt_mutex_t {
345 ompt_mutex_test_lock = 2,
346 ompt_mutex_nest_lock = 3,
347 ompt_mutex_test_nest_lock = 4,
348 ompt_mutex_critical = 5,
349 ompt_mutex_atomic = 6,
350 ompt_mutex_ordered = 7
353 typedef enum ompt_native_mon_flag_t {
354 ompt_native_data_motion_explicit = 0x01,
355 ompt_native_data_motion_implicit = 0x02,
356 ompt_native_kernel_invocation = 0x04,
357 ompt_native_kernel_execution = 0x08,
358 ompt_native_driver = 0x10,
359 ompt_native_runtime = 0x20,
360 ompt_native_overhead = 0x40,
361 ompt_native_idleness = 0x80
362 } ompt_native_mon_flag_t;
364 typedef enum ompt_task_flag_t {
365 ompt_task_initial = 0x00000001,
366 ompt_task_implicit = 0x00000002,
367 ompt_task_explicit = 0x00000004,
368 ompt_task_target = 0x00000008,
369 ompt_task_taskwait = 0x00000010,
370 ompt_task_undeferred = 0x08000000,
371 ompt_task_untied = 0x10000000,
372 ompt_task_final = 0x20000000,
373 ompt_task_mergeable = 0x40000000,
374 ompt_task_merged = 0x80000000
377 typedef enum ompt_task_status_t {
378 ompt_task_complete = 1,
380 ompt_task_cancel = 3,
381 ompt_task_detach = 4,
382 ompt_task_early_fulfill = 5,
383 ompt_task_late_fulfill = 6,
384 ompt_task_switch = 7,
385 ompt_taskwait_complete = 8
386 } ompt_task_status_t;
388 typedef enum ompt_target_t {
390 ompt_target_enter_data = 2,
391 ompt_target_exit_data = 3,
392 ompt_target_update = 4,
393 ompt_target_nowait = 9,
394 ompt_target_enter_data_nowait = 10,
395 ompt_target_exit_data_nowait = 11,
396 ompt_target_update_nowait = 12
399 typedef enum ompt_parallel_flag_t {
400 ompt_parallel_invoker_program = 0x00000001,
401 ompt_parallel_invoker_runtime = 0x00000002,
402 ompt_parallel_league = 0x40000000,
403 ompt_parallel_team = 0x80000000
404 } ompt_parallel_flag_t;
406 typedef enum ompt_target_map_flag_t {
407 ompt_target_map_flag_to = 0x01,
408 ompt_target_map_flag_from = 0x02,
409 ompt_target_map_flag_alloc = 0x04,
410 ompt_target_map_flag_release = 0x08,
411 ompt_target_map_flag_delete = 0x10,
412 ompt_target_map_flag_implicit = 0x20
413 } ompt_target_map_flag_t;
415 typedef enum ompt_dependence_type_t {
416 ompt_dependence_type_in = 1,
417 ompt_dependence_type_out = 2,
418 ompt_dependence_type_inout = 3,
419 ompt_dependence_type_mutexinoutset = 4,
420 ompt_dependence_type_source = 5,
421 ompt_dependence_type_sink = 6,
422 ompt_dependence_type_inoutset = 7,
423 ompt_dependence_type_out_all_memory = 34,
424 ompt_dependence_type_inout_all_memory = 35
425 } ompt_dependence_type_t;
427 typedef enum ompt_severity_t {
432 typedef enum ompt_cancel_flag_t {
433 ompt_cancel_parallel = 0x01,
434 ompt_cancel_sections = 0x02,
435 ompt_cancel_loop = 0x04,
436 ompt_cancel_taskgroup = 0x08,
437 ompt_cancel_activated = 0x10,
438 ompt_cancel_detected = 0x20,
439 ompt_cancel_discarded_task = 0x40
440 } ompt_cancel_flag_t;
442 typedef uint64_t ompt_hwid_t;
444 typedef uint64_t ompt_wait_id_t;
446 typedef enum ompt_frame_flag_t {
447 ompt_frame_runtime = 0x00,
448 ompt_frame_application = 0x01,
449 ompt_frame_cfa = 0x10,
450 ompt_frame_framepointer = 0x20,
451 ompt_frame_stackaddress = 0x30
454 typedef enum ompt_state_t {
455 ompt_state_work_serial = 0x000,
456 ompt_state_work_parallel = 0x001,
457 ompt_state_work_reduction = 0x002,
459 ompt_state_wait_barrier DEPRECATED_51 = 0x010,
460 ompt_state_wait_barrier_implicit_parallel = 0x011,
461 ompt_state_wait_barrier_implicit_workshare = 0x012,
462 ompt_state_wait_barrier_implicit DEPRECATED_51 = 0x013,
463 ompt_state_wait_barrier_explicit = 0x014,
464 ompt_state_wait_barrier_implementation = 0x015,
465 ompt_state_wait_barrier_teams = 0x016,
467 ompt_state_wait_taskwait = 0x020,
468 ompt_state_wait_taskgroup = 0x021,
470 ompt_state_wait_mutex = 0x040,
471 ompt_state_wait_lock = 0x041,
472 ompt_state_wait_critical = 0x042,
473 ompt_state_wait_atomic = 0x043,
474 ompt_state_wait_ordered = 0x044,
476 ompt_state_wait_target = 0x080,
477 ompt_state_wait_target_map = 0x081,
478 ompt_state_wait_target_update = 0x082,
480 ompt_state_idle = 0x100,
481 ompt_state_overhead = 0x101,
482 ompt_state_undefined = 0x102
485 typedef uint64_t (*ompt_get_unique_id_t) (void);
487 typedef uint64_t ompd_size_t;
489 typedef uint64_t ompd_wait_id_t;
491 typedef uint64_t ompd_addr_t;
492 typedef int64_t ompd_word_t;
493 typedef uint64_t ompd_seg_t;
495 typedef uint64_t ompd_device_t;
497 typedef uint64_t ompd_thread_id_t;
499 typedef enum ompd_scope_t {
500 ompd_scope_global = 1,
501 ompd_scope_address_space = 2,
502 ompd_scope_thread = 3,
503 ompd_scope_parallel = 4,
504 ompd_scope_implicit_task = 5,
508 typedef uint64_t ompd_icv_id_t;
510 typedef enum ompd_rc_t {
512 ompd_rc_unavailable = 1,
513 ompd_rc_stale_handle = 2,
514 ompd_rc_bad_input = 3,
516 ompd_rc_unsupported = 5,
517 ompd_rc_needs_state_tracking = 6,
518 ompd_rc_incompatible = 7,
519 ompd_rc_device_read_error = 8,
520 ompd_rc_device_write_error = 9,
522 ompd_rc_incomplete = 11,
523 ompd_rc_callback_error = 12
526 typedef void (*ompt_interface_fn_t) (void);
528 typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
529 const char *interface_function_name
532 typedef union ompt_data_t {
537 typedef struct ompt_frame_t {
538 ompt_data_t exit_frame;
539 ompt_data_t enter_frame;
540 int exit_frame_flags;
541 int enter_frame_flags;
544 typedef void (*ompt_callback_t) (void);
546 typedef void ompt_device_t;
548 typedef void ompt_buffer_t;
550 typedef void (*ompt_callback_buffer_request_t) (
552 ompt_buffer_t **buffer,
556 typedef void (*ompt_callback_buffer_complete_t) (
558 ompt_buffer_t *buffer,
560 ompt_buffer_cursor_t begin,
564 typedef void (*ompt_finalize_t) (
565 ompt_data_t *tool_data
568 typedef int (*ompt_initialize_t) (
569 ompt_function_lookup_t lookup,
570 int initial_device_num,
571 ompt_data_t *tool_data
574 typedef struct ompt_start_tool_result_t {
575 ompt_initialize_t initialize;
576 ompt_finalize_t finalize;
577 ompt_data_t tool_data;
578 } ompt_start_tool_result_t;
580 typedef struct ompt_record_abstract_t {
581 ompt_record_native_t rclass;
583 ompt_device_time_t start_time;
584 ompt_device_time_t end_time;
586 } ompt_record_abstract_t;
588 typedef struct ompt_dependence_t {
589 ompt_data_t variable;
590 ompt_dependence_type_t dependence_type;
593 typedef struct ompt_dispatch_chunk_t {
596 } ompt_dispatch_chunk_t;
598 typedef int (*ompt_enumerate_states_t) (
601 const char **next_state_name
604 typedef int (*ompt_enumerate_mutex_impls_t) (
607 const char **next_impl_name
610 typedef ompt_set_result_t (*ompt_set_callback_t) (
611 ompt_callbacks_t event,
612 ompt_callback_t callback
615 typedef int (*ompt_get_callback_t) (
616 ompt_callbacks_t event,
617 ompt_callback_t *callback
620 typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
622 typedef int (*ompt_get_num_procs_t) (void);
624 typedef int (*ompt_get_num_places_t) (void);
626 typedef int (*ompt_get_place_proc_ids_t) (
632 typedef int (*ompt_get_place_num_t) (void);
634 typedef int (*ompt_get_partition_place_nums_t) (
639 typedef int (*ompt_get_proc_id_t) (void);
641 typedef int (*ompt_get_state_t) (
642 ompt_wait_id_t *wait_id
645 typedef int (*ompt_get_parallel_info_t) (
647 ompt_data_t **parallel_data,
651 typedef int (*ompt_get_task_info_t) (
654 ompt_data_t **task_data,
655 ompt_frame_t **task_frame,
656 ompt_data_t **parallel_data,
660 typedef int (*ompt_get_task_memory_t)(
666 typedef int (*ompt_get_target_info_t) (
667 uint64_t *device_num,
668 ompt_id_t *target_id,
669 ompt_id_t *host_op_id
672 typedef int (*ompt_get_num_devices_t) (void);
674 typedef void (*ompt_finalize_tool_t) (void);
676 typedef int (*ompt_get_device_num_procs_t) (
677 ompt_device_t *device
680 typedef ompt_device_time_t (*ompt_get_device_time_t) (
681 ompt_device_t *device
684 typedef double (*ompt_translate_time_t) (
685 ompt_device_t *device,
686 ompt_device_time_t time
689 typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
690 ompt_device_t *device,
695 typedef ompt_set_result_t (*ompt_set_trace_native_t) (
696 ompt_device_t *device,
701 typedef int (*ompt_start_trace_t) (
702 ompt_device_t *device,
703 ompt_callback_buffer_request_t request,
704 ompt_callback_buffer_complete_t complete
707 typedef int (*ompt_pause_trace_t) (
708 ompt_device_t *device,
712 typedef int (*ompt_flush_trace_t) (
713 ompt_device_t *device
716 typedef int (*ompt_stop_trace_t) (
717 ompt_device_t *device
720 typedef int (*ompt_advance_buffer_cursor_t) (
721 ompt_device_t *device,
722 ompt_buffer_t *buffer,
724 ompt_buffer_cursor_t current,
725 ompt_buffer_cursor_t *next
728 typedef ompt_record_t (*ompt_get_record_type_t) (
729 ompt_buffer_t *buffer,
730 ompt_buffer_cursor_t current
733 typedef void *(*ompt_get_record_native_t) (
734 ompt_buffer_t *buffer,
735 ompt_buffer_cursor_t current,
736 ompt_id_t *host_op_id
739 typedef ompt_record_abstract_t *
740 (*ompt_get_record_abstract_t) (
744 typedef void (*ompt_callback_thread_begin_t) (
745 ompt_thread_t thread_type,
746 ompt_data_t *thread_data
749 typedef struct ompt_record_thread_begin_t {
750 ompt_thread_t thread_type;
751 } ompt_record_thread_begin_t;
753 typedef void (*ompt_callback_thread_end_t) (
754 ompt_data_t *thread_data
757 typedef void (*ompt_callback_parallel_begin_t) (
758 ompt_data_t *encountering_task_data,
759 const ompt_frame_t *encountering_task_frame,
760 ompt_data_t *parallel_data,
761 unsigned int requested_parallelism,
763 const void *codeptr_ra
766 typedef struct ompt_record_parallel_begin_t {
767 ompt_id_t encountering_task_id;
768 ompt_id_t parallel_id;
769 unsigned int requested_parallelism;
771 const void *codeptr_ra;
772 } ompt_record_parallel_begin_t;
774 typedef void (*ompt_callback_parallel_end_t) (
775 ompt_data_t *parallel_data,
776 ompt_data_t *encountering_task_data,
778 const void *codeptr_ra
781 typedef struct ompt_record_parallel_end_t {
782 ompt_id_t parallel_id;
783 ompt_id_t encountering_task_id;
785 const void *codeptr_ra;
786 } ompt_record_parallel_end_t;
788 typedef void (*ompt_callback_work_t) (
789 ompt_work_t work_type,
790 ompt_scope_endpoint_t endpoint,
791 ompt_data_t *parallel_data,
792 ompt_data_t *task_data,
794 const void *codeptr_ra
797 typedef struct ompt_record_work_t {
798 ompt_work_t work_type;
799 ompt_scope_endpoint_t endpoint;
800 ompt_id_t parallel_id;
803 const void *codeptr_ra;
804 } ompt_record_work_t;
806 typedef void (*ompt_callback_dispatch_t) (
807 ompt_data_t *parallel_data,
808 ompt_data_t *task_data,
809 ompt_dispatch_t kind,
813 typedef struct ompt_record_dispatch_t {
814 ompt_id_t parallel_id;
816 ompt_dispatch_t kind;
817 ompt_data_t instance;
818 } ompt_record_dispatch_t;
820 typedef void (*ompt_callback_task_create_t) (
821 ompt_data_t *encountering_task_data,
822 const ompt_frame_t *encountering_task_frame,
823 ompt_data_t *new_task_data,
826 const void *codeptr_ra
829 typedef struct ompt_record_task_create_t {
830 ompt_id_t encountering_task_id;
831 ompt_id_t new_task_id;
834 const void *codeptr_ra;
835 } ompt_record_task_create_t;
837 typedef void (*ompt_callback_dependences_t) (
838 ompt_data_t *task_data,
839 const ompt_dependence_t *deps,
843 typedef struct ompt_record_dependences_t {
845 ompt_dependence_t dep;
847 } ompt_record_dependences_t;
849 typedef void (*ompt_callback_task_dependence_t) (
850 ompt_data_t *src_task_data,
851 ompt_data_t *sink_task_data
854 typedef struct ompt_record_task_dependence_t {
855 ompt_id_t src_task_id;
856 ompt_id_t sink_task_id;
857 } ompt_record_task_dependence_t;
859 typedef void (*ompt_callback_task_schedule_t) (
860 ompt_data_t *prior_task_data,
861 ompt_task_status_t prior_task_status,
862 ompt_data_t *next_task_data
865 typedef struct ompt_record_task_schedule_t {
866 ompt_id_t prior_task_id;
867 ompt_task_status_t prior_task_status;
868 ompt_id_t next_task_id;
869 } ompt_record_task_schedule_t;
871 typedef void (*ompt_callback_implicit_task_t) (
872 ompt_scope_endpoint_t endpoint,
873 ompt_data_t *parallel_data,
874 ompt_data_t *task_data,
875 unsigned int actual_parallelism,
880 typedef struct ompt_record_implicit_task_t {
881 ompt_scope_endpoint_t endpoint;
882 ompt_id_t parallel_id;
884 unsigned int actual_parallelism;
887 } ompt_record_implicit_task_t;
889 typedef void (*ompt_callback_masked_t) (
890 ompt_scope_endpoint_t endpoint,
891 ompt_data_t *parallel_data,
892 ompt_data_t *task_data,
893 const void *codeptr_ra
896 typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51;
898 typedef struct ompt_record_masked_t {
899 ompt_scope_endpoint_t endpoint;
900 ompt_id_t parallel_id;
902 const void *codeptr_ra;
903 } ompt_record_masked_t;
905 typedef void (*ompt_callback_sync_region_t) (
906 ompt_sync_region_t kind,
907 ompt_scope_endpoint_t endpoint,
908 ompt_data_t *parallel_data,
909 ompt_data_t *task_data,
910 const void *codeptr_ra
913 typedef struct ompt_record_sync_region_t {
914 ompt_sync_region_t kind;
915 ompt_scope_endpoint_t endpoint;
916 ompt_id_t parallel_id;
918 const void *codeptr_ra;
919 } ompt_record_sync_region_t;
921 typedef void (*ompt_callback_mutex_acquire_t) (
925 ompt_wait_id_t wait_id,
926 const void *codeptr_ra
929 typedef struct ompt_record_mutex_acquire_t {
933 ompt_wait_id_t wait_id;
934 const void *codeptr_ra;
935 } ompt_record_mutex_acquire_t;
937 typedef void (*ompt_callback_mutex_t) (
939 ompt_wait_id_t wait_id,
940 const void *codeptr_ra
943 typedef struct ompt_record_mutex_t {
945 ompt_wait_id_t wait_id;
946 const void *codeptr_ra;
947 } ompt_record_mutex_t;
949 typedef void (*ompt_callback_nest_lock_t) (
950 ompt_scope_endpoint_t endpoint,
951 ompt_wait_id_t wait_id,
952 const void *codeptr_ra
955 typedef struct ompt_record_nest_lock_t {
956 ompt_scope_endpoint_t endpoint;
957 ompt_wait_id_t wait_id;
958 const void *codeptr_ra;
959 } ompt_record_nest_lock_t;
961 typedef void (*ompt_callback_flush_t) (
962 ompt_data_t *thread_data,
963 const void *codeptr_ra
966 typedef struct ompt_record_flush_t {
967 const void *codeptr_ra;
968 } ompt_record_flush_t;
970 typedef void (*ompt_callback_cancel_t) (
971 ompt_data_t *task_data,
973 const void *codeptr_ra
976 typedef struct ompt_record_cancel_t {
979 const void *codeptr_ra;
980 } ompt_record_cancel_t;
982 typedef void (*ompt_callback_device_initialize_t) (
985 ompt_device_t *device,
986 ompt_function_lookup_t lookup,
987 const char *documentation
990 typedef void (*ompt_callback_device_finalize_t) (
994 typedef void (*ompt_callback_device_load_t) (
996 const char *filename,
997 int64_t offset_in_file,
1005 typedef void (*ompt_callback_device_unload_t) (
1010 typedef void (*ompt_callback_target_data_op_emi_t) (
1011 ompt_scope_endpoint_t endpoint,
1012 ompt_data_t *target_task_data,
1013 ompt_data_t *target_data,
1014 ompt_id_t *host_op_id,
1015 ompt_target_data_op_t optype,
1019 int dest_device_num,
1021 const void *codeptr_ra
1024 typedef void (*ompt_callback_target_data_op_t) (
1025 ompt_id_t target_id,
1026 ompt_id_t host_op_id,
1027 ompt_target_data_op_t optype,
1031 int dest_device_num,
1033 const void *codeptr_ra
1036 typedef struct ompt_record_target_data_op_t {
1037 ompt_id_t host_op_id;
1038 ompt_target_data_op_t optype;
1042 int dest_device_num;
1044 ompt_device_time_t end_time;
1045 const void *codeptr_ra;
1046 } ompt_record_target_data_op_t;
1048 typedef void (*ompt_callback_target_emi_t) (
1050 ompt_scope_endpoint_t endpoint,
1052 ompt_data_t *task_data,
1053 ompt_data_t *target_task_data,
1054 ompt_data_t *target_data,
1055 const void *codeptr_ra
1058 typedef void (*ompt_callback_target_t) (
1060 ompt_scope_endpoint_t endpoint,
1062 ompt_data_t *task_data,
1063 ompt_id_t target_id,
1064 const void *codeptr_ra
1067 typedef struct ompt_record_target_t {
1069 ompt_scope_endpoint_t endpoint;
1072 ompt_id_t target_id;
1073 const void *codeptr_ra;
1074 } ompt_record_target_t;
1076 typedef void (*ompt_callback_target_map_emi_t) (
1077 ompt_data_t *target_data,
1078 unsigned int nitems,
1082 unsigned int *mapping_flags,
1083 const void *codeptr_ra
1086 typedef void (*ompt_callback_target_map_t) (
1087 ompt_id_t target_id,
1088 unsigned int nitems,
1092 unsigned int *mapping_flags,
1093 const void *codeptr_ra
1096 typedef struct ompt_record_target_map_t {
1097 ompt_id_t target_id;
1098 unsigned int nitems;
1102 unsigned int *mapping_flags;
1103 const void *codeptr_ra;
1104 } ompt_record_target_map_t;
1106 typedef void (*ompt_callback_target_submit_emi_t) (
1107 ompt_scope_endpoint_t endpoint,
1108 ompt_data_t *target_data,
1109 ompt_id_t *host_op_id,
1110 unsigned int requested_num_teams
1113 typedef void (*ompt_callback_target_submit_t) (
1114 ompt_id_t target_id,
1115 ompt_id_t host_op_id,
1116 unsigned int requested_num_teams
1119 typedef struct ompt_record_target_kernel_t {
1120 ompt_id_t host_op_id;
1121 unsigned int requested_num_teams;
1122 unsigned int granted_num_teams;
1123 ompt_device_time_t end_time;
1124 } ompt_record_target_kernel_t;
1126 typedef int (*ompt_callback_control_tool_t) (
1130 const void *codeptr_ra
1133 typedef struct ompt_record_control_tool_t {
1136 const void *codeptr_ra;
1137 } ompt_record_control_tool_t;
1139 typedef void (*ompt_callback_error_t) (
1140 ompt_severity_t severity,
1141 const char *message, size_t length,
1142 const void *codeptr_ra
1145 typedef struct ompt_record_error_t {
1146 ompt_severity_t severity;
1147 const char *message;
1149 const void *codeptr_ra;
1150 } ompt_record_error_t;
1152 typedef struct ompd_address_t {
1154 ompd_addr_t address;
1157 typedef struct ompd_frame_info_t {
1158 ompd_address_t frame_address;
1159 ompd_word_t frame_flag;
1160 } ompd_frame_info_t;
1162 typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
1163 typedef struct _ompd_thread_handle ompd_thread_handle_t;
1164 typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
1165 typedef struct _ompd_task_handle ompd_task_handle_t;
1167 typedef struct _ompd_aspace_cont ompd_address_space_context_t;
1168 typedef struct _ompd_thread_cont ompd_thread_context_t;
1170 typedef struct ompd_device_type_sizes_t {
1171 uint8_t sizeof_char;
1172 uint8_t sizeof_short;
1174 uint8_t sizeof_long;
1175 uint8_t sizeof_long_long;
1176 uint8_t sizeof_pointer;
1177 } ompd_device_type_sizes_t;
1179 void ompd_dll_locations_valid(void);
1181 typedef ompd_rc_t (*ompd_callback_memory_alloc_fn_t)(ompd_size_t nbytes,
1184 typedef ompd_rc_t (*ompd_callback_memory_free_fn_t)(void *ptr);
1186 typedef ompd_rc_t (*ompd_callback_get_thread_context_for_thread_id_fn_t)(
1187 ompd_address_space_context_t *address_space_context, ompd_thread_id_t kind,
1188 ompd_size_t sizeof_thread_id, const void *thread_id,
1189 ompd_thread_context_t **thread_context);
1191 typedef ompd_rc_t (*ompd_callback_sizeof_fn_t)(
1192 ompd_address_space_context_t *address_space_context,
1193 ompd_device_type_sizes_t *sizes);
1195 typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t)(
1196 ompd_address_space_context_t *address_space_context,
1197 ompd_thread_context_t *thread_context, const char *symbol_name,
1198 ompd_address_t *symbol_addr, const char *file_name);
1200 typedef ompd_rc_t (*ompd_callback_memory_read_fn_t)(
1201 ompd_address_space_context_t *address_space_context,
1202 ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1203 ompd_size_t nbytes, void *buffer);
1205 typedef ompd_rc_t (*ompd_callback_memory_write_fn_t)(
1206 ompd_address_space_context_t *address_space_context,
1207 ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1208 ompd_size_t nbytes, const void *buffer);
1210 typedef ompd_rc_t (*ompd_callback_device_host_fn_t)(
1211 ompd_address_space_context_t *address_space_context, const void *input,
1212 ompd_size_t unit_size, ompd_size_t count, void *output);
1214 typedef ompd_rc_t (*ompd_callback_print_string_fn_t)(const char *string,
1217 typedef struct ompd_callbacks_t {
1218 ompd_callback_memory_alloc_fn_t alloc_memory;
1219 ompd_callback_memory_free_fn_t free_memory;
1220 ompd_callback_print_string_fn_t print_string;
1221 ompd_callback_sizeof_fn_t sizeof_type;
1222 ompd_callback_symbol_addr_fn_t symbol_addr_lookup;
1223 ompd_callback_memory_read_fn_t read_memory;
1224 ompd_callback_memory_write_fn_t write_memory;
1225 ompd_callback_memory_read_fn_t read_string;
1226 ompd_callback_device_host_fn_t device_to_host;
1227 ompd_callback_device_host_fn_t host_to_device;
1228 ompd_callback_get_thread_context_for_thread_id_fn_t
1229 get_thread_context_for_thread_id;
1232 void ompd_bp_parallel_begin(void);
1234 void ompd_bp_parallel_end(void);
1236 void ompd_bp_task_begin(void);
1238 void ompd_bp_task_end(void);
1240 void ompd_bp_thread_begin(void);
1242 void ompd_bp_thread_end(void);
1244 void ompd_bp_device_begin(void);
1246 void ompd_bp_device_end(void);
1248 ompd_rc_t ompd_initialize(ompd_word_t api_version,
1249 const ompd_callbacks_t *callbacks);
1251 ompd_rc_t ompd_get_api_version(ompd_word_t *version);
1253 ompd_rc_t ompd_get_version_string(const char **string);
1255 ompd_rc_t ompd_finalize(void);
1257 ompd_rc_t ompd_process_initialize(ompd_address_space_context_t *context,
1258 ompd_address_space_handle_t **handle);
1260 ompd_rc_t ompd_device_initialize(ompd_address_space_handle_t *process_handle,
1261 ompd_address_space_context_t *device_context,
1262 ompd_device_t kind, ompd_size_t sizeof_id,
1264 ompd_address_space_handle_t **device_handle);
1266 ompd_rc_t ompd_rel_address_space_handle(ompd_address_space_handle_t *handle);
1268 ompd_rc_t ompd_get_omp_version(ompd_address_space_handle_t *address_space,
1269 ompd_word_t *omp_version);
1272 ompd_get_omp_version_string(ompd_address_space_handle_t *address_space,
1273 const char **string);
1275 ompd_rc_t ompd_get_thread_in_parallel(ompd_parallel_handle_t *parallel_handle,
1277 ompd_thread_handle_t **thread_handle);
1279 ompd_rc_t ompd_get_thread_handle(ompd_address_space_handle_t *handle,
1280 ompd_thread_id_t kind,
1281 ompd_size_t sizeof_thread_id,
1282 const void *thread_id,
1283 ompd_thread_handle_t **thread_handle);
1285 ompd_rc_t ompd_rel_thread_handle(ompd_thread_handle_t *thread_handle);
1287 ompd_rc_t ompd_thread_handle_compare(ompd_thread_handle_t *thread_handle_1,
1288 ompd_thread_handle_t *thread_handle_2,
1291 ompd_rc_t ompd_get_thread_id(ompd_thread_handle_t *thread_handle,
1292 ompd_thread_id_t kind,
1293 ompd_size_t sizeof_thread_id, void *thread_id);
1296 ompd_get_curr_parallel_handle(ompd_thread_handle_t *thread_handle,
1297 ompd_parallel_handle_t **parallel_handle);
1299 ompd_rc_t ompd_get_enclosing_parallel_handle(
1300 ompd_parallel_handle_t *parallel_handle,
1301 ompd_parallel_handle_t **enclosing_parallel_handle);
1304 ompd_get_task_parallel_handle(ompd_task_handle_t *task_handle,
1305 ompd_parallel_handle_t **task_parallel_handle);
1307 ompd_rc_t ompd_rel_parallel_handle(ompd_parallel_handle_t *parallel_handle);
1310 ompd_parallel_handle_compare(ompd_parallel_handle_t *parallel_handle_1,
1311 ompd_parallel_handle_t *parallel_handle_2,
1314 ompd_rc_t ompd_get_curr_task_handle(ompd_thread_handle_t *thread_handle,
1315 ompd_task_handle_t **task_handle);
1318 ompd_get_generating_task_handle(ompd_task_handle_t *task_handle,
1319 ompd_task_handle_t **generating_task_handle);
1322 ompd_get_scheduling_task_handle(ompd_task_handle_t *task_handle,
1323 ompd_task_handle_t **scheduling_task_handle);
1325 ompd_rc_t ompd_get_task_in_parallel(ompd_parallel_handle_t *parallel_handle,
1327 ompd_task_handle_t **task_handle);
1329 ompd_rc_t ompd_rel_task_handle(ompd_task_handle_t *task_handle);
1331 ompd_rc_t ompd_task_handle_compare(ompd_task_handle_t *task_handle_1,
1332 ompd_task_handle_t *task_handle_2,
1335 ompd_rc_t ompd_get_task_function(ompd_task_handle_t *task_handle,
1336 ompd_address_t *entry_point);
1338 ompd_rc_t ompd_get_task_frame(ompd_task_handle_t *task_handle,
1339 ompd_frame_info_t *exit_frame,
1340 ompd_frame_info_t *enter_frame);
1343 ompd_enumerate_states(ompd_address_space_handle_t *address_space_handle,
1344 ompd_word_t current_state, ompd_word_t *next_state,
1345 const char **next_state_name, ompd_word_t *more_enums);
1347 ompd_rc_t ompd_get_state(ompd_thread_handle_t *thread_handle,
1348 ompd_word_t *state, ompd_wait_id_t *wait_id);
1351 ompd_get_display_control_vars(ompd_address_space_handle_t *address_space_handle,
1352 const char *const **control_vars);
1354 ompd_rc_t ompd_rel_display_control_vars(const char *const **control_vars);
1356 ompd_rc_t ompd_enumerate_icvs(ompd_address_space_handle_t *handle,
1357 ompd_icv_id_t current, ompd_icv_id_t *next_id,
1358 const char **next_icv_name,
1359 ompd_scope_t *next_scope, int *more);
1361 ompd_rc_t ompd_get_icv_from_scope(void *handle, ompd_scope_t scope,
1362 ompd_icv_id_t icv_id, ompd_word_t *icv_value);
1364 ompd_rc_t ompd_get_icv_string_from_scope(void *handle, ompd_scope_t scope,
1365 ompd_icv_id_t icv_id,
1366 const char **icv_string);
1368 ompd_rc_t ompd_get_tool_data(void *handle, ompd_scope_t scope,
1369 ompd_word_t *value, ompd_address_t *ptr);
1371 typedef struct ompt_record_ompt_t {
1372 ompt_callbacks_t type;
1373 ompt_device_time_t time;
1374 ompt_id_t thread_id;
1375 ompt_id_t target_id;
1377 ompt_record_thread_begin_t thread_begin;
1378 ompt_record_parallel_begin_t parallel_begin;
1379 ompt_record_parallel_end_t parallel_end;
1380 ompt_record_work_t work;
1381 ompt_record_dispatch_t dispatch;
1382 ompt_record_task_create_t task_create;
1383 ompt_record_dependences_t dependences;
1384 ompt_record_task_dependence_t task_dependence;
1385 ompt_record_task_schedule_t task_schedule;
1386 ompt_record_implicit_task_t implicit_task;
1387 ompt_record_masked_t masked;
1388 ompt_record_sync_region_t sync_region;
1389 ompt_record_mutex_acquire_t mutex_acquire;
1390 ompt_record_mutex_t mutex;
1391 ompt_record_nest_lock_t nest_lock;
1392 ompt_record_flush_t flush;
1393 ompt_record_cancel_t cancel;
1394 ompt_record_target_t target;
1395 ompt_record_target_data_op_t target_data_op;
1396 ompt_record_target_map_t target_map;
1397 ompt_record_target_kernel_t target_kernel;
1398 ompt_record_control_tool_t control_tool;
1400 } ompt_record_ompt_t;
1402 typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
1403 ompt_buffer_t *buffer,
1404 ompt_buffer_cursor_t current
1407 #define ompt_id_none 0
1408 #define ompt_data_none {0}
1409 #define ompt_time_none 0
1410 #define ompt_hwid_none 0
1411 #define ompt_addr_none ~0
1412 #define ompt_mutex_impl_none 0
1413 #define ompt_wait_id_none 0
1415 #define ompd_segment_none 0
1417 #endif /* __OMPT__ */