55// Tool related code below
66#include <omp-tools.h>
77
8+ static const char * ompt_target_data_op_t_values [] = {
9+ "" ,
10+ "ompt_target_data_alloc" ,
11+ "ompt_target_data_transfer_to_device" ,
12+ "ompt_target_data_transfer_from_device" ,
13+ "ompt_target_data_delete" ,
14+ "ompt_target_data_associate" ,
15+ "ompt_target_data_disassociate" ,
16+ "ompt_target_data_alloc_async" ,
17+ "ompt_target_data_transfer_to_device_async" ,
18+ "ompt_target_data_transfer_from_device_async" ,
19+ "ompt_target_data_delete_async" };
20+
21+ static const char * ompt_scope_endpoint_t_values [] = {
22+ "" , "ompt_scope_begin" , "ompt_scope_end" , "ompt_scope_beginend" };
23+
24+ static const char * ompt_target_t_values [] = {"" ,
25+ "ompt_target" ,
26+ "ompt_target_enter_data" ,
27+ "ompt_target_exit_data" ,
28+ "ompt_target_update" ,
29+ "" ,
30+ "" ,
31+ "" ,
32+ "" ,
33+ "" ,
34+ "ompt_target_nowait" ,
35+ "ompt_target_enter_data_nowait" ,
36+ "ompt_target_exit_data_nowait" ,
37+ "ompt_target_update_nowait" };
38+
839// For EMI callbacks
940ompt_id_t next_op_id = 0x8000000000000001 ;
1041
@@ -38,11 +69,11 @@ static void on_ompt_callback_target_data_op(
3869 void * src_addr , int src_device_num , void * dest_addr , int dest_device_num ,
3970 size_t bytes , const void * codeptr_ra ) {
4071 assert (codeptr_ra != 0 && "Unexpected null codeptr" );
41- printf (" Callback DataOp: target_id=%lu host_op_id=%lu optype=%d src=%p "
72+ printf (" Callback DataOp: target_id=%lu host_op_id=%lu optype=%s src=%p "
4273 "src_device_num=%d "
4374 "dest=%p dest_device_num=%d bytes=%lu code=%p\n" ,
44- target_id , host_op_id , optype , src_addr , src_device_num , dest_addr ,
45- dest_device_num , bytes , codeptr_ra );
75+ target_id , host_op_id , ompt_target_data_op_t_values [ optype ] , src_addr ,
76+ src_device_num , dest_addr , dest_device_num , bytes , codeptr_ra );
4677}
4778
4879static void on_ompt_callback_target (ompt_target_t kind ,
@@ -51,9 +82,10 @@ static void on_ompt_callback_target(ompt_target_t kind,
5182 ompt_id_t target_id ,
5283 const void * codeptr_ra ) {
5384 assert (codeptr_ra != 0 && "Unexpected null codeptr" );
54- printf ("Callback Target: target_id=%lu kind=%d endpoint=%d device_num=%d "
85+ printf ("Callback Target: target_id=%lu kind=%s endpoint=%s device_num=%d "
5586 "code=%p\n" ,
56- target_id , kind , endpoint , device_num , codeptr_ra );
87+ target_id , ompt_target_t_values [kind ],
88+ ompt_scope_endpoint_t_values [endpoint ], device_num , codeptr_ra );
5789}
5890
5991static void on_ompt_callback_target_submit (ompt_id_t target_id ,
@@ -84,13 +116,15 @@ static void on_ompt_callback_target_data_op_emi(
84116 // target_task_data may be null, avoid dereferencing it
85117 uint64_t target_task_data_value =
86118 (target_task_data ) ? target_task_data -> value : 0 ;
87- printf (" Callback DataOp EMI: endpoint=%d optype=%d target_task_data=%p "
119+ printf (" Callback DataOp EMI: endpoint=%s optype=%s target_task_data=%p "
88120 "(0x%lx) target_data=%p (0x%lx) host_op_id=%p (0x%lx) src=%p "
89121 "src_device_num=%d "
90122 "dest=%p dest_device_num=%d bytes=%lu code=%p\n" ,
91- endpoint , optype , target_task_data , target_task_data_value ,
92- target_data , target_data -> value , host_op_id , * host_op_id , src_addr ,
93- src_device_num , dest_addr , dest_device_num , bytes , codeptr_ra );
123+ ompt_scope_endpoint_t_values [endpoint ],
124+ ompt_target_data_op_t_values [optype ], target_task_data ,
125+ target_task_data_value , target_data , target_data -> value , host_op_id ,
126+ * host_op_id , src_addr , src_device_num , dest_addr , dest_device_num ,
127+ bytes , codeptr_ra );
94128}
95129
96130static void on_ompt_callback_target_emi (ompt_target_t kind ,
@@ -102,20 +136,21 @@ static void on_ompt_callback_target_emi(ompt_target_t kind,
102136 assert (codeptr_ra != 0 && "Unexpected null codeptr" );
103137 if (endpoint == ompt_scope_begin )
104138 target_data -> value = next_op_id ++ ;
105- printf ("Callback Target EMI: kind=%d endpoint=%d device_num=%d task_data=%p "
139+ printf ("Callback Target EMI: kind=%s endpoint=%s device_num=%d task_data=%p "
106140 "(0x%lx) target_task_data=%p (0x%lx) target_data=%p (0x%lx) code=%p\n" ,
107- kind , endpoint , device_num , task_data , task_data -> value ,
108- target_task_data , target_task_data -> value , target_data ,
109- target_data -> value , codeptr_ra );
141+ ompt_target_t_values [kind ], ompt_scope_endpoint_t_values [endpoint ],
142+ device_num , task_data , task_data ? task_data -> value : 0 ,
143+ target_task_data , target_task_data ? target_task_data -> value : 0 ,
144+ target_data , target_data -> value , codeptr_ra );
110145}
111146
112147static void on_ompt_callback_target_submit_emi (
113148 ompt_scope_endpoint_t endpoint , ompt_data_t * target_data ,
114149 ompt_id_t * host_op_id , unsigned int requested_num_teams ) {
115- printf (" Callback Submit EMI: endpoint=%d req_num_teams=%d target_data=%p "
150+ printf (" Callback Submit EMI: endpoint=%s req_num_teams=%d target_data=%p "
116151 "(0x%lx) host_op_id=%p (0x%lx)\n" ,
117- endpoint , requested_num_teams , target_data , target_data -> value ,
118- host_op_id , * host_op_id );
152+ ompt_scope_endpoint_t_values [ endpoint ] , requested_num_teams ,
153+ target_data , target_data -> value , host_op_id , * host_op_id );
119154}
120155
121156static void on_ompt_callback_target_map_emi (ompt_data_t * target_data ,
0 commit comments