[ET-VK][qlinear] Look through output view_copy when detecting output quantization#18014
Merged
meta-codesync[bot] merged 4 commits intogh/SS-JIA/461/basefrom Mar 10, 2026
Merged
Conversation
…quantization When `aten.linear` has 3D+ inputs, it decomposes into `view_copy -> mm -> view_copy`. The output view_copy between mm and the subsequent quantize_per_tensor node was preventing the pattern matcher from detecting output quantization, causing the match to fall through to `linear_q8ta_q8csw` instead of `q8ta_linear_gemv`. This caused a dtype mismatch during FakeTensor re-tracing in FusePatternsPass because `linear_q8ta_q8csw`'s composite implementation does not dequantize its input, producing int8 output where float32 was expected. Mirror the existing input-side view_copy handling (lines 99-104) on the output side so the quantize node is found through the view_copy. Differential Revision: [D95807075](https://our.internmc.facebook.com/intern/diff/D95807075/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18014
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 1 Cancelled JobAs of commit d7eda9c with merge base f09bd55 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Mar 9, 2026
This PR needs a
|
…ing output quantization" When `aten.linear` has 3D+ inputs, it decomposes into `view_copy -> mm -> view_copy`. The output view_copy between mm and the subsequent quantize_per_tensor node was preventing the pattern matcher from detecting output quantization, causing the match to fall through to `linear_q8ta_q8csw` instead of `q8ta_linear_gemv`. This caused a dtype mismatch during FakeTensor re-tracing in FusePatternsPass because `linear_q8ta_q8csw`'s composite implementation does not dequantize its input, producing int8 output where float32 was expected. Mirror the existing input-side view_copy handling (lines 99-104) on the output side so the quantize node is found through the view_copy. Differential Revision: [D95807075](https://our.internmc.facebook.com/intern/diff/D95807075/) [ghstack-poisoned]
manuelcandales
approved these changes
Mar 9, 2026
added 2 commits
March 9, 2026 12:11
…ing output quantization" When `aten.linear` has 3D+ inputs, it decomposes into `view_copy -> mm -> view_copy`. The output view_copy between mm and the subsequent quantize_per_tensor node was preventing the pattern matcher from detecting output quantization, causing the match to fall through to `linear_q8ta_q8csw` instead of `q8ta_linear_gemv`. This caused a dtype mismatch during FakeTensor re-tracing in FusePatternsPass because `linear_q8ta_q8csw`'s composite implementation does not dequantize its input, producing int8 output where float32 was expected. Mirror the existing input-side view_copy handling (lines 99-104) on the output side so the quantize node is found through the view_copy. Differential Revision: [D95807075](https://our.internmc.facebook.com/intern/diff/D95807075/) [ghstack-poisoned]
…ing output quantization" When `aten.linear` has 3D+ inputs, it decomposes into `view_copy -> mm -> view_copy`. The output view_copy between mm and the subsequent quantize_per_tensor node was preventing the pattern matcher from detecting output quantization, causing the match to fall through to `linear_q8ta_q8csw` instead of `q8ta_linear_gemv`. This caused a dtype mismatch during FakeTensor re-tracing in FusePatternsPass because `linear_q8ta_q8csw`'s composite implementation does not dequantize its input, producing int8 output where float32 was expected. Mirror the existing input-side view_copy handling (lines 99-104) on the output side so the quantize node is found through the view_copy. Differential Revision: [D95807075](https://our.internmc.facebook.com/intern/diff/D95807075/) [ghstack-poisoned]
420ce2c
into
gh/SS-JIA/461/base
213 of 221 checks passed
SS-JIA
pushed a commit
that referenced
this pull request
Mar 10, 2026
…quantization Pull Request resolved: #18014 When `aten.linear` has 3D+ inputs, it decomposes into `view_copy -> mm -> view_copy`. The output view_copy between mm and the subsequent quantize_per_tensor node was preventing the pattern matcher from detecting output quantization, causing the match to fall through to `linear_q8ta_q8csw` instead of `q8ta_linear_gemv`. This caused a dtype mismatch during FakeTensor re-tracing in FusePatternsPass because `linear_q8ta_q8csw`'s composite implementation does not dequantize its input, producing int8 output where float32 was expected. Mirror the existing input-side view_copy handling (lines 99-104) on the output side so the quantize node is found through the view_copy. ghstack-source-id: 349646653 @exported-using-ghexport Differential Revision: [D95807075](https://our.internmc.facebook.com/intern/diff/D95807075/)
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.
Stack from ghstack (oldest at bottom):
When
aten.linearhas 3D+ inputs, it decomposes intoview_copy -> mm -> view_copy. The output view_copy between mm and thesubsequent quantize_per_tensor node was preventing the pattern matcher
from detecting output quantization, causing the match to fall through
to
linear_q8ta_q8cswinstead ofq8ta_linear_gemv. This caused adtype mismatch during FakeTensor re-tracing in FusePatternsPass because
linear_q8ta_q8csw's composite implementation does not dequantize itsinput, producing int8 output where float32 was expected.
Mirror the existing input-side view_copy handling (lines 99-104) on the
output side so the quantize node is found through the view_copy.
Differential Revision: D95807075
cc @manuelcandales @digantdesai @cbilgin