Skip to content

ci: build the stages ci:run-wsl needs on narrowed builds - #9628

Open
amd-justchen wants to merge 3 commits into
mainfrom
users/justchen/wsl-label-adds-rocdxg-stage
Open

amd-justchen wants to merge 3 commits into
mainfrom
users/justchen/wsl-label-adds-rocdxg-stage

Conversation

@amd-justchen

@amd-justchen amd-justchen commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

ci:run-wsl (#8457) fails setup on external repo PRs that narrow the build. rocm-systems passes build_stages per PR, which usually leaves out wsl-rocdxg, and configure_multi_arch_ci.py then raises ci:run-wsl needs the wsl-rocdxg stage. Per review on ROCm/rocm-systems#14472, this belongs in TheRock rather than in each caller.

GitHub issue: https://github.com/ROCm/TheRock-Infra/issues/317

Technical Details

Following the review design: build_stages is the requested stages, and decide_jobs() resolves the effective stages from what the requested tests need.

  • CIInputs reads build_stages as-is. This removes the ci:run-wsl append and the wsl-rocdxg check in validate() (from feat(ci): run hip-tests and rocrtst on WSL GPU runners alongside native Linux #8457), so configure_multi_arch_ci.py no longer names any stage.
  • amdgpu_family_matrix.CI_LABEL_REQUIRED_ARTIFACTS declares the artifacts a CI label needs beyond the components' own: ci:run-wsl -> wsl-rocdxg (the WSL libhsakmt that install_rocm_from_artifacts installs on WSL).
  • decide_jobs() unions the requested stages with get_topology().get_stages_for_artifacts() of those artifacts (producing stage plus dependencies) and skips everything else.

Example: requested compiler-runtime,dctools-core, plus compiler-runtime,wsl-rocdxg for the test, gives effective compiler-runtime,dctools-core,wsl-rocdxg. Full builds and PRs without the label are unchanged.

Test Plan

  • python -m pytest build_tools/github_actions/tests
  • Workflow dispatch on this branch: build_stages=compiler-runtime,runtime-tests, pr_labels=ci:run-wsl,test:hip-tests,test:rocrtst, gfx110X, prebuilt compiler-runtime/runtime-tests.

Test Result

  • configure_multi_arch_ci_test.py + amdgpu_family_matrix_test.py: 192 passed, 1 skipped. Full build_tools/github_actions/tests: 1112 passed. The only failure is run_jax_tests_test.py::test_a_symlink_leading_out_of_the_test_tree_is_fatal, which needs symlink rights and fails the same on main on this Windows machine.
  • test_run_wsl_adds_wsl_rocdxg_to_partial_build feeds a labelled PR event through from_environ() and decide_jobs(). It checks that the requested stages are unchanged, and that wsl-rocdxg is built only with the label.
  • Run 41680234108:
    • Setup logs Requested build stages: ['compiler-runtime', 'runtime-tests'] and Added for the requested tests: ['wsl-rocdxg'].
    • wsl-rocdxg built, and WSL hip-tests and rocrtst passed.
    • Before this change, the same inputs failed setup on main (run 41018833833).

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

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

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@amd-justchen

amd-justchen commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Tested with the same workflow_dispatch (build_stages=compiler-runtime,runtime-tests, pr_labels=ci:run-wsl,test:hip-tests,test:rocrtst, gfx110X, prebuilt from main):

@amd-justchen
amd-justchen requested a review from geomin12 October 30, 2026 15:34
Comment on lines +413 to +419
# A narrowed build (e.g. an external repo PR) usually leaves out wsl-rocdxg.
if (
build_stages
and WSL_RUN_LABEL in pr_labels
and WSL_REQUIRED_STAGE not in build_stages
):
build_stages.append(WSL_REQUIRED_STAGE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rule of thumb: there should be zero mentions of specific build stages or subprojects in this file. The CI system should be general purpose and read dynamic data from the build system. See prior review comments on #7600 (comment).

What we actually want here is

  1. A pr label requested building/testing a particular subproject
  2. Ensure that ROCm artifacts are built (and not skipped/prebuilt)
  3. Ensure that the requested ROCm subproject is built
  4. Ensure that the ROCm build stage including that subproject is built

I would implement like so:

  • Keep CIInputs as-is
    • No data changing logic in here. Just read from the environment.
    • Recategorize "build_stages" as "requested build stages" not "build stages allow-list"
  • In decide_jobs(), resolve requested build/test stages, labels, etc. to produce the actual build/skip stage lists
  • In expand_build_configs(), use all the resolved decisions (some code there may still be a passthrough from inputs)

Sample code:

     # Illustrative: these helpers would be added.
     test_request = resolve_test_request(ci_inputs, targets)
     required_artifacts = get_required_artifacts(test_request)
     required_stages = topology.get_stages_for_artifacts(required_artifacts)

     effective_stages = (
         set(ci_inputs.build_stages) | required_stages
         if ci_inputs.build_stages
         else set(topology.get_all_stage_names())
     )
     skipped_stages = _resolve_skipped_stages(sorted(effective_stages))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Example code flow we should have:

ci:run-wsl label in inputs
  → test configuration requires artifact "wsl-rocdxg"
  → topology resolves its producing stage and dependencies
  → effective stages include "wsl-rocdxg" and "compiler-runtime"

Those stages are unioned with ci_inputs.build_stages to produce the effective stages. The original requested stages stay unchanged.

For example:

Input:      compiler-runtime,dctools-core
Additional: compiler-runtime,wsl-rocdxg
Effective:  compiler-runtime,dctools-core,wsl-rocdxg

Solving this generally should also make it easier to move the "changed projects --> stages/artifacts to build" into TheRock. Today if you change for example projects/rdc and request test:rocrtst I believe that will get rejected instead of expanding dynamically.


We should be able to remove configure_external_repo_ci.py [almost?] entirely, with the CI system used across each repository going down one sequence:

  1. Detect which projects changed (in submodules)
  2. Select builds/tests to run for those changes
  3. Resolve which artifacts and stages supply those tests
  4. Plan execution (build/reuse/skip), choose platforms, choose runner labels, etc.
  5. Run CI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review! Will rework this!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reworked in f4ada56 along these lines:

  • CIInputs reads build_stages as-is (the requested stages). The ci:run-wsl append and the wsl-rocdxg check in validate() are gone, and configure_multi_arch_ci.py no longer names any stage.
  • amdgpu_family_matrix.CI_LABEL_REQUIRED_ARTIFACTS declares what a label needs beyond the components' own artifacts (ci:run-wsl -> wsl-rocdxg).
  • decide_jobs() unions the requested stages with get_stages_for_artifacts() of those artifacts, then skips the rest.

Run on the branch (build_stages=compiler-runtime,runtime-tests, ci:run-wsl,test:hip-tests,test:rocrtst): https://github.com/ROCm/TheRock/actions/runs/41680234108

Requested build stages: ['compiler-runtime', 'runtime-tests']
Added for the requested tests: ['wsl-rocdxg']

wsl-rocdxg built, and WSL hip-tests and rocrtst passed.

STAGE_TO_TEST_LABELS and the test-label auto-select in from_environ() predate this PR. I can move them to the same requested -> effective flow in a follow-up, along with the changed-projects resolution.

amd-justchen and others added 3 commits November 3, 2026 08:57
External repo PRs pass a build_stages allowlist that usually leaves out
wsl-rocdxg, so ci:run-wsl failed setup with "ci:run-wsl needs the
wsl-rocdxg stage". Add that stage and the stages it builds on instead, so
the label works for any caller (e.g. rocm-systems) without repo-side
logic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the _add_wsl_stages helper with a plain check where build_stages is
parsed: with ci:run-wsl and a narrowed build_stages, append wsl-rocdxg.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per review: configure_multi_arch_ci.py should not name specific stages, and
CIInputs should only read the environment.

- CIInputs.build_stages is now the requested stages, read as-is. The
  ci:run-wsl append in from_environ() and the wsl-rocdxg check in validate()
  are removed.
- amdgpu_family_matrix.CI_LABEL_REQUIRED_ARTIFACTS declares the artifacts a
  CI label needs beyond the components' own (ci:run-wsl -> wsl-rocdxg).
- decide_jobs() unions the requested stages with the stages the topology
  says produce those artifacts (and their dependencies), and skips the rest.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amd-justchen
amd-justchen force-pushed the users/justchen/wsl-label-adds-rocdxg-stage branch from 2f618cf to f4ada56 Compare November 3, 2026 17:01
@amd-justchen amd-justchen changed the title ci: add the wsl-rocdxg stage for ci:run-wsl on narrowed builds ci: build the stages ci:run-wsl needs on narrowed builds Nov 3, 2026

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, this is pretty clean. Thanks for the edits.

This branch has not been deployed

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

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

3 participants