Skip to content

Build sccache from source for CUDA 13.3+ (--simt-only parser fix) - #190927

Closed
tinglvv wants to merge 1 commit into
mainfrom
tingl/sccache-source-build
Closed

tinglvv wants to merge 1 commit into
mainfrom
tingl/sccache-source-build

Conversation

@tinglvv

@tinglvv tinglvv commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #190832

nvcc 13.3+ injects a valueless --simt-only flag (Tile compilation) into the cicc sub-command of nvcc --dryrun. sccache 0.16.0 locates the cicc input by a fixed offset from the end of the argument list, so the extra token makes it splice out --simt-only as the "input" and skip the device compile. This affects any separable/relocatable (-rdc=true) CUDA target (e.g. gloo_cuda, torch_nvshmem).

Building from source in sccache 0.16.0 + the root cause fix, and keeping consistent for all builds.

Root cause fix is pending mozilla/sccache#2722, once fixed release ships we will drop this from-source build.

Test Plan:

To be validated in 13.4 build https://github.com/pytorch/pytorch/actions/runs/29947019889/job/89015281565?pr=190639

cc @ptrblck @nWEIdia @eqy @atalman @malfet

@tinglvv
tinglvv requested a review from a team as a code owner July 23, 2026 18:04
@pytorch-bot

pytorch-bot Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/190927

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (15 Unrelated Failures)

As of commit d599eab with merge base e27c721 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@eqy
eqy requested a review from atalman July 23, 2026 20:44
@tinglvv
tinglvv force-pushed the tingl/sccache-source-build branch 2 times, most recently from 2822519 to c2f04dd Compare July 24, 2026 23:22
@tinglvv
tinglvv requested a review from jeffdaily as a code owner July 24, 2026 23:22
@tinglvv
tinglvv force-pushed the tingl/sccache-source-build branch 2 times, most recently from 225ab0d to d370a53 Compare July 27, 2026 19:24
@tinglvv

tinglvv commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

sccache source build is enabled, https://github.com/pytorch/pytorch/actions/runs/30298112928/job/90084106715

2026-07-27T20:07:56.8844811Z #81 0.036 + echo 'Building sccache 0.16.0 from source with the nvcc 13.3 dryrun fix'
2026-07-27T20:07:56.8845359Z #81 0.036 Building sccache 0.16.0 from source with the nvcc 13.3 dryrun fix

Two build failures are not relevant. We can merge this.

@atalman atalman added the ciflow/binaries Trigger all binary build and upload jobs on the PR label Jul 28, 2026

@atalman atalman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, lets make sure binaries build are successful before merging this

@atalman

atalman commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

@pytorchmergebot merge -f "all looks good"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorch-auto-revert

Copy link
Copy Markdown

@pytorchbot revert -m "Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable" -c autorevert

This PR is attributed to have caused regression in:

Note: This revert was accelerated by the AI advisor: AI advisor: related (confidence=0.95)

Please investigate and fix the issues.
@claude Can you please read this revert comment, follow the links and read the errors, to then give a brief diagnostics on the cause of the error? If you judge the error to be legitimate reason for a revert, please provide brief guidance on how the author could fix it.

@claude

claude Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Claude finished @pytorch-auto-revert[bot]'s task in 12m 11s —— View job


Autorevert diagnostics

  • Fetch the failing linux-jammy-py3.10-clang21-asan / build log
  • Correlate failure with this PR's changes to .ci/docker/
  • Judge whether the revert is legitimate and give fix guidance

Summary: the ASAN "build" failure is not a compile error — zero build steps ran. The pod could never pull its CI docker image, because this PR rotates the content-hash docker tag for every CI image and no image had been published for the new tag at the time the job started. The revert is justified as a trunk-unblock, but nothing in the sccache logic itself is implicated.

Full diagnostics

What the log actually shows

Job 90586597884 failed at step 2, Initialize containers. It never reached Build, never invoked sccache, never invoked a compiler:

