Skip to content

Add fast path for contiguous innermost-dim reduction in var_mean.correction_out (#18791)#18791

Merged
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
pssrawat:export-D100111209
Apr 9, 2026
Merged

Add fast path for contiguous innermost-dim reduction in var_mean.correction_out (#18791)#18791
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
pssrawat:export-D100111209

Conversation

@pssrawat
Copy link
Copy Markdown
Contributor

@pssrawat pssrawat commented Apr 9, 2026

Summary:

Add a fast path to the portable var_mean.correction_out kernel for the common case of reducing a contiguous tensor over its innermost (last) dimension with matching input/output dtypes. Both passes (sum for mean, then squared deviations for variance) use tight loops over contiguous memory that the compiler can auto-vectorize, bypassing the generic MapReduceOverDimListPlan infrastructure.

Same activation conditions as the sum.IntList_out and mean.out fast paths: contiguous, single innermost dim, same dtype. Falls through to the original generic path otherwise.

Reviewed By: manuelcandales, bruceshuyu

Differential Revision: D100111209

@pssrawat pssrawat requested a review from manuelcandales as a code owner April 9, 2026 15:25
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 9, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 12 Pending

As of commit 97b22d9 with merge base c5e917d (image):

NEW FAILURE - The following job has failed:

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 Apr 9, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 9, 2026

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

@pssrawat pssrawat added the release notes: none Do not include this in the release notes label Apr 9, 2026
…ection_out (pytorch#18791)

Summary:

Add a fast path to the portable var_mean.correction_out kernel for the common case of reducing a contiguous tensor over its innermost (last) dimension with matching input/output dtypes. Both passes (sum for mean, then squared deviations for variance) use tight loops over contiguous memory that the compiler can auto-vectorize, bypassing the generic MapReduceOverDimListPlan infrastructure.

Same activation conditions as the sum.IntList_out and mean.out fast paths: contiguous, single innermost dim, same dtype. Falls through to the original generic path otherwise.

Reviewed By: manuelcandales, bruceshuyu

Differential Revision: D100111209
@meta-codesync meta-codesync bot changed the title Add fast path for contiguous innermost-dim reduction in var_mean.correction_out Add fast path for contiguous innermost-dim reduction in var_mean.correction_out (#18791) Apr 9, 2026
@pssrawat pssrawat force-pushed the export-D100111209 branch from b6ea005 to 97b22d9 Compare April 9, 2026 19:35
@meta-codesync meta-codesync bot merged commit 64cbc64 into pytorch:main Apr 9, 2026
160 of 164 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. fb-exported meta-exported release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants