Repository navigation
[XNNPACK] Test addmm with non-default alpha or beta - #24814
JakeStevens wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24814
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 106 PendingAs of commit 8855927 with merge base bc5bd66 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review effort:max |
|
Claude finished @JakeStevens's task in 3m 17s —— View job The partitioner check is correct, but in the LLM export flow a scaled addmm with a transposed weight still gets rewritten to Detailed reviewPR Review: #24814Summary
Code Quality
Testing
RecommendationApprove The change is correct and strictly improves on main. The |
2c560b1 to
fa8a870
Compare
pytorch#24658 made the XNNPACK partitioner reject an addmm whose alpha or beta is not 1, and made the addmm-to-linear transform keep such an addmm. These tests also cover ConvertToLinearPass, which the LLM export builder runs on the whole program, and beta=0, which makes addmm ignore its input. ConvertToLinearPass keeps an addmm with a transposed weight and alpha or beta, and still turns the default one into a linear. The partitioner leaves an addmm with only alpha, only beta, or beta=0 on portable. This change was authored with Claude Code.
fa8a870 to
8855927
Compare
Summary
This PR started as a fix for the XNNPACK partitioner and the addmm-to-linear transform dropping addmm
alphaandbeta. #24658 landed the same fix on main, so after rebasing, this PR only adds tests.test_convert_to_linear.py::test_fp32_addmm_with_alpha_or_betaruns an addmm with a transposed weight throughConvertToLinearPass, whichextension/llm/export/builder.pyruns on the whole program. It checks that only the default addmm becomes a linear and that each output matches eager, for onlyalpha, onlybeta, andbeta=0.test_linear.py::test_fp32_addmm_with_alpha_or_betachecks that the partitioner leaves the same addmm on portable. They overlap with #24658'stest_only_an_addmm_without_scales_becomes_a_linearandtest_fp32_addmm_with_scales; what they add isbeta=0and theConvertToLinearPasspath.Test plan
python -m pytest backends/xnnpack/test/passes/test_convert_to_linear.pypython -m pytest backends/xnnpack/test/ops/test_linear.py -o addopts="" -k addmmThe first test fails with the
alphaandbetachecks removed fromaddmm_can_be_linear, and the second with them removed fromAddmmConfig.check_constraints.pytest.iniskipstest_linear.py, hence-o addopts="".This PR was authored with Claude Code.