[prepare_job] workflow image: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/ci-image:pytorch-linux-jammy-py3.10-clang21-fcf07d98a124ec2d9f0f909688d5f689c89aa809
Pod ...: waiting=[job: ErrImagePull]      (51s/7200s)
Pod ...: waiting=[job: ImagePullBackOff]  (91s/7200s)
... 2 hours of ImagePullBackOff ...
##[error]Error: pod failed to come online ... is unhealthy with phase status Pending: backoff timeout

This is the whole failure. ImagePullBackOff for the full 7200s timeout: the tag does not resolve in ECR.

Why the tag doesn't resolve

PyTorch tags CI images by the git tree hash of .ci/docker:

  • .github/workflows/docker-builds.yml:132 — DOCKER_TAG=$(git rev-parse HEAD:.ci/docker)
  • .github/workflows/_runner-determinator.yml:120 — same hash is passed to consumers as ci-docker-hash

On current trunk:

$ git rev-parse HEAD:.ci/docker
fcf07d98a124ec2d9f0f909688d5f689c89aa809   # == the tag the pod tried to pull

So fcf07d98… is the tree hash produced by this PR. Because this PR touches .ci/docker/common/install_cache.sh, adds .ci/docker/common/patches/…, and edits three Dockerfiles, it invalidates the tag for every CI image at once — that is exactly the hazard called out in CLAUDE.md:

The .ci/docker/ directory is content-hashed to determine whether Docker images need rebuilding. Any file change inside .ci/docker/ (including the README) changes the hash and triggers a full Docker image rebuild.

Corroborating evidence that this is tag-rotation and not a code defect: all four build jobs in run 30455070082 failed identically at Initialize containers, across unrelated toolchains — clang21-asan, clang21, cuda13.0-sm86, cuda13.2-sm86. A real sccache regression would be image-specific and would surface as a compiler/linker error, not a pull failure. (It also would not touch clang21-asan, which has no CUDA at all — the --simt-only bug this PR fixes only affects nvcc.)

The likely contributing factor: the docker-builds run was never green

This PR's own docker-builds run (30298112928) finished failure: pytorch-linux-jammy-cuda13.0-cudnn9-py3-gcc11-… and pytorch-linux-jammy-rocm-n-py3-benchmarks both failed in Build and push to ECR. It was then force-merged (@pytorchmergebot merge -f) at 13:13, and the failing build jobs started at 13:17 — four minutes later, long before trunk's own docker-builds push run could publish images for the post-rebase hash.

Worth checking as the underlying rebuild blocker: DrCI attributed the cuda13.0 docker failure to deb.nodesource.com/setup_16.x serving HTML instead of a script. That is .ci/docker/common/install_docs_reqs.sh:10, and Node 16 is long EOL, so NodeSource has retired those setup scripts:

curl --retry 3 -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -

This matters directly for the reverted job: pytorch-linux-jammy-py3.10-clang21 is built with KATEX=yes / DOCS=yes (.ci/docker/build.sh:172-179), and .ci/docker/ubuntu/Dockerfile:34-35 runs install_docs_reqs.sh unconditionally. So the very image the ASAN job needs must clear that dead NodeSource URL to rebuild. While the images were cached under the old tag, nobody noticed; forcing a full rebuild un-masks it. If that step is failing now, the image for fcf07d98… can never be published and the trunk redness would not self-heal.

