Unified configuration for metrics (#726)

* Show description of metrics during analysis
    * Use --include-cols Description show the Description column in analyze mode (this is hidden by default)
    * Remove tips field from analysis config

* Align metric names in analysis config and documentation

* Add unified config utils/unified_config.yaml

* Add python script utils/split_config.py to auto generate analysis configuration and documentation metrics description
   * Add test case to ensure unified config is older than auto-generated config
   * Auto generate analysis config and documentation metrics description

* Update CONTRIBUTING.md to add instructions to build documentation assets
    * Add docker image and compose file to build documentation

* Update CHANGELOG and Documentation

* Use jinja template instead of hardcoding metric tables in documentation

[ROCm/rocprofiler-compute commit: bb44e90b2d]
This commit is contained in:
vedithal-amd
2025-07-25 14:01:34 -04:00
committed by GitHub
parent dcdadfd37d
commit 354fe5f52c
232 changed files with 44409 additions and 22480 deletions
@@ -174,7 +174,7 @@ def test_L1_cache_counters(
# 3. save results in local
# FIXME: customize file name to avoid hardcode
csv_path = workload_dir + "/16.3_L1D_Cache_Accesses.csv"
csv_path = workload_dir + "/16.3_vL1D_cache_access_metrics.csv"
data = load_metrics(csv_path)
for metric in metrics:
@@ -470,37 +470,13 @@ def test_save_dfs(binary_handler_analyze_rocprof_compute):
assert code == 0
files_in_workload = os.listdir(output_path)
single_row_tables = [
"0.1_Top_Kernels.csv",
"13.3_Instruction_Cache_-_L2_Interface.csv",
"18.1_Aggregate_Stats_(All_channels).csv",
]
for file_name in files_in_workload:
df = pd.read_csv(output_path + "/" + file_name)
if file_name in single_row_tables:
assert len(df.index) == 1
else:
assert len(df.index) >= 3
assert len(df.index) >= 1
shutil.rmtree(output_path)
test_utils.clean_output_dir(config["cleanup"], workload_dir)
for dir in indirs:
workload_dir = test_utils.setup_workload_dir(dir)
code = binary_handler_analyze_rocprof_compute(
["analyze", "--path", workload_dir, "--save-dfs", output_path]
)
assert code == 0
files_in_workload = os.listdir(output_path)
for file_name in files_in_workload:
df = pd.read_csv(output_path + "/" + file_name)
if file_name in single_row_tables:
assert len(df.index) == 1
else:
assert len(df.index) >= 3
test_utils.clean_output_dir(config["cleanup"], workload_dir)
@pytest.mark.col
def test_col_1(binary_handler_analyze_rocprof_compute):
@@ -519,7 +495,7 @@ def test_col_2(binary_handler_analyze_rocprof_compute):
for dir in indirs:
workload_dir = test_utils.setup_workload_dir(dir)
code = binary_handler_analyze_rocprof_compute(
["analyze", "--path", workload_dir, "--cols", "2"]
["analyze", "--path", workload_dir, "--cols", "2", "--include-cols", "Description"]
)
assert code == 0
@@ -0,0 +1,43 @@
import hashlib
from pathlib import Path
import pytest
import yaml
@pytest.mark.autogen_config
def test_modification_time():
# Ensure modification time of utils/unified_config.yaml is older than
# utils/autogen_hash.yaml
# docs/data/metrics_description.yaml and
# src/rocprof_compute_soc/analysis_configs/gfx*/*.yaml
unified_config_path = Path("utils/unified_config.yaml")
hash_path = Path("utils/autogen_hash.yaml")
docs_config_path = Path("docs/data/metrics_description.yaml")
analysis_config_paths = list(
Path("src/rocprof_compute_soc/analysis_configs").glob("gfx*/*.yaml")
)
assert (
unified_config_path.stat().st_mtime < hash_path.stat().st_mtime
), f"{unified_config_path} is not older than {hash_path}"
assert (
unified_config_path.stat().st_mtime < docs_config_path.stat().st_mtime
), f"{unified_config_path} is not older than {docs_config_path}"
for analysis_config_path in analysis_config_paths:
assert (
unified_config_path.stat().st_mtime < analysis_config_path.stat().st_mtime
), f"{unified_config_path} is not older than {analysis_config_path}"
# Ensure hash map consistency
with open(hash_path, "r") as f:
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}"
@@ -41,7 +41,6 @@ import test_utils
# TODO: MI350 What are the gpu models in MI 350 series
SUPPORTED_ARCHS = {
"gfx906": {"mi50": ["MI50", "MI60"]},
"gfx908": {"mi100": ["MI100"]},
"gfx90a": {"mi200": ["MI210", "MI250", "MI250X"]},
"gfx940": {"mi300": ["MI300A_A0"]},
@@ -8702,7 +8702,7 @@ def test_add_counter_overwrite_existing():
updated_description = "Updated version"
updated_expression = "updated_expr"
updated_architectures = ["gfx906", "gfx908"]
updated_architectures = ["gfx908"]
updated_properties = ["P_UPDATED", "P_NEW"]