SWDEV-318682: Using roctx to rename long kernel names to shorter ones.

To enable this feature use the --roctx-rename rocprof option. This
implementation records all messages received in roctxPush calls and
use them to replace corresponding kernel names.

Tested with the following HIP program:

\#include <hip/hip_runtime.h>
\#include <roctracer/roctx.h>

__global__ void
ThisIsALongKernelName ()
{
}

int
main (int argc, char* argv[])
{
  hipSetDevice (0);

  // Not in a roctx range.
  ThisIsALongKernelName<<<1, 1>>> ();

  roctxRangePush ("A");
  // In a simple first level roctx range.
  ThisIsALongKernelName<<<1, 1>>> ();
  roctxRangePop ();

  roctxRangePush ("B");
  roctxRangePush ("C");
  // In a nested roctx range.
  ThisIsALongKernelName<<<1, 1>>> ();
  roctxRangePop ();
  roctxRangePop ();

  roctxRangePush ("D");
  roctxRangePush ("E");
  roctxRangePop ();
  // In a first level roctx range, but after a nested range.
  ThisIsALongKernelName<<<1, 1>>> ();
  roctxRangePop ();

  hipDeviceSynchronize ();
  return 0;
}

Change-Id: I629312234468daff8b017caa5cb0773707d98cce


[ROCm/rocprofiler commit: 1078a088e9]
Esse commit está contido em:
Laurent Morichetti
2022-04-04 22:38:35 -07:00
commit 26bb13ade0
4 arquivos alterados com 48 adições e 9 exclusões
+1 -1
Ver Arquivo
@@ -220,7 +220,7 @@ class SQLiteDB:
value = data[value_index]
if label[:3] == '"__': continue
if name_ptrn.search(label): value = sub_ptrn.sub(r'', value)
if label != '"Index"': args_list.append('%s:"%s"' % (label, value))
if label != '"Index"' and label != '"roctx-range"': args_list.append('%s:"%s"' % (label, value))
fd.write(',{"ph":"%s",%s,\n "args":{\n %s\n }\n}\n' % ('X', ','.join(vals_list), ',\n '.join(args_list)))