Format source code to PEP8 using Ruff (#36)
* added ruff docs * style: Run ruff and black before yapf pass * yapf -r -i (23 fixes) * fixed conf.py and ran ruff format . * fixed conf.py 2 * formatted argparser.py * formatted src/rocprof_compute_analyze * formatted src/rocprof_compute_profile * formatted soc_base.py * formatted rocprof_compute_tui * formatted gui_components * formatted src/utils * formatted tests/ * format extra files * cleanup * fix test_utils.py * fixed typos * Update pyproject.toml * Update README.md * Update test_utils.py --------- Signed-off-by: jamessiddeley-amd <James.Siddeley@amd.com> Co-authored-by: James Siddeley <James.Siddeley@amd.com> Co-authored-by: systems-assistant[bot] <systems-assistant[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d3f9ab25eb
commit
58d2a016ce
@@ -23,14 +23,15 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import subprocess
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module()
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -52,7 +53,12 @@ def pytest_addoption(parser):
|
||||
@pytest.fixture
|
||||
def binary_handler_profile_rocprof_compute(request):
|
||||
def _handler(
|
||||
config, workload_dir, options=[], check_success=True, roof=False, app_name="app_1"
|
||||
config,
|
||||
workload_dir,
|
||||
options=[],
|
||||
check_success=True,
|
||||
roof=False,
|
||||
app_name="app_1",
|
||||
):
|
||||
if request.config.getoption("--rocprofiler-sdk-library-path"):
|
||||
options.extend(
|
||||
|
||||
@@ -23,11 +23,9 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
my_parser = argparse.ArgumentParser(description="create test_analyze_workloads.py")
|
||||
@@ -52,11 +50,16 @@ if __name__ == "__main__":
|
||||
+ arch
|
||||
+ "():"
|
||||
+ "\n\twith pytest.raises(SystemExit) as e:"
|
||||
+ "\n\t\twith patch('sys.argv',['rocprof-compute', 'analyze', '--path', '"
|
||||
+ workload
|
||||
+ "/"
|
||||
+ arch
|
||||
+ "']):\n\t\t\trocprof_compute.main()"
|
||||
+ (
|
||||
"\n\t\twith patch("
|
||||
"'sys.argv',"
|
||||
"["
|
||||
"'rocprof-compute', "
|
||||
"'analyze', "
|
||||
"'--path', "
|
||||
"'" + workload + "/" + arch + "']"
|
||||
"):\n\t\t\trocprof_compute.main()"
|
||||
)
|
||||
+ "\n\tassert e.value.code == 0"
|
||||
)
|
||||
f.write(test)
|
||||
|
||||
@@ -23,23 +23,18 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import csv
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pandas as pd
|
||||
import pytest
|
||||
import test_utils
|
||||
|
||||
rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module()
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
config = {}
|
||||
config["vseq"] = ["./tests/vsequential_access"]
|
||||
@@ -49,7 +44,6 @@ config["COUNTER_LOGGING"] = False
|
||||
config["METRIC_COMPARE"] = False
|
||||
config["METRIC_LOGGING"] = False
|
||||
|
||||
|
||||
SUPPORTED_ARCHS = {
|
||||
"gfx940": {"mi300": ["MI300A_A0"]},
|
||||
"gfx941": {"mi300": ["MI300X_A0"]},
|
||||
@@ -153,7 +147,6 @@ def test_L1_cache_counters(
|
||||
base = Path(test_utils.get_output_dir())
|
||||
|
||||
for app_name in app_names:
|
||||
|
||||
workload_dir = str(base / app_name)
|
||||
|
||||
# 1. profile the app
|
||||
@@ -168,9 +161,15 @@ def test_L1_cache_counters(
|
||||
assert return_code == 0
|
||||
|
||||
# 2. analyze the results
|
||||
return_code = binary_handler_analyze_rocprof_compute(
|
||||
["analyze", "--path", workload_dir, "-b", "16.3", "--save-dfs", workload_dir]
|
||||
)
|
||||
return_code = binary_handler_analyze_rocprof_compute([
|
||||
"analyze",
|
||||
"--path",
|
||||
workload_dir,
|
||||
"-b",
|
||||
"16.3",
|
||||
"--save-dfs",
|
||||
workload_dir,
|
||||
])
|
||||
assert return_code == 0
|
||||
|
||||
# 3. save results in local
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,6 @@ def test_modification_time():
|
||||
hash_map = yaml.safe_load(f)
|
||||
for file, hash in hash_map.items():
|
||||
file_hash = hashlib.sha256(Path(file).read_bytes()).hexdigest()
|
||||
assert (
|
||||
file_hash == hash
|
||||
), f"Hash mismatch for {file}: expected {hash}, got {file_hash}"
|
||||
assert file_hash == hash, (
|
||||
f"Hash mismatch for {file}: expected {hash}, got {file_hash}"
|
||||
)
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import logging
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
import pandas as pd
|
||||
import pytest
|
||||
from db_connector import DatabaseConnector
|
||||
|
||||
logging.TRACE = logging.DEBUG - 5
|
||||
logging.addLevelName(logging.TRACE, "TRACE")
|
||||
@@ -40,8 +40,6 @@ def trace_logger(message, *args, **kwargs):
|
||||
|
||||
setattr(logging, "trace", trace_logger)
|
||||
|
||||
from db_connector import DatabaseConnector
|
||||
|
||||
"""
|
||||
Tests for the DatabaseConnector class that tests almost methods with initialization,
|
||||
CSV import, database removal, and error handling.
|
||||
@@ -109,9 +107,10 @@ class TestDatabaseConnector:
|
||||
mock_path.return_value.joinpath.return_value = "/fake/path/sysinfo.csv"
|
||||
mock_path.return_value.is_file.return_value = True
|
||||
|
||||
mock_sysinfo = pd.DataFrame(
|
||||
{"gpu_model": ["MI100 "], "workload_name": [" test_workload"]}
|
||||
)
|
||||
mock_sysinfo = pd.DataFrame({
|
||||
"gpu_model": ["MI100 "],
|
||||
"workload_name": [" test_workload"],
|
||||
})
|
||||
mock_read_csv.return_value = mock_sysinfo
|
||||
|
||||
connector = DatabaseConnector(mock_args_import)
|
||||
@@ -236,9 +235,9 @@ class TestDatabaseConnector:
|
||||
connector.db_remove()
|
||||
|
||||
mock_client.drop_database.assert_called_once_with(mock_db_to_remove)
|
||||
mock_names_col.delete_many.assert_called_once_with(
|
||||
{"name": "rocprofiler-compute_test_team_workload_mi100"}
|
||||
)
|
||||
mock_names_col.delete_many.assert_called_once_with({
|
||||
"name": "rocprofiler-compute_test_team_workload_mi100"
|
||||
})
|
||||
|
||||
def test_pre_processing_no_action_specified(self, mock_args_import):
|
||||
"""Test pre_processing when neither upload nor remove is specified"""
|
||||
@@ -398,9 +397,10 @@ class TestDatabaseConnectorIntegration:
|
||||
)
|
||||
mock_path.return_value.is_file.return_value = True
|
||||
|
||||
mock_sysinfo = pd.DataFrame(
|
||||
{"gpu_model": ["MI100"], "workload_name": ["device_filter"]}
|
||||
)
|
||||
mock_sysinfo = pd.DataFrame({
|
||||
"gpu_model": ["MI100"],
|
||||
"workload_name": ["device_filter"],
|
||||
})
|
||||
mock_read_csv.return_value = mock_sysinfo
|
||||
|
||||
connector = DatabaseConnector(args)
|
||||
|
||||
@@ -23,24 +23,20 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, mock_open, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pandas as pd
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from src.utils.specs import generate_machine_specs
|
||||
|
||||
rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module()
|
||||
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
# NOTE: Only testing gfx942 for now.
|
||||
GFX942_CHIP_IDS_TO_NUM_XCDS = {
|
||||
@@ -70,7 +66,7 @@ def parse_table_dict(output: str) -> dict:
|
||||
"""
|
||||
Parse an ASCII table into a dict mapping Spec -> Value.
|
||||
"""
|
||||
lines = [l for l in output.splitlines() if l.startswith("│")]
|
||||
lines = [line for line in output.splitlines() if line.startswith("│")]
|
||||
# locate header row (the one containing 'Spec' and 'Value')
|
||||
header_idx = next(
|
||||
(i for i, ln in enumerate(lines) if "Spec" in ln and "Value" in ln), None
|
||||
@@ -132,7 +128,6 @@ def get_num_xcds():
|
||||
|
||||
|
||||
def get_gpu_arch():
|
||||
|
||||
rocminfo = str(
|
||||
# decode with utf-8 to account for rocm-smi changes in latest rocm
|
||||
subprocess.run(
|
||||
@@ -182,18 +177,18 @@ def test_num_xcds_cli_output():
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
assert (
|
||||
proc.returncode == 0
|
||||
), f"Non-zero exit ({proc.returncode}), stderr:\n{proc.stderr}"
|
||||
assert proc.returncode == 0, (
|
||||
f"Non-zero exit ({proc.returncode}), stderr:\n{proc.stderr}"
|
||||
)
|
||||
|
||||
# 3. strip ANSI, parse table
|
||||
clean = strip_ansi(proc.stdout)
|
||||
return_dict = parse_table_dict(clean)
|
||||
|
||||
# 4. check results are expected
|
||||
assert (
|
||||
"Compute Partition" in return_dict
|
||||
), "Spec 'Compute Partition' not found in table"
|
||||
assert "Compute Partition" in return_dict, (
|
||||
"Spec 'Compute Partition' not found in table"
|
||||
)
|
||||
assert "Num XCDs" in return_dict, "Spec 'Num XCDs' not found in table"
|
||||
|
||||
compute_partition_actual = return_dict["Compute Partition"]
|
||||
@@ -257,7 +252,7 @@ def test_get_gpu_series_uninitialized():
|
||||
|
||||
with patch.object(MIGPUSpecs, "_gpu_series_dict", {}):
|
||||
with pytest.raises(SystemExit):
|
||||
result = MIGPUSpecs.get_gpu_series("gfx942")
|
||||
result = MIGPUSpecs.get_gpu_series("gfx942") # noqa: F841
|
||||
|
||||
|
||||
@pytest.mark.misc
|
||||
@@ -315,7 +310,7 @@ def test_get_num_xcds_no_compute_partition_data():
|
||||
|
||||
mock_dict = {"gfx942": None}
|
||||
with patch.object(MIGPUSpecs, "_gpu_arch_to_compute_partition_dict", mock_dict):
|
||||
result = MIGPUSpecs.get_num_xcds(gpu_arch="gfx942")
|
||||
result = MIGPUSpecs.get_num_xcds(gpu_arch="gfx942") # noqa: F841
|
||||
|
||||
|
||||
@pytest.mark.misc
|
||||
@@ -333,7 +328,7 @@ def test_get_num_xcds_unknown_gpu_model():
|
||||
"""Test get_num_xcds with unknown gpu model - covers lines 319-321"""
|
||||
from src.utils.mi_gpu_spec import MIGPUSpecs
|
||||
|
||||
result = MIGPUSpecs.get_num_xcds(gpu_arch="gfx950", gpu_model="UNKNOWN_MODEL")
|
||||
result = MIGPUSpecs.get_num_xcds(gpu_arch="gfx950", gpu_model="UNKNOWN_MODEL") # noqa: F841
|
||||
|
||||
|
||||
@pytest.mark.misc
|
||||
@@ -341,7 +336,7 @@ def test_get_num_xcds_no_compute_partition():
|
||||
"""Test get_num_xcds with no compute partition - covers lines 325-327"""
|
||||
from src.utils.mi_gpu_spec import MIGPUSpecs
|
||||
|
||||
result = MIGPUSpecs.get_num_xcds(
|
||||
result = MIGPUSpecs.get_num_xcds( # noqa: F841
|
||||
gpu_arch="gfx950", gpu_model="MI350", compute_partition=""
|
||||
)
|
||||
|
||||
@@ -351,7 +346,7 @@ def test_get_num_xcds_unknown_compute_partition():
|
||||
"""Test get_num_xcds with unknown compute partition - covers lines 329-332"""
|
||||
from src.utils.mi_gpu_spec import MIGPUSpecs
|
||||
|
||||
result = MIGPUSpecs.get_num_xcds(
|
||||
result = MIGPUSpecs.get_num_xcds( # noqa: F841
|
||||
gpu_arch="gfx950", gpu_model="MI350", compute_partition="UNKNOWN"
|
||||
)
|
||||
|
||||
@@ -363,7 +358,7 @@ def test_get_num_xcds_none_partition_value():
|
||||
|
||||
mock_dict = {"mi350": {"spx": None}}
|
||||
with patch.object(MIGPUSpecs, "_num_xcds_dict", mock_dict):
|
||||
result = MIGPUSpecs.get_num_xcds(
|
||||
result = MIGPUSpecs.get_num_xcds( # noqa: F841
|
||||
gpu_arch="gfx950", gpu_model="MI350", compute_partition="spx"
|
||||
)
|
||||
|
||||
@@ -373,7 +368,7 @@ def test_get_num_xcds_no_gpu_model():
|
||||
"""Test get_num_xcds with no gpu model - covers line 342"""
|
||||
from src.utils.mi_gpu_spec import MIGPUSpecs
|
||||
|
||||
result = MIGPUSpecs.get_num_xcds(
|
||||
result = MIGPUSpecs.get_num_xcds( # noqa: F841
|
||||
gpu_arch="gfx950", gpu_model="", compute_partition="spx"
|
||||
)
|
||||
|
||||
@@ -385,7 +380,7 @@ def test_get_chip_id_dict_empty():
|
||||
|
||||
with patch.object(MIGPUSpecs, "_chip_id_dict", {}):
|
||||
with patch("src.utils.mi_gpu_spec.console_error") as mock_error:
|
||||
result = MIGPUSpecs.get_chip_id_dict()
|
||||
result = MIGPUSpecs.get_chip_id_dict() # noqa: F841
|
||||
mock_error.assert_called_once()
|
||||
|
||||
|
||||
@@ -396,7 +391,7 @@ def test_get_num_xcds_dict_empty():
|
||||
|
||||
with patch.object(MIGPUSpecs, "_num_xcds_dict", {}):
|
||||
with patch("src.utils.mi_gpu_spec.console_error") as mock_error:
|
||||
result = MIGPUSpecs.get_num_xcds_dict()
|
||||
result = MIGPUSpecs.get_num_xcds_dict() # noqa: F841
|
||||
mock_error.assert_called_once()
|
||||
|
||||
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module()
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
##################################################
|
||||
## Generated tests ##
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
@@ -54,7 +53,6 @@ CHIP_IDS = {
|
||||
"30112": "MI350",
|
||||
}
|
||||
|
||||
|
||||
# --
|
||||
# Runtime config options
|
||||
# --
|
||||
@@ -74,101 +72,91 @@ DEFAULT_ABS_DIFF = 15
|
||||
DEFAULT_REL_DIFF = 50
|
||||
MAX_REOCCURING_COUNT = 28
|
||||
|
||||
ALL_CSVS_MI100 = sorted(
|
||||
[
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
]
|
||||
)
|
||||
ALL_CSVS_MI100 = sorted([
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
])
|
||||
|
||||
ALL_CSVS_MI200 = sorted(
|
||||
[
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
]
|
||||
)
|
||||
ALL_CSVS_MI300 = sorted(
|
||||
[
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
]
|
||||
)
|
||||
ALL_CSVS_MI350 = sorted(
|
||||
[
|
||||
"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",
|
||||
"pmc_perf_10.csv",
|
||||
"pmc_perf_11.csv",
|
||||
"pmc_perf_12.csv",
|
||||
"pmc_perf_13.csv",
|
||||
"pmc_perf_14.csv",
|
||||
"sysinfo.csv",
|
||||
]
|
||||
)
|
||||
ALL_CSVS_MI200 = sorted([
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
])
|
||||
ALL_CSVS_MI300 = sorted([
|
||||
"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",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
])
|
||||
ALL_CSVS_MI350 = sorted([
|
||||
"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",
|
||||
"pmc_perf_10.csv",
|
||||
"pmc_perf_11.csv",
|
||||
"pmc_perf_12.csv",
|
||||
"pmc_perf_13.csv",
|
||||
"pmc_perf_14.csv",
|
||||
"sysinfo.csv",
|
||||
])
|
||||
|
||||
ROOF_ONLY_FILES = sorted(
|
||||
[
|
||||
"empirRoof_gpu-0_FP32.pdf",
|
||||
"pmc_perf.csv",
|
||||
"pmc_perf_0.csv",
|
||||
"pmc_perf_1.csv",
|
||||
"pmc_perf_2.csv",
|
||||
"roofline.csv",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
]
|
||||
)
|
||||
ROOF_ONLY_FILES = sorted([
|
||||
"empirRoof_gpu-0_FP32.pdf",
|
||||
"pmc_perf.csv",
|
||||
"pmc_perf_0.csv",
|
||||
"pmc_perf_1.csv",
|
||||
"pmc_perf_2.csv",
|
||||
"roofline.csv",
|
||||
"sysinfo.csv",
|
||||
"timestamps.csv",
|
||||
])
|
||||
|
||||
METRIC_THRESHOLDS = {
|
||||
"2.1.12": {"absolute": 0, "relative": 8},
|
||||
@@ -292,7 +280,9 @@ def counter_compare(test_name, errors_pd, baseline_df, run_df, threshold=5):
|
||||
# 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))
|
||||
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]
|
||||
@@ -429,7 +419,13 @@ def baseline_compare_metric(test_name, workload_dir, args=[]):
|
||||
metric_info = re.findall(
|
||||
r"(^"
|
||||
+ metric
|
||||
+ r")(?: *)([()0-9A-Za-z- ]+ )(?: *)([0-9.-]*)(?: *)([0-9.-]*)(?: *)\(([-0-9.]*)%\)(?: *)([-0-9.e]*)",
|
||||
+ (
|
||||
r")(?: *)([()0-9A-Za-z- ]+ )"
|
||||
r"(?: *)([0-9.-]*)"
|
||||
r"(?: *)([0-9.-]*)"
|
||||
r"(?: *)\(([-0-9.]*)%\)"
|
||||
r"(?: *)([-0-9.e]*)"
|
||||
),
|
||||
captured_output,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
@@ -489,20 +485,20 @@ def baseline_compare_metric(test_name, workload_dir, args=[]):
|
||||
# print("logging...")
|
||||
# print(metric_info)
|
||||
|
||||
new_error = pd.DataFrame.from_dict(
|
||||
{
|
||||
"Index": [metric_idx],
|
||||
"Metric": [metric_name],
|
||||
"Percent Difference": [relative_diff],
|
||||
"Absolute Difference": [absolute_diff],
|
||||
"Baseline": [baseline_val],
|
||||
"Current": [current_val],
|
||||
"Test Name": [test_name],
|
||||
}
|
||||
)
|
||||
new_error = pd.DataFrame.from_dict({
|
||||
"Index": [metric_idx],
|
||||
"Metric": [metric_name],
|
||||
"Percent Difference": [relative_diff],
|
||||
"Absolute Difference": [absolute_diff],
|
||||
"Baseline": [baseline_val],
|
||||
"Current": [current_val],
|
||||
"Test Name": [test_name],
|
||||
})
|
||||
error_df = pd.concat([error_df, new_error])
|
||||
counts = error_df.groupby(["Index"]).cumcount()
|
||||
reoccurring_metrics = error_df.loc[counts > MAX_REOCCURING_COUNT]
|
||||
reoccurring_metrics = error_df.loc[
|
||||
counts > MAX_REOCCURING_COUNT
|
||||
]
|
||||
reoccurring_metrics["counts"] = counts[
|
||||
counts > MAX_REOCCURING_COUNT
|
||||
]
|
||||
@@ -843,7 +839,7 @@ def test_roofline_empty_kernel_names_handling(binary_handler_profile_rocprof_com
|
||||
]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
|
||||
returncode = binary_handler_profile_rocprof_compute(
|
||||
returncode = binary_handler_profile_rocprof_compute( # noqa: F841
|
||||
config, workload_dir, options, check_success=False, roof=True
|
||||
)
|
||||
|
||||
@@ -860,10 +856,16 @@ def test_roofline_unsupported_datatype_error(binary_handler_profile_rocprof_comp
|
||||
pytest.skip("Skipping roofline test for MI100")
|
||||
return
|
||||
|
||||
options = ["--device", "0", "--roof-only", "--roofline-data-type", "UNSUPPORTED_TYPE"]
|
||||
options = [
|
||||
"--device",
|
||||
"0",
|
||||
"--roof-only",
|
||||
"--roofline-data-type",
|
||||
"UNSUPPORTED_TYPE",
|
||||
]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
|
||||
returncode = binary_handler_profile_rocprof_compute(
|
||||
returncode = binary_handler_profile_rocprof_compute( # noqa: F841
|
||||
config, workload_dir, options, check_success=False, roof=True
|
||||
)
|
||||
|
||||
@@ -914,7 +916,7 @@ def test_roof_cli_plot_generation(binary_handler_profile_rocprof_compute):
|
||||
return
|
||||
|
||||
try:
|
||||
import plotext as plt
|
||||
import plotext as plt # noqa: F401
|
||||
|
||||
cli_available = True
|
||||
except ImportError:
|
||||
@@ -924,7 +926,7 @@ def test_roof_cli_plot_generation(binary_handler_profile_rocprof_compute):
|
||||
options = ["--device", "0", "--roof-only"]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
|
||||
returncode = binary_handler_profile_rocprof_compute(
|
||||
returncode = binary_handler_profile_rocprof_compute( # noqa: F841
|
||||
config, workload_dir, options, check_success=False, roof=True
|
||||
)
|
||||
|
||||
@@ -946,7 +948,7 @@ def test_roof_error_handling(binary_handler_profile_rocprof_compute):
|
||||
if os.path.exists(pmc_perf_path):
|
||||
os.remove(pmc_perf_path)
|
||||
|
||||
returncode = binary_handler_profile_rocprof_compute(
|
||||
returncode = binary_handler_profile_rocprof_compute( # noqa: F841
|
||||
config, workload_dir, options, check_success=False, roof=True
|
||||
)
|
||||
|
||||
@@ -1072,7 +1074,7 @@ def test_roofline_ceiling_data_validation(binary_handler_profile_rocprof_compute
|
||||
options = ["--device", "0", "--roof-only", "--mem-level", "INVALID_LEVEL"]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
|
||||
returncode = binary_handler_profile_rocprof_compute(
|
||||
returncode = binary_handler_profile_rocprof_compute( # noqa: F841
|
||||
config, workload_dir, options, check_success=False, roof=True
|
||||
)
|
||||
|
||||
@@ -1523,7 +1525,9 @@ def test_instmix_memchart_section(binary_handler_profile_rocprof_compute):
|
||||
assert test_utils.check_file_pattern(
|
||||
"- '10'", f"{workload_dir}/profiling_config.yaml"
|
||||
)
|
||||
assert test_utils.check_file_pattern("- '3'", f"{workload_dir}/profiling_config.yaml")
|
||||
assert test_utils.check_file_pattern(
|
||||
"- '3'", f"{workload_dir}/profiling_config.yaml"
|
||||
)
|
||||
assert test_utils.check_file_pattern(
|
||||
"TA_FLAT_WAVEFRONTS", f"{workload_dir}/pmc_perf.csv"
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user