Skip to content

Activate the static consumer-graph parser for test selection - #8757

Draft
endurthiabhilash wants to merge 40 commits into
mainfrom
users/aendurth/issue-7782-pr2-activation
Draft

endurthiabhilash wants to merge 40 commits into
mainfrom
users/aendurth/issue-7782-pr2-activation

Conversation

@endurthiabhilash

@endurthiabhilash endurthiabhilash commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Follow-up to #8199. That PR added the parser report-only; this one makes the generated maps drive test selection and removes the configure-time CMake emit.

GitHub issue: #7782

Technical Details

  • generate_consumer_graph.py: generates all three committed maps (therock_consumer_graph.json, therock_subtree_map.json, therock_source_dir_map.json)
  • determine_rocm_test_dependencies.py: resolves subtrees from the committed subtree_map plus a hand-override layer, replacing the static alias dict. The map is loaded once from --therock-dir (falling back to the committed copy), so subtree resolution follows the same source as the graph.
  • Selector reachability: five test-matrix jobs that had no graph key and no alias (hipdnn_install, hipthreads_examples, libhipcxx_amdclang, libhipcxx_hiprtc, miopen-dbsync, plus hipdnn-cudnn-samples) are aliased onto the components they exercise, and a guard fails when any test-matrix job is unreachable from every component. Previously these ran only under *.
  • cmake_consumer_graph.py: unresolvable SUBPROJECT_DEPS are omitted with a diagnostic, not fatal.
  • Removes therock_emit_consumer_graph.cmake and the configure-time emit, plus test_consumer_graph_drift.yml and check_consumer_graph_drift.py.
  • Adds generator, test-label consistency, external-repo, and robustness coverage.

Test Plan

  • cd build_tools && python3 -m pytest tests/ github_actions/tests/
  • cd test_tools && python3 -m pytest
  • python3 build_tools/generate_consumer_graph.py --check
  • Unit Tests workflow on ubuntu + windows.

Test Result

  • build_tools + test_tools unit suites pass on ubuntu and windows; --check exits 0.

Submission Checklist

Regenerate test_tools/therock_consumer_graph.json with generate_consumer_graph.py
(the conservative may-depend superset: +4 nodes, +11 edges over the old
cmake-emitted graph) and make the blocking `Test build_tools` pytest gate assert
exact equality against the parser output.

Retire the configure-based drift job (test_consumer_graph_drift.yml,
check_consumer_graph_drift.py, and its test) — the parser test now enforces
freshness without a full-tree configure. Sweep stale references to the removed
workflow in comments.
generate_consumer_graph.py now also writes test_tools/therock_subtree_map.json
(each external source subtree -> the graph key(s) built from it; 61 entries), and
--check diffs both committed files, exiting non-zero on any drift. Add a blocking
real-tree test asserting the committed subtree_map equals the parser output.

The node graph file stays flat and byte-identical, so the graph loaders (which
treat every top-level key as a node) are unaffected. The artifact/source-dir map
lands in 6b alongside its consumer.
determine_rocm_test_dependencies.py now reads test_tools/therock_subtree_map.json
and layers a 14-entry _SUBTREE_ALIAS_OVERRIDES on top, replacing the 25-entry hand
_EXTERNAL_SUBTREE_ALIASES. 11 derivable entries are retired; the residue the parser
cannot derive (non-declared subprojects, the nested hipblaslt/tensilelite path,
name skews like cuid->rdc, and the variable-sourced amd-dbgapi) stays as overrides.

Superset-safe: a parity test freezes the full old dict and asserts no
under-selection for any of its 25 keys. Exactly one selection change —
projects/clr now selects [hip-clr, ocl-clr] (was [hip-clr]; clr builds both, so
the old value under-selected). _CI_TEST_SELECTOR_ALIASES is left for commit 7.
Parses therock_provide_artifact; --check covers it. No selection change.
…tion

Adds a drift test; documents kfdtest/composable-kernel. No behavior change.
Parser is authoritative; drop therock_emit_consumer_graph and its CMakeLists call.
Report-only source-dir map parsing no longer aborts the authoritative graph.
Lazy friendly-error load; guard overrides against shadowing generated edges.
@therock-pr-bot

therock-pr-bot Bot commented Oct 5, 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

therock-pr-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

Pre-commit check failed

⛔ pre-commit failed

Please run locally:

  • python -m pip install pre-commit
  • pre-commit install
  • pre-commit run --all-files --show-diff-on-failure

This repo uses .pre-commit-config.yaml.

@therock-pr-bot

therock-pr-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

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

endurthiabhilash and others added 2 commits October 7, 2026 16:45
Drop profiler-hub, drop rocjitsu edge, add rocwmma.
Five test-matrix jobs (hipdnn_install, hipthreads_examples, miopen-dbsync,
libhipcxx_amdclang, libhipcxx_hiprtc) have no graph key and no selector
alias, so they only run when selection is "*". Scoped PR runs skip them,
and a libhipcxx change selects no jobs at all.

