Skip to content

[ExecuTorch][WebGPU] Optimize reduction-family kernels to cooperative shared-memory#21225

Merged
meta-codesync[bot] merged 3 commits into
gh/JCNTH/185/basefrom
gh/JCNTH/185/head
Jul 24, 2026
Merged

[ExecuTorch][WebGPU] Optimize reduction-family kernels to cooperative shared-memory#21225
meta-codesync[bot] merged 3 commits into
gh/JCNTH/185/basefrom
gh/JCNTH/185/head

Conversation

@JCNTH

@JCNTH JCNTH commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
@exported-using-ghexport

Differential Revision: D112257649

Differential Revision: D112257649

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 30 Pending

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

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

This was referenced Jul 22, 2026
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
JCNTH added a commit that referenced this pull request Jul 24, 2026
… shared-memory

Pull Request resolved: #21225

Problem: The reduction ops (amax/amin/argmax/sum/mean), softmax/log_softmax, and native_group_norm's reduce pass used naive one-thread-per-row serial loops — far below Vulkan's optimization level, where backends/vulkan/runtime/graph/ops/glsl/reduce.glsl uses a cooperative shared-memory reduction.

Solution: Rewrite each to Vulkan's cooperative design — one workgroup per reduction row/group, each thread reduces a strided slice into a workgroup shared array, thread 0 aggregates the partials. Dispatch changed to one workgroup per row. argmax preserves torch's first-index tie-break; softmax keeps numerical stability + the log variant.
ghstack-source-id: 406388754
@exported-using-ghexport

Differential Revision: [D112257649](https://our.internmc.facebook.com/intern/diff/D112257649/)
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.

2 participants