I could not confirm the trunk docker-builds push-run outcome from this sandbox (the gh api / gh run list calls I need aren't permitted here), so treat the NodeSource link as a strong hypothesis rather than a confirmed root cause — please check the trunk docker-build (…, pytorch-linux-jammy-py3.10-clang21) job on 89b35f6f to confirm.

Is the revert legitimate?

Yes as a trunk-unblock, no as a verdict on the code. Reverting restores the previous .ci/docker tree hash, whose images are already in ECR, so trunk goes green immediately. But the sccache-from-source change is not itself broken — the autoreverter's signal here is "images missing for the new tag," which is a side effect of any .ci/docker edit, not of this edit's content. So don't go looking for a bug in install_cache.sh.

Suggested path to reland

  1. Fix or confirm the docker rebuild first. Land the install_docs_reqs.sh NodeSource fix (Node 16 → a supported major, e.g. setup_20.x/setup_22.x, or drop the NodeSource repo and use distro nodejs) as its own PR, and let docker-builds go fully green on it. Until every image in docker-builds can rebuild from scratch, any .ci/docker PR will take trunk down the same way.
  2. Do not force-merge a .ci/docker PR. -f bypasses precisely the docker-builds signal that guarantees images exist for the new tag. Wait for docker-builds green, or use -i so pending jobs still report.
  3. Rebase immediately before merge. The tag is the tree hash, so if main's .ci/docker moved after your docker-builds run, the hash that lands is one no run has ever built. Re-run docker-builds on the final rebased commit.
  4. Keep the change itself as-is — the riscv64 prebuilt carve-out and the explicit missing-patch guard in install_cache.sh:20 both look right, and the --simt-only analysis in the PR description is sound.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Jul 29, 2026
…fix) (#190927)"

This reverts commit 89b35f6.

Reverted #190927 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](#190927 (comment)))
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@tinglvv your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Jul 29, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@tinglvv

tinglvv commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@tinglvv

tinglvv commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Both Windows XPU and Linux XPU wheels fail with

ERROR: Could not find a version that satisfies the requirement triton-xpu==3.8.0+git1e2d42a0; python_version < "3.15" (from torch) (from versions: 3.6.0+git225cdbde, 3.7.0+git307748db, 3.7.0+git33f782ef, 3.7.0+git64bb0de3, 3.7.1+git21033c4e, 3.7.2+git5fcc14d9)
ERROR: No matching distribution found for triton-xpu==3.8.0+git1e2d42a0; python_version < "3.15"

The failed jobs are from 6 hours ago, now the triton-xpu wheels are published on https://download.pytorch.org/whl/nightly/triton-xpu/. Rerunning the jobs.

@tinglvv

tinglvv commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Refusing to merge: this PR modifies the CI docker images, but the .ci/docker tree of the merge commit (65f6106b6564dc7721a9912769892d70e8fd49c5) does not match the tree that ciflow/docker built and tested on the PR head (562e79cacef2e9577f320b0d13062377c6061759). Another docker-affecting change landed on the base branch after your docker images were built, so the images required after this merge were never built or tested (a land race). Please rebase this PR (e.g. @pytorchbot rebase), let the ciflow/docker builds re-run, and then merge again.

Details for Dev Infra team Raised by workflow job

@tinglvv

tinglvv commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

Reland of #190927 (landed as 2a4b761, auto-reverted in dc90186), with
the cause of the revert fixed.

Two separate sccache 0.16.0 bugs break CUDA builds; this patches both
(patches/sccache-nvcc-13.3-dryrun-parsing.patch) and builds sccache from source
until a release carrying them ships.

First, nvcc 13.3+ injects a valueless --simt-only flag into the cudafe++ and
cicc sub-commands of `nvcc --dryrun`, right before -o. sccache locates the
sub-command input by a fixed offset from the end of the argument list, so the
extra token makes cicc mis-locate its input and skip the device compile; ptxas
then produces no .cubin and the build dies with "fatbinary fatal: Could not open
input file '*.cubin'". mozilla/sccache#2722 fixes this by locating the input by
its generated-file suffix (.cpp1.ii for cicc, .ptx for ptxas) instead.

That fix is taken with one deviation: the suffix search runs only when the
argument at the historical offset is not itself a generated input file. Of the
three sub-commands sccache parses this way, only cicc is affected -- cudafe++
takes the input as its last argument (offset 1, unaffected by a flag inserted
before it) and ptxas never receives --simt-only at all, so its offset was
already correct. Gating keeps every command line nvcc still emits in the old
shape parsing exactly as stock 0.16.0 does, with identical cache keys, while
13.3+ still gets the fix on the one sub-command that needs it.

Second, and this is what the autorevert caught: for a virtual-only gencode such
as -gencode arch=compute_120,code=compute_120, nvcc runs ptxas as a PTX
verification pass with no -o at all --

  ptxas -arch=compute_120 -m64 kernel.compute_120.ptx

It syntax-checks the PTX and emits nothing. sccache marks every ptxas
sub-command Cacheable::Yes, and the caching path requires an "obj" output that
only -o populates, so the whole compile fails with `Missing "cubin" file
output`. This is not a regression from #2722: stock 0.16.0 fails identically
here, since with a three-argument list the offset picks -arch=compute_120 as the
input and there is still no -o to find. Any target carrying a +PTX architecture
can hit it; here it was torchao's mxfp8 extension, built as a dependency of
inductor-build-cuda132.

Mark that sub-command Cacheable::No instead, which routes it to the path nvcc.rs
already uses for non-cacheable sub-commands: build the command and run it. The
first attempt at this returned CompilerArguments::CannotCache from
cicc::parse_arguments, but the nvcc sub-command dispatch converts CannotCache
into an error rather than falling back to running the command, so it only moved
the failure ("Cannot cache(no output file)"). Deciding at the grouping stage
avoids that path entirely; Cacheable::No with a group is already how the host
preprocessor steps are handled.

The "Missing <lang> file output" error now also reports the parsed input and
argument lists. That instrumentation is what identified the second bug -- the
error alone said only that an output was absent, not that the command never had
one -- and nvcc reshapes these sub-commands between CUDA releases, so the
argument vector as sccache saw it is worth keeping in the message.

Build from source for all image types (riscv64 keeps the prebuilt binary: no
nvcc, no sccache-dist, and a from-source build under QEMU emulation would be
impractically slow) so the whole fleet shares a single sccache binary.

Build with the pre-installed rust toolchain rather than reinstalling rustup.
Since #186302 the builder images pre-install a pinned rust (1.97.1) at
CARGO_HOME=/opt/rust with /opt/rust/bin on PATH. The first landing ran
`curl rustup | sh` then `. "$HOME/.cargo/env"`, but with CARGO_HOME=/opt/rust
that env file is /opt/rust/env, so the source failed and every from-source image
died at that line before reaching cargo. Drop the redundant (and pin-diverging)
rustup reinstall and just use the cargo already on PATH.

Disabling sccache for the affected CUDA versions was considered and rejected: it
gives up CUDA build caching, which is the reason to run sccache at all.

Drop the from-source build and return to the prebuilt binary once a sccache
release including these fixes ships. See #190832.

Test Plan:
The patch applies cleanly to a pristine v0.16.0:

```
git clone --depth 1 --branch v0.16.0 https://github.com/mozilla/sccache /tmp/sccache
git -C /tmp/sccache apply --check .ci/docker/common/patches/sccache-nvcc-13.3-dryrun-parsing.patch
```

The second bug reproduces without PyTorch or torchao, on any CUDA install, from
the virtual-only gencode alone:

```
echo '__global__ void k() {}' > repro.cu
cargo build --manifest-path /tmp/sccache/Cargo.toml --release
/tmp/sccache/target/release/sccache nvcc -gencode=arch=compute_100,code=sm_100 \
    -gencode=arch=compute_120,code=compute_120 -c repro.cu -o repro.o
```

In CI, the torchao mxfp8 extension built by inductor-build-cuda132 is the direct
regression test. For the first bug, in a CUDA 13.3+ image:

```
sccache nvcc -rdc=true -gencode arch=compute_75,code=sm_75 -c repro.cu -o repro.o  # succeeds, no fatbinary error
```

and confirm non-CUDA / ROCm / XPU images still build and cache normally.

Authored with assistance from Claude.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased tingl/sccache-source-build onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout tingl/sccache-source-build && git pull --rebase)