Alias each onto the component it exercises (plus hipdnn-cudnn-samples,
which exists on main), and add a guard that fails when any test-matrix
job is unreachable from every component.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tony-davis

Copy link
Copy Markdown
Contributor

Hi Abhilash! I put up #8990 against this branch. A handful of test-matrix jobs (hipdnn_install, hipthreads_examples, miopen-dbsync, and both libhipcxx jobs) aren't reachable from any component, so they only run on full * selections. A libhipcxx change actually selects no jobs at all. The fix is a few _CI_TEST_SELECTOR_ALIASES entries plus a reachability guard in your new label_consistency_test.py.

I'm not really thinking of it as a stack. I think it fits naturally as part of this PR, since you're already reworking the alias layer. Would you be up for merging #8990 into your branch (or cherry-picking the one commit, whichever you prefer)? One heads-up: on this branch as it stands, the guard flags profiler-hub. That's just because profiler-hub joined the graph on main (#8711) after you branched, so it should clear once you rebase and regenerate the maps.

Regenerate test_tools/therock_consumer_graph.json with generate_consumer_graph.py
(the conservative may-depend superset: +4 nodes, +11 edges over the old
cmake-emitted graph) and make the blocking `Test build_tools` pytest gate assert
exact equality against the parser output.

Retire the configure-based drift job (test_consumer_graph_drift.yml,
check_consumer_graph_drift.py, and its test) — the parser test now enforces
freshness without a full-tree configure. Sweep stale references to the removed
workflow in comments.
generate_consumer_graph.py now also writes test_tools/therock_subtree_map.json
(each external source subtree -> the graph key(s) built from it; 61 entries), and
--check diffs both committed files, exiting non-zero on any drift. Add a blocking
real-tree test asserting the committed subtree_map equals the parser output.

The node graph file stays flat and byte-identical, so the graph loaders (which
treat every top-level key as a node) are unaffected. The artifact/source-dir map
lands in 6b alongside its consumer.
determine_rocm_test_dependencies.py now reads test_tools/therock_subtree_map.json
and layers a 14-entry _SUBTREE_ALIAS_OVERRIDES on top, replacing the 25-entry hand
_EXTERNAL_SUBTREE_ALIASES. 11 derivable entries are retired; the residue the parser
cannot derive (non-declared subprojects, the nested hipblaslt/tensilelite path,
name skews like cuid->rdc, and the variable-sourced amd-dbgapi) stays as overrides.

Superset-safe: a parity test freezes the full old dict and asserts no
under-selection for any of its 25 keys. Exactly one selection change —
projects/clr now selects [hip-clr, ocl-clr] (was [hip-clr]; clr builds both, so
the old value under-selected). _CI_TEST_SELECTOR_ALIASES is left for commit 7.
Parses therock_provide_artifact; --check covers it. No selection change.
…tion

Adds a drift test; documents kfdtest/composable-kernel. No behavior change.
Parser is authoritative; drop therock_emit_consumer_graph and its CMakeLists call.
@endurthiabhilash
endurthiabhilash force-pushed the users/aendurth/issue-7782-pr2-activation branch from 13ca00c to bf34239 Compare October 13, 2026 22:22
@endurthiabhilash

Copy link
Copy Markdown
Contributor Author

Thanks for the PR Tony. I don't have any issues merging your PR into this branch. Once I merge it, I still have to do a few more tests to make this PR ready for review.

JonathanLichtnerAMD added a commit that referenced this pull request Oct 27, 2026
JIRA ID: ALMIOPEN-3021

## Motivation

`miopen-dbsync` (GPU-free rocjitsu StaticFDBSync, #8813 added gfx950 as
advisory) is never scheduled for PR-style runs. A rocm-libraries PR
touching `projects/miopen` selects
`projects_to_test=hipdnn-integration-tests,hipdnn-samples,miopen,miopenprovider`
at `test_type=standard`; `fetch_test_configurations.py` only schedules a
job whose key is in that list (or `*`), so `miopen-dbsync` only runs in
nightlies (`*`) or manual dispatch.

Verified on a throwaway rocm-libraries PR against TheRock `b0958085`:
the gfx94X "Configure test matrix" log requested sanity, miopen,
hipdnn-integration-tests, hipdnn-samples, miopenprovider and no
`miopen-dbsync`.

## Technical Details

Add `"miopen": ["miopen", "miopen-dbsync"]` to
`_CI_TEST_SELECTOR_ALIASES` in
`test_tools/determine_rocm_test_dependencies.py` (same pattern as
`tensilelite` -> `tensilelite-common`). `miopen` stays selected;
`miopen-dbsync` is added whenever `miopen` is in the result. The job
still self-limits to standard/comprehensive/full tiers, gfx942
(blocking) and gfx950 (xfail) on the CPU runner, so quick-tier and other
families are unchanged.

This is the same alias #8990 adds, but #8990 merged into the stacked
branch of #8757 and so is not on `main`; this PR does not depend on
#8757. If #8757 lands later it should carry the same alias (its
reachability guard already requires it).

## Test Plan

