Repository navigation
Conversation
ConvertToLinearPass rebuilds linear from an [add]mm by taking the weight from before its transpose. When constant propagation or a transpose removal pass has already folded that transpose into the constant, the [add]mm reads the transposed weight directly and the rebuilt linear transposes it a second time: square weights give wrong values and other shapes make the pass fail. Only convert nodes whose weight still comes through a transpose, and leave the rest as [add]mm. Fixes pytorch#10499
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24784
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 59bdd6d with merge base e0015e1 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @sohailshk! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@mcr229 @digantdesai @metascroy @JakeStevens bringing this to your attention |
|
The four red QNN jobs fail while downloading the QNN SDK, before anything in this PR runs: |
|
@claude review effort:max |
|
Claude finished @JakeStevens's task in 3m 31s —— View job The fix is correct for folded Detailed reviewPR Review: #24784SummaryThis PR stops Code Quality
Testing
RecommendationApprove. Ideally the |
…ct argument A bmm weight arrives through view_copy and expand_copy, so the direct argument check skipped bmm that was still convertible. A bmm whose bias add follows a view_copy is left alone, since the pass cannot find that bias and would drop it. Also drop the stale TODO about pytorch#10499 and test lowering of the folded graph.
|
@JakeStevens thanks for running the review. I addressed each point in 22b3f54:
|
|
Thanks for the quick turnaround on the earlier feedback. The bmm bias catch is a good find. One more issue before this lands, plus a few small cleanups.
Example: Suggested fix: stop at the same set of nodes The linear's own permute (and Smaller items
|
|
lintrunner failure seems to be unrelated |
can_convert followed args[0] past the partition inputs, so a transpose upstream of the linear (for example F.linear(x, (a.t() + 1).t()) once the permute pair at the weight is cancelled) counted as the weight transpose, and create_linear then transposed the weight a second time. A weight such as a cat, whose first arg is a list, raised AttributeError. Stop at the same nodes as find(): partition inputs and params, non-call_function nodes, dequants, and anything that is not a Node. Add tests for both cases and reword the docstring.
|
Thanks, you were right about the walk. I reproduced it with
The new tests import |
ConvertToLinearPass rebuilds linear from an [add]mm by taking the weight from before its transpose. When constant propagation or a transpose removal pass has already folded that transpose into the constant, the [add]mm reads the transposed weight directly and the rebuilt linear transposes it a second time: square weights give wrong values and other shapes make the pass fail. Only convert nodes whose weight still comes through a transpose, and leave the rest as [add]mm.
AI assistance: most of the code, tests and this description were drafted with Claude Code.
Fixes #10499
cc @GregoryComer @digantdesai @cbilgin @JakeStevens @nil-is-all