omp-tools.h 48 KB

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