6d7c631cd7
* Initial commit for pytest Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Check if csvs populated Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * pytest now checks soc for soc specific testing Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Roof only csvs updated - Removes dir if workload dir already present Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Tests create difference logs calculated from a baseline Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * pytest scripts updated to revamp test cases Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Fix dispatch notation Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Introduce a cmake option to enable python code coverage. It now defaults to being disabled and can be enabled via a -DENABLE_COVERAGE=ON option (#194). Introduce CI on mi100 that leverages code coverage and publishes results along with a testing report. Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * update branch for CI -> 2.x Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * add profile execution test in cmake and enable in CI Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * run all ci tests Signed-off-by: Karl W. Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Initial overhaul of Profile mode Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Modify vcopy to enable multi iteration and multi kernel for CI Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Update docs and --help menu to reflect new vcopy usage Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Fix typo in IPBlock logging Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Cache ascii art in source and remove ascii dependency Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Update testing collateral to reflect name change of kernel-verbose option Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Small typo corrections in docs Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Fixing more typos... Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * run profiler tests through queue Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * bump wallclock runlimit for test Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * add mi100 badge Signed-off-by: Karl W. Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * include step to build hip binary Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * add additional top-level vars for number of kernels expected and dispatch id; tests updated to use these vars so that vcopy binary can be used instead of mixbench Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * add requirements-test.txt file to organize python testing dependencies (#205) * add a requirements-test.txt file to organize additional python packages needed to support testing; update CI to install python packages from dependency files Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Dynamically load dependency checker from requirements.txt Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Add comments Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Replace any - with _ for checker logic Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Update cmake config with Fix for pyyaml package installation check Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * update mi100 CI config Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * upgrade jsdom version (#206) Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Adding the log_metric differ function Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Added missing hasattr checker Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Enable running on mi100 and fixed typos - Also enables RHEL9 roofline Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * update CMakeLists.txt Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Remove pytest raises SystemExit Add default thresholds Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Initial overhaul of Analyze mode. Basic CLI is enabled. Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Revert "Remove pytest raises SystemExit" This reverts commit 9762728eb37e740c39ced87ced7dd7a0d423824d. Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * restore formal call to sys.exit() in top-level main; this is needed for companion testing collateral which expects SystemExit exceptions to be raised. Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Update return code error checks for roofline-only analysis on MI100 Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * disable coverage comment Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * fix comment typo Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Move error logging to util.py Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Move perfmon_configs dir into omniperf_soc dir. Rename config dirs for clarity Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Add a supported_archs property to Omniperf base class Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Remove pytest raises SystemExit Add default thresholds Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Revert "Remove pytest raises SystemExit" This reverts commit 9762728eb37e740c39ced87ced7dd7a0d423824d. Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Add Absolute Difference to report-diff output - Pytest regex updated to read Absolute Difference - Pytest creates Baseline (Assumes vcopy binary present) - Adding Metric logging Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * vcopy binary created before running tests Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Adding the log_metric differ function Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> * Update test_profile_general.py remove extra log_metric function Signed-off-by: JoseSantosAMD <87447437+JoseSantosAMD@users.noreply.github.com> * Update CMakeLists.txt soc_params was merged into a class, it isn't a standalone file anymore Signed-off-by: JoseSantosAMD <87447437+JoseSantosAMD@users.noreply.github.com> --------- Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com> Signed-off-by: Karl W Schulz <karl.schulz@amd.com> Signed-off-by: Karl W. Schulz <karl.schulz@amd.com> Signed-off-by: colramos-amd <colramos@amd.com> Signed-off-by: JoseSantosAMD <87447437+JoseSantosAMD@users.noreply.github.com> Co-authored-by: Karl W Schulz <karl.schulz@amd.com> Co-authored-by: colramos-amd <colramos@amd.com> Co-authored-by: Karl W. Schulz <koomie@users.noreply.github.com>
2751 rinda
75 KiB
Python
2751 rinda
75 KiB
Python
import os.path
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
import pytest
|
|
from importlib.machinery import SourceFileLoader
|
|
import pandas as pd
|
|
import subprocess
|
|
import re
|
|
import shutil
|
|
import inspect
|
|
import sys
|
|
|
|
omniperf = SourceFileLoader("omniperf", "src/omniperf").load_module()
|
|
workload_1 = os.path.realpath("workload")
|
|
kernel_name_1 = "vecCopy(double*, double*, double*, int, int) [clone .kd]"
|
|
|
|
app_1 = ["./sample/vcopy", "-n", "1048576", "-b", "256", "-i", "3"]
|
|
num_kernels = 3
|
|
|
|
dispatch_id = 0
|
|
|
|
ALL_CSVS = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_13.csv",
|
|
"pmc_perf_14.csv",
|
|
"pmc_perf_15.csv",
|
|
"pmc_perf_16.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
ALL_CSVS_MI200 = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_13.csv",
|
|
"pmc_perf_14.csv",
|
|
"pmc_perf_15.csv",
|
|
"pmc_perf_16.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
|
|
ROOF_ONLY_FILES = [
|
|
"empirRoof_gpu-ALL_fp32.pdf",
|
|
"empirRoof_gpu-ALL_int8_fp16.pdf",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
|
|
# logging function for threshold outliers set to false
|
|
COUNTER_LOGGING = False
|
|
METRIC_LOGGING = True
|
|
|
|
|
|
|
|
def metric_compare(test_name, errors_pd, baseline_df, run_df, threshold=5):
|
|
# iterate data one row at a time
|
|
for idx_1 in run_df.index:
|
|
run_row = run_df.iloc[idx_1]
|
|
baseline_row = baseline_df.iloc[idx_1]
|
|
if not run_row["KernelName"] == baseline_row["KernelName"]:
|
|
print("Kernel/dispatch mismatch")
|
|
assert 0
|
|
kernel_name = run_row["KernelName"]
|
|
gpu_id = run_row["gpu-id"]
|
|
differences = {}
|
|
|
|
for pmc_counter in run_row.index:
|
|
if "Ns" in pmc_counter or "id" in pmc_counter or "[" in pmc_counter:
|
|
# print("skipping "+pmc_counter)
|
|
continue
|
|
# assert 0
|
|
|
|
if not pmc_counter in list(baseline_df.columns):
|
|
print("error: pmc mismatch! " + pmc_counter + " is not in baseline_df")
|
|
continue
|
|
|
|
run_data = run_row[pmc_counter]
|
|
baseline_data = baseline_row[pmc_counter]
|
|
if isinstance(run_data, str) and isinstance(baseline_data, str):
|
|
if run_data not in baseline_data:
|
|
print(baseline_data)
|
|
else:
|
|
# relative difference
|
|
if not run_data == 0:
|
|
diff = round(100 * abs(baseline_data - run_data) / run_data, 2)
|
|
if diff > threshold:
|
|
print("[" + pmc_counter + "] diff is :" + str(diff) + "%")
|
|
if pmc_counter not in differences.keys():
|
|
print(
|
|
"[" + pmc_counter + "] not found in ",
|
|
list(differences.keys()),
|
|
)
|
|
differences[pmc_counter] = [diff]
|
|
else:
|
|
# Why are we here?
|
|
print(
|
|
"Why did we get here?!?!? errors_pd[idx_1]:",
|
|
list(differences.keys()),
|
|
)
|
|
differences[pmc_counter].append(diff)
|
|
else:
|
|
# if 0 show absolute difference
|
|
diff = round(baseline_data - run_data, 2)
|
|
if diff > threshold:
|
|
print(str(idx_1) + "[" + pmc_counter + "] diff is :" + str(diff))
|
|
differences["kernel_name"] = [kernel_name]
|
|
differences["test_name"] = [test_name]
|
|
differences["gpu-id"] = [gpu_id]
|
|
errors_pd = pd.concat([errors_pd, pd.DataFrame.from_dict(differences)])
|
|
return errors_pd
|
|
|
|
|
|
def run(cmd):
|
|
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
if cmd[0] == "rocm-smi" and p.returncode == 8:
|
|
print("ERROR: No GPU detected. Unable to load rocm-smi")
|
|
assert 0
|
|
return p.stdout.decode("ascii")
|
|
|
|
|
|
def gpu_soc():
|
|
rocminfo = str(
|
|
subprocess.run(
|
|
["rocminfo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
).stdout.decode("ascii")
|
|
)
|
|
rocminfo = rocminfo.split("\n")
|
|
soc_regex = re.compile(r"^\s*Name\s*:\s+ ([a-zA-Z0-9]+)\s*$", re.MULTILINE)
|
|
gpu_id = list(filter(soc_regex.match, rocminfo))[0].split()[1]
|
|
|
|
print("gpu_id", gpu_id)
|
|
if gpu_id == "gfx906":
|
|
return "mi50"
|
|
elif gpu_id == "gfx908":
|
|
return "mi100"
|
|
elif gpu_id == "gfx90a":
|
|
return "mi200"
|
|
elif gpu_id == "gfx900":
|
|
return "vega10"
|
|
else:
|
|
print("Invalid SoC")
|
|
assert 0
|
|
|
|
|
|
soc = gpu_soc()
|
|
|
|
# change to directory where baseline is at
|
|
Baseline_dir = os.path.realpath("Baseline_vcopy_" + soc)
|
|
if os.path.exists(Baseline_dir):
|
|
shutil.rmtree(Baseline_dir)
|
|
subprocess.run(
|
|
["hipcc", "sample/vcopy.cpp", "-o", "sample/vcopy"],
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE,
|
|
)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
Baseline_dir,
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
|
|
|
|
def logger(file_dict, test_name):
|
|
for file in file_dict.keys():
|
|
if file == "pmc_perf.csv" or "SQ" in file:
|
|
print(file)
|
|
# read file in Baseline
|
|
df_1 = pd.read_csv(Baseline_dir + "/" + file, index_col=0)
|
|
# get corresponding file from current test run
|
|
df_2 = file_dict[file]
|
|
|
|
errors = metric_compare(test_name, pd.DataFrame(), df_1, df_2, 5)
|
|
if not errors.empty:
|
|
if os.path.exists(
|
|
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
|
|
):
|
|
error_log = pd.read_csv(
|
|
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv",
|
|
index_col=0,
|
|
)
|
|
new_error_log = pd.concat([error_log, errors])
|
|
new_error_log = new_error_log.reindex(
|
|
sorted(new_error_log.columns), axis=1
|
|
)
|
|
new_error_log = new_error_log.sort_values(
|
|
by=["test_name", "kernel_name", "gpu-id"]
|
|
)
|
|
new_error_log.to_csv(
|
|
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
|
|
)
|
|
else:
|
|
errors.to_csv(
|
|
Baseline_dir + "/" + file.split(".")[0] + "_error_log.csv"
|
|
)
|
|
|
|
def log_metric(test_name, thresholds, args=[]):
|
|
t = subprocess.Popen(
|
|
[
|
|
sys.executable,
|
|
"src/omniperf",
|
|
"analyze",
|
|
"--path",
|
|
Baseline_dir,
|
|
]
|
|
+ args
|
|
+ ["--path", workload_1, "--report-diff", "5"],
|
|
stdout=subprocess.PIPE,
|
|
)
|
|
captured_output = t.communicate(timeout=1300)[0].decode("utf-8")
|
|
print("captured_output", captured_output)
|
|
if "DEBUG ERROR" in captured_output:
|
|
error_df = pd.DataFrame()
|
|
output_metric_errors = re.findall(r"(\')([0-9.]*)(\')", captured_output)
|
|
naughty_metrics = [x[1] for x in output_metric_errors]
|
|
print("naughty metrics:", naughty_metrics)
|
|
for metric in naughty_metrics:
|
|
metric_info = re.findall(
|
|
r"(^"
|
|
+ metric
|
|
+ r" *)([()0-9A-Za-z-]+ ?)*(?: *)([0-9.-]*)(?: *)([0-9.-]*)(?: *)\(([-0-9.]*)%\)(?: *)([-0-9.e]*)",
|
|
captured_output,
|
|
flags=re.MULTILINE,
|
|
)
|
|
if len(metric_info):
|
|
metric_info = metric_info[0]
|
|
if metric_info[-4] != "-100.0":
|
|
print("metric info:", metric_info)
|
|
print(
|
|
re.findall(
|
|
r"^" + metric + r".*", captured_output, flags=re.MULTILINE
|
|
)
|
|
)
|
|
table_idx = metric_info[1].split(".")[0]
|
|
relative_diff = float(metric_info[-2])
|
|
absolute_diff = float(metric_info[-1])
|
|
relative_threshold = thresholds["default"]["relative"]
|
|
absolute_threshold = thresholds["default"]["absolute"]
|
|
|
|
if table_idx in thresholds:
|
|
relative_threshold = thresholds[table_idx]["relative"]
|
|
absolute_threshold = thresholds[table_idx]["absolute"]
|
|
|
|
if (
|
|
relative_diff > relative_threshold
|
|
or absolute_diff > absolute_threshold
|
|
):
|
|
new_error = pd.DataFrame.from_dict(
|
|
{
|
|
"index": [metric_info[0].split()[0]],
|
|
"metric": [table_idx],
|
|
"Percent Difference": [relative_diff],
|
|
"Absolute Difference": [absolute_diff],
|
|
"Baseline": [metric_info[-2]],
|
|
"Current": [metric_info[-1]],
|
|
}
|
|
)
|
|
error_df = pd.concat([error_df, new_error])
|
|
|
|
error_df["test_name"] = test_name
|
|
if os.path.exists(Baseline_dir + "/metric_error_log.csv"):
|
|
error_log = pd.read_csv(
|
|
Baseline_dir + "/metric_error_log.csv",
|
|
index_col=0,
|
|
)
|
|
new_error_log = pd.concat([error_log, error_df])
|
|
new_error_log = new_error_log.reindex(sorted(new_error_log.columns), axis=1)
|
|
new_error_log = new_error_log.sort_values(by=["metric", "test_name"])
|
|
new_error_log.to_csv(Baseline_dir + "/metric_error_log.csv")
|
|
else:
|
|
error_df.to_csv(Baseline_dir + "/metric_error_log.csv")
|
|
|
|
|
|
def test_path():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file, index_col=0)
|
|
print("length is: ", len(file_dict[file].index))
|
|
print(file_dict[file])
|
|
# TODO: verify contents: we know function evaluated
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_kernel():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel",
|
|
kernel_name_1,
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_kernel_summaries():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-summaries",
|
|
"vcopy",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
def test_ipblocks_SQ():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_ipblocks_SQC():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQC",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(5, "roofline.csv")
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_TA():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"TA",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(9, "roofline.csv")
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_ipblocks_TD():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"TD",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_TCP():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"TCP",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(11, "roofline.csv")
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_ipblocks_TCC():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"TCC",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(12, "roofline.csv")
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SPI():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SPI",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(10, "roofline.csv")
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_CPC():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"CPC",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(7, "roofline.csv")
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_ipblocks_CPF():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"CPF",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs.insert(5, "roofline.csv")
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SQ_CPC():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"CPC",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SQ_TA():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"TA",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SQ_SPI():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"SPI",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SQ_SQC_TCP_CPC():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"SQC",
|
|
"TCP",
|
|
"CPC",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_ipblocks_SQ_SPI_TA_TCC_CPF():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--ipblocks",
|
|
"SQ",
|
|
"SPI",
|
|
"TA",
|
|
"TCC",
|
|
"CPF",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
|
|
print(sorted(list(file_dict.keys())))
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
if soc == "mi200":
|
|
expected_csvs = [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
assert sorted(list(file_dict.keys())) == expected_csvs
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_dispatch_0():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--dispatch",
|
|
"0",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file and not "roofline" in file:
|
|
assert len(file_dict[file].index) == 1
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_dispatch_0_1():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--dispatch",
|
|
"0:2",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file and not "roofline" in file:
|
|
assert len(file_dict[file].index) == 2
|
|
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_dispatch_2():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--dispatch",
|
|
dispatch_id,
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file and not "roofline" in file:
|
|
assert len(file_dict[file].index) == 1
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_kernel_verbose_0():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"0",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_kernel_verbose_1():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"1",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_kernel_verbose_2():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"2",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_kernel_verbose_3():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"3",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
def test_kernel_verbose_4():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"4",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_kernel_verbose_5():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--kernel-verbose",
|
|
"5",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_join_type_grid():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--join-type",
|
|
"grid",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_join_type_kernel():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--join-type",
|
|
"kernel",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_device_0():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--device",
|
|
"0",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
if "roofline" in file:
|
|
assert len(file_dict[file].index)
|
|
else:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_no_roof():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--no-roof",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == [
|
|
"SQ_IFETCH_LEVEL.csv",
|
|
"SQ_INST_LEVEL_LDS.csv",
|
|
"SQ_INST_LEVEL_SMEM.csv",
|
|
"SQ_INST_LEVEL_VMEM.csv",
|
|
"SQ_LEVEL_WAVES.csv",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_10.csv",
|
|
"pmc_perf_11.csv",
|
|
"pmc_perf_12.csv",
|
|
"pmc_perf_13.csv",
|
|
"pmc_perf_14.csv",
|
|
"pmc_perf_15.csv",
|
|
"pmc_perf_16.csv",
|
|
"pmc_perf_2.csv",
|
|
"pmc_perf_3.csv",
|
|
"pmc_perf_4.csv",
|
|
"pmc_perf_5.csv",
|
|
"pmc_perf_6.csv",
|
|
"pmc_perf_7.csv",
|
|
"pmc_perf_8.csv",
|
|
"pmc_perf_9.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_sort_dispatches():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--sort",
|
|
"dispatches",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_sort_kernels():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--sort",
|
|
"kernels",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
file_dict = {}
|
|
# Check if csvs have data
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_mem_levels_HBM():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"HBM",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_mem_levels_L2():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"L2",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_mem_levels_vL1D():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"vL1D",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
|
|
def test_mem_levels_LDS():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"LDS",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_mem_levels_HBM_LDS():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"HBM",
|
|
"LDS",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_mem_levels_vL1D_LDS():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"vL1D",
|
|
"LDS",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_mem_levels_L2_vL1D_LDS():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--mem-level",
|
|
"L2",
|
|
"vL1D",
|
|
"LDS",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1 , "relative": 5}})
|
|
|
|
|
|
|
|
def test_kernel_names():
|
|
if os.path.exists(workload_1):
|
|
shutil.rmtree(workload_1)
|
|
with pytest.raises(SystemExit) as e:
|
|
with patch(
|
|
"sys.argv",
|
|
[
|
|
"omniperf",
|
|
"profile",
|
|
"-n",
|
|
"app_1",
|
|
"-VVV",
|
|
"--path",
|
|
workload_1,
|
|
"--roof-only",
|
|
"--kernel-names",
|
|
"--",
|
|
]
|
|
+ app_1,
|
|
):
|
|
omniperf.main()
|
|
|
|
if soc == "mi100":
|
|
# assert that it did not run
|
|
assert e.value.code >= 1
|
|
# Do not continue testing
|
|
return
|
|
# assert successful run
|
|
assert e.value.code == 0
|
|
|
|
files_in_workload = os.listdir(workload_1)
|
|
|
|
# Check if csvs have data
|
|
file_dict = {}
|
|
for file in files_in_workload:
|
|
if file.endswith(".csv"):
|
|
file_dict[file] = pd.read_csv(workload_1 + "/" + file)
|
|
if not "sysinfo" in file:
|
|
assert len(file_dict[file].index) >= num_kernels
|
|
elif file.endswith(".pdf"):
|
|
file_dict[file] = "pdf"
|
|
if soc == "mi200":
|
|
print(sorted(list(file_dict.keys())))
|
|
assert sorted(list(file_dict.keys())) == [
|
|
"empirRoof_gpu-ALL_fp32.pdf",
|
|
"empirRoof_gpu-ALL_int8_fp16.pdf",
|
|
"kernelName_legend.pdf",
|
|
"pmc_perf.csv",
|
|
"pmc_perf_0.csv",
|
|
"pmc_perf_1.csv",
|
|
"pmc_perf_2.csv",
|
|
"roofline.csv",
|
|
"sysinfo.csv",
|
|
"timestamps.csv",
|
|
]
|
|
else:
|
|
assert sorted(list(file_dict.keys())) == ALL_CSVS
|
|
|
|
if COUNTER_LOGGING:
|
|
logger(file_dict, inspect.stack()[0][3])
|
|
|
|
if METRIC_LOGGING:
|
|
log_metric(inspect.stack()[0][3], {"default": {"absolute": 1, "relative": 5}})
|
|
|