Skip to content

feat(ci): add mirage/rocjitsu emulation tests#6436

Draft
amd-arosa wants to merge 5 commits into
mainfrom
users/arosa/mirage/tests
Draft

feat(ci): add mirage/rocjitsu emulation tests#6436
amd-arosa wants to merge 5 commits into
mainfrom
users/arosa/mirage/tests

Conversation

@amd-arosa

Copy link
Copy Markdown
Contributor

Motivation

rocrtst and most of our other runtime tests need a real GPU to run, which ties
them to our (limited) pool of GPU runners. rocjitsu is a CPU-based GPU emulator —
it executes AMD GPU code objects on the host — and mirage is the CLI that drives
it. Running tests through mirage means we can exercise the runtime on plain CPU
machines, and eventually on architectures we don't have silicon for yet.

This is the first emulation test wired into the matrix. The other goal was to set
it up so adding the next one doesn't require rethinking any of the CI plumbing.

Technical Details

The main idea is that an emulation job picks its runner from the emulator it uses,
not from a hardcoded label. A matrix entry opts in by setting "emulator", and
fetch_test_configurations.py maps that to a node (and whether the node has a
GPU) in _EMULATOR_RUNNERS:

  • rocjitsurocjitsu-cpu, no GPU
  • rocjitsu-dbtrocjitsu-gpu, has a GPU (dbt offloads to hardware)
  • nooprocjitsu-cpu, no GPU

The script writes the resolved label to emulation_runner, and the GPU container
devices (/dev/kfd, the video groups, etc.) are only added when the node
actually has a GPU. An unknown emulator raises instead of quietly falling through
to a GPU runner. The workflow just reads emulation_runner — same pattern as
multi_gpu_runner — so adding a new backend or node is a one-line change in the
map and no workflow edits.

The rest:

  • emulation_utils.py — small helper to find the mirage binary, pick the mirage
    profile for an AMDGPU family, and build the mirage run ... -- <cmd> command.
  • test_rocrtst_emulation.py — runs rocrtst64 under rocjitsu. Emulation is
    slow, so it runs the reduced test set by default; set EMULATION_TEST_TYPE=full
    for the whole suite. Families rocjitsu can't emulate are skipped.
  • test_mirage_smoke.py — a minimal check that mirage works, using the noop
    backend (no GPU, no rocjitsu runtime needed).

Linux only, since the emulation artifacts are Linux only.

The triggering side lives in a separate rocm-systems PR (emulation changes run the
smoke test; runtimes/all/nightly run rocrtst-emulation), so this PR stands on its
own. Note that the rocjitsu-cpu runner label needs to exist for the jobs to
land somewhere.

Test Plan

mirage and rocjitsu run for real in CI, so locally I checked the matrix output and
the script logic:

  • Generated the matrix and confirmed the runner + container options for
    rocrtst-emulation, mirage-smoke, and a rocjitsu-dbt entry.
  • Ran test_mirage_smoke.py against a stub mirage.
  • Ran test_rocrtst_emulation.py for supported/unsupported families and for
    quick vs full.
  • Existing matrix/artifact unit tests, plus a YAML parse of the workflow.

In CI, the plan is to dispatch the multi-arch workflow with
linux_test_labels: test:mirage-smoke (then test:rocrtst-emulation) on a
supported family — gfx942, gfx950, or gfx1250.

Test Result

Everything above passes locally:

  • rocjitsu and noop route to rocjitsu-cpu with no GPU devices; rocjitsu-dbt
    routes to rocjitsu-gpu and keeps them; non-emulation jobs are unchanged; a bad
    emulator name raises.
  • The mirage smoke script passes end to end.
  • rocrtst-emulation picks the mi350x profile for gfx950, uses the reduced filter
    by default, runs the full set with EMULATION_TEST_TYPE=full, shards correctly,
    and skips gfx1151.
  • 31 unit tests pass and the workflow YAML parses.

Submission Checklist

amd-arosa added 2 commits July 9, 2026 00:48
Add a reusable helper plus two GPU-less tests that run through the mirage CLI on
top of the rocjitsu emulator, so they can run on `rocjitsu-cpu` runners:

- emulation_utils.py: locate the mirage binary, map an AMDGPU family to a
  builtin mirage profile, and wrap a native command as `mirage run`.
- test_rocrtst_emulation.py: run the rocrtst64 suite under rocjitsu. Defaults to
  the reduced (non-full) set and is configurable via EMULATION_TEST_TYPE; skips
  cleanly for families rocjitsu cannot emulate.
- test_mirage_smoke.py: minimal mirage CLI smoke test using the noop backend.
Add rocrtst-emulation and mirage-smoke to the test matrix and select their
runner node purely from the emulator backend, so adding a new backend/node is a
one-line change and never needs a workflow edit.

- fetch_test_configurations.py: add _EMULATOR_RUNNERS (rocjitsu -> rocjitsu-cpu,
  rocjitsu-dbt -> rocjitsu-gpu, noop -> rocjitsu-cpu), set `emulation_runner`
  per job, and drop GPU container options only for GPU-less emulation nodes.
- test_artifacts.yml: route jobs to the resolved `emulation_runner`.
@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Title/Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot therock-pr-bot Bot added the Not ready to Review PR has unresolved policy failures — reviews blocked label Jul 9, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@amd-arosa amd-arosa changed the title feat(ci): add mirage/rocjitsu emulation tests with emulator-driven runner selection feat(ci): add mirage/rocjitsu emulation tests Jul 9, 2026
amd-arosa added 3 commits July 9, 2026 01:11
Emulation jobs now derive their mirage CLI (and any backend runtime) artifacts
from the emulator backend instead of listing them in each matrix entry.

_EMULATOR_RUNNERS gains a `fetch_args` field (rocjitsu/rocjitsu-dbt -> --mirage
--rocjitsu, noop -> --mirage) that is merged, de-duplicated, into each emulation
job's fetch_artifact_args. Matrix entries now list only their own component
artifacts (rocrtst-emulation: --rocrtst --tests; mirage-smoke: none), and adding
a backend stays a one-line change.
The noop backend is not compiled into the CI mirage build (mirage emulators
lists only rocjitsu / rocjitsu-dbt), so the noop-based smoke test always failed.

Remove noop entirely and make mirage-smoke run rocminfo on top of the rocjitsu
emulator, asserting the emulated GPU is visible ("Device Type: GPU"). The
runner has no physical GPU, so a GPU agent can only come from rocjitsu. Its
emulator now autofills --mirage --rocjitsu (rocminfo ships in the base
artifacts).
rocrtstFunc.IPC (cross-process IPC memory handles) and
rocrtstFunc.Deallocation_Notifier_Test (deallocation notifier callbacks) are not
implemented by rocjitsu and fail the rocrtst-emulation job. Exclude both on
every family, for both the quick and full sets, via EMULATION_UNSUPPORTED_TESTS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not ready to Review PR has unresolved policy failures — reviews blocked

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant