Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pytest_profile_general.py #265

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions tests/test_profile_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
config["app_1"] = ["./tests/vcopy", "-n", "1048576", "-b", "256", "-i", "3"]
config["cleanup"] = True
config["COUNTER_LOGGING"] = False
config["METRIC_COMPARE"] = False
config["METRIC_COMPARE"] = True
config["METRIC_LOGGING"] = False

baseline_opts = ["omniperf", "profile", "-n", "app_1", "-VVV"]
Expand Down Expand Up @@ -80,6 +80,8 @@
"pmc_perf_14.csv",
"pmc_perf_15.csv",
"pmc_perf_16.csv",
"pmc_perf_17.csv",
"pmc_perf_18.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
Expand All @@ -92,6 +94,7 @@
"sysinfo.csv",
"timestamps.csv",
]

ROOF_ONLY_FILES = [
"empirRoof_gpu-0_fp32.pdf",
"empirRoof_gpu-0_int8_fp16.pdf",
Expand All @@ -106,14 +109,16 @@

# Must not change relative difference is zero
METRIC_THRESHOLDS = {
"2.1.12": {"absolute": 0, "relative": 1},
"2.1.15": {"absolute": 0, "relative": 1},
"2.1.19": {"absolute": 0, "relative": 1},
"2.1.12": {"absolute": 0, "relative": 8},
"3.1.1": {"absolute": 0, "relative": 10},
"3.1.10": {"absolute": 0, "relative": 10},
"3.1.11": {"absolute": 0, "relative": 1},
"3.1.12": {"absolute": 0, "relative": 1},
"3.1.13": {"absolute": 0, "relative": 1},
"5.1.0": {"absolute": 0, "relative": 15},
"5.2.0": {"absolute": 0, "relative": 15},
"6.1.5": {"absolute": 0, "relative": 1},
"6.1.0": {"absolute": 0, "relative": 15},
# "6.1.3" : {"absolute": 0, "relative": 5},
"6.1.3": {"absolute": 0, "relative": 11},
"6.2.12": {"absolute": 0, "relative": 1},
"6.2.13": {"absolute": 0, "relative": 1},
Expand All @@ -123,8 +128,8 @@
"7.1.5": {"absolute": 0, "relative": 1},
"7.1.6": {"absolute": 0, "relative": 1},
"7.1.7": {"absolute": 0, "relative": 1},
"7.2.0": {"absolute": 0, "relative": 5},
"7.2.1": {"absolute": 0, "relative": 10},
"7.2.3": {"absolute": 0, "relative": 12},
"7.2.6": {"absolute": 0, "relative": 1},
"10.1.4": {"absolute": 0, "relative": 1},
"10.1.5": {"absolute": 0, "relative": 1},
Expand All @@ -134,7 +139,7 @@
"10.3.5": {"absolute": 0, "relative": 1},
"10.3.6": {"absolute": 0, "relative": 1},
"11.2.1": {"absolute": 0, "relative": 1},
"11.2.4": {"absolute": 0, "relative": 1},
"11.2.4": {"absolute": 0, "relative": 5},
"13.2.0": {"absolute": 0, "relative": 1},
"13.2.2": {"absolute": 0, "relative": 1},
"14.2.0": {"absolute": 0, "relative": 1},
Expand Down Expand Up @@ -163,13 +168,11 @@
"16.5.0": {"absolute": 0, "relative": 1},
"17.3.3": {"absolute": 0, "relative": 1},
"17.3.6": {"absolute": 0, "relative": 1},
"17.3.13": {"absolute": 0, "relative": 1},
"18.1.0": {"absolute": 0, "relative": 1},
"18.1.1": {"absolute": 0, "relative": 1},
"18.1.2": {"absolute": 0, "relative": 1},
"18.1.3": {"absolute": 0, "relative": 1},
"5.1.2": {"absolute": 0, "relative": 1},
"6.1.4": {"absolute": 0, "relative": 1},
"6.1.4": {"absolute": 4, "relative": 0},
"18.1.5": {"absolute": 0, "relative": 1},
"18.1.6": {"absolute": 1, "relative": 0},
}
Expand Down Expand Up @@ -320,6 +323,7 @@ def baseline_compare_metric(test_name, workload_dir, args=[]):
stdout=subprocess.PIPE,
)
captured_output = t.communicate(timeout=1300)[0].decode("utf-8")
print(captured_output)
assert t.returncode == 0

if "DEBUG ERROR" in captured_output:
Expand Down Expand Up @@ -413,11 +417,18 @@ def baseline_compare_metric(test_name, workload_dir, args=[]):
counts > MAX_REOCCURING_COUNT
]
if reoccurring_metrics.any(axis=None):
print(
"These metrics appear alot\n",
reoccurring_metrics,
)
print(list(reoccurring_metrics["Index"]))
with pd.option_context(
"display.max_rows",
None,
"display.max_columns",
None,
# 'display.precision', 3,
):
print(
"These metrics appear alot\n",
reoccurring_metrics,
)
# print(list(reoccurring_metrics["Index"]))

# log into csv
if not error_df.empty:
Expand Down Expand Up @@ -445,6 +456,7 @@ def test_path():

file_dict = test_utils.check_csv_files(workload_dir, num_devices, 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
Expand Down Expand Up @@ -478,6 +490,8 @@ def test_no_roof():
"pmc_perf_14.csv",
"pmc_perf_15.csv",
"pmc_perf_16.csv",
"pmc_perf_17.csv",
"pmc_perf_18.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
Expand Down Expand Up @@ -517,7 +531,6 @@ def test_kernel_names():

file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
if soc == "mi200":
print(sorted(list(file_dict.keys())))
assert sorted(list(file_dict.keys())) == [
"empirRoof_gpu-0_fp32.pdf",
"empirRoof_gpu-0_int8_fp16.pdf",
Expand All @@ -530,6 +543,7 @@ def test_kernel_names():
"sysinfo.csv",
"timestamps.csv",
]

else:
assert sorted(list(file_dict.keys())) == ALL_CSVS

Expand Down
Loading