Use own counter definition (#91)

* Use own counter definition
  * Do not depend on rocprofiler-sdk counter definition

* Add missing counter definitions for MI100, MI200, MI300, MI350 series
  * Counters added based on register specification
  * This prevents some missing metrics

* Enable SQC_DCACHE_INFLIGHT_LEVEL counter and associated metrics

* Enable TCP_TCP_LATENCY counter and associated counter for all GPUs
  except MI300

* Update TCC_EA_* counters for MI100 to TCC_EA0_*
  * Update MI100 metrics which depend on TCC_EA0_* counters

* Enable accumulation counters for MI100

* Improve rocprof list avail usage to get a better idea of supported
  counters

* Update CHANGELOG

* Move accumulation counters to counter definition

---------

Co-authored-by: Vignesh Edithal <Vignesh.Edithal@amd.com>
This commit is contained in:
systems-assistant[bot]
2025-08-08 14:39:10 -04:00
committato da GitHub
parent 97d9f35033
commit d3f9ab25eb
12 ha cambiato i file con 10942 aggiunte e 3214 eliminazioni
@@ -737,41 +737,21 @@ def run_prof(
new_env = os.environ.copy()
if using_v3():
# Default counter definitions
if rocprof_cmd == "rocprofiler-sdk":
counter_defs_path = (
path(options["ROCP_TOOL_LIBRARIES"])
.resolve()
.parent.parent.parent.joinpath(
"share", "rocprofiler-sdk", "counter_defs.yaml"
)
)
else:
counter_defs_path = (
path(shutil.which(rocprof_cmd))
.resolve()
.parent.parent.joinpath("share", "rocprofiler-sdk", "counter_defs.yaml")
)
# Custom counter definitions for MI 100
if mspec.gpu_model.lower() == "mi100":
counter_defs_path = (
config.rocprof_compute_home
/ "rocprof_compute_soc"
/ "profile_configs"
/ "gfx908_counter_defs.yaml"
)
# Read counter definitions
with open(counter_defs_path, "r") as file:
# Counter definitions
with open(
config.rocprof_compute_home
/ "rocprof_compute_soc"
/ "profile_configs"
/ f"counter_defs.yaml",
"r",
) as file:
counter_defs = yaml.safe_load(file)
# Get extra counter definitions
path_counter_config_yaml = path(fname).with_suffix(".yaml")
if path_counter_config_yaml.exists():
with open(path_counter_config_yaml, "r") as file:
extra_counter_defs = yaml.safe_load(file)
# Merge extra counter definitions
counter_defs["rocprofiler-sdk"]["counters"].extend(
extra_counter_defs["rocprofiler-sdk"]["counters"]
)
# Extra counter definitions
if path(fname).with_suffix(".yaml").exists():
with open(path(fname).with_suffix(".yaml"), "r") as file:
counter_defs["rocprofiler-sdk"]["counters"].extend(
yaml.safe_load(file)["rocprofiler-sdk"]["counters"]
)
# Write counter definitions to a temporary file
tmpfile_path = (
path(tempfile.mkdtemp(prefix="rocprof_counter_defs_", dir="/tmp"))
@@ -779,7 +759,7 @@ def run_prof(
)
with open(tmpfile_path, "w") as tmpfile:
yaml.dump(counter_defs, tmpfile, default_flow_style=False, sort_keys=False)
# Set rocprofiler sdk counter definitions
# Set counter definitions
new_env["ROCPROFILER_METRICS_PATH"] = str(tmpfile_path.parent)
console_debug(
f"Adding env var for counter definitions: ROCPROFILER_METRICS_PATH={new_env['ROCPROFILER_METRICS_PATH']}"