Skip to content

feat(ci): Add --projects flag for selective builds#6451

Open
geomin12 wants to merge 1 commit into
mainfrom
users/geomin12/project-selection
Open

feat(ci): Add --projects flag for selective builds#6451
geomin12 wants to merge 1 commit into
mainfrom
users/geomin12/project-selection

Conversation

@geomin12

@geomin12 geomin12 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Add the ability to build specific projects without needing to build an entire stage. This enables external repositories (like rocm-systems) to trigger builds that only compile the components they changed.

This is Part 1 of the selective build feature. Part 2 (workflow integration) will follow in a separate PR after this lands.

New Features

  • --projects flag: Enable specific projects for building

    # Build only rocBLAS and MIOpen
    python build_tools/configure_stage.py --projects rocblas miopen --oneline
    # Output: -DTHEROCK_ENABLE_ALL=OFF -DTHEROCK_ENABLE_BLAS=ON -DTHEROCK_ENABLE_MIOPEN=ON
  • --list-projects flag: Show available projects and their artifact mappings

    python build_tools/configure_stage.py --list-projects
  • --skip-stages flag: Compute which stages can be skipped based on projects

    python build_tools/configure_stage.py --projects hip --skip-stages
    # Output: dctools-core,debug-tools,math-libs,media-libs,...
  • rocm-systems support: Handle paths like projects/hip from external repos via normalize_project_name() and rocm_systems_projects.json

Technical Details

  • artifact_subprojects.json manifest auto-generated by CMake maps artifacts to subprojects
  • build_topology.py extended with project resolution logic (resolve_projects_to_features, get_stages_for_projects)
  • test_artifacts field added to core-runtime and core-hip in BUILD_TOPOLOGY.toml for proper test inclusion
  • hipsparselt moved from blas to sparse split_databases (fixes [ci] Introducing specific build selection with --projects flag #5449)

Test plan

  • All 34 unit tests pass (pytest build_tools/tests/configure_stage_test.py)
  • --list-projects shows correct mappings
  • --projects hip resolves correctly to THEROCK_ENABLE_HIP_RUNTIME
  • --projects projects/hip (path format) normalizes correctly
  • --skip-stages computes correct stages
  • CI workflows pass

Next steps

  • .github/workflows/* changes to pass projects input to stages
  • Stage-specific project routing (changes go to correct stage)

🤖 Generated with Claude Code

Add the ability to build specific projects without needing to build an
entire stage. This enables external repositories (like rocm-systems) to
trigger builds that only compile the components they changed.

Key changes:

- Add `--projects` flag to configure_stage.py for enabling specific
  projects (e.g., `--projects rocblas miopen hip`)
- Add `--list-projects` flag to show available projects and their
  artifact mappings
- Add `--skip-stages` flag to compute which stages can be skipped
  based on the projects being built
- Add `--build-dir` flag for using CMake-generated manifest
- Support rocm-systems project paths like "projects/hip" via
  normalize_project_name() and rocm_systems_projects.json mapping

The artifact_subprojects.json manifest is auto-generated by CMake
during configure and maps artifact names to their subproject names,
enabling dynamic project resolution without hardcoding in TOML.

Additional changes:
- Move hipsparselt from blas to sparse split_databases (fixes #5449)
- Add test_artifacts to core-runtime and core-hip for proper test
  artifact inclusion when building these projects
- Fast-fail on unknown project names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/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.

@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

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

@geomin12 geomin12 changed the title feat(configure_stage): Add --projects flag for selective builds feat(ci): Add --projects flag for selective builds Jul 9, 2026
geomin12 added a commit that referenced this pull request Jul 9, 2026
Add `projects` workflow input to enable building only specific projects
within a stage, with intelligent stage-specific routing.

Key changes:

1. Stage-specific project filtering: When both --stage and --projects
   are specified, configure_stage.py filters the projects to only those
   produced by that stage. This means:
   - `--stage compiler-runtime --projects hip rccl` -> enables only HIP
   - `--stage comm-libs --projects hip rccl` -> enables only RCCL
   - `--stage math-libs --projects hip rccl` -> falls back to stage defaults

2. New filter_projects_for_stage() method in build_topology.py

3. Workflow changes: Added `projects` input to reusable workflows that
   gets passed to configure_stage.py

This enables external repos (like rocm-systems) to trigger selective
builds where each stage only builds the artifacts it's responsible for,
avoiding unnecessary feature enablement across stages.

Depends on: feat(configure_stage): Add --projects flag (#6451)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
alias_map[artifact.name.lower()] = artifact.name

if manifest and artifact.name in manifest:
for alias in manifest[artifact.name]:

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.

This uses the artifact packaging manifest as the project-to-feature source, but those mappings do not always match the CMake feature gates. For example, artifact_subprojects.json puts hipSPARSE, hipSOLVER, and rocSOLVER under blas, so --projects hipsparse/hipsolver/rocsolver emits only -DTHEROCK_ENABLE_BLAS=ON. Those projects are gated by THEROCK_ENABLE_SPARSE / THEROCK_ENABLE_SOLVER, so the selected project would not be built. Can we make the project map feature-oriented, or add overrides/tests for these cases instead of deriving feature selection directly from artifact packaging slices?

"rocm-smi-lib": "base",
"rocminfo": "core-runtime",
"rocprofiler": "rocprofiler-sdk",
"rocprofiler-compute": "rocprofiler-systems",

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.

This override points rocprofiler-compute at rocprofiler-systems, even though the generated artifact/subproject manifest already maps the rocprofiler-compute subproject to the rocprofiler-compute artifact. Because these overrides are applied after the manifest, --projects rocprofiler-compute --platform linux currently emits -DTHEROCK_ENABLE_ROCPROFSYS=ON instead of the rocprofiler-compute feature. Can this entry map to rocprofiler-compute or avoid overriding an existing manifest alias?

@erman-gurses erman-gurses 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.

Added some comments below:

)
sys.exit(1)
else:
shutil.copy(generated, MANIFEST_PATH)

@erman-gurses erman-gurses Jul 10, 2026

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.

Since artifact_subprojects.json is included as a generated, tracked file in this PR, should CI run python build_tools/generate_subproject_manifest.py --verify to ensure it stays synchronized with the CMake-generated manifest?

self.assertIn("fft", alias_map)
self.assertIn("miopen", alias_map)

def test_alias_map_includes_split_databases(self):

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.

We have good coverage for alias resolution, but I don't see a test that validates the generated artifact_subprojects.json matches what CMake emits. Since this manifest is now a source of truth for project resolution, should we add a test (or CI verification) to catch accidental drift?

"rocm-smi-lib": "base",
"rocminfo": "core-runtime",
"rocprofiler": "rocprofiler-sdk",
"rocprofiler-compute": "rocprofiler-systems",

@erman-gurses erman-gurses Jul 10, 2026

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.

This appears to overwrite the canonical rocprofiler-compute -> rocprofiler-compute mapping created from BUILD_TOPOLOGY.toml. Because the ROCm Systems mappings are applied unconditionally afterward, --projects rocprofiler-compute will resolve to the rocprofiler-systems artifact rather than the dedicated rocprofiler-compute artifact. should this map to "rocprofiler-compute`, or should the alias-map merge avoid overwriting canonical artifact names?

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