CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
96 lines
2.9 KiB
Python
96 lines
2.9 KiB
Python
# Copyright (c) Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from pathlib import Path
|
|
|
|
import common
|
|
import pandas as pd
|
|
import pytest
|
|
|
|
config = {}
|
|
config["vseq"] = ["./tests/vsequential_access"]
|
|
config["vrand"] = ["./tests/vrandom_access"]
|
|
config["cleanup"] = True
|
|
config["COUNTER_LOGGING"] = False
|
|
config["METRIC_COMPARE"] = False
|
|
config["METRIC_LOGGING"] = False
|
|
|
|
|
|
def load_metrics(csv_file_path):
|
|
"""Read workload_metric.csv and return {metric_name: {value_name: value}}."""
|
|
df = pd.read_csv(csv_file_path)
|
|
return df.pivot(index="metric_name", columns="value_name", values="value").to_dict(
|
|
orient="index"
|
|
)
|
|
|
|
|
|
_, soc = common.gpu_soc()
|
|
|
|
|
|
@pytest.mark.L1_cache
|
|
def test_L1_cache_counters(
|
|
binary_handler_profile_rocprof_compute, binary_handler_analyze_rocprof_compute
|
|
):
|
|
if not soc or "MI300" not in soc:
|
|
pytest.skip("Skipping L1 cache test for non-mi300 socs.")
|
|
|
|
# set up two apps: sequential and random access
|
|
app_names = ["vseq", "vrand"]
|
|
# Scope to the relevant metric section and multiplex counters across
|
|
# kernel iterations so the app runs only once.
|
|
options = ["-b", "16.3"]
|
|
|
|
result = {}
|
|
metrics = ["Read Req", "Write Req", "Cache Hit Rate"]
|
|
base = Path(common.get_output_dir())
|
|
|
|
for app_name in app_names:
|
|
workload_dir = f"{base}/{app_name}"
|
|
workload_dir_output = f"{base}_{app_name}"
|
|
|
|
# 1. profile the app
|
|
return_code = binary_handler_profile_rocprof_compute(
|
|
config,
|
|
workload_dir,
|
|
options,
|
|
check_success=False,
|
|
roof=False,
|
|
app_name=app_name,
|
|
)
|
|
assert return_code == 0
|
|
|
|
# 2. analyze the results
|
|
return_code = binary_handler_analyze_rocprof_compute([
|
|
"analyze",
|
|
"--path",
|
|
workload_dir,
|
|
"-b",
|
|
"16.3",
|
|
"--output-format",
|
|
"csv",
|
|
"--output-name",
|
|
workload_dir_output,
|
|
])
|
|
assert return_code == 0
|
|
|
|
# 3. save results in local
|
|
csv_path = workload_dir_output + "/workload_metric.csv"
|
|
data = load_metrics(csv_path)
|
|
|
|
for metric in metrics:
|
|
if app_name not in result or not isinstance(result[app_name], dict):
|
|
result[app_name] = {}
|
|
result[app_name][metric] = data[metric]["Avg"]
|
|
|
|
# 4. clean local output
|
|
common.clean_output_dir(config["cleanup"], workload_dir)
|
|
common.clean_output_dir(config["cleanup"], workload_dir_output)
|
|
common.clean_output_dir(config["cleanup"], base)
|
|
|
|
# 5. check results are expected
|
|
|
|
# FIXME: use a range for comparison to account for different results
|
|
assert result["vseq"]["Cache Hit Rate"] >= result["vrand"]["Cache Hit Rate"]
|
|
assert result["vseq"]["Read Req"] <= result["vrand"]["Read Req"]
|
|
assert result["vseq"]["Write Req"] <= result["vrand"]["Write Req"]
|