Repository navigation
PR #41980: [XLA:GPU] Insert ReshapeDecomposer before LayoutNormalization in AutotunerAndPostCleanup - #117755
Merged
Conversation
…ion in AutotunerAndPostCleanup Imported from GitHub PR openxla/xla#41980 📝 Summary of Changes Add the missing pipeline.AddPass<ReshapeDecomposer>() before LayoutNormalization in GpuCompiler::AutotunerAndPostCleanup — the third call site introduced by xla 6874dd2 without ReshapeDecomposer, mirroring the inline pattern at the three pre-existing sites. One-line change. 🎯 Justification #41481 added ReshapeDecomposer ahead of two LayoutNormalization sites to prevent a RET_CHECK when GemmRewriter pins a __cublas$lt$matmul output and a downstream reshape becomes non-bitcast. xla 6874dd23a1 added a third LayoutNormalization site without the precondition and reopened the bug, most visibly on ROCm under multi-process pytest (tests/nn_test.py::testDotProductAttention*, tests/pallas/gpu_paged_attention_test.py). AutotunerAndPostCleanup is the autotuner's boundary in the main pipeline: FissionBackend::ApplyConfig + InlineFissionedComputation can re-introduce a non-bitcast reshape there when the hipBLASLt candidate wins. Only that LayoutNormalization invocation is downstream of the layout shift, so the cleanup belongs at exactly that one site. The fix preserves --xla_disable_hlo_passes=reshape-decomposer (no encapsulation) and stays in a single named pipeline (no HLO-dump pollution). 🚀 Kind of Contribution 🐛 Bug Fix 🧪 Execution Test xla/tools/run_hlo_module on the jit_dot_general HLO from jax.nn.dot_product_attention(impl='xla'), using the cuBLAS-LT-first hack from #817 + XLA_FLAGS=--xla_gpu_autotune_level=0 to deterministically force the failing path on a single MI355X gfx950. Copybara import of the project: -- 94b1d0cf77c759a40830902af3815b56cfc32019 by Ruturaj4 <[email protected]>: [XLA:GPU] Insert ReshapeDecomposer before LayoutNormalization in AutotunerAndPostCleanup Restores LayoutNormalization::HandleReshape's ShapeUtil::ReshapeIsBitcast precondition on the GpuCompiler::AutotunerAndPostCleanup path. PR #41481 (commit 788f269) added ReshapeDecomposer before two LayoutNormalization invocations in xla/service/gpu/gpu_compiler.cc to satisfy that precondition after GemmRewriter pins __cublas$lt$matmul output layouts to {n-1,...,1,0}. Commit 6874dd2 ("Move gemm-conv autotuner pass after fusion passes behind a flag.") introduced a third LayoutNormalization invocation inside the new AutotunerAndPostCleanup helper without a matching ReshapeDecomposer, reopening the RET_CHECK whenever the autotuner fissions __triton_gemm back to __cublas$lt$matmul. Add the missing ReshapeDecomposer call, mirroring the inline pattern at the three pre-existing sites. AutotunerAndPostCleanup is the autotuner's boundary in the main pipeline; FissionBackend::ApplyConfig + InlineFissionedComputation can re-introduce a non-bitcast reshape there when the hipBLASLt candidate wins, and only that LayoutNormalization invocation is downstream of the layout shift. The fix preserves `--xla_disable_hlo_passes=reshape-decomposer` (no encapsulation) and stays in a single named pipeline (no HLO-dump pollution). Reproduces the original 41481 failure mode on ROCm under multi-process pytest (tests/nn_test.py::testDotProductAttention*, tests/pallas/gpu_paged_attention_test.py) once the autotuner picks the hipBLASLt fission backend. See PR #817's cuBLAS-LT-first patch + `XLA_FLAGS=--xla_gpu_autotune_level=0` for a deterministic single-process reproducer. Co-authored-by: magaonka <[email protected]> Merging this change closes #41980 PiperOrigin-RevId: 911205496
copybara-service
Bot
force-pushed
the
exported_pr_911114333
branch
from
May 6, 2026 09:46
d1edd2b to
c726caf
Compare
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.
PR #41980: [XLA:GPU] Insert ReshapeDecomposer before LayoutNormalization in AutotunerAndPostCleanup
Imported from GitHub PR openxla/xla#41980
📝 Summary of Changes
Add the missing pipeline.AddPass() before LayoutNormalization in GpuCompiler::AutotunerAndPostCleanup — the third call site introduced by xla 6874dd2 without ReshapeDecomposer, mirroring the inline pattern at the three pre-existing sites. One-line change.
🎯 Justification
#41481 added ReshapeDecomposer ahead of two LayoutNormalization sites to prevent a RET_CHECK when GemmRewriter pins a __cublas$lt$matmul output and a downstream reshape becomes non-bitcast. xla 6874dd23a1 added a third LayoutNormalization site without the precondition and reopened the bug, most visibly on ROCm under multi-process pytest (tests/nn_test.py::testDotProductAttention*, tests/pallas/gpu_paged_attention_test.py).
AutotunerAndPostCleanup is the autotuner's boundary in the main pipeline: FissionBackend::ApplyConfig + InlineFissionedComputation can re-introduce a non-bitcast reshape there when the hipBLASLt candidate wins. Only that LayoutNormalization invocation is downstream of the layout shift, so the cleanup belongs at exactly that one site.
The fix preserves --xla_disable_hlo_passes=reshape-decomposer (no encapsulation) and stays in a single named pipeline (no HLO-dump pollution).
🚀 Kind of Contribution
🐛 Bug Fix
🧪 Execution Test
xla/tools/run_hlo_module on the jit_dot_general HLO from jax.nn.dot_product_attention(impl='xla'), using the cuBLAS-LT-first hack from #817 + XLA_FLAGS=--xla_gpu_autotune_level=0 to deterministically force the failing path on a single MI355X gfx950.
Copybara import of the project:
--
94b1d0cf77c759a40830902af3815b56cfc32019 by Ruturaj4 [email protected]:
[XLA:GPU] Insert ReshapeDecomposer before LayoutNormalization in AutotunerAndPostCleanup
Restores LayoutNormalization::HandleReshape's ShapeUtil::ReshapeIsBitcast
precondition on the GpuCompiler::AutotunerAndPostCleanup path. PR #41481
(commit 788f269) added ReshapeDecomposer before two LayoutNormalization
invocations in xla/service/gpu/gpu_compiler.cc to satisfy that
precondition after GemmRewriter pins __cublas$lt$matmul output layouts
to {n-1,...,1,0}. Commit 6874dd2 ("Move gemm-conv autotuner pass after
fusion passes behind a flag.") introduced a third LayoutNormalization
invocation inside the new AutotunerAndPostCleanup helper without a
matching ReshapeDecomposer, reopening the RET_CHECK whenever the
autotuner fissions __triton_gemm back to __cublas$lt$matmul.
Add the missing ReshapeDecomposer call, mirroring the inline pattern at
the three pre-existing sites. AutotunerAndPostCleanup is the autotuner's
boundary in the main pipeline; FissionBackend::ApplyConfig +
InlineFissionedComputation can re-introduce a non-bitcast reshape there
when the hipBLASLt candidate wins, and only that LayoutNormalization
invocation is downstream of the layout shift. The fix preserves
--xla_disable_hlo_passes=reshape-decomposer(no encapsulation) and staysin a single named pipeline (no HLO-dump pollution).
Reproduces the original 41481 failure mode on ROCm under multi-process
pytest (tests/nn_test.py::testDotProductAttention*,
tests/pallas/gpu_paged_attention_test.py) once the autotuner picks the
hipBLASLt fission backend. See PR #817's cuBLAS-LT-first patch +
XLA_FLAGS=--xla_gpu_autotune_level=0for a deterministic single-processreproducer.
Co-authored-by: magaonka [email protected]
Merging this change closes #41980
FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#41980 from ROCm:fix-encapsulate-reshape-decomposer-in-layout-normalization 94b1d0cf77c759a40830902af3815b56cfc32019