diff --git a/script/hsaap.py b/script/hsaap.py index e1a3d71784..0acf101570 100755 --- a/script/hsaap.py +++ b/script/hsaap.py @@ -362,11 +362,13 @@ class API_DescrParser: self.content += ' struct {\n' for (var, item) in struct['astr'].items(): self.content += ' ' + item + ';\n' + if call == "hsa_amd_memory_async_copy_rect" and item == "const hsa_dim3_t* range": + self.content += ' hsa_dim3_t range__val;\n' self.content += ' } ' + call + ';\n' else: self.content += ' } args;\n' self.content += '};\n' - + # generate API callbacks def gen_callbacks(self, n, name, call, struct): if n == -1: @@ -384,6 +386,8 @@ class API_DescrParser: self.content += ' api_data.args.' + call + '.' + var + ' = ' + '(' + var + ' != NULL) ? strdup(' + var + ')' + ' : NULL;\n' else: self.content += ' api_data.args.' + call + '.' + var + ' = ' + var + ';\n' + if call == 'hsa_amd_memory_async_copy_rect' and var == 'range': + self.content += ' api_data.args.' + call + '.' + var + '__val = ' + '*(' + var + ');\n' self.content += ' activity_rtapi_callback_t api_callback_fun = NULL;\n' self.content += ' void* api_callback_arg = NULL;\n' self.content += ' cb_table.get(' + call_id + ', &api_callback_fun, &api_callback_arg);\n' @@ -459,6 +463,9 @@ class API_DescrParser: self.content += ' out << "0x" << std::hex << (uint64_t)' + arg_val else: self.content += ' out << ' + arg_val + if call == "hsa_amd_memory_async_copy_rect" and arg_var == "range": + self.content += ' << ", ";\n' + self.content += ' out << ' + arg_val + '__val' ''' arg_item = struct['tlst'][ind] if re.search(r'\(\* ', arg_item): arg_pref = '' diff --git a/test/tool/tracer_tool.cpp b/test/tool/tracer_tool.cpp index cf55574766..0b1721d5b1 100644 --- a/test/tool/tracer_tool.cpp +++ b/test/tool/tracer_tool.cpp @@ -315,6 +315,7 @@ constexpr roctracer::TraceBuffer::flush_prm_t hsa_flush_p roctracer::TraceBuffer* hsa_api_trace_buffer = NULL; // HSA API callback function + void hsa_api_callback( uint32_t domain, uint32_t cid, @@ -326,6 +327,7 @@ void hsa_api_callback( if (data->phase == ACTIVITY_API_PHASE_ENTER) { hsa_begin_timestamp = timer->timestamp_fn_ns(); } else { + const timestamp_t end_timestamp = (cid == HSA_API_ID_hsa_shut_down) ? hsa_begin_timestamp : timer->timestamp_fn_ns(); hsa_api_trace_entry_t* entry = hsa_api_trace_buffer->GetEntry(); entry->cid = cid;