Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194786
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit dba3349 with merge base 9286a16 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
karthickai
approved these changes
Aug 25, 2026
Contributor
Author
|
@pytorchbot merge |
Collaborator
Merge startedYour 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 |
Collaborator
|
@pytorchmergebot cherry-pick --onto release/2.14 -c critical |
Collaborator
Cherry picking #194786Command Details for Dev Infra teamRaised by workflow job |
This was referenced Aug 26, 2026
atalman
added a commit
that referenced
this pull request
Aug 26, 2026
…me (#194786) (#194833) * [inductor] Fix loop-local load CSE lifetime (#194786) Manual cherry-pick of 60598ed (#194786) onto release/2.14. Triton load placement and CSE lifetime used separate heuristics. An indirect load emitted inside a loop could remain cached after loop closure and be reused by an epilogue even though its temporary did not dominate that use. Use the selected load buffer as the source of truth for whether a CSE value survives loop closure, and stop hoisting loads that carry reduction masks before those masks are defined. Conflict resolution: * torch/_inductor/codegen/triton.py: upstream also deletes the reduction_axes_omitted bookkeeping added by #184287, which is not on this branch, so that deletion is already satisfied and the surrounding code is left as-is. The two substantive changes (the has_rmask() guard on lifting, and load_buffer is self.body as the CSE-lifetime test) apply unchanged. * test/inductor/test_indexing.py: upstream adds the regression test to ReductionInvariantIndexingTests, a class that #184287 introduced and which does not exist here. The regression test is ported verbatim into a new TestLoopLocalLoadCSELifetime class with the imports it needs (run_and_get_kernels, FileCheck, HAS_CUDA_AND_TRITON, config), all of which exist on this branch. The unrelated @parametrize("dense_indexing") hunk is dropped, since it belongs to a #184287 test. Fixes #194490 on the release branch. * Fix PYFMT import ordering --------- Co-authored-by: eellison <[email protected]>
This was referenced Aug 27, 2026
pytorchmergebot
pushed a commit
that referenced
this pull request
Aug 28, 2026
…5024) Adds a wheel-level regression check for gh-194490. ## What it covers that the existing test doesn't gh-194490 was a 2.13 Inductor regression — a gather/scatter pair around a loop reduction produced Triton whose epilogue read a temporary defined only inside the reduction body: ``` tmp41 = tl.where(tmp38, tmp40, tmp19) ^ NameError: tmp19 is not defined ``` It was found by a user training Dion3 through vllm-project/speculators, not by CI. The fix (gh-194786) added `test_loop_epilogue_indirect_load_scope` to `test/inductor/test_indexing.py`, and **that remains the authoritative test** — it asserts codegen structure via FileCheck, which this cannot. But it compiles with `dynamic=True`, whereas the reported failure only appeared on the **second** compile, once a differing shape triggered *automatic* dynamic shapes. Those are different paths. So this check does two trials with different row counts and no `dynamic=` flag: the first compiles statically, the second generalizes. That's the route users actually hit. ## Fidelity to the reproducer The `torch.where` over a tensor predicate is kept deliberately — the failure surfaced *inside* a `tl.where`, so simplifying it to a plain lerp risks not regenerating the same codegen. I had simplified it initially and put it back for that reason. Shapes shrink from the reproducer's `(6, 4096, 4096)` to `2 x k x 4096`, but the **4096-wide reduction dim is preserved on purpose** so the reduction stays non-persistent and the loop path is actually emitted. Smaller and it becomes a persistent reduction and stops covering the bug. ## Blast radius Runs under the existing torch-compile gate (already skipped on Python 3.15+ and non-Linux/macOS), and returns early without CUDA — so CPU and Windows wheels are unaffected. Roughly two `torch.compile` invocations on ~128K-element tensors. Tolerances are loose (`rtol/atol 1e-4`). The assertion that matters is that codegen succeeds at all; a 4096-wide reduction over bf16 inputs differs between eager and Inductor by reduction order alone, and a wheel check must not fail on that. ## Caveats, stated plainly **I could not run this** — no GPU on the machine I authored it on. Syntax and wiring are verified; the codegen behaviour is not. It needs one real run on a CUDA wheel before it's trusted. If it turns out the reduction goes persistent at these shapes, the test passes while covering nothing, and the reduction dim needs raising. **Coverage is heuristic-dependent.** If Inductor's persistent-reduction threshold changes, this silently stops exercising the bug rather than failing. That's noted in the docstring with a pointer to the inductor test, which has no such dependency. **On placement:** my own view is that compiler-codegen regressions belong in `test/inductor/`, not in the release smoke test — the smoke test validates that the binary works, and this adds a GPU-only, Triton-dependent, config-sensitive path to every wheel check. Adding it here anyway at @atalman's direction, since the escape happened on a release binary and the release gate is where he wants the net. Recording the tradeoff so the next person editing this file knows why it's here. --- Filed with the help of Claude Code. Pull Request resolved: #195024 Approved by: https://github.com/eellison, https://github.com/karthickai
pytorchmergebot
pushed a commit
that referenced
this pull request
Aug 31, 2026
test-infra's Release Binaries Validations checks out smoke_test.py from pytorch main but installs the published stable wheel. The regression check added in #195024 covers gh-194490, whose fix (#194786) landed after the 2.13 branch cut, so it reds all six linux CUDA 12.6 legs against the immutable 2.13.0 artifact with NameError('tmp19 is not defined'). Gate on the first release series containing the fix: 2.14, which has it via cherry-pick #194833. Reverting #195024 was the alternative, but it drops nightly coverage and leaves the next regression test added here to hit the same trap. Test Plan: 2.13.0 skips; 2.14.0, main and nightly run. ``` python -c " from torch.torch_version import TorchVersion for v in ['2.13.0+cu126','2.14.0+cu130','2.15.0a0+gitabc','2.15.0.dev20260829+cu126']: print(v, TorchVersion(v) < (2, 14)) " lintrunner -a --paths-cmd 'echo .ci/pytorch/smoke_test/smoke_test.py' ``` Authored with assistance from Claude Code. Pull Request resolved: #195306 Approved by: https://github.com/pytorchgreenlight, https://github.com/atalman
orrangetabby17
pushed a commit
to orrangetabby17/pytorch
that referenced
this pull request
Sep 2, 2026
Human context: fix for pytorch#194490) exposed by pytorch#184287 although the underlying cause was prior CSE / loop hoisting logic (and ultimately the fact that this is all tied to one very complicated file).. Triton load placement and CSE lifetime used separate heuristics. An indirect load emitted inside a loop could consequently remain cached after loop closure and be reused by an epilogue even though its temporary did not dominate that use. Use the selected load buffer as the source of truth for whether a CSE value survives loop closure. Also prevent loads carrying reduction masks from being hoisted before those masks are defined. Test Plan: ``` python test/inductor/test_indexing.py ReductionInvariantIndexingTests python test/inductor/test_codegen_triton.py -k reduction_invariant_load_indexing git diff --check lintrunner -a test/inductor/test_indexing.py torch/_inductor/codegen/triton.py ``` The two test commands and git diff check pass. Lintrunner was invoked, but Pyrefly failed on unrelated repository-wide missing-attribute errors because this detached worktree has no initialized lintrunner data. AI-Assisted: Author reviewed and validated all AI-generated content. Pull Request resolved: pytorch#194786 Approved by: https://github.com/atalman, https://github.com/karthickai
orrangetabby17
pushed a commit
to orrangetabby17/pytorch
that referenced
this pull request
Sep 2, 2026
… (pytorch#195024) Adds a wheel-level regression check for pytorchgh-194490. ## What it covers that the existing test doesn't pytorchgh-194490 was a 2.13 Inductor regression — a gather/scatter pair around a loop reduction produced Triton whose epilogue read a temporary defined only inside the reduction body: ``` tmp41 = tl.where(tmp38, tmp40, tmp19) ^ NameError: tmp19 is not defined ``` It was found by a user training Dion3 through vllm-project/speculators, not by CI. The fix (pytorchgh-194786) added `test_loop_epilogue_indirect_load_scope` to `test/inductor/test_indexing.py`, and **that remains the authoritative test** — it asserts codegen structure via FileCheck, which this cannot. But it compiles with `dynamic=True`, whereas the reported failure only appeared on the **second** compile, once a differing shape triggered *automatic* dynamic shapes. Those are different paths. So this check does two trials with different row counts and no `dynamic=` flag: the first compiles statically, the second generalizes. That's the route users actually hit. ## Fidelity to the reproducer The `torch.where` over a tensor predicate is kept deliberately — the failure surfaced *inside* a `tl.where`, so simplifying it to a plain lerp risks not regenerating the same codegen. I had simplified it initially and put it back for that reason. Shapes shrink from the reproducer's `(6, 4096, 4096)` to `2 x k x 4096`, but the **4096-wide reduction dim is preserved on purpose** so the reduction stays non-persistent and the loop path is actually emitted. Smaller and it becomes a persistent reduction and stops covering the bug. ## Blast radius Runs under the existing torch-compile gate (already skipped on Python 3.15+ and non-Linux/macOS), and returns early without CUDA — so CPU and Windows wheels are unaffected. Roughly two `torch.compile` invocations on ~128K-element tensors. Tolerances are loose (`rtol/atol 1e-4`). The assertion that matters is that codegen succeeds at all; a 4096-wide reduction over bf16 inputs differs between eager and Inductor by reduction order alone, and a wheel check must not fail on that. ## Caveats, stated plainly **I could not run this** — no GPU on the machine I authored it on. Syntax and wiring are verified; the codegen behaviour is not. It needs one real run on a CUDA wheel before it's trusted. If it turns out the reduction goes persistent at these shapes, the test passes while covering nothing, and the reduction dim needs raising. **Coverage is heuristic-dependent.** If Inductor's persistent-reduction threshold changes, this silently stops exercising the bug rather than failing. That's noted in the docstring with a pointer to the inductor test, which has no such dependency. **On placement:** my own view is that compiler-codegen regressions belong in `test/inductor/`, not in the release smoke test — the smoke test validates that the binary works, and this adds a GPU-only, Triton-dependent, config-sensitive path to every wheel check. Adding it here anyway at @atalman's direction, since the escape happened on a release binary and the release gate is where he wants the net. Recording the tradeoff so the next person editing this file knows why it's here. --- Filed with the help of Claude Code. Pull Request resolved: pytorch#195024 Approved by: https://github.com/eellison, https://github.com/karthickai
orrangetabby17
pushed a commit
to orrangetabby17/pytorch
that referenced
this pull request
Sep 2, 2026
…ch#195306) test-infra's Release Binaries Validations checks out smoke_test.py from pytorch main but installs the published stable wheel. The regression check added in pytorch#195024 covers pytorchgh-194490, whose fix (pytorch#194786) landed after the 2.13 branch cut, so it reds all six linux CUDA 12.6 legs against the immutable 2.13.0 artifact with NameError('tmp19 is not defined'). Gate on the first release series containing the fix: 2.14, which has it via cherry-pick pytorch#194833. Reverting pytorch#195024 was the alternative, but it drops nightly coverage and leaves the next regression test added here to hit the same trap. Test Plan: 2.13.0 skips; 2.14.0, main and nightly run. ``` python -c " from torch.torch_version import TorchVersion for v in ['2.13.0+cu126','2.14.0+cu130','2.15.0a0+gitabc','2.15.0.dev20260829+cu126']: print(v, TorchVersion(v) < (2, 14)) " lintrunner -a --paths-cmd 'echo .ci/pytorch/smoke_test/smoke_test.py' ``` Authored with assistance from Claude Code. Pull Request resolved: pytorch#195306 Approved by: https://github.com/pytorchgreenlight, https://github.com/atalman
Sanskaaar1
pushed a commit
to Sanskaaar1/pytorch
that referenced
this pull request
Sep 8, 2026
… (pytorch#195024) Adds a wheel-level regression check for pytorchgh-194490. ## What it covers that the existing test doesn't pytorchgh-194490 was a 2.13 Inductor regression — a gather/scatter pair around a loop reduction produced Triton whose epilogue read a temporary defined only inside the reduction body: ``` tmp41 = tl.where(tmp38, tmp40, tmp19) ^ NameError: tmp19 is not defined ``` It was found by a user training Dion3 through vllm-project/speculators, not by CI. The fix (pytorchgh-194786) added `test_loop_epilogue_indirect_load_scope` to `test/inductor/test_indexing.py`, and **that remains the authoritative test** — it asserts codegen structure via FileCheck, which this cannot. But it compiles with `dynamic=True`, whereas the reported failure only appeared on the **second** compile, once a differing shape triggered *automatic* dynamic shapes. Those are different paths. So this check does two trials with different row counts and no `dynamic=` flag: the first compiles statically, the second generalizes. That's the route users actually hit. ## Fidelity to the reproducer The `torch.where` over a tensor predicate is kept deliberately — the failure surfaced *inside* a `tl.where`, so simplifying it to a plain lerp risks not regenerating the same codegen. I had simplified it initially and put it back for that reason. Shapes shrink from the reproducer's `(6, 4096, 4096)` to `2 x k x 4096`, but the **4096-wide reduction dim is preserved on purpose** so the reduction stays non-persistent and the loop path is actually emitted. Smaller and it becomes a persistent reduction and stops covering the bug. ## Blast radius Runs under the existing torch-compile gate (already skipped on Python 3.15+ and non-Linux/macOS), and returns early without CUDA — so CPU and Windows wheels are unaffected. Roughly two `torch.compile` invocations on ~128K-element tensors. Tolerances are loose (`rtol/atol 1e-4`). The assertion that matters is that codegen succeeds at all; a 4096-wide reduction over bf16 inputs differs between eager and Inductor by reduction order alone, and a wheel check must not fail on that. ## Caveats, stated plainly **I could not run this** — no GPU on the machine I authored it on. Syntax and wiring are verified; the codegen behaviour is not. It needs one real run on a CUDA wheel before it's trusted. If it turns out the reduction goes persistent at these shapes, the test passes while covering nothing, and the reduction dim needs raising. **Coverage is heuristic-dependent.** If Inductor's persistent-reduction threshold changes, this silently stops exercising the bug rather than failing. That's noted in the docstring with a pointer to the inductor test, which has no such dependency. **On placement:** my own view is that compiler-codegen regressions belong in `test/inductor/`, not in the release smoke test — the smoke test validates that the binary works, and this adds a GPU-only, Triton-dependent, config-sensitive path to every wheel check. Adding it here anyway at @atalman's direction, since the escape happened on a release binary and the release gate is where he wants the net. Recording the tradeoff so the next person editing this file knows why it's here. --- Filed with the help of Claude Code. Pull Request resolved: pytorch#195024 Approved by: https://github.com/eellison, https://github.com/karthickai
Sanskaaar1
pushed a commit
to Sanskaaar1/pytorch
that referenced
this pull request
Sep 8, 2026
…ch#195306) test-infra's Release Binaries Validations checks out smoke_test.py from pytorch main but installs the published stable wheel. The regression check added in pytorch#195024 covers pytorchgh-194490, whose fix (pytorch#194786) landed after the 2.13 branch cut, so it reds all six linux CUDA 12.6 legs against the immutable 2.13.0 artifact with NameError('tmp19 is not defined'). Gate on the first release series containing the fix: 2.14, which has it via cherry-pick pytorch#194833. Reverting pytorch#195024 was the alternative, but it drops nightly coverage and leaves the next regression test added here to hit the same trap. Test Plan: 2.13.0 skips; 2.14.0, main and nightly run. ``` python -c " from torch.torch_version import TorchVersion for v in ['2.13.0+cu126','2.14.0+cu130','2.15.0a0+gitabc','2.15.0.dev20260829+cu126']: print(v, TorchVersion(v) < (2, 14)) " lintrunner -a --paths-cmd 'echo .ci/pytorch/smoke_test/smoke_test.py' ``` Authored with assistance from Claude Code. Pull Request resolved: pytorch#195306 Approved by: https://github.com/pytorchgreenlight, https://github.com/atalman
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
Human context: fix for #194490) exposed by #184287 although the underlying cause was prior CSE / loop hoisting logic (and ultimately the fact that this is all tied to one very complicated file)..
Triton load placement and CSE lifetime used separate heuristics. An indirect load emitted inside a loop could consequently remain cached after loop closure and be reused by an epilogue even though its temporary did not dominate that use.
Use the selected load buffer as the source of truth for whether a CSE value survives loop closure. Also prevent loads carrying reduction masks from being hoisted before those masks are defined.
Test Plan:
The two test commands and git diff check pass. Lintrunner was invoked, but Pyrefly failed on unrelated repository-wide missing-attribute errors because this detached worktree has no initialized lintrunner data.
AI-Assisted: Author reviewed and validated all AI-generated content.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo