Skip to content

Commit 4dfb479

Browse files
authored
[rocprofiler-compute] Skip PC sampling test if not supported on machine post profiling (#4387)
## Motivation CI machine can sometimes run on machine which does not support stochastic pc sampling driver/firmware Fixes ROCm/TheRock#4034 <!-- Explain the purpose of this PR and the goals it aims to achieve. --> ## Technical Details In test_pc_sampling.py skip stochastic pc sampling test if profiling output complains about PC sampling configuration not supported <!-- Explain the changes along with any relevant GitHub links. --> ## JIRA ID <!-- If applicable, mention the JIRA ID resolved by this PR (Example: Resolves SWDEV-12345). --> <!-- Do not post any JIRA links here. --> ## Test Plan Run test_pc_sampling.py locally <!-- Explain any relevant testing done to verify this PR. --> ## Test Result Tests pass <!-- Briefly summarize test outcomes. --> ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
1 parent 3a8bafb commit 4dfb479

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

projects/rocprofiler-compute/tests/test_pc_sampling.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
])
6262

6363

64+
def is_pc_sampling_not_supported(output):
65+
"""
66+
To be called with the stdout + stderr after profiling.
67+
Check whether profiling output said PC sampling is not supported on the machine
68+
"""
69+
return "Given PC sampling configuration is not supported" in output
70+
71+
6472
def test_pc_sampling_host_trap(binary_handler_profile_rocprof_compute):
6573
"""
6674
Test that PC sampling works with --block 21 and --pc-sampling-method host_trap.
@@ -114,15 +122,22 @@ def test_pc_sampling_stochastic(binary_handler_profile_rocprof_compute):
114122

115123
workload_dir = test_utils.get_output_dir()
116124

117-
_ = binary_handler_profile_rocprof_compute(
125+
code, stdout, stderr = binary_handler_profile_rocprof_compute(
118126
config,
119127
workload_dir,
120128
options,
121-
check_success=True,
129+
check_success=False,
130+
capture_output=True,
122131
roof=False,
123132
app_name="app_mat_mul_max",
124133
)
125134

135+
output = f"{stdout}\n{stderr}"
136+
if is_pc_sampling_not_supported(output):
137+
test_utils.clean_output_dir(config["cleanup"], workload_dir)
138+
pytest.skip("PC sampling is not supported")
139+
140+
assert code == 0
126141
file_dict = test_utils.check_non_pmc_files(workload_dir, num_devices, 1)
127142
assert sorted(list(file_dict.keys())) == sorted(PC_SAMPLING_STOCHASTIC_FILES)
128143

0 commit comments

Comments
 (0)