diff --git a/projects/rocprofiler-compute/tests/common.py b/projects/rocprofiler-compute/tests/common.py index 66cb38cf8e8..37ef5157ce3 100644 --- a/projects/rocprofiler-compute/tests/common.py +++ b/projects/rocprofiler-compute/tests/common.py @@ -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") @@ -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}") diff --git a/projects/rocprofiler-compute/tests/test_pc_sampling.py b/projects/rocprofiler-compute/tests/test_pc_sampling.py index 67af8803d33..f4309f4a74b 100644 --- a/projects/rocprofiler-compute/tests/test_pc_sampling.py +++ b/projects/rocprofiler-compute/tests/test_pc_sampling.py @@ -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", @@ -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", @@ -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") @@ -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") @@ -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", @@ -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", diff --git a/projects/rocprofiler-compute/tests/test_profile_general.py b/projects/rocprofiler-compute/tests/test_profile_general.py index 534bf35ac12..b1c82338e0c 100644 --- a/projects/rocprofiler-compute/tests/test_profile_general.py +++ b/projects/rocprofiler-compute/tests/test_profile_general.py @@ -2030,8 +2030,18 @@ def test_comprehensive_error_paths(): @pytest.mark.live_attach_detach -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, @@ -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()