Repository navigation
[Inductor] Don't expand bias for addmm in max-autotune mode (#180270) - #180270
PaulZhang12 wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/180270
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 New Failures, 3 Unrelated FailuresAs of commit 9053f3b with merge base d90db5c ( NEW FAILURES - The following jobs have failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
UNSTABLE - The following jobs are 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
|
4607714 to
9b790dc
Compare
|
@PaulZhang12 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100670723. |
9b790dc to
e042c1e
Compare
|
@PaulZhang12 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100670723. |
Summary: Pull Request resolved: #180270 Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723
…180270) Summary: Pull Request resolved: pytorch#180270 Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723
e042c1e to
6aa6bad
Compare
…180270) Summary: Pull Request resolved: pytorch#180270 Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723
6aa6bad to
9053f3b
Compare
|
@pytorchbot merge -i (Initiating merge automatically since Phabricator Diff has merged, merging with -i because oss signals were bypassed internally) |
…e_addmm PR #180270 fixes the bias handling in addmm max-autotune so that 1D bias no longer needs to be manually reshaped to 2D with broadcast stride. Generated-by: Claude Code (claude-opus-4-5-20251101)
|
@pytorchbot merge -i "unit test failure fixed in #180349" |
|
❌ 🤖 pytorchbot command failed: Try |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 5 checks: rocm-mi300 / linux-noble-rocm-py3.12-mi300 / test (default, 3, 6, linux.rocm.gpu.gfx942.1), rocm-mi300 / linux-noble-rocm-py3.12-mi300 / test (default, 6, 6, linux.rocm.gpu.gfx942.1), B200 Smoke Tests / linux-jammy-cuda12.8-py3.10-gcc11-sm100 / test (smoke_b200, 1, 1, linux.dgx.b200), trunk / linux-jammy-rocm-py3.10-mi355 / test (default, 4, 6, linux.rocm.gpu.gfx950.1, unstable), trunk / linux-jammy-rocm-py3.10-mi355 / test (distributed, 2, 3, linux.rocm.gpu.gfx950.2, unstable) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…e_addmm PR #180270 fixes the bias handling in addmm max-autotune so that 1D bias no longer needs to be manually reshaped to 2D with broadcast stride. Generated-by: Claude Code (claude-opus-4-5-20251101)
…#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: #180270 Approved by: https://github.com/atalman
…180270) (#180270)" This reverts commit 043b807. Reverted #180270 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](#180270 (comment)))
…#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: #180270 Approved by: https://github.com/atalman
…180270) (pytorch#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: pytorch#180270 Approved by: https://github.com/atalman
…180270) (pytorch#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: pytorch#180270 Approved by: https://github.com/atalman
…ytorch#180270) (pytorch#180270)" This reverts commit 043b807. Reverted pytorch#180270 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](pytorch#180270 (comment)))
…180270) (pytorch#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: pytorch#180270 Approved by: https://github.com/atalman
…180270) (pytorch#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: pytorch#180270 Approved by: https://github.com/atalman
…ytorch#180270) (pytorch#180270)" This reverts commit 043b807. Reverted pytorch#180270 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](pytorch#180270 (comment)))
…180270) (pytorch#180270) Summary: Relanding D100157470 Test Plan: `test_addmm_1d_bias_no_reinterpret_tensor` Differential Revision: D100670723 Pull Request resolved: pytorch#180270 Approved by: https://github.com/atalman
tuned_addmm read inp.get_stride()[0] and only then checked that the bias is 2-D, so a 0-dim bias raised IndexError out of the lowering. Short-circuit evaluation cannot help when the guard follows the access it protects. The bias reaches this line unexpanded since pytorch#180270, which is what made a scalar bias able to get here at all. Claude-Session: https://claude.ai/code/session_017VFnedDBoeAQRMCayVzTmt
) ## Linked issue or supporting maintainer Fixes #204950 ## BC-breaking? No ## Summary (human written only) Compiling with `max_autotune` crashes on the first call (`NameError: buf3`) when an `addmm` has a non-contiguous bias. The reporter hit it through a 1x1 convolution. The change makes the bias realized once, and in the autotune path the ATen candidates read the same buffer the templates do. The plain non-autotune path is unchanged, and so is `beta == 0` without autotuning. ## Agent details (if applicable) Used tool is Cursor with Claude Opus 5.5: produced repro that showed `buf3` being dropped as dead code, initial patch draft, the regression test, and the GPU verification scripts. Since #180270, `tuned_addmm` realizes the bias twice: the GEMM templates read the copy `mm_args` expands, and the ATen choices read a separate `realize_inputs(inp)` copy. The `MultiTemplateBuffer` depends only on the first, so the second is eliminated as dead, and finalizing to the ATen choice (forced in the issue by a layout conflict on the weight) emits `extern_kernels.addmm(buf3, ...)` with `buf3` never computed. `inp_expanded` is now a stride-0 view of the realized bias, and with `beta == 0` the autotune-path ATen choices read the zeros the templates read. That keeps an `[N]` zeros fill even when ATen is the only choice; switching ATen to the zeros only when a template is added, as `tuned_baddbmm` does, is left for a follow-up. <details> <summary>Test results</summary> Run on H100 and GB200 against a nightly at cb41f4e (Triton 3.9.0), with the new test added before the fix: ``` test_max_autotune.py -k "addmm or bias or extern", test_mmdecomp.py H100 GB200 before the fix 291 passed, 4 failed 259 passed, 4 failed after the fix 295 passed 263 passed ``` The 4 failures before the fix are `test_addmm_strided_bias_extern_fallback` (`beta` 0 and 1, in `TestMaxAutotune` and `TestMaxAutotuneAsyncPipelined`); no other test changes result. The reproducer from #204950 raises `NameError` before the fix and matches eager after it on both GPUs, as do its variants with contiguous inputs, ATen-only and Triton-only GEMM backends, `benchmark_template_fusion=False`, and an `addmm` whose bias is a view of a Triton GEMM input. </details> Pull Request resolved: #205740 Approved by: https://github.com/eellison
Summary:
Relanding D100157470
Test Plan:
test_addmm_1d_bias_no_reinterpret_tensorDifferential Revision: D100670723
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo