feat(ci): Add --projects flag for selective builds#6451
Conversation
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>
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
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]: |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Added some comments below:
| ) | ||
| sys.exit(1) | ||
| else: | ||
| shutil.copy(generated, MANIFEST_PATH) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
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
--projectsflag: Enable specific projects for building--list-projectsflag: Show available projects and their artifact mappings--skip-stagesflag: Compute which stages can be skipped based on projectspython 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/hipfrom external repos vianormalize_project_name()androcm_systems_projects.jsonTechnical Details
artifact_subprojects.jsonmanifest auto-generated by CMake maps artifacts to subprojectsbuild_topology.pyextended with project resolution logic (resolve_projects_to_features,get_stages_for_projects)test_artifactsfield added tocore-runtimeandcore-hipin BUILD_TOPOLOGY.toml for proper test inclusionsplit_databases(fixes [ci] Introducing specific build selection with--projectsflag #5449)Test plan
pytest build_tools/tests/configure_stage_test.py)--list-projectsshows correct mappings--projects hipresolves correctly toTHEROCK_ENABLE_HIP_RUNTIME--projects projects/hip(path format) normalizes correctly--skip-stagescomputes correct stagesNext steps
🤖 Generated with Claude Code