Skip to content

Vulkan: keep a reshape that changes the last dim before a quantized linear - #24116

Merged
SS-JIA merged 2 commits into
pytorch:mainfrom
msluszniak:ms/vulkan-qlinear-keep-input-view
Nov 3, 2026
Merged

SS-JIA merged 2 commits into
pytorch:mainfrom
msluszniak:ms/vulkan-qlinear-keep-input-view

Conversation

@msluszniak

Copy link
Copy Markdown
Contributor

Summary

QuantizedLinearMatch skipped any view_copy feeding a quantized linear. A reshape that changes the last dim (merging attention heads, [S, H, D] -> [S, H * D]) was skipped too, so linear_q4gsw got the [S, H, D] tensor and FusePatternsPass failed. Now only a view that keeps the last dim is skipped.

Test plan

python -m unittest backends.vulkan.test.test_vulkan_passes (new test_fuse_q4gsw_linear_keeps_preceding_reshape fails without the fix).

cc @SS-JIA @manuelcandales @digantdesai @cbilgin @nil-is-all

@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Oct 23, 2026
@msluszniak
msluszniak requested a review from SS-JIA as a code owner October 23, 2026 14:35
@pytorch-bot

pytorch-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ 3 Pending, 1 Unrelated Failure

As of commit 1bf0cc8 with merge base 1a0ffe8 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2026
@nil-is-all nil-is-all added the release notes: vulkan Changes to the Vulkan backend delegate label Oct 23, 2026
@executorch-triage executorch-triage Bot added the community: contribution PRs coming from community (excluding hardware partners) label Oct 23, 2026
@SS-JIA

SS-JIA commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@msluszniak changes LGTM but lintrunner is failing, so can't merge just yet!

@msluszniak

Copy link
Copy Markdown
Contributor Author

@SS-JIA Done ;)

@msluszniak
msluszniak force-pushed the ms/vulkan-qlinear-keep-input-view branch from f9ce1ae to 156f422 Compare October 30, 2026 13:37
…ntized linear

QuantizedLinearMatch skipped any view_copy feeding the linear, assuming it is the
leading-dim flatten from aten.linear's N-D decomposition. A reshape that merges
attention heads ([S, H, D] -> [S, H * D]) was skipped too, so the fused
et_vk.linear_q4gsw received the [S, H, D] tensor and lowering failed in the fake
kernel. Skip the view only when it keeps the last dim.
@SS-JIA
SS-JIA force-pushed the ms/vulkan-qlinear-keep-input-view branch from 156f422 to 1bf0cc8 Compare November 3, 2026 00:10
@SS-JIA
SS-JIA merged commit 35e961e into pytorch:main Nov 3, 2026
216 of 217 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. community: contribution PRs coming from community (excluding hardware partners) module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ release notes: vulkan Changes to the Vulkan backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants