[inductor] Fix index_reduce_ on view inputs raising AssertionError in assert_functional_graph#176606
[inductor] Fix index_reduce_ on view inputs raising AssertionError in assert_functional_graph#176606aorenste wants to merge 3 commits intogh/aorenste/207/basefrom
index_reduce_ on view inputs raising AssertionError in assert_functional_graph#176606Conversation
…in `assert_functional_graph` The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176606
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (7 Unrelated Failures)As of commit 766cfa8 with merge base d87ebee ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
…in `assert_functional_graph` The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. ghstack-source-id: 8468ef5 Pull Request resolved: #176606
…rtionError in `assert_functional_graph`" The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
…in `assert_functional_graph` The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. ghstack-source-id: 292cd14 Pull Request resolved: #176606
| out2 = run_session(100, 16, 64, self.device) | ||
| self.assertEqual(out2.device.type, self.device) | ||
|
|
||
| def test_index_reduce_on_view_input(self): |
There was a problem hiding this comment.
Do we know why this causes a failure for Pallas backend? Let's make sure those signals are good before landing
There was a problem hiding this comment.
According to claude the pallas backend doesn't support index_reduce_ so the only solution was to expect it to fail.
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
This PR needs a
|
|
@pytorchbot merge |
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 |
|
This broke ROCm CI. PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=4 PYTORCH_TEST_WITH_ROCM=1 python test/test_meta.py TestMetaCUDA.test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 GH job link HUD commit link |
|
@pytorchbot revert -c weird -m "trunk was passing pre-merge, but failures appeared post-merge only. see test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 GH job link HUD commit link" |
|
@pytorchbot successfully started a revert job. Check the current status here. |
|
@jeffdaily already pinged the team, but feel free to find commit that causes conflicts and revert as well |
|
@pytorchbot revert -c weird -m "trunk was passing pre-merge, but failures appeared post-merge only. see test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 GH job link HUD commit link" |
|
@pytorchbot successfully started a revert job. Check the current status here. |
Reverting PR 176606 failedReason: Command Details for Dev Infra teamRaised by workflow job |
|
rip I thought I got the merge conflict |
…hader codegen (#176436)" This reverts commit 4926192. Reverted #176436 on behalf of https://github.com/zou3519 due to sorry I need to revert this in order to revert #176606 ([comment](#176436 (comment)))
…degen (#176436) Metal Shading Language rejects implicit float-to-bfloat conversions, so bare float literals like `0.0` in generated shaders cause compilation failures when the target variable is `bfloat` (or `half`). Three codegen methods were affected: - `constant()` ignored its `dtype` parameter and returned raw literals. - `masked()` assigned a bare literal in the else-branch (`} else tmp = 0.0;`). - `where()` passed a bare literal through the ternary without casting. All three now emit `static_cast<bfloat>(...)` / `static_cast<half>(...)` where needed. Tests added for half-precision constants, reductions, and conditionals. Pull Request resolved: #176436 Approved by: https://github.com/malfet
|
@pytorchbot revert -c weird -m "trunk was passing pre-merge, but failures appeared post-merge only. see test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 GH job link HUD commit link" |
|
@pytorchbot successfully started a revert job. Check the current status here. |
…onError in `assert_functional_graph` (#176606)" This reverts commit 354b0ff. Reverted #176606 on behalf of https://github.com/zou3519 due to trunk was passing pre-merge, but failures appeared post-merge only. see test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 [GH job link](https://github.com/pytorch/pytorch/actions/runs/22771325935/job/66057190983) [HUD commit link](https://hud.pytorch.org/pytorch/pytorch/commit/354b0ff88ca5350b68da5d1dee8f3e32dcede563) ([comment](#176606 (comment)))
|
@aorenste your PR has been successfully reverted. |
…rtionError in `assert_functional_graph`" The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
…in `assert_functional_graph` The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes #144846 Authored with Claude. ghstack-source-id: ad3ad51 Pull Request resolved: #176606
|
@pytorchbot merge |
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 |
…in `assert_functional_graph` (pytorch#176606) The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes pytorch#144846 Authored with Claude. Pull Request resolved: pytorch#176606 Approved by: https://github.com/Lucaskabela
…hader codegen (pytorch#176436)" This reverts commit 4926192. Reverted pytorch#176436 on behalf of https://github.com/zou3519 due to sorry I need to revert this in order to revert pytorch#176606 ([comment](pytorch#176436 (comment)))
…onError in `assert_functional_graph` (pytorch#176606)" This reverts commit 354b0ff. Reverted pytorch#176606 on behalf of https://github.com/zou3519 due to trunk was passing pre-merge, but failures appeared post-merge only. see test/test_meta.py::TestMetaCUDA::test_dispatch_symbolic_meta_outplace_all_strides_index_fill_cuda_float32 [GH job link](https://github.com/pytorch/pytorch/actions/runs/22771325935/job/66057190983) [HUD commit link](https://hud.pytorch.org/pytorch/pytorch/commit/354b0ff88ca5350b68da5d1dee8f3e32dcede563) ([comment](pytorch#176606 (comment)))
…in `assert_functional_graph` (pytorch#176606) The `_index_fill` decomposition used mutable `empty_like + copy_` to restore strides when `index_copy` returned a contiguous tensor, which broke the functional graph invariant. Replace with the functional `prims.copy_strided` prim that does the same thing as a single op. Fixes pytorch#144846 Authored with Claude. Pull Request resolved: pytorch#176606 Approved by: https://github.com/Lucaskabela, https://github.com/mlazos
Stack from ghstack (oldest at bottom):
index_reduce_on view inputs raising AssertionError inassert_functional_graph#176606The
_index_filldecomposition used mutableempty_like + copy_torestore strides when
index_copyreturned a contiguous tensor, whichbroke the functional graph invariant. Replace with the functional
prims.copy_stridedprim that does the same thing as a single op.Fixes #144846
Authored with Claude.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo