Skip to content

Fold constant_pad_nd into convolution input padding#20553

Open
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D109871964
Open

Fold constant_pad_nd into convolution input padding#20553
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D109871964

Conversation

@JakeStevens

Copy link
Copy Markdown
Contributor

Summary:
When using padding="same" for a conv with even kernels, torch.export creates an explicit pad node, leading to a dq -> pad -> conv chain, which is not recognized, so conv ends up undelegated. The ReLU ends up in its own partition with a quantize. XNNPACK does not support this, resulting in xnn_status_unsupported_parameter.

This PR fixes this, allowing for full delegation to XNNPACK in this case, by pulling the pad into the same partition as the conv, and then re-folding it back into the conv itself in the XNNPACK input padding metadata, as XNNPACK does support this.

Differential Revision: D109871964

Summary:
When using padding="same" for a conv with even kernels, `torch.export` creates an explicit pad node, leading to a dq -> pad -> conv chain, which is not recognized, so conv ends up undelegated. The ReLU ends up in its own partition with a quantize. XNNPACK does not support this, resulting in `xnn_status_unsupported_parameter`.

This PR fixes this, allowing for full delegation to XNNPACK in this case, by pulling the pad into the same partition as the conv, and then re-folding it back into the conv itself in the XNNPACK input padding metadata, as XNNPACK *does* support this.

Differential Revision: D109871964
@JakeStevens JakeStevens requested a review from digantdesai as a code owner June 26, 2026 19:22
@pytorch-bot

pytorch-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit a04093b with merge base b919db7 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Jun 26, 2026
@meta-codesync

meta-codesync Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@JakeStevens has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109871964.

@github-actions

Copy link
Copy Markdown

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.

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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant