Skip to content

Vectorize op_mean fast path with at::vec for innermost-dim reductions (#21986) - #21986

Open
pssrawat wants to merge 1 commit into
pytorch:mainfrom
pssrawat:export-D103682580
Open

Vectorize op_mean fast path with at::vec for innermost-dim reductions (#21986)#21986
pssrawat wants to merge 1 commit into
pytorch:mainfrom
pssrawat:export-D103682580

Conversation

@pssrawat

@pssrawat pssrawat commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary:

aten.mean.dim escapes the XNNPACK delegate 49 times for STITO model. This commit adds an optimized op_mean.cpp under kernels/optimized/cpu/ that vectorizes the same fast path with at::vec::Vectorized: per-row vector accumulation at the accumulator type's native width, vec_reduce_all to fold the lanes, then a scalar tail.

Also wires mean.out into optimized.yaml so the optimized_native_cpu_ops umbrella picks it up; portable remains the fallback for builds that don't use the optimized kernel set.

Differential Revision: D103682580

@pytorch-bot

pytorch-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 78 New Failures, 1 Cancelled Job, 3 Unrelated Failures, 5 Unclassified Failures

As of commit 97bf058 with merge base 227fb47 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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 Aug 20, 2026
@meta-codesync

meta-codesync Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

@meta-codesync meta-codesync Bot changed the title Vectorize op_mean fast path with at::vec for innermost-dim reductions Vectorize op_mean fast path with at::vec for innermost-dim reductions (#21986) Aug 20, 2026
pssrawat added a commit to pssrawat/executorch that referenced this pull request Aug 20, 2026
…pytorch#21986)

Summary:

`aten.mean.dim` escapes the XNNPACK delegate 49 times for STITO model. This commit adds an optimized `op_mean.cpp` under `kernels/optimized/cpu/` that vectorizes the same fast path with `at::vec::Vectorized`: per-row vector accumulation at the accumulator type's native width, `vec_reduce_all` to fold the lanes, then a scalar tail.

Also wires `mean.out` into `optimized.yaml` so the `optimized_native_cpu_ops` umbrella picks it up; portable remains the fallback for builds that don't use the optimized kernel set.

Differential Revision: D103682580
…pytorch#21986)

Summary:

`aten.mean.dim` escapes the XNNPACK delegate 49 times for STITO model. This commit adds an optimized `op_mean.cpp` under `kernels/optimized/cpu/` that vectorizes the same fast path with `at::vec::Vectorized`: per-row vector accumulation at the accumulator type's native width, `vec_reduce_all` to fold the lanes, then a scalar tail.

Also wires `mean.out` into `optimized.yaml` so the `optimized_native_cpu_ops` umbrella picks it up; portable remains the fallback for builds that don't use the optimized kernel set.

Differential Revision: D103682580
@pssrawat pssrawat added the release notes: none Do not include this in the release notes label Aug 20, 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. 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.

1 participant