Fix a profiling data corrupted error

Using rocprof with ROCP_MCOPY_DATA=1 while tracing HSA produces the
following error:

tblextr.py: Memcpy args "(0x7feb16a00000, 123handle=28593376125, 0x7feb12a00010, 123handle=27558560125, 4194304, 0, 0, 123handle=140661639440000125) = 1" cannot be identified
Profiling data corrupted: ' ./out/rpl_data_220930_143009_1826700/input_results_220930_143009/results.txt'

There are two issues:

1) The hsa_agent_t handle argument is misprinted: "123handle=...125"
  Instead of printing '{' and '}', it prints '123' and '125'. The wrong
  operator<<(unsigned char) is used and an integer value is printed
  instead of a char.

  Use std::operator<< instead of hsa_support::detail::operator<< to
  print '{' and '}'

2) The result value is unitialized and in some cases printed as a
  negative integer value. The leading '-' is not matched by the
  mem_manager regular expresion for HSA api calls.

  Correctly capture the HSA function's return value.

Change-Id: If13a1e62eeb4e598447c4b90d53d1b2e3b408696
Этот коммит содержится в:
Laurent Morichetti
2022-09-30 11:02:27 -07:00
родитель 329c0467cb
Коммит 6416434d3b
2 изменённых файлов: 4 добавлений и 6 удалений
+2 -2
Просмотреть файл
@@ -191,7 +191,7 @@ def gen_cppheader(infilepath, outfilepath, rank):
if len(cppHeader.classes[c]["properties"]["public"]) != 0:
output_filename_h.write("inline static std::ostream& operator<<(std::ostream& out, const " + c + "& v)\n")
output_filename_h.write("{\n")
output_filename_h.write(" roctracer::" + apiname.lower() + "_support::detail::operator<<(out, '{');\n")
output_filename_h.write(" std::operator<<(out, '{');\n")
output_filename_h.write(" " + apiname.upper() + "_depth_max_cnt++;\n")
output_filename_h.write(" if (" + apiname.upper() + "_depth_max == -1 || " + apiname.upper() + "_depth_max_cnt <= " + apiname.upper() + "_depth_max" + ") {\n" )
process_struct(output_filename_h, c, cppHeader, "", apiname)
@@ -200,7 +200,7 @@ def gen_cppheader(infilepath, outfilepath, rank):
output_filename_h.write(global_str)
output_filename_h.write(" };\n")
output_filename_h.write(" " + apiname.upper() + "_depth_max_cnt--;\n")
output_filename_h.write(" roctracer::" + apiname.lower() + "_support::detail::operator<<(out, '}');\n")
output_filename_h.write(" std::operator<<(out, '}');\n")
output_filename_h.write(" return out;\n")
output_filename_h.write("}\n")
global_str = ''
+2 -4
Просмотреть файл
@@ -441,8 +441,7 @@ class API_DescrParser:
content += '\n'
if ret_type != 'void':
# FIXME: we should capture the return value and store it in the api_data
content += ' ' + ret_type + ' ret ='
content += ' trace_data.api_data.' + ret_type + '_retval = '
content += ' ' + name + '_saved_before_cb.' + call + '_fn(' + ', '.join(struct['alst']) + ');\n'
content += '\n'
@@ -450,8 +449,7 @@ class API_DescrParser:
content += ' trace_data.phase_exit(' + call_id + ', &trace_data);\n'
if ret_type != 'void':
content += '\n'
content += ' return ret;\n'
content += ' return trace_data.api_data.' + ret_type + '_retval;\n'
content += '}\n'
return content