Skip to content

[Test] Add support for Hecbench_spirv test - #46

Open
pranavprakash-amd wants to merge 3 commits into
mainfrom
users/pranavprakash-amd/Hecbench_spirv
Open

[Test] Add support for Hecbench_spirv test#46
pranavprakash-amd wants to merge 3 commits into
mainfrom
users/pranavprakash-amd/Hecbench_spirv

Conversation

@pranavprakash-amd

@pranavprakash-amd pranavprakash-amd commented Jul 16, 2026

Copy link
Copy Markdown

Motivation

HeCBench is a large, widely-used collection of HIP/CUDA benchmarks that exercises a broad cross-section of the compiler and HIP runtime stack. The
legacy suite (tests/COMPILERS/hecbench/hecbench.py, the HecBench class) validated these benchmarks but predates the rocm-tests framework — it
cloned the repo into an ad-hoc scratch dir, iterated src/-hip folders imperatively, and decided SPIR-V mode by sniffing an executor's
compiler string for the substring "spirv", reporting into a separate "Hecbench_spirv" suite.

This PR ports HeCBench into the rocm-tests framework as a marker-compliant, parametrized e2e test. The goals:

  • Bring HeCBench compile+run coverage under the standard framework (executors, fixtures, markers, Allure metrics, remote-fleet support).
  • Promote SPIR-V from an out-of-band compiler-string hack to a first-class mode parametrization axis, so every benchmark produces both a -hip
    (plain hipcc) and a -spirv (--offload-arch=amdgcnspirv) test — giving explicit, per-benchmark SPIR-V codegen signal.
  • Provide a fast nightly smoke gate plus a full weekly soak run over the entire catalog.

Technical Details

Adds tests/e2e/compiler/hecbench/ with four files:

  • test_hecbench.py — the ported test. A shared _run_benchmark() helper: skips (rather than fails) when a src/-hip folder is absent from the
    checkout; puts --rock-dir's bin/ on PATH and sets LD_LIBRARY_PATH (via ld_path) so the Makefile's hipcc and the built binary resolve TheRock libs;
    runs make clean/make/make run through target_executor so compile and run land on the same node/filesystem.
    • SPIR-V mode: patches the Makefile with sed -i 's/hipcc/hipcc --offload-arch=amdgcnspirv/g'. Before every run it restores the Makefile via git
      checkout -- Makefile, so the shared session checkout is never left in a patched state regardless of run order.
    • Pass criterion (preserves legacy semantics): compile succeeds and the benchmark's subset.json regex extracts a nonzero numeric total
      (_extract_total sums all float-castable captures, robust to multi-group regexes). Benchmarks with an empty regex are validated on clean exit only
      — a deliberate, documented deviation from the legacy behavior, which marked those "failed" purely due to a test-data gap.
    • Metrics reported to Allure via report_metric("HECBENCH__", total).
    • Two test functions: test_hecbench_smoke (curated 5-benchmark subset, runtime.medium, keeps the profile-injected ci.nightly) and
      test_hecbench_full_suite (entire catalog, overrides to ci.weekly + runtime.soak). Both parametrized over benchmark × mode.
  • conftest.py — a session-scoped hecbench_repo fixture that clones https://github.com/zjin-lcf/HeCBench (ref master) exactly once via the
    remote-aware external_build.clone_repo helper, replacing the legacy one-off clone. URL/ref overridable via ROCM_TEST_HECBENCH_URL /
    ROCM_TEST_HECBENCH_REF; assert_license_present acts as a provenance guard.
  • subset.json — the benchmark → capture-regex catalog (~498 benchmarks), copied verbatim from the legacy suite.
  • init.py — package marker.

Markers hw.gpu, layer.runtime, ci.nightly, e2e.stack, os.linux are auto-injected by CATEGORY_PROFILES for tests/e2e/compiler/; explicit runtime.*
/ ci.weekly markers are declared per function. No framework code changed — this is purely additive under tests/.

Prereqs: --rock-dir/ROCK_DIR pointing at a ROCm/TheRock install with bin/hipcc, an AMD GPU, and network access to clone HeCBench.

Test Plan

  • Marker/collection validation without hardware:
    pytest tests/e2e/compiler/hecbench/test_hecbench.py --collect-only -q --no-gpu
  • Nightly smoke on a real GPU:
    pytest tests/e2e/compiler/hecbench/test_hecbench.py::test_hecbench_smoke -v
    --rock-dir /path/to/therock --gpu-arch gfx942
  • Full weekly suite (soak):
    pytest tests/e2e/compiler/hecbench/test_hecbench.py::test_hecbench_full_suite -v
    -m "ci.weekly" --rock-dir /path/to/therock --gpu-arch gfx942
  • Lint gate (ruff, black, mypy, pylint) and the marker-lint hook run on the new files.

Test Result

====================================================== ROCm Test Suite Summary ======================================================
Test Directory PASS FAIL SKIP ERROR Duration
───────────────────────────────────────────────────────────────────
tests/e2e/compiler/hecbench 7 3 0 0 147.8 s
───────────────────────────────────────────────────────────────────
TOTAL 10 tests │ 7 passed │ 3 failed │ 0 skipped │ 0 error │ 147.8 s

Submission Checklist

Signed-off-by: Pranav Prakash <pranav.prakash@amd.com>
@pranavprakash-amd
pranavprakash-amd force-pushed the users/pranavprakash-amd/Hecbench_spirv branch from ac2c896 to cbca053 Compare July 23, 2026 05:04
@mparamas-amd

Copy link
Copy Markdown
Contributor

Add a NOTICES.md

"(?:Total time \\(s\\): )([0-9.+-e]+)"
],
"heat2d": [
"(?:PASS)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update regex entry from ["(?:PASS)"] to [""] — an empty string — so the test validates it on exit code alone, aligned with Original.

Comment thread tests/e2e/compiler/hecbench/__init__.py Outdated
Comment thread tests/e2e/compiler/hecbench/subset.json
Comment thread tests/e2e/compiler/hecbench/test_hecbench.py Outdated
@mparamas-amd mparamas-amd removed the Review PR ready for review label Jul 27, 2026
Sum of all parsed numeric captures (``0.0`` when nothing matched).
"""
total = 0.0
for match in re.findall(regex, output):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check with Original assert ? flatten of group required?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated with the original logic. The same logic of regex is been used

Signed-off-by: Pranav Prakash <pranav.prakash@amd.com>
Signed-off-by: Pranav Prakash <pranav.prakash@amd.com>
@pranavprakash-amd pranavprakash-amd added the Review PR ready for review label Jul 29, 2026
@mparamas-amd

Copy link
Copy Markdown
Contributor

@pranavprakash-amd did you root cause on the 3 test failures ?

@pranavprakash-amd

Copy link
Copy Markdown
Author

@pranavprakash-amd did you root cause on the 3 test failures ?

Yes @mparamas-amd there are JIRA's tracking the failures with respect to the above. Have track of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review PR ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants