ROCm / roctracer

ROCm Tracer Callback/Activity Library for Performance tracing AMD GPUs
https://rocm.docs.amd.com/projects/roctracer/en/latest/
Other
64 stars 30 forks source link

Save mangled kernel names and demangle only on demand #69

Open lfmeadow opened 2 years ago

lfmeadow commented 2 years ago

It is very useful to have the mangled names when performing tasks like searching binaries for kernel assembly code. It may be possible to do this with c++filt on the assembly code, but it is much easier to user the mangled name.

I use the following patch:

diff --git a/test/tool/tracer_tool.cpp b/test/tool/tracer_tool.cpp
index d111d60..478e6b0 100644
--- a/test/tool/tracer_tool.cpp
+++ b/test/tool/tracer_tool.cpp
@@ -522,8 +522,8 @@ void hip_api_flush_cb(hip_api_trace_entry_t* entry) {
       const char* str = hipApiString((hip_api_id_t)cid, data);
       rec_ss << " " << str;
       if (is_hip_kernel_launch_api(cid) && entry->name) {
-        const char* kernel_name = cxx_demangle(entry->name);
-        rec_ss << " kernel=" << kernel_name;
+        //const char* kernel_name = cxx_demangle(entry->name);
+        rec_ss << " kernel=" << entry->name;
       }
       rec_ss<< " :" << correlation_id;
       fprintf(hip_api_file_handle, "%s\n", rec_ss.str().c_str());

I did not attempt to add code to the various csv writers to demangle; it should be easy. It is possilble that a similar patch is needed to rocprof, I haven't gotten that far.

Thanks for your consideration.