Skip to content

Add AMD GPU accelerator detection to archdetect (+ CI tests) - #273

Open
hmeiland wants to merge 4 commits into
EESSI:mainfrom
hmeiland:amdaccel-full
Open

Add AMD GPU accelerator detection to archdetect (+ CI tests)#273
hmeiland wants to merge 4 commits into
EESSI:mainfrom
hmeiland:amdaccel-full

Conversation

@hmeiland

Copy link
Copy Markdown

Completes the WIP AMD GPU accelerator detection from #205 and makes it testable in CI.

Builds on top of #205 (which refactors accelpath() into nvidia_accelpath() + amd_accelpath(), detects AMD GPUs via the KFD sysfs topology with an amd-smi fallback, and widens the override regex to accept accel/amd/gfx<arch>).

What this PR adds on top of #205

  • Testability: the KFD topology base path in amd_accelpath() can now be overridden via $EESSI_KFD_NODES_OVERRIDE (defaults to the real /sys/devices/virtual/kfd/kfd/topology/nodes). Without this the AMD detection path cannot be exercised in CI (it needs real AMD hardware + root).
  • Fixtures: tests/archdetect/amd-kfd/ KFD topology trees + expected outputs for:
    • 1xmi250xaccel/amd/gfx90a
    • 1xmi300xaccel/amd/gfx942
    • 1xv710accel/amd/gfx1101 (AMD Radeon PRO V710)
    • no_devices (KFD present, CPU node only) → no accelerator
    • none (no KFD topology) → no accelerator
  • Workflow: tests_archdetect_amd_gpu.yml, mirroring the existing NVIDIA GPU accelerator-detection workflow.

Testing

Verified locally:

  • KFD gfx_target_versiongfx<arch> decoding: 90010→gfx90a, 90402→gfx942, 110001→gfx1101, 100300→gfx1030.
  • accelpath against every fixture (via $EESSI_KFD_NODES_OVERRIDE): all expected outputs; CPU-only / absent topology → exit 2.
  • AMD override (EESSI_ACCELERATOR_TARGET_OVERRIDE=accel/amd/gfx90a) echoed back verbatim.
  • bash -n clean; existing cpupath fixtures still pass (no regression).

The . init/bash CVMFS portion of the workflow runs only on the runner (no AMD stack exists in EESSI 2023.06 yet, so a detected AMD GPU is expected to find no matching module path — modelled on the existing NVIDIA cc01 case).

Notes

@hmeiland

Copy link
Copy Markdown
Author

Note: this PR was prepared with the assistance of AI coding tools (opencode and GitHub Copilot).

zerefwayne and others added 4 commits July 28, 2026 17:31
…ests

- Add $EESSI_KFD_NODES_OVERRIDE hook so amd_accelpath() can be tested
  against fixture KFD topology trees (defaults to the real sysfs path).
- Add tests/archdetect/amd-kfd fixtures for gfx90a (MI250X), gfx942
  (MI300X), gfx1101 (Radeon PRO V710), plus no-device and no-topology cases.
- Add tests_archdetect_amd_gpu.yml workflow mirroring the NVIDIA GPU tests.
The refactor into nvidia_accelpath()/amd_accelpath() only checked for a 0
return code and fell through on any non-zero code, turning a present-but-failing
nvidia-smi (return 3) into a generic 'no accelerator' exit 2. Restore the
original semantics: a present-but-failing vendor tool is a hard error (exit 3),
while 'tool not found' (2) falls through to the next vendor. Fixes the
no_devices NVIDIA GPU test.
EESSI 2023.06 has no AMD accelerator stack, so the init script maps each
detected gfx target to its nearest supported base target (gfx90a->gfx900,
gfx942->gfx940, gfx1101->gfx1100) before reporting 'No matching path found'.
Match that line by prefix instead of pinning the exact detected gfx string.
@alexschroeter

Copy link
Copy Markdown
This was created with the help of AI

Since you asked for a test in the gpu channel on slack, I had claude run the test on our setup.

Result: PASS — PR #273 (commit 71d50a9) correctly detects the AMD GPUs on our cluster.

Tested via Slurm job 1765835 on the gpu partition.
Node gpu03-002: 8× AMD Instinct MI210, EL9 kernel 5.14.0-611.9.1, KFD topology
reports gfx_target_version 90010, amd-smi available. Full log: pr273_test_1765835.out.

# Check Result
1 PR accelpath on real hardware (KFD sysfs method) accel/amd/gfx90a, rc 0 ✅
2 Baseline: current main accelpath on same node rc 2, no accelerator found (the gap this PR fixes) ✅
3 amd-smi fallback (KFD path overridden to non-existent dir) accel/amd/gfx90a, rc 0 ✅
4 amd-smi fallback (CPU-only KFD fixture) accel/amd/gfx90a, rc 0 ✅
5 CI KFD fixtures on-node: MI250X / MI300X / V710 gfx90a / gfx942 / gfx1101, rc 0 ✅
6 EESSI_ACCELERATOR_TARGET_OVERRIDE valid / invalid echoed back rc 0 / rejected rc 1 ✅
7 Failing amd-smi propagates hard error rc 3 ✅
8 cpupath regression vs main (same node) both x86_64/amd/zen2, rc 0 ✅

Notes:

  • Debug log confirms the intended code path: nvidia-smi not found → KFD sysfs found →
    gfx90a derived from KFD node 2 → accel/amd/gfx90a.
  • The . init/bash integration step could not be tested here: /cvmfs/software.eessi.io
    is not mounted on this cluster (neither login nor GPU nodes). The PR's CI workflow
    covers that part on the GitHub runner.
  • Checkout used for testing: software-layer-scripts/ (branch pr273), main-branch
    worktree for comparison: software-layer-main/. Job script: test_pr273.sbatch.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants