Repository navigation
feat: Adding Artifact reuse and stage skip functionality to multi-arch CI #6264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
1928e80
1097ec2
b0d8f67
7bd631c
58b0a1d
9b7a0e1
fc21126
0648dcc
78fef0c
886eafc
ce75e62
76397f3
c6fb127
fe28af9
4259e85
da6adb4
6851c06
397e824
e7086a2
d7c3c09
cb85bc7
07f7f7f
b1f3c37
0673a91
5dc07b4
1c19f0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -43,6 +43,10 @@ on: | |||
| description: "Workflow run ID to copy prebuilt stage artifacts from." | ||||
| type: string | ||||
| default: "" | ||||
| stage_reuse_mode: | ||||
| description: "dry-run (default) only reports which stages would be skipped; skip-stage actually skips unaffected stages." | ||||
| type: string | ||||
| default: "dry-run" | ||||
| build_pytorch: | ||||
| description: "Build PyTorch wheels." | ||||
| type: boolean | ||||
|
|
@@ -159,6 +163,10 @@ jobs: | |||
| WINDOWS_TEST_LABELS: ${{ inputs.windows_test_labels }} | ||||
| PREBUILT_STAGES: ${{ inputs.prebuilt_stages }} | ||||
| BASELINE_RUN_ID: ${{ inputs.baseline_run_id }} | ||||
| STAGE_REUSE_MODE: ${{ inputs.stage_reuse_mode }} | ||||
| STAGE_REUSE_CURRENT_SHA: ${{ steps.checkout.outputs.commit }} | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can actaully get this from ${{ github.sha }} (current sha)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends on what commit ref you want.
For runs in rocm-libraries and rocm-systems, we may want to use baseline runs from those repositories instead of TheRock though. Ultimately I think the best artifact reuse we'll be able to get will be some query against a database where we say "here are the artifact fingerprints that my current source code produces, fetch me artifacts for any with matching fingerprints from the database", which we'd want to abstract away from the github actions runs API entirely. We wouldn't need to scan commit history or workflow runs with that architecture. |
||||
| STAGE_REUSE_MAX_AGE_HOURS: "72" | ||||
| STAGE_REUSE_COMMIT_HISTORY: "50" | ||||
|
ammallya marked this conversation as resolved.
Resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are becoming part of the stage-reuse interface - will make sense to document this environment contract in the module docstring.
ammallya marked this conversation as resolved.
Resolved
|
||||
| # Skip path filtering for external repos (git sha won't exist in TheRock) | ||||
| SKIP_PATH_FILTERS: ${{ inputs.external_repo != '' && 'true' || '' }} | ||||
| CI_CONFIG_PATH: ci-config | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -685,14 +685,38 @@ def decide_jobs( | |
| """Determine which job groups to run, skip, or satisfy with prebuilt files.""" | ||
|
|
||
| # Build ROCm. | ||
| # TODO(#3399): Use changed files and build_topology.py to: | ||
| # 1. set per-stage prebuilt decisions | ||
| # 2. skip job groups that aren't reachable from the changed files | ||
| # Parse explicit prebuilt stages from workflow_dispatch input. | ||
| # Parse explicit prebuilt stages from workflow_dispatch input. These are | ||
| # the MANUAL inputs and are always honored, unchanged, in every mode. | ||
|
|
||
| stage_decisions: dict[str, JobAction] = {} | ||
| if ci_inputs.prebuilt_stages: | ||
| for stage in _parse_prebuilt_stages(ci_inputs.prebuilt_stages): | ||
| stage_decisions[stage] = JobAction.PREBUILT | ||
|
|
||
| # Behind STAGE_REUSE_MODE: in dry-run we only PRINT | ||
| # which stages WOULD be skipped and apply nothing; in "skip-stage" the | ||
| # eligible stages are merged into stage_decisions so the orchestrator | ||
| # skips their builds and copies artifacts instead. | ||
| from stage_reuse_decision import ( | ||
| StageReuseMode, | ||
| compute_auto_stage_reuse, | ||
| render_step_summary, | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason these imports are local rather than module-level? If it's to avoid import cycles, it might be worth adding a short comment.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope - follow the style guide. These imports must be moved to the top. https://github.com/ROCm/TheRock/blob/main/docs/development/style_guides/python_style_guide.md#import-organization No import cycles here. If there are cycles we should break them instead of use local imports. |
||
| target_families = _stage_reuse_target_families(ci_inputs) | ||
| auto = compute_auto_stage_reuse( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
ammallya marked this conversation as resolved.
Resolved
|
||
| changed_files=git_context.changed_files, | ||
| mode=StageReuseMode.from_environ(), | ||
| target_families=target_families, | ||
| ) | ||
|
|
||
| for line in auto.report_lines: | ||
| print(line) | ||
| try: | ||
| gha_append_step_summary(render_step_summary(auto)) | ||
|
ammallya marked this conversation as resolved.
Resolved
|
||
| except Exception as exc: # never fail CI config on a reporting | ||
| print(f"[STAGE-REUSE] could not write step summary: {exc}") | ||
| # Only skip-stage mode returns non-empty applied_reuse_stages. | ||
| for stage in auto.applied_reuse_stages: | ||
|
erman-gurses marked this conversation as resolved.
Resolved
|
||
| stage_decisions.setdefault(stage, JobAction.PREBUILT) | ||
| build_rocm = BuildRocmDecision( | ||
| action=JobAction.RUN, | ||
| stage_decisions=stage_decisions, | ||
|
|
@@ -741,6 +765,12 @@ def decide_jobs( | |
| # Step 4: Select Targets | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| def _stage_reuse_target_families(ci_inputs: "CIInputs") -> list[str]: | ||
|
ammallya marked this conversation as resolved.
Resolved
|
||
| families = list(dict.fromkeys( | ||
| [*ci_inputs.linux_amdgpu_families, *ci_inputs.windows_amdgpu_families])) | ||
| if "generic" not in families: | ||
| families.append("generic") | ||
| return families | ||
|
|
||
| def _validate_family_names( | ||
| names: list[str], | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.