Names shortened/demangled after join_prof

-  Added kernelVerbose flag in profile_group
-  Added KernelVerbose flag in analyze_group
-  Analyze replaces csv with shortened/demangled name
-  csv_converter uses llvm-cxxfilt

Signed-off-by: josantos <josantos@amd.com>


[ROCm/rocprofiler-compute commit: 59d77f9d81]
This commit is contained in:
josantos
2023-08-10 11:13:27 -05:00
parent 9d01f81aac
commit cd0dc01401
4 changed files with 86 additions and 35 deletions
@@ -25,6 +25,7 @@
import argparse
import collections
import os
import subprocess
import sys
import re
import pandas as pd
@@ -33,11 +34,11 @@ from pymongo import MongoClient
from tqdm import tqdm
import shutil
cache = dict()
supported_arch = {"gfx906": "mi50", "gfx908": "mi100", "gfx90a": "mi200"}
MAX_SERVER_SEL_DELAY = 5000 # 5 sec connection timeout
def kernel_name_shortener(df, cache, level):
if level >= 5:
return df
@@ -55,6 +56,13 @@ def kernel_name_shortener(df, cache, level):
if original_name in cache:
continue
cmd = ["llvm-cxxfilt", original_name]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
demangled_name, e = proc.communicate()
demangled_name = str(demangled_name, "UTF-8").strip()
# cache miss, add the shortened name to the dictionary
new_name = ""
matches = ""
@@ -62,15 +70,14 @@ def kernel_name_shortener(df, cache, level):
names_and_args = re.compile(r"(?P<name>[( )A-Za-z0-9_]+)([ ,*<>()]+)(::)?")
# works for name Kokkos::namespace::init_lock_array_kernel_threadid(int) [clone .kd]
if names_and_args.search(original_name):
matches = names_and_args.findall(original_name)
if names_and_args.search(demangled_name):
matches = names_and_args.findall(demangled_name)
else:
# Works for first case '__amd_rocclr_fillBuffer.kd'
# remove .kd and then parse through original regex
first_case = re.compile(r"([^\s]+)(.kd)")
Mod_name_and_args = re.compile(r"(?P<name>[( )A-Za-z0-9_]+)([ ,*<>()]*)")
interim_name = first_case.search(original_name).group(1)
matches = Mod_name_and_args.findall(interim_name)
cache[original_name] = new_name
if new_name == None or new_name == "":
cache[original_name] = demangled_name
continue
current_level = 0
for name in matches:
@@ -103,13 +110,12 @@ def kernel_name_shortener(df, cache, level):
cache[original_name] = new_name
if new_name == None or new_name == "":
cache[original_name] = original_name
cache[original_name] = demangled_name
df[columnName] = df[columnName].map(cache)
return df
# Verify target directory and setup connection
def parse(args, profileAndExport):
host = args.host