- Unit test `test_cli_selects_miopen_dbsync_with_miopen`:
`--changed-projects miopen` outputs exactly `{miopen, miopen-dbsync}`.
- Run the real selection scripts locally for gfx94X-dcgpu and
gfx950-dcgpu at standard and quick tiers.
- End to end in rocm-libraries CI: a PR pinned to a TheRock commit
containing this change, with a MIOpen source change.

## Test Result

- `cd test_tools && python3 -m unittest
tests.determine_rocm_test_dependencies_test`: 75 tests OK (74 before).
- `build_tools/github_actions/tests/fetch_test_configurations_test.py`:
passes unchanged.
- Local scripts: `determine_rocm_test_dependencies.py --changed-projects
projects/miopen --gha-output` now emits
`hipdnn-integration-tests,hipdnn-samples,miopen,miopen-dbsync,miopenprovider`.
`fetch_test_configurations.py --platform=linux` at `TEST_TYPE=standard`
requests `miopen-dbsync` on the CPU runner for both gfx94X-dcgpu and
gfx950-dcgpu; at `quick` it logs `Excluding job miopen-dbsync` for both.
- End to end: throwaway rocm-libraries PR #14288 (closed) pinned TheRock
to `2104ff3c` and touched a `projects/miopen` source file. `2104ff3c`
was this change plus a prototype that treats `.github/actions/ci-env/*`
as a workflow change in `configure_external_repo_ci.py`. That prototype
is NOT part of this PR. It was needed only because a pin bump edits
`ci-env/action.yml`, which otherwise forces run-all at quick tier, where
`miopen-dbsync` is skipped by design. Run:
https://github.com/ROCm/rocm-libraries/actions/runs/39985392063
- `Test miopen-dbsync (gfx94X-dcgpu)`: passed. StaticFDBSync gfx942 @
304 CU and @ 228 CU, each `[ PASSED ] 1 test`.
- `Test miopen-dbsync (gfx950-dcgpu) (xfail)`: passed. StaticFDBSync
gfx950 @ 256 CU, `[ PASSED ] 1 test`.
- Both ran on the CPU runner `aws-linux-scale-rocm-prod`; the gfx94X
"Configure test matrix" log showed `TEST_TYPE: standard` and `Requesting
job miopen-dbsync`.
- Other jobs in that run were not waited on; the run was cancelled after
the dbsync jobs finished.
- Not run: `label_consistency_test` (module did not import in my
environment, before or after this change), pre-commit.

## Risk Assessment

**Risk Level: Low.** CI selection only; adds one job to MIOpen-touching
PR runs, CPU runner, gfx950 non-blocking.
@tony-davis

Copy link
Copy Markdown
Contributor

Hi Abhilash! I put up #9539 against your branch. It's a small change to the subtree map: build_subtree_map() already knows which root (rocm-libraries or rocm-systems) each subtree came from, so it keeps that and the map becomes {repo: {subtree: [keys]}}. The overrides get grouped by repo the same way. Flat lookups for changed projects work just like before.

The reason is ROCm/rocm-libraries#14048. @ScottTodd's feedback there was that TheRock should know how to scope a scheduled external-repo run to that repo's own code, not each repo parsing its own repos-config.json. With the repo in the map, a new get_repo_subtrees("rocm-libraries") gives exactly that. I checked it selects the same 38 test jobs as the rocm-libraries script, and no rocm-systems jobs.

I figured it's easier to change the file format before it lands than after, which is why I aimed it at your branch. Most of the diff is the regenerated JSON and test updates. If you'd rather not grow this PR, no worries at all. I can rebase it onto main as a follow-up once #8757 merges.

One small thing I noticed while tagging the overrides: projects/cuid doesn't match a real path. rocm-systems has shared/cuid, so I think a cuid change would currently fail selection. I left it alone since it's your table.

cc @geomin12 @amd-shiraz

@endurthiabhilash

Copy link
Copy Markdown
Contributor Author

Thank you @tony-davis, I'll check and merge the changes to my branch.

@geomin12
geomin12 added this pull request to stack #9612 October 29, 2026 18:23

@geomin12 geomin12 left a comment

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.

few comments, overall looks pretty good, however, reviews + merges will go a lot faster if this is split up. perhaps we add the trees + logic, then make the transition in a follow-up? (deletion).

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.

for subtrees, should we just map the ones that are mismatched? such as:

"dnn-providers/integration-tests": [
    "hipdnn_integration_tests"
  ],

Comment thread test_tools/therock_source_dir_map.json Outdated

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.

oh i thought cmake parser would get this too. is this needed?

Take main's hipccl subtree overrides and selector aliases, regenerate the
consumer-graph maps, delete test_consumer_graph_drift.yml (main only bumped
runners/actions in it), add HARDENING_DEFERRED to the parser keyword set, and
let the reachability guard honor base_project (hipfft/rocfft multi-gpu).
…umer

Remove therock_source_dir_map.json, its generation and --check coverage, the
therock_provide_artifact parsing, the related tests, and the RFC0013 text. It
returns with the BuildTopology change that reads it.

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