Skip to content

[ET-VK][ez] Fix duplicate placeholder target in create_constant_placeholder#18031

Merged
manuelcandales merged 5 commits intomainfrom
gh/SS-JIA/460/orig
Mar 10, 2026
Merged

[ET-VK][ez] Fix duplicate placeholder target in create_constant_placeholder#18031
manuelcandales merged 5 commits intomainfrom
gh/SS-JIA/460/orig

Conversation

@pytorchbot
Copy link
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #18013 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/460/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/460/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/460/orig
Differential Revision: D95807071
@diff-train-skip-merge

…holder

Pull Request resolved: #18013

When multiple pattern replacements (e.g., quantized conv and quantized linear)
share the same weight parameter, each independently calls
create_constant_placeholder to create a _sums placeholder with the same name.
torch.fx.Graph.create_node deduplicates node.name but not node.target, so the
second call produces a placeholder with a unique name but a duplicate target.
Since recompile() uses node.target for function parameter names, this causes a
SyntaxError: duplicate argument in function definition.

Fix by checking the state_dict/constants dicts (O(1) lookup) before creating the
node. If the name already exists, find and return the existing placeholder node.
ghstack-source-id: 349646647
@exported-using-ghexport

Differential Revision: [D95807071](https://our.internmc.facebook.com/intern/diff/D95807071/)
@pytorchbot pytorchbot requested a review from kimishpatel as a code owner March 10, 2026 08:53
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 10, 2026

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 08cb793 with merge base f09bd55 (image):

NEW FAILURE - The following job has failed:

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

@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@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 Mar 10, 2026
ssjia added 4 commits March 10, 2026 10:38
…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/)
…per tensor

Pull Request resolved: #18015

The Q8ta quantize/dequantize ops were limited to 4D tensors because the GLSL
block indexing infrastructure only handled 4 dimensions. This adds native 8D
support to the block indexing helpers so that tensors with 5+ dimensions (common
in models with batch dimensions) can be quantized/dequantized without falling
back to CPU.

The approach adds 8D versions of the block index functions (using TensorIndex
instead of TensorIndex4D), 8D block load/store macros, and an 8D block
decomposition function. Packed dim indices are guaranteed < 4, so the block
dimensions always operate on data[0] while dims 4-7 are handled as implicit
outer batch dimensions. The C++ dispatch functions are also updated to include
extra batch dims in the thread count computation.

This diff was authored with the assistance of an AI coding tool.
ghstack-source-id: 349646650
@exported-using-ghexport

Differential Revision: [D95807073](https://our.internmc.facebook.com/intern/diff/D95807073/)
Pull Request resolved: #18016

Implement quantized transposed 2D convolution for the Vulkan backend,
enabling int8 transposed convolutions used in decoder/upsampling networks.

The GLSL shader iterates over all kernel positions and derives valid input
positions via (output + padding - kernel) / stride. Invalid positions use
input_zp_packed so the precomputed weight_sums zero-point correction
remains consistent. Reuses the existing q8ta_conv2d weight packing and
workgroup size selection since, after the pattern matcher reshapes
transposed weights from (IC, OC, KH, KW) to (OC, KH*KW*IC), the layout
is identical to regular conv2d.

Supports hardware int8 dot product with software fallback, grouped
convolutions, optional bias and ReLU activation. Only dilation=1 is
supported (matching the ATen conv_transpose2d constraint).

This diff was authored with Claude.
ghstack-source-id: 349646651
@exported-using-ghexport

Differential Revision: [D95807070](https://our.internmc.facebook.com/intern/diff/D95807070/)
Pull Request resolved: #18017

Some quantized linear projections (e.g. in EdgeTAM's SpatialPerceiver / mask
decoder) decompose as aten.bmm instead of aten.mm. Add aten.bmm.default as an
anchor node in the quantized linear pattern detector so these nodes can be fused
into custom quantized linear ops. Reject bmm nodes with batch dim > 1 since the
custom ops assume a single batch.
ghstack-source-id: 349646654
@exported-using-ghexport

Differential Revision: [D95807072](https://our.internmc.facebook.com/intern/diff/D95807072/)
@SS-JIA SS-JIA self-requested a review as a code owner March 10, 2026 14:38
@manuelcandales manuelcandales merged commit 918e92b into main Mar 10, 2026
222 of 224 checks passed
@manuelcandales manuelcandales deleted the gh/SS-JIA/460/orig branch March 10, 2026 23:40
manuelcandales added a commit that referenced this pull request Mar 10, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants