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