Skip to content

[CI] Parity: still generate report on partial download, flag job failed#3433

Open
ethanwee1 wants to merge 14 commits into
ROCm:developfrom
ethanwee1:parity-partial-report-on-download-fail
Open

[CI] Parity: still generate report on partial download, flag job failed#3433
ethanwee1 wants to merge 14 commits into
ROCm:developfrom
ethanwee1:parity-partial-report-on-download-fail

Conversation

@ethanwee1

Copy link
Copy Markdown

Summary

When an upstream config's jobs are missing — e.g. the ROCm distributed test job is skipped during GPU capacity crunches — download_testlogs exits non-zero, and with set -o pipefail that aborted the whole generate-parity job before the CSV was built or uploaded. Result: no report at all for that arch (e.g. mi300 autoparity runs just went red with nothing to show).

This changes generate-parity so a partial download still produces a usable report while keeping the run visibly failed:

  • capture download_testlogs' real exit code instead of aborting (set +e + PIPESTATUS), so the job continues;
  • the report is still built and uploaded from whatever downloaded (default/inductor, plus partial distributed);
  • a final "Flag incomplete download" step exit 1s when the download was incomplete, so the arch job is clearly marked failed;
  • Collect upload paths / Upload artifacts are if: always() (guarded on the folder/paths existing) so the artifact uploads even on the failing path.

summarize already runs on failure (if: ${{ !cancelled() }}), so the aggregated report still builds.

Validation

mi300 dispatch on main with distributed genuinely missing (periodic-rocm-mi300 test job skipped):

  • generate-parity (mi300): failure ✅ (incomplete download flagged)
  • parity-results-mi300 artifact: present ✅ (365,503 rows; default + inductor intact — default 3,009 / inductor 267 disagreements)
  • summarize: success

Deployment status

Deployed to fork ethanwee1/pytorch:main so it's live for autoparity. This PR is the landing target for ROCm/pytorch:develop.

ethanwee1 added 14 commits July 7, 2026 17:28
…main


download_testlogs required exactly one of --pr_id or --sha1 and rejected
the "neither" case, so dispatching parity with an empty/"latest" sha (the
documented "latest green on main" option, e.g. a baseline_sha comparison)
failed with "Please provide either pr_id or sha!".

Treat an empty --sha1 or the literal "latest" as "resolve latest green run
on main": look up the newest successful ROCm default-workflow run on main
(download_workflow_run already does this when given no head_sha) and use
its head commit as the target sha. The parity.yml side already omits
--sha1 for "latest", so no workflow change is needed. Also clarifies the
both-provided error message.
Auto-parity was trunk-scoped (mi350 only). mi300/mi200/navi31 run in their
own scheduled upstream workflows on their own SHAs at a different cadence,
so the trunk-push scan never reached them.

- Discover candidate SHAs from both trunk.yml pushes and the scheduled
  per-arch workflows (fetch_scheduled_commits / fetch_candidate_commits),
  deduped newest-first; a 40-hex guard drops stray non-row output.
- Hold back SHAs newer than the newest scheduled run so a lagging
  mi300/mi200/navi batch can still join that SHA's report, yielding ONE
  combined parity report per SHA (parity.yml's matrix already emits a
  per-arch artifact plus a merged summary) once every arch that ran has
  finished. When no scheduled runs exist, nothing is held (mi350/trunk
  behaves exactly as before).
