Skip to content
13 changes: 13 additions & 0 deletions projects/rocprofiler-compute/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path

import pandas as pd
import pytest

ROOT = os.path.dirname(os.path.dirname(__file__))
src_candidate = os.path.join(ROOT, "src")
Expand Down Expand Up @@ -255,3 +256,15 @@ def gpu_soc():
return "", ""
model = list(SUPPORTED_ARCHS[arch].keys())[0].upper()
return arch, model


def skip_unsupported_pc_sampling_soc(is_stochastic=False):
"""Skip PC-sampling tests on SoCs that do not support the selected mode."""
_, soc = gpu_soc()

unsupported_socs = {"MI100", "RDNA35_HALO"}
if is_stochastic:
unsupported_socs.add("MI200")

if soc in unsupported_socs:
pytest.skip(f"PC sampling is not supported on {soc}")
21 changes: 6 additions & 15 deletions projects/rocprofiler-compute/tests/test_pc_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,11 @@ def is_pc_sampling_not_supported(output):
return "Given PC sampling configuration is not supported" in output


def skip_unsupported_pc_sampling_soc(is_stochastic=False):
unsupported_socs = {"MI100", "RDNA35_HALO"}
if is_stochastic:
unsupported_socs.add("MI200")

if soc in unsupported_socs:
pytest.skip(f"PC sampling is not supported on {soc}")


def test_pc_sampling_host_trap(binary_handler_profile_rocprof_compute):
"""
Test that PC sampling works with --block 21 and --pc-sampling-method host_trap.
"""
skip_unsupported_pc_sampling_soc()
common.skip_unsupported_pc_sampling_soc()

options = [
"--block",
Expand Down Expand Up @@ -93,7 +84,7 @@ def test_pc_sampling_stochastic(binary_handler_profile_rocprof_compute):
"""
Test that PC sampling works with --block 21 and --pc-sampling-method stochastic.
"""
skip_unsupported_pc_sampling_soc(is_stochastic=True)
common.skip_unsupported_pc_sampling_soc(is_stochastic=True)

options = [
"--block",
Expand Down Expand Up @@ -135,7 +126,7 @@ def test_multi_rank_pc_sampling_only(
Test that no multi-rank warning is printed when running with only
--block 21 (PC sampling only mode requires a single pass) with multi-rank.
"""
skip_unsupported_pc_sampling_soc()
common.skip_unsupported_pc_sampling_soc()

monkeypatch.setenv("OMPI_COMM_WORLD_RANK", "0")
monkeypatch.setenv("OMPI_COMM_WORLD_SIZE", "2")
Expand Down Expand Up @@ -174,7 +165,7 @@ def test_multi_rank_warning_pc_sampling_with_counters(
and another block (PC sampling with counters mode requires multiple passes)
with multi-rank.
"""
skip_unsupported_pc_sampling_soc()
common.skip_unsupported_pc_sampling_soc()

monkeypatch.setenv("OMPI_COMM_WORLD_RANK", "0")
monkeypatch.setenv("OMPI_COMM_WORLD_SIZE", "2")
Expand Down Expand Up @@ -219,7 +210,7 @@ def test_pc_sampling_profile_then_analyze(
End-to-end: profile with PC sampling (host_trap), then
run analysis on the profiling output.
"""
skip_unsupported_pc_sampling_soc()
common.skip_unsupported_pc_sampling_soc()

options = [
"--block",
Expand Down Expand Up @@ -301,7 +292,7 @@ def test_pc_sampling_with_sol_block(binary_handler_profile_rocprof_compute):
Test that PC sampling works with --block 21 and --block 2
(PC sampling with counter collection)
"""
skip_unsupported_pc_sampling_soc()
common.skip_unsupported_pc_sampling_soc()

options = [
"--block",
Expand Down
16 changes: 14 additions & 2 deletions projects/rocprofiler-compute/tests/test_profile_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,8 +2030,18 @@ def test_comprehensive_error_paths():


@pytest.mark.live_attach_detach
Comment thread
ywang103-amd marked this conversation as resolved.
def test_live_attach_detach_block(binary_handler_profile_rocprof_compute):
options = ["--block", "3.1.1", "4.1.1", "5.1.1"]
@pytest.mark.parametrize("profile_format", ["rocpd", "csv"])
def test_live_attach_detach_block(
binary_handler_profile_rocprof_compute, profile_format
):
options = [
"--block",
"3.1.1",
"4.1.1",
"5.1.1",
"--format-rocprof-output",
profile_format,
]
workload_dir = common.get_output_dir()

# TODO: temp fix for sdk defautly disable attach/detach,
Expand Down Expand Up @@ -2223,6 +2233,8 @@ def test_live_attach_detach_singlepass_launch_stats(
def test_live_attach_detach_pc_sampling(
binary_handler_profile_rocprof_compute,
):
common.skip_unsupported_pc_sampling_soc(is_stochastic=True)

options = ["-b", "21"]
workload_dir = common.get_output_dir()

Expand Down
Loading