1 // $FreeBSD$ 2 /* 3 * include/omp-tools.h.var 4 */ 5 6 //===----------------------------------------------------------------------===// 7 // 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 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef __OMPT__ 15 #define __OMPT__ 16 17 /***************************************************************************** 18 * system include files 19 *****************************************************************************/ 20 21 #include <stdint.h> 22 #include <stddef.h> 23 24 #ifdef DEPRECATION_WARNINGS 25 # ifdef __cplusplus 26 # define DEPRECATED_51 [[deprecated("as of 5.1")]] 27 # else 28 # define DEPRECATED_51 __attribute__((deprecated("as of 5.1"))) 29 #endif 30 #else 31 #define DEPRECATED_51 32 #endif 33 34 /***************************************************************************** 35 * iteration macros 36 *****************************************************************************/ 37 38 #define FOREACH_OMPT_INQUIRY_FN(macro) \ 39 macro (ompt_enumerate_states) \ 40 macro (ompt_enumerate_mutex_impls) \ 41 \ 42 macro (ompt_set_callback) \ 43 macro (ompt_get_callback) \ 44 \ 45 macro (ompt_get_state) \ 46 \ 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) \ 53 \ 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) \ 60 \ 61 macro(ompt_get_target_info) \ 62 macro(ompt_get_num_devices) 63 64 #define FOREACH_OMPT_STATE(macro) \ 65 \ 66 /* first available state */ \ 67 macro (ompt_state_undefined, 0x102) /* undefined thread state */ \ 68 \ 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 */ \ 73 \ 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 */ \ 82 \ 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 */ \ 86 \ 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 */ \ 93 \ 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 */ \ 98 \ 99 /* misc (256..511) */ \ 100 macro (ompt_state_idle, 0x100) /* waiting for work */ \ 101 macro (ompt_state_overhead, 0x101) /* overhead excluding wait states */ \ 102 \ 103 /* implementation-specific states (512..) */ 104 105 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 */ 111 112 #define FOREACH_OMPT_EVENT(macro) \ 113 \ 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 */ \ 117 \ 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 */ \ 120 \ 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 */ \ 124 \ 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 */ \ 128 \ 129 macro (ompt_callback_control_tool, ompt_callback_control_tool_t, 11) /* control tool */ \ 130 \ 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 */ \ 133 \ 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 */ \ 136 \ 137 /* Optional Events */ \ 138 macro (ompt_callback_sync_region_wait, ompt_callback_sync_region_t, 16) /* sync region wait begin or end */ \ 139 \ 140 macro (ompt_callback_mutex_released, ompt_callback_mutex_t, 17) /* mutex released */ \ 141 \ 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 */ \ 144 \ 145 macro (ompt_callback_work, ompt_callback_work_t, 20) /* task at work begin or end */ \ 146 \ 147 macro (ompt_callback_masked, ompt_callback_masked_t, 21) /* task at masked begin or end */ \ 148 \ 149 macro (ompt_callback_target_map, ompt_callback_target_map_t, 22) /* target map */ \ 150 \ 151 macro (ompt_callback_sync_region, ompt_callback_sync_region_t, 23) /* sync region begin or end */ \ 152 \ 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 */ \ 155 \ 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 */ \ 158 \ 159 macro (ompt_callback_nest_lock, ompt_callback_nest_lock_t, 28) /* nest lock */ \ 160 \ 161 macro (ompt_callback_flush, ompt_callback_flush_t, 29) /* after executing flush */ \ 162 \ 163 macro (ompt_callback_cancel, ompt_callback_cancel_t, 30) /* cancel innermost binding region */ \ 164 \ 165 macro (ompt_callback_reduction, ompt_callback_sync_region_t, 31) /* reduction */ \ 166 \ 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 */ 173 174 /***************************************************************************** 175 * implementation specific types 176 *****************************************************************************/ 177 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 182 } kmp_mutex_impl_t; 183 184 /***************************************************************************** 185 * definitions generated from spec 186 *****************************************************************************/ 187 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 227 } ompt_callbacks_t; 228 229 typedef enum ompt_record_t { 230 ompt_record_ompt = 1, 231 ompt_record_native = 2, 232 ompt_record_invalid = 3 233 } ompt_record_t; 234 235 typedef enum ompt_record_native_t { 236 ompt_record_native_info = 1, 237 ompt_record_native_event = 2 238 } ompt_record_native_t; 239 240 typedef enum ompt_set_result_t { 241 ompt_set_error = 0, 242 ompt_set_never = 1, 243 ompt_set_impossible = 2, 244 ompt_set_sometimes = 3, 245 ompt_set_sometimes_paired = 4, 246 ompt_set_always = 5 247 } ompt_set_result_t; 248 249 typedef uint64_t ompt_id_t; 250 251 typedef uint64_t ompt_device_time_t; 252 253 typedef uint64_t ompt_buffer_cursor_t; 254 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 260 } ompt_thread_t; 261 262 typedef enum ompt_scope_endpoint_t { 263 ompt_scope_begin = 1, 264 ompt_scope_end = 2, 265 ompt_scope_beginend = 3 266 } ompt_scope_endpoint_t; 267 268 typedef enum ompt_dispatch_t { 269 ompt_dispatch_iteration = 1, 270 ompt_dispatch_section = 2 271 } ompt_dispatch_t; 272 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; 285 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; 298 299 typedef enum ompt_work_t { 300 ompt_work_loop = 1, 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, 307 ompt_work_scope = 8 308 } ompt_work_t; 309 310 typedef enum ompt_mutex_t { 311 ompt_mutex_lock = 1, 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 318 } ompt_mutex_t; 319 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; 330 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 342 } ompt_task_flag_t; 343 344 typedef enum ompt_task_status_t { 345 ompt_task_complete = 1, 346 ompt_task_yield = 2, 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; 354 355 typedef enum ompt_target_t { 356 ompt_target = 1, 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 364 } ompt_target_t; 365 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; 372 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; 381 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; 391 392 typedef enum ompt_severity_t { 393 ompt_warning = 1, 394 ompt_fatal = 2 395 } ompt_severity_t; 396 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; 406 407 typedef uint64_t ompt_hwid_t; 408 409 typedef uint64_t ompt_wait_id_t; 410 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 417 } ompt_frame_flag_t; 418 419 typedef enum ompt_state_t { 420 ompt_state_work_serial = 0x000, 421 ompt_state_work_parallel = 0x001, 422 ompt_state_work_reduction = 0x002, 423 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, 431 432 ompt_state_wait_taskwait = 0x020, 433 ompt_state_wait_taskgroup = 0x021, 434 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, 440 441 ompt_state_wait_target = 0x080, 442 ompt_state_wait_target_map = 0x081, 443 ompt_state_wait_target_update = 0x082, 444 445 ompt_state_idle = 0x100, 446 ompt_state_overhead = 0x101, 447 ompt_state_undefined = 0x102 448 } ompt_state_t; 449 450 typedef uint64_t (*ompt_get_unique_id_t) (void); 451 452 typedef uint64_t ompd_size_t; 453 454 typedef uint64_t ompd_wait_id_t; 455 456 typedef uint64_t ompd_addr_t; 457 typedef int64_t ompd_word_t; 458 typedef uint64_t ompd_seg_t; 459 460 typedef uint64_t ompd_device_t; 461 462 typedef uint64_t ompd_thread_id_t; 463 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, 470 ompd_scope_task = 6 471 } ompd_scope_t; 472 473 typedef uint64_t ompd_icv_id_t; 474 475 typedef enum ompd_rc_t { 476 ompd_rc_ok = 0, 477 ompd_rc_unavailable = 1, 478 ompd_rc_stale_handle = 2, 479 ompd_rc_bad_input = 3, 480 ompd_rc_error = 4, 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, 486 ompd_rc_nomem = 10, 487 } ompd_rc_t; 488 489 typedef void (*ompt_interface_fn_t) (void); 490 491 typedef ompt_interface_fn_t (*ompt_function_lookup_t) ( 492 const char *interface_function_name 493 ); 494 495 typedef union ompt_data_t { 496 uint64_t value; 497 void *ptr; 498 } ompt_data_t; 499 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; 505 } ompt_frame_t; 506 507 typedef void (*ompt_callback_t) (void); 508 509 typedef void ompt_device_t; 510 511 typedef void ompt_buffer_t; 512 513 typedef void (*ompt_callback_buffer_request_t) ( 514 int device_num, 515 ompt_buffer_t **buffer, 516 size_t *bytes 517 ); 518 519 typedef void (*ompt_callback_buffer_complete_t) ( 520 int device_num, 521 ompt_buffer_t *buffer, 522 size_t bytes, 523 ompt_buffer_cursor_t begin, 524 int buffer_owned 525 ); 526 527 typedef void (*ompt_finalize_t) ( 528 ompt_data_t *tool_data 529 ); 530 531 typedef int (*ompt_initialize_t) ( 532 ompt_function_lookup_t lookup, 533 int initial_device_num, 534 ompt_data_t *tool_data 535 ); 536 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; 542 543 typedef struct ompt_record_abstract_t { 544 ompt_record_native_t rclass; 545 const char *type; 546 ompt_device_time_t start_time; 547 ompt_device_time_t end_time; 548 ompt_hwid_t hwid; 549 } ompt_record_abstract_t; 550 551 typedef struct ompt_dependence_t { 552 ompt_data_t variable; 553 ompt_dependence_type_t dependence_type; 554 } ompt_dependence_t; 555 556 typedef int (*ompt_enumerate_states_t) ( 557 int current_state, 558 int *next_state, 559 const char **next_state_name 560 ); 561 562 typedef int (*ompt_enumerate_mutex_impls_t) ( 563 int current_impl, 564 int *next_impl, 565 const char **next_impl_name 566 ); 567 568 typedef ompt_set_result_t (*ompt_set_callback_t) ( 569 ompt_callbacks_t event, 570 ompt_callback_t callback 571 ); 572 573 typedef int (*ompt_get_callback_t) ( 574 ompt_callbacks_t event, 575 ompt_callback_t *callback 576 ); 577 578 typedef ompt_data_t *(*ompt_get_thread_data_t) (void); 579 580 typedef int (*ompt_get_num_procs_t) (void); 581 582 typedef int (*ompt_get_num_places_t) (void); 583 584 typedef int (*ompt_get_place_proc_ids_t) ( 585 int place_num, 586 int ids_size, 587 int *ids 588 ); 589 590 typedef int (*ompt_get_place_num_t) (void); 591 592 typedef int (*ompt_get_partition_place_nums_t) ( 593 int place_nums_size, 594 int *place_nums 595 ); 596 597 typedef int (*ompt_get_proc_id_t) (void); 598 599 typedef int (*ompt_get_state_t) ( 600 ompt_wait_id_t *wait_id 601 ); 602 603 typedef int (*ompt_get_parallel_info_t) ( 604 int ancestor_level, 605 ompt_data_t **parallel_data, 606 int *team_size 607 ); 608 609 typedef int (*ompt_get_task_info_t) ( 610 int ancestor_level, 611 int *flags, 612 ompt_data_t **task_data, 613 ompt_frame_t **task_frame, 614 ompt_data_t **parallel_data, 615 int *thread_num 616 ); 617 618 typedef int (*ompt_get_task_memory_t)( 619 void **addr, 620 size_t *size, 621 int block 622 ); 623 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 628 ); 629 630 typedef int (*ompt_get_num_devices_t) (void); 631 632 typedef void (*ompt_finalize_tool_t) (void); 633 634 typedef int (*ompt_get_device_num_procs_t) ( 635 ompt_device_t *device 636 ); 637 638 typedef ompt_device_time_t (*ompt_get_device_time_t) ( 639 ompt_device_t *device 640 ); 641 642 typedef double (*ompt_translate_time_t) ( 643 ompt_device_t *device, 644 ompt_device_time_t time 645 ); 646 647 typedef ompt_set_result_t (*ompt_set_trace_ompt_t) ( 648 ompt_device_t *device, 649 unsigned int enable, 650 unsigned int etype 651 ); 652 653 typedef ompt_set_result_t (*ompt_set_trace_native_t) ( 654 ompt_device_t *device, 655 int enable, 656 int flags 657 ); 658 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 663 ); 664 665 typedef int (*ompt_pause_trace_t) ( 666 ompt_device_t *device, 667 int begin_pause 668 ); 669 670 typedef int (*ompt_flush_trace_t) ( 671 ompt_device_t *device 672 ); 673 674 typedef int (*ompt_stop_trace_t) ( 675 ompt_device_t *device 676 ); 677 678 typedef int (*ompt_advance_buffer_cursor_t) ( 679 ompt_device_t *device, 680 ompt_buffer_t *buffer, 681 size_t size, 682 ompt_buffer_cursor_t current, 683 ompt_buffer_cursor_t *next 684 ); 685 686 typedef ompt_record_t (*ompt_get_record_type_t) ( 687 ompt_buffer_t *buffer, 688 ompt_buffer_cursor_t current 689 ); 690 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 695 ); 696 697 typedef ompt_record_abstract_t * 698 (*ompt_get_record_abstract_t) ( 699 void *native_record 700 ); 701 702 typedef void (*ompt_callback_thread_begin_t) ( 703 ompt_thread_t thread_type, 704 ompt_data_t *thread_data 705 ); 706 707 typedef struct ompt_record_thread_begin_t { 708 ompt_thread_t thread_type; 709 } ompt_record_thread_begin_t; 710 711 typedef void (*ompt_callback_thread_end_t) ( 712 ompt_data_t *thread_data 713 ); 714 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, 720 int flags, 721 const void *codeptr_ra 722 ); 723 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; 728 int flags; 729 const void *codeptr_ra; 730 } ompt_record_parallel_begin_t; 731 732 typedef void (*ompt_callback_parallel_end_t) ( 733 ompt_data_t *parallel_data, 734 ompt_data_t *encountering_task_data, 735 int flags, 736 const void *codeptr_ra 737 ); 738 739 typedef struct ompt_record_parallel_end_t { 740 ompt_id_t parallel_id; 741 ompt_id_t encountering_task_id; 742 int flags; 743 const void *codeptr_ra; 744 } ompt_record_parallel_end_t; 745 746 typedef void (*ompt_callback_work_t) ( 747 ompt_work_t wstype, 748 ompt_scope_endpoint_t endpoint, 749 ompt_data_t *parallel_data, 750 ompt_data_t *task_data, 751 uint64_t count, 752 const void *codeptr_ra 753 ); 754 755 typedef struct ompt_record_work_t { 756 ompt_work_t wstype; 757 ompt_scope_endpoint_t endpoint; 758 ompt_id_t parallel_id; 759 ompt_id_t task_id; 760 uint64_t count; 761 const void *codeptr_ra; 762 } ompt_record_work_t; 763 764 typedef void (*ompt_callback_dispatch_t) ( 765 ompt_data_t *parallel_data, 766 ompt_data_t *task_data, 767 ompt_dispatch_t kind, 768 ompt_data_t instance 769 ); 770 771 typedef struct ompt_record_dispatch_t { 772 ompt_id_t parallel_id; 773 ompt_id_t task_id; 774 ompt_dispatch_t kind; 775 ompt_data_t instance; 776 } ompt_record_dispatch_t; 777 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, 782 int flags, 783 int has_dependences, 784 const void *codeptr_ra 785 ); 786 787 typedef struct ompt_record_task_create_t { 788 ompt_id_t encountering_task_id; 789 ompt_id_t new_task_id; 790 int flags; 791 int has_dependences; 792 const void *codeptr_ra; 793 } ompt_record_task_create_t; 794 795 typedef void (*ompt_callback_dependences_t) ( 796 ompt_data_t *task_data, 797 const ompt_dependence_t *deps, 798 int ndeps 799 ); 800 801 typedef struct ompt_record_dependences_t { 802 ompt_id_t task_id; 803 ompt_dependence_t dep; 804 int ndeps; 805 } ompt_record_dependences_t; 806 807 typedef void (*ompt_callback_task_dependence_t) ( 808 ompt_data_t *src_task_data, 809 ompt_data_t *sink_task_data 810 ); 811 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; 816 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 821 ); 822 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; 828 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, 834 unsigned int index, 835 int flags 836 ); 837 838 typedef struct ompt_record_implicit_task_t { 839 ompt_scope_endpoint_t endpoint; 840 ompt_id_t parallel_id; 841 ompt_id_t task_id; 842 unsigned int actual_parallelism; 843 unsigned int index; 844 int flags; 845 } ompt_record_implicit_task_t; 846 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 852 ); 853 854 typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51; 855 856 typedef struct ompt_record_masked_t { 857 ompt_scope_endpoint_t endpoint; 858 ompt_id_t parallel_id; 859 ompt_id_t task_id; 860 const void *codeptr_ra; 861 } ompt_record_masked_t; 862 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 869 ); 870 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; 875 ompt_id_t task_id; 876 const void *codeptr_ra; 877 } ompt_record_sync_region_t; 878 879 typedef void (*ompt_callback_mutex_acquire_t) ( 880 ompt_mutex_t kind, 881 unsigned int hint, 882 unsigned int impl, 883 ompt_wait_id_t wait_id, 884 const void *codeptr_ra 885 ); 886 887 typedef struct ompt_record_mutex_acquire_t { 888 ompt_mutex_t kind; 889 unsigned int hint; 890 unsigned int impl; 891 ompt_wait_id_t wait_id; 892 const void *codeptr_ra; 893 } ompt_record_mutex_acquire_t; 894 895 typedef void (*ompt_callback_mutex_t) ( 896 ompt_mutex_t kind, 897 ompt_wait_id_t wait_id, 898 const void *codeptr_ra 899 ); 900 901 typedef struct ompt_record_mutex_t { 902 ompt_mutex_t kind; 903 ompt_wait_id_t wait_id; 904 const void *codeptr_ra; 905 } ompt_record_mutex_t; 906 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 911 ); 912 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; 918 919 typedef void (*ompt_callback_flush_t) ( 920 ompt_data_t *thread_data, 921 const void *codeptr_ra 922 ); 923 924 typedef struct ompt_record_flush_t { 925 const void *codeptr_ra; 926 } ompt_record_flush_t; 927 928 typedef void (*ompt_callback_cancel_t) ( 929 ompt_data_t *task_data, 930 int flags, 931 const void *codeptr_ra 932 ); 933 934 typedef struct ompt_record_cancel_t { 935 ompt_id_t task_id; 936 int flags; 937 const void *codeptr_ra; 938 } ompt_record_cancel_t; 939 940 typedef void (*ompt_callback_device_initialize_t) ( 941 int device_num, 942 const char *type, 943 ompt_device_t *device, 944 ompt_function_lookup_t lookup, 945 const char *documentation 946 ); 947 948 typedef void (*ompt_callback_device_finalize_t) ( 949 int device_num 950 ); 951 952 typedef void (*ompt_callback_device_load_t) ( 953 int device_num, 954 const char *filename, 955 int64_t offset_in_file, 956 void *vma_in_file, 957 size_t bytes, 958 void *host_addr, 959 void *device_addr, 960 uint64_t module_id 961 ); 962 963 typedef void (*ompt_callback_device_unload_t) ( 964 int device_num, 965 uint64_t module_id 966 ); 967 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, 974 void *src_addr, 975 int src_device_num, 976 void *dest_addr, 977 int dest_device_num, 978 size_t bytes, 979 const void *codeptr_ra 980 ); 981 982 typedef void (*ompt_callback_target_data_op_t) ( 983 ompt_id_t target_id, 984 ompt_id_t host_op_id, 985 ompt_target_data_op_t optype, 986 void *src_addr, 987 int src_device_num, 988 void *dest_addr, 989 int dest_device_num, 990 size_t bytes, 991 const void *codeptr_ra 992 ); 993 994 typedef struct ompt_record_target_data_op_t { 995 ompt_id_t host_op_id; 996 ompt_target_data_op_t optype; 997 void *src_addr; 998 int src_device_num; 999 void *dest_addr; 1000 int dest_device_num; 1001 size_t bytes; 1002 ompt_device_time_t end_time; 1003 const void *codeptr_ra; 1004 } ompt_record_target_data_op_t; 1005 1006 typedef void (*ompt_callback_target_emi_t) ( 1007 ompt_target_t kind, 1008 ompt_scope_endpoint_t endpoint, 1009 int device_num, 1010 ompt_data_t *task_data, 1011 ompt_data_t *target_task_data, 1012 ompt_data_t *target_data, 1013 const void *codeptr_ra 1014 ); 1015 1016 typedef void (*ompt_callback_target_t) ( 1017 ompt_target_t kind, 1018 ompt_scope_endpoint_t endpoint, 1019 int device_num, 1020 ompt_data_t *task_data, 1021 ompt_id_t target_id, 1022 const void *codeptr_ra 1023 ); 1024 1025 typedef struct ompt_record_target_t { 1026 ompt_target_t kind; 1027 ompt_scope_endpoint_t endpoint; 1028 int device_num; 1029 ompt_id_t task_id; 1030 ompt_id_t target_id; 1031 const void *codeptr_ra; 1032 } ompt_record_target_t; 1033 1034 typedef void (*ompt_callback_target_map_emi_t) ( 1035 ompt_data_t *target_data, 1036 unsigned int nitems, 1037 void **host_addr, 1038 void **device_addr, 1039 size_t *bytes, 1040 unsigned int *mapping_flags, 1041 const void *codeptr_ra 1042 ); 1043 1044 typedef void (*ompt_callback_target_map_t) ( 1045 ompt_id_t target_id, 1046 unsigned int nitems, 1047 void **host_addr, 1048 void **device_addr, 1049 size_t *bytes, 1050 unsigned int *mapping_flags, 1051 const void *codeptr_ra 1052 ); 1053 1054 typedef struct ompt_record_target_map_t { 1055 ompt_id_t target_id; 1056 unsigned int nitems; 1057 void **host_addr; 1058 void **device_addr; 1059 size_t *bytes; 1060 unsigned int *mapping_flags; 1061 const void *codeptr_ra; 1062 } ompt_record_target_map_t; 1063 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 1069 ); 1070 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 1075 ); 1076 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; 1083 1084 typedef int (*ompt_callback_control_tool_t) ( 1085 uint64_t command, 1086 uint64_t modifier, 1087 void *arg, 1088 const void *codeptr_ra 1089 ); 1090 1091 typedef struct ompt_record_control_tool_t { 1092 uint64_t command; 1093 uint64_t modifier; 1094 const void *codeptr_ra; 1095 } ompt_record_control_tool_t; 1096 1097 typedef void (*ompt_callback_error_t) ( 1098 ompt_severity_t severity, 1099 const char *message, size_t length, 1100 const void *codeptr_ra 1101 ); 1102 1103 typedef struct ompd_address_t { 1104 ompd_seg_t segment; 1105 ompd_addr_t address; 1106 } ompd_address_t; 1107 1108 typedef struct ompd_frame_info_t { 1109 ompd_address_t frame_address; 1110 ompd_word_t frame_flag; 1111 } ompd_frame_info_t; 1112 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; 1117 1118 typedef struct _ompd_aspace_cont ompd_address_space_context_t; 1119 typedef struct _ompd_thread_cont ompd_thread_context_t; 1120 1121 typedef struct ompd_device_type_sizes_t { 1122 uint8_t sizeof_char; 1123 uint8_t sizeof_short; 1124 uint8_t sizeof_int; 1125 uint8_t sizeof_long; 1126 uint8_t sizeof_long_long; 1127 uint8_t sizeof_pointer; 1128 } ompd_device_type_sizes_t; 1129 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; 1135 union { 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; 1158 } record; 1159 } ompt_record_ompt_t; 1160 1161 typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) ( 1162 ompt_buffer_t *buffer, 1163 ompt_buffer_cursor_t current 1164 ); 1165 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 1173 1174 #define ompd_segment_none 0 1175 1176 #endif /* __OMPT__ */ 1177