- Expand ARCHS_IN to mi350 mi300 mi200 navi31.
- Per-config CUDA-baseline gating: a SHA whose CUDA jobs for a test config
  did not run (e.g. a failed trunk run that never launched CUDA default)
  has no baseline for that config, so exclude just that config from the
  dispatch (via parity.yml's exclude_* inputs) instead of emitting a bogus
  all-MISSED column, and drop its ROCm shards from the completion gate.

No parity_job_config.json change: mi300 has no fallback; its default/
distributed/inductor come from rocm-mi300 / periodic-rocm-mi300 /
inductor-rocm-mi300, which run together on one scheduled SHA.
Shard counts were hardcoded (config value or literals), so when an arch
falls back to a different workflow whose sharding differs, the constructed
"(config, i, N)" job/artifact keys miss the real jobs. Concretely mi200's
default/inductor workflows are dormant upstream and fall back to
trunk-rocm-sandbox, which shards default into 10 (config says 6) and
inductor into 4 (config says 2) - so every key "DOES NOT EXIST IN JOBS"
and the mi200 shard of a combined auto report fails.

Add derive_shard_count(), which reads the actual shard total from the
resolved run's job names, and use it for ROCm default/distributed/inductor
(falling back to the config value only when no matching jobs are found).
This unblocks mi200 in the multi-arch auto-trigger.
The DISAGREE/AGREE metric counted a ROCm SKIPPED or MISSED test as a
disagreement whenever CUDA merely did not SKIP it - which includes the
large set of attention-backend parametrization variants CUDA never even
enumerates (CUDA MISSED). Those are not real ROCm-vs-CUDA coverage gaps and
inflated DISAGREE to ~3% (AGREE ~97%).

Count a disagreement only when CUDA actually PASSED the test (s2 == PASSED)
in both compute_test_config_stats and compute_overall_stats, and relabel the
two line items accordingly ('PASSED on <set2>'). This matches the triage
spreadsheet's adjusted definition; AGREE% becomes ~99%.
The HUD link added in pytorch#3258 was lost when parity.yml was rewritten. Re-add it in generate_summary.py (next to the Commit SHA header) so it lives in the report itself (step summary + CSV artifact) and survives workflow rewrites. The link targets the upstream HUD page for the resolved commit, regex-filtered to the trunk CUDA/inductor/rocm test jobs the report is built from. Parens/pipes are percent-encoded to keep the markdown link valid; normal runs already pass set1_name=rocm/set2_name=cuda. Verified end-to-end against a real mi350 status CSV.
Consumer-side support for commit-vs-commit parity (baseline_sha mode):

- detect_log_failures.py: preserve the short commit-SHA prefix on log
  filenames (e.g. 09e0c59b_rocm3.txt) as the platform label, matching the
  SHA-prefixed filenames download_testlogs produces in baseline mode.
- summarize_xml_testreports.py: name the per-test-file running-time CSV
  columns from the resolved set names (set1/set2) instead of hardcoded
  rocm_/cuda_, and add per-config test-shard counts.

The download_testlogs run-selection side of this work already landed in
develop via pytorch#3278, so this PR carries only the remaining consumer-side
parsing changes.
The running-time CSV columns use set1_name/set2_name (rocm/cuda by default, commit SHAs in commit-vs-commit mode), but the printed summary still hardcoded ROCM/CUDA. Drive the user-facing summary headers from the same set names so both stay consistent; normal-mode output is unchanged (rocm/cuda).
Adds a "preview" ROCm arch so parity can be run against the upstream
rocm-preview lane (linux-noble-rocm-preview-py3.12-gfx942, gfx942), which
runs the TheRock preview wheel (e.g. ROCm 7.14) via the ciflow/rocm-preview
label. default/distributed/inductor all come from the single rocm-preview
workflow (6/3/2 shards).

- parity_job_config.json: new rocm.preview entry.
- download_testlogs: allow --arch preview.
- parity.yml: list preview as an arch option.

Because rocm-preview is ciflow-triggered (not scheduled on main), this arch
is for manual/on-demand parity runs against a rocm-preview commit; it is
intentionally not added to the auto-trigger scope.
test_conv2d_backward_parametrized is skipped on ROCm via skipIfRocmArch
(upstream pytorch#188671, CI timeout). It was falling into the generic Misc
bucket; add a Tier-1 rule so conv2d_backward gfx-arch skips are categorized
as 'PT2.0 - Convolution' instead. Non-conv2d gfx skips stay Misc.
Flip the parity.yml auto_classify input default false->true so skip-reason
classification runs on every dispatch, including autoparity commits (which
don't pass the input and so inherit the default). Previously auto runs left
skip_reason blank; now the disagreement subset (SKIPPED/MISSED on ROCm +
PASSED on CUDA) is categorized automatically.
…istributed config

pytorch#189232 hived single-GPU distributed tests out of the 'distributed'
config onto CUDA's 1-GPU 'default' runner, while ROCm still runs the whole
distributed suite under 'distributed'. Our (test, config) keying then can't
match a CUDA-'default' result with the ROCm-'distributed' result, so the same
passing test double-counts as MISSED on both sides (~1700 spurious mi350
disagreements starting 07/11).

Canonicalize default -> distributed for distributed.* test files so the two
stacks line up again. Scoped to distributed.* files only, leaving genuine
default/inductor results untouched.
The log-based flaky detector inferred flakiness from the last individual
"... PASSED" line seen before a "Test succeeded in new process" marker. That
heuristic attaches the flaky flag to whatever test happened to pass most
recently, which is often an unrelated test that passed normally much earlier in
the shard -- not the test that actually crashed/failed and then passed on
rerun.

Concrete example (run 29255582284, mi350, inductor/test_compiled_autograd):
test_wrap_recreates_contexts_for_repeated_runs passed normally at ~16% and was
wrongly reported as flaky, while the test that truly failed-then-passed on
rerun was FuncTorchHigherOrderOpTestsWithCompiledAutograd::test_jacfwd.

run_test.py already prints an authoritative per-shard summary naming the exact
tests:

  The following tests failed and then succeeded when run in a new process
  ['test/inductor/test_compiled_autograd.py::...::test_jacfwd']

Parse that line directly instead of guessing. Verified against the real ROCm
and CUDA logs from the run above: test_wrap is no longer flagged and test_jacfwd
is correctly reported on both platforms.
The distributed-config fold (pytorch#189232) was applied to the per-test
counts but not to the per-file running-time aggregation, which keys config
from the testsuite dict (index 2) rather than the folded testcase dict. That
left distributed.* files with a phantom 'default' row carrying the CUDA
default-shard import time but 0 tests run (e.g. test_fully_shard_comm:
default cuda_running_time=48.9, cuda_tests_run=0).

Factor the mapping into _canonical_distributed_config() and apply it in the
ROCm/CUDA running-time and shard aggregation loops so per-file times fold into
'distributed' alongside the counts. No phantom 0-test rows; times and counts
are now consistent. Disagreement counts are unchanged.
… job failed

When an upstream config's jobs are missing (e.g. ROCm distributed test job
skipped during GPU capacity crunches), download_testlogs exits non-zero and,
with `set -o pipefail`, aborted the whole generate-parity job before the CSV
was built or uploaded -- so no report at all for that arch.

Capture download_testlogs' real exit code instead of aborting, let the report
generate and upload from whatever downloaded (default/inductor), then fail the
job at the end via a dedicated "Flag incomplete download" step. Net effect for
e.g. mi300 with distributed off: the per-arch report + artifact are still
produced (and summarize still aggregates via `if: !cancelled()`), but the arch
job is clearly marked failed so the incomplete download is visible.
@rocm-repo-management-api

rocm-repo-management-api Bot commented Jul 14, 2026

Copy link
Copy Markdown

Jenkins build for 68906cd9150107d9ebc051d9baa51b450e32476d commit finished as FAILURE
Links: Pipeline Overview / Build artifacts / Test Results

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant