Skip to content

[ET-VK] Do not partition batch norm on a non-4d input - #22509

Open
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-batch-norm-4d-guard
Open

[ET-VK] Do not partition batch norm on a non-4d input#22509
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-batch-norm-4d-guard

Conversation

@msluszniak

@msluszniak msluszniak commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

add_native_batch_norm_node() asserts on both the input and the output sizes:

VK_CHECK_COND(in_sizes.size() == 4, "BatchNorm only support 4d tensor");
VK_CHECK_COND(out_sizes.size() == 4, "BatchNorm only support 4d tensor");

but the partitioner claims _native_batch_norm_legit_no_training at any rank. A batch norm on rank-3 activations, which is every conv1d model, therefore lowers cleanly and aborts at execute time rather than falling back.

This declines the node when the input is not 4d, following the existing _check_copy_is_noop / check_conv_node precedent.

Split out of #22399, which is now scoped to constant_pad_nd.

cc @SS-JIA @manuelcandales @digantdesai @cbilgin

add_native_batch_norm_node() asserts
VK_CHECK_COND(in_sizes.size() == 4, "BatchNorm only support 4d tensor") on
both the input and the output sizes, but the partitioner claims the node at any
rank. A batch norm on rank-3 activations, which is every conv1d model, lowers
cleanly and then aborts at execute time.

Decline the node instead so it falls back.

Split out of pytorch#22399, which is now scoped to constant_pad_nd.
@msluszniak
msluszniak requested a review from SS-JIA as a code owner September 3, 2026 07:21
@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Sep 3, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 15 Awaiting Approval

As of commit a17af0e with merge base 135a109 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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 Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

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.

@msluszniak msluszniak changed the title Vulkan: do not partition batch norm on a non-4d input [ET-VK] Do not partition batch norm on a non-4d input Sep 3, 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. module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants