Skip to content

[Inductor] Lookup table fixes for addmm path (#180349) - #180349

Closed
PaulZhang12 wants to merge 1 commit into
pytorch:mainfrom
PaulZhang12:export-D100810662
Closed

PaulZhang12 wants to merge 1 commit into
pytorch:mainfrom
PaulZhang12:export-D100810662

Conversation

@PaulZhang12

@PaulZhang12 PaulZhang12 commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

@pytorch-bot

pytorch-bot Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit a2c6ce2 with merge base d3f8120 (image):

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.

@meta-codesync

meta-codesync Bot commented Apr 14, 2026

Copy link
Copy Markdown

@PaulZhang12 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100810662.

@meta-codesync meta-codesync Bot changed the title [Inductor] Lookup table fixes for addmm path [Inductor] Lookup table fixes for addmm path (#180349) Apr 14, 2026
PaulZhang12 added a commit to PaulZhang12/pytorch that referenced this pull request Apr 14, 2026
Summary:
Pull Request resolved: pytorch#180349

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Differential Revision: D100810662
@PaulZhang12
PaulZhang12 force-pushed the export-D100810662 branch 2 times, most recently from 48e8da2 to 399e738 Compare April 14, 2026 15:01
PaulZhang12 added a commit to PaulZhang12/pytorch that referenced this pull request Apr 14, 2026
Summary:
Pull Request resolved: pytorch#180349

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Differential Revision: D100810662
@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 14, 2026
PaulZhang12 added a commit to PaulZhang12/pytorch that referenced this pull request Apr 14, 2026
Summary:
Pull Request resolved: pytorch#180349

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662
Summary:
Pull Request resolved: pytorch#180349

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662
@PaulZhang12

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i "unrelated"

@pytorch-bot

pytorch-bot Bot commented Apr 14, 2026

Copy link
Copy Markdown

❌ 🤖 pytorchbot command failed:

@pytorchbot: error: unrecognized arguments: unrelated

usage: @pytorchbot [-h]
                   
                   {merge,revert,rebase,label,drci,lint,fix-lint,apply-lint,cherry-pick}
                   ...

Try @pytorchbot --help for more info.

@PaulZhang12

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 2 checks: pull / linux-docs / build-docs-cpp-false, pull / linux-docs / build-docs-python-false

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: revert (confidence=0.95); AI advisor: revert (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 Apr 14, 2026 •

Copy link
Copy Markdown

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


Diagnosis of Revert for PR #180349

  • Read the PR diff and changed test file
  • Follow CI failure links and read error logs
  • Diagnose root cause
  • Provide fix guidance

Root Cause

The test test_valid_lookup_table_entry_operation_addmm fails with:

ValueError: Expected 2 choices, got 1

The PR updated the test assertion for the addmm path at test/inductor/test_lookup_table.py:930-933 to expect 2 choices matching pattern triton_|addmm:

if operation == "addmm":
    add_preprocessing_fn(
        partial(verify_choice_names, pattern="triton_|addmm", expected_count=2)
    )

The intent was that the addmm path would produce 2 choices: one Triton template choice (triton_*) and one ATen fallback (addmm). However, in CI only 1 choice is produced at runtime.

The underlying issue is a mismatch between what the PR author's "default addmm path changes" actually produce on the CI GPU hardware (NVIDIA A10G / sm86) vs. what was expected. On the CI machines, when a lookup table entry matches for addmm, the default behavior only produces 1 choice (the Triton template from the lookup table), not the additional ATen addmm fallback choice. This is likely because the non-max-autotune addmm path (lines 653-666 in mm.py) returns early with just the ATen choices, while the max-autotune path's ATen choice generation depends on use_aten_gemm_kernels() and the lookup table configuration filtering.

The comment in the test code itself hints at this being a known issue:

# TODO (paulzhan): Update LookupTableChoices to return empty
#  (not fallback) when key matches

Is the Revert Legitimate?

Yes. The test assertion expects 2 choices for addmm but only 1 is produced on CI hardware. This is a real test failure, not a flaky or infrastructure issue — it failed consistently across 3 retries on both CUDA 12.8 and CUDA 13.0 runners.

Suggested Fix

The author should update the expected choice count for addmm to match what the runtime actually produces. There are two approaches:

  1. If the lookup table path for addmm should only return the Triton template (no ATen fallback): Change expected_count=2 to expected_count=1 and adjust the pattern to "triton_" only:

    if operation == "addmm":
        add_preprocessing_fn(
            partial(verify_choice_names, pattern="triton_", expected_count=1)
        )
  2. If the addmm path really should produce 2 choices (Triton + ATen fallback): The underlying tuned_addmm / LookupTableChoices logic needs to be fixed so that the ATen addmm choice is also included when a lookup table entry matches. This likely involves changes in torch/_inductor/kernel/mm.py or the LookupTableChoices class to ensure the ATen fallback is appended alongside the lookup table entry for the addmm operation.

The author should verify on the target hardware which behavior is correct and adjust accordingly.


@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 Apr 14, 2026
…)"

This reverts commit 30dee11.

Reverted #180349 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](#180349 (comment)))
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@PaulZhang12 your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Apr 14, 2026
BoyuanFeng pushed a commit that referenced this pull request Apr 15, 2026
Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: #180349
Approved by: https://github.com/njriasan
BoyuanFeng pushed a commit that referenced this pull request Apr 15, 2026
…)"

This reverts commit 30dee11.

Reverted #180349 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](#180349 (comment)))
pytorchmergebot pushed a commit to scotts/pytorch that referenced this pull request Apr 15, 2026
…h#180349)

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: pytorch#180349
Approved by: https://github.com/njriasan
@PaulZhang12

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -f "#180270 needs this test fix in trunk"

@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

gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…h#180349)

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: pytorch#180349
Approved by: https://github.com/njriasan
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…pytorch#180349)"

This reverts commit 30dee11.

Reverted pytorch#180349 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#180349 (comment)))
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…h#180349)

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: pytorch#180349
Approved by: https://github.com/njriasan
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…h#180349)

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: pytorch#180349
Approved by: https://github.com/njriasan
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…pytorch#180349)"

This reverts commit 30dee11.

Reverted pytorch#180349 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#180349 (comment)))
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…h#180349)

Summary:

Default addmm path changes now to match NVIDIA/AMD and to prevent performance regressions. We fix the lookup table tests accordingly

Test Plan: buck2 run mode/opt caffe2/test/inductor:lookup_table

Reviewed By: njriasan

Differential Revision: D100810662

Pull Request resolved: pytorch#180349
Approved by: https://github.com/njriasan
jeffdaily added a commit to ROCm/pytorch that referenced this pull request Sep 10, 2026
The previous commit removed the decorator-level ROCm skip on test_valid_lookup_table_entry but left an in-body skipTest for the addmm parametrization, so only mm, bmm and mm_plus_mm were actually re-enabled.

The addmm case failed on every ROCm runner in April 2026 because the test asserted exactly one "triton_" choice while the ROCm addmm path (pytorch#177130, pytorch#178929) keeps the hipblasLt bias-fused extern "addmm" choice next to the lookup-table Triton choice. pytorch#179955 disabled it on rocm, its malformed title kept the bot skip from applying (test-infra#7963), and pytorch#180316 added this in-body skip as a workaround. pytorch#180349 then changed the test to expect "triton_|addmm" with count 2 for addmm, which is the expectation it has today, and the workaround was never removed. With the skip gone the addmm case passes on gfx950 (ROCm 10.0): 25 consecutive isolated runs clean and the full test_lookup_table.py file passes (32 passed, 5 TMA-gated skips).

Test plan:

PYTORCH_TEST_WITH_ROCM=1 python -m pytest test/inductor/test_lookup_table.py -k test_valid_lookup_table_entry_operation_addmm
PYTORCH_TEST_WITH_ROCM=1 python -m pytest test/inductor/test_lookup_table.py

gfx942/gfx90a via the PR's ciflow labels.

Authored with the assistance of an AI agent (Claude).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants