Omniperf rocomni changes
Signed-off-by: colramos-amd <colramos@amd.com>
This commit is contained in:
zatwierdzone przez
JoseSantosAMD
rodzic
c16656eb87
commit
599bc01310
@@ -47,36 +47,50 @@ from omniperf_analyze.utils import parser, file_io
|
||||
from omniperf_analyze.utils.gui_components.roofline import get_roofline
|
||||
|
||||
|
||||
def initialize_run(args, normalization_filter=None):
|
||||
import pandas as pd
|
||||
from collections import OrderedDict
|
||||
################################################
|
||||
# Helper Functions
|
||||
################################################
|
||||
def generate_configs(config_dir, list_kernels, filter_metrics):
|
||||
from omniperf_analyze.utils import schema
|
||||
from tabulate import tabulate
|
||||
|
||||
# Fixme: cur_root.parent.joinpath('soc_params')
|
||||
soc_params_dir = os.path.join(os.path.dirname(__file__), "..", "soc_params")
|
||||
soc_spec_df = file_io.load_soc_params(soc_params_dir)
|
||||
|
||||
single_panel_config = file_io.is_single_panel_config(Path(args.config_dir))
|
||||
single_panel_config = file_io.is_single_panel_config(Path(config_dir))
|
||||
global archConfigs
|
||||
archConfigs = {}
|
||||
for arch in file_io.supported_arch.keys():
|
||||
ac = schema.ArchConfig()
|
||||
if args.list_kernels:
|
||||
if list_kernels:
|
||||
ac.panel_configs = file_io.top_stats_build_in_config
|
||||
else:
|
||||
arch_panel_config = (
|
||||
args.config_dir if single_panel_config else args.config_dir.joinpath(arch)
|
||||
config_dir if single_panel_config else config_dir.joinpath(arch)
|
||||
)
|
||||
ac.panel_configs = file_io.load_panel_configs(arch_panel_config)
|
||||
|
||||
# TODO: filter_metrics should/might be one per arch
|
||||
# print(ac)
|
||||
|
||||
parser.build_dfs(ac, args.filter_metrics)
|
||||
parser.build_dfs(ac, filter_metrics)
|
||||
|
||||
archConfigs[arch] = ac
|
||||
|
||||
return archConfigs # Note: This return comes in handy for rocScope which borrows generate_configs() in its rocomni plugin
|
||||
|
||||
|
||||
################################################
|
||||
# Core Functions
|
||||
################################################
|
||||
def initialize_run(args, normalization_filter=None):
|
||||
import pandas as pd
|
||||
from collections import OrderedDict
|
||||
from tabulate import tabulate
|
||||
from omniperf_analyze.utils import schema
|
||||
|
||||
# Fixme: cur_root.parent.joinpath('soc_params')
|
||||
soc_params_dir = os.path.join(os.path.dirname(__file__), "..", "soc_params")
|
||||
soc_spec_df = file_io.load_soc_params(soc_params_dir)
|
||||
|
||||
generate_configs(args.config_dir, args.list_kernels, args.filter_metrics)
|
||||
|
||||
if args.list_metrics in file_io.supported_arch.keys():
|
||||
print(
|
||||
tabulate(
|
||||
|
||||
@@ -320,6 +320,26 @@ def update_normUnit_string(equation, unit):
|
||||
str(equation),
|
||||
).capitalize()
|
||||
|
||||
def gen_counter_list(formula):
|
||||
function_filter = {"MIN": None, "MAX": None, "AVG": None, "ROUND": None, "TO_INT": None, "GB": None, "STD": None, "GFLOP": None, "GOP": None, "OP": None, "CU": None, "NC": None, "UC": None, "CC": None, "RW": None, "GIOP": None}
|
||||
|
||||
counters = []
|
||||
if not isinstance(formula,str):
|
||||
return counters
|
||||
try:
|
||||
tree = ast.parse(
|
||||
formula
|
||||
.replace("$normUnit", "SQ_WAVES")
|
||||
.replace("$denom", "SQ_WAVES")
|
||||
.replace("$","")
|
||||
)
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, ast.Name) and node.id.rstrip("_sum").isupper() and node.id not in function_filter:
|
||||
counters.append(node.id.rstrip("_sum"))
|
||||
except:
|
||||
pass
|
||||
return counters
|
||||
|
||||
|
||||
def build_dfs(archConfigs, filter_metrics):
|
||||
"""
|
||||
@@ -338,6 +358,7 @@ def build_dfs(archConfigs, filter_metrics):
|
||||
d = {}
|
||||
metric_list = {}
|
||||
dfs_type = {}
|
||||
metric_counters = {}
|
||||
for panel_id, panel in archConfigs.panel_configs.items():
|
||||
for data_source in panel["data source"]:
|
||||
for type, data_cofig in data_source.items():
|
||||
@@ -362,6 +383,7 @@ def build_dfs(archConfigs, filter_metrics):
|
||||
)
|
||||
metric_idx = data_source_idx + "." + str(i)
|
||||
values = []
|
||||
eqn_content = []
|
||||
|
||||
if (
|
||||
(not filter_metrics)
|
||||
@@ -378,6 +400,7 @@ def build_dfs(archConfigs, filter_metrics):
|
||||
for k, v in entries.items():
|
||||
if k != "tips" and k != "coll_level" and k != "alias":
|
||||
values.append(v)
|
||||
eqn_content.append(v)
|
||||
|
||||
if "alias" in entries.keys():
|
||||
values.append(entries["alias"])
|
||||
@@ -396,6 +419,15 @@ def build_dfs(archConfigs, filter_metrics):
|
||||
|
||||
# collect metric_list
|
||||
metric_list[metric_idx] = key.replace(" ", "_")
|
||||
# generate mapping of counters and metrics
|
||||
filter = {}
|
||||
for formula in eqn_content:
|
||||
if formula is not None and formula != "None":
|
||||
for k in gen_counter_list(formula):
|
||||
filter[k] = None
|
||||
if len(filter) > 0:
|
||||
metric_counters[key] = list(filter)
|
||||
|
||||
i += 1
|
||||
|
||||
df.set_index("Index", inplace=True)
|
||||
@@ -431,6 +463,7 @@ def build_dfs(archConfigs, filter_metrics):
|
||||
setattr(archConfigs, "dfs", d)
|
||||
setattr(archConfigs, "metric_list", metric_list)
|
||||
setattr(archConfigs, "dfs_type", dfs_type)
|
||||
setattr(archConfigs, "metric_counters", metric_counters)
|
||||
|
||||
|
||||
def build_metric_value_string(dfs, dfs_type, normal_unit):
|
||||
@@ -469,7 +502,8 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug):
|
||||
|
||||
# confirm no illogical counter values (only consider non-roofline runs)
|
||||
roof_only_run = sys_info.ip_blocks == "roofline"
|
||||
if not roof_only_run and (raw_pmc_df["pmc_perf"]["GRBM_GUI_ACTIVE"] == 0).any():
|
||||
rocscope_run = sys_info.ip_blocks == "rocscope"
|
||||
if not rocscope_run and not roof_only_run and (raw_pmc_df["pmc_perf"]["GRBM_GUI_ACTIVE"] == 0).any():
|
||||
print("WARNING: Dectected GRBM_GUI_ACTIVE == 0\nHaulting execution.")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -711,12 +745,13 @@ def load_kernel_top(workload, dir):
|
||||
workload.dfs.update(tmp)
|
||||
|
||||
|
||||
def load_table_data(workload, dir, is_gui, debug, verbose):
|
||||
def load_table_data(workload, dir, is_gui, debug, verbose, skipKernelTop=False):
|
||||
"""
|
||||
Load data for all "raw_csv_table".
|
||||
Calculate mertric value for all "metric_table".
|
||||
"""
|
||||
load_kernel_top(workload, dir)
|
||||
if not skipKernelTop:
|
||||
load_kernel_top(workload, dir)
|
||||
|
||||
eval_metric(
|
||||
workload.dfs,
|
||||
|
||||
@@ -52,6 +52,8 @@ class ArchConfig:
|
||||
# [Index: Metric name] pairs
|
||||
metric_list: Dict[str, str] = field(default_factory=dict)
|
||||
|
||||
# [Metric name: Counters] pairs
|
||||
metric_counters: Dict[str, list] = field(default_factory=dict)
|
||||
|
||||
@dataclass
|
||||
class Workload:
|
||||
|
||||
Reference in New Issue
Block a user