@tinglvv

tinglvv commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -i

@tinglvv tinglvv added the autorevert: disable Disable autorevert for a specific PR label Aug 5, 2026
pytorchmergebot pushed a commit that referenced this pull request Aug 7, 2026
…arn (#192522)

Follow-up to #191508.

## What #191508 added, and what changes here

It added two gates for docker-affecting PRs, both in `merge_into` so force merges
cannot bypass them:

1. **`check_docker_builds_ready`** — the PR's own `ciflow/docker` builds must have
   run and passed. **Unchanged by this PR.** Pending builds still raise
   `MandatoryChecksMissingError` so a normal merge waits; missing/failed builds are
   still refused.
2. **`check_no_docker_merge_skew`** — additionally required the `.ci/docker` tree of
   the *merge commit* to equal the tree `ciflow/docker` built on the PR head, and
   refused the merge otherwise. **This PR downgrades it to a warning.**

So the "all the builds are green" requirement is fully retained; what goes away is
the extra requirement that the base branch not have moved.

## Why

Requiring the two trees to match means a docker PR has to win a race against the
base branch, and a rebase only helps until the next docker-affecting PR lands. On
a busy day a PR can bounce indefinitely. #190639 hit it twice in a row — the
PR-head tree moved (`08b9699a` → `75ce86e4`) after a rebase while the merge-commit
tree stayed `ab961773`:

```
Refusing to merge: this PR modifies the CI docker images, but the .ci/docker tree
of the merge commit (ab96177...) does not match the tree that ciflow/docker built
and tested on the PR head (75ce86e...)
```

**A missing post-merge image is not fatal**, which is the key point:

- `docker-builds.yml` triggers on `push` to `main` / `release/*`, so the merged
  tree's images get built and pushed right after the merge lands.
- test-infra's `calculate-docker-image` polls for the image before giving up —
  `docker manifest inspect` in a loop, `sleep 300` per iteration, up to 120
  minutes for non-docker-build jobs — and then falls through to `rebuild=true`
  and builds it locally.

So a skew costs **time** on the first trunk jobs after the merge (waiting for
docker-builds, or a local rebuild with longer TTS), not a hard failure. Trading
that against docker PRs being unable to land seems like the better default.

## Kept: the diagnostic

The mismatch is still printed to the merge job log, so a slow or rebuilding trunk
job can be correlated with the land race that caused it:

```
WARNING: docker land race on PR #NNNNN: the .ci/docker tree of the merge commit
(...) does not match the tree that ciflow/docker built and tested on the PR head
(...). ... the first trunk jobs after this merge may wait for docker-builds to
publish the merged tree's images, or rebuild them locally. Merging anyway.
```

Renamed `check_no_docker_merge_skew` → `warn_on_docker_merge_skew` so the name
matches the behaviour.

## Test plan

- `python -m pytest .github/scripts/test_trymerge.py` → **74 passed, 2 skipped**
  (the 4 docker-gate tests included; none referenced the renamed function).
- `py_compile` clean; no remaining references to the old name
  (`grep -rn check_no_docker_merge_skew .github/` → empty).
- `MergeRuleFailedError` is still used in 7 other places, so the import is not
  orphaned.

## Trade-off, stated plainly

This intentionally reopens the window that #191508 closed: a docker PR can now
land whose post-merge images were never built or tested, which is the shape of the
#190927 / #186302 land race cited in that PR. The mitigation is that the images
are auto-published by `docker-builds.yml` on the merge and that jobs wait for
them, so the failure mode is latency rather than red trunk. If dev-infra would
rather keep a hard gate, an alternative is to keep refusing only when
`check_docker_builds_ready` did **not** pass, i.e. exactly the unbuilt-image case,
and always allow the pure-skew case — happy to switch to that.

Pull Request resolved: #192522
Approved by: https://github.com/tinglvv, https://github.com/izaitsevfb, https://github.com/ezyang
ankitbhrdwj pushed a commit to ankitbhrdwj/pytorch that referenced this pull request Aug 12, 2026
…arn (pytorch#192522)

Follow-up to pytorch#191508.

## What pytorch#191508 added, and what changes here

It added two gates for docker-affecting PRs, both in `merge_into` so force merges
cannot bypass them:

1. **`check_docker_builds_ready`** — the PR's own `ciflow/docker` builds must have
   run and passed. **Unchanged by this PR.** Pending builds still raise
   `MandatoryChecksMissingError` so a normal merge waits; missing/failed builds are
   still refused.
2. **`check_no_docker_merge_skew`** — additionally required the `.ci/docker` tree of
   the *merge commit* to equal the tree `ciflow/docker` built on the PR head, and
   refused the merge otherwise. **This PR downgrades it to a warning.**

So the "all the builds are green" requirement is fully retained; what goes away is
the extra requirement that the base branch not have moved.

## Why

Requiring the two trees to match means a docker PR has to win a race against the
base branch, and a rebase only helps until the next docker-affecting PR lands. On
a busy day a PR can bounce indefinitely. pytorch#190639 hit it twice in a row — the
PR-head tree moved (`08b9699a` → `75ce86e4`) after a rebase while the merge-commit
tree stayed `ab961773`:

```
Refusing to merge: this PR modifies the CI docker images, but the .ci/docker tree
of the merge commit (ab96177...) does not match the tree that ciflow/docker built
and tested on the PR head (75ce86e...)
```

**A missing post-merge image is not fatal**, which is the key point:

- `docker-builds.yml` triggers on `push` to `main` / `release/*`, so the merged
  tree's images get built and pushed right after the merge lands.
- test-infra's `calculate-docker-image` polls for the image before giving up —
  `docker manifest inspect` in a loop, `sleep 300` per iteration, up to 120
  minutes for non-docker-build jobs — and then falls through to `rebuild=true`
  and builds it locally.

So a skew costs **time** on the first trunk jobs after the merge (waiting for
docker-builds, or a local rebuild with longer TTS), not a hard failure. Trading
that against docker PRs being unable to land seems like the better default.

## Kept: the diagnostic

The mismatch is still printed to the merge job log, so a slow or rebuilding trunk
job can be correlated with the land race that caused it:

```
WARNING: docker land race on PR #NNNNN: the .ci/docker tree of the merge commit
(...) does not match the tree that ciflow/docker built and tested on the PR head
(...). ... the first trunk jobs after this merge may wait for docker-builds to
publish the merged tree's images, or rebuild them locally. Merging anyway.
```

Renamed `check_no_docker_merge_skew` → `warn_on_docker_merge_skew` so the name
matches the behaviour.

## Test plan

- `python -m pytest .github/scripts/test_trymerge.py` → **74 passed, 2 skipped**
  (the 4 docker-gate tests included; none referenced the renamed function).
- `py_compile` clean; no remaining references to the old name
  (`grep -rn check_no_docker_merge_skew .github/` → empty).
- `MergeRuleFailedError` is still used in 7 other places, so the import is not
  orphaned.

## Trade-off, stated plainly

This intentionally reopens the window that pytorch#191508 closed: a docker PR can now
land whose post-merge images were never built or tested, which is the shape of the
pytorch#190927 / pytorch#186302 land race cited in that PR. The mitigation is that the images
are auto-published by `docker-builds.yml` on the merge and that jobs wait for
them, so the failure mode is latency rather than red trunk. If dev-infra would
rather keep a hard gate, an alternative is to keep refusing only when
`check_docker_builds_ready` did **not** pass, i.e. exactly the unbuilt-image case,
and always allow the pure-skew case — happy to switch to that.

Pull Request resolved: pytorch#192522
Approved by: https://github.com/tinglvv, https://github.com/izaitsevfb, https://github.com/ezyang
@github-actions
github-actions Bot deleted the tingl/sccache-source-build branch October 31, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autorevert: disable Disable autorevert for a specific PR ci-no-td Do not run TD on this PR ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/docker ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged open source Reverted topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable sccache for CUDA on 13.4 (nvcc --simt-only breaks sccache)

7 participants