Repository navigation
[ET-VK][runtime] Default to x-major local workgroups - #24716
Merged
Merged
Conversation
## Ulterior Motive
Closing the latency gap between ET-VK and LiteRT GPU on the FP16 DSR
(`ImageSRDenoiseNet`) model. Unfused `y + x * scale` residuals (83 per
inference, each a `mul` then an `add`) are the largest gap category on
Galaxy S24, Galaxy S25 and Pixel 9 Pro XL. Besides the missing fusion, ET-VK's
binary op itself reached only 9–41 GB/s on S24 against LiteRT's 46–50 GB/s for the
same tensors. The cause, the local workgroup shape, applies to most texture
ops, not just binary ops.
## Rationale
**What**: `default_pick_lwg` now fills X first (up to 64 invocations), then Y,
and Z only with what X and Y cannot hold. A new `pick_balanced_lwg` keeps the
previous behaviour (`{4, 4, 4}` for 3D grids) for permute, `view_copy` and the
q8csw conv2d im2col.
**Why**: For texture-extent grids, `{4, 4, 4}` makes a work group span four
depth slices of a texture3d tensor. Each slice is a separate 2D surface, so the
group's reads scatter across surfaces. On Adreno the cost grows with the number
of slices: on S24, an FP16 add of a 256-channel 189x252 tensor ran at 13 GB/s
with `{4, 4, 4}` and 48 GB/s with `{64, 1, 1}`. Mali-G715 gains about 20%.
Most other memory-bound texture ops gain the same way on S24 (`avg_pool2d`
1.78x, `constant_pad_nd` 1.55x, `pixel_shuffle` 1.44x, `embedding_q4gsw`
1.36x). Ops whose reads and writes walk different axes lose instead (permute up
to 3.3x slower, q8csw im2col up to 1.5x slower), so they keep the balanced
shape.
## Details
- Ops that dispatch a texture-extent grid through `default_pick_lwg`, e.g.
binary ops, split, unary ops, `clone`, `flip`, `slice_copy`, `select_copy`,
`constant_pad_nd`, pooling, `repeat`, `expand_copy`, upsample,
`pixel_shuffle`, `embedding_q4gsw`
- **Before**: `{4, 4, 4}` for grids with three non-trivial axes, `{8, 8, 1}`
for two.
- **After**: `{64, 1, 1}` when the grid is at least 62 wide; narrower grids
fill Y before Z (14x14x256 gets `{16, 4, 1}`, 7x7x64 gets `{8, 8, 1}`).
- Permute, `view_copy` (both its copy and dtype-convert dispatches) and the
q8csw conv2d im2col: unchanged, via `pick_balanced_lwg`. x-major would speed
up some of these on Pixel 8 Pro (permute up to 1.20x) but slows permute and
q8csw on S24 by up to 3.3x and small `view_copy` on Pixel 8 Pro by 1.37x.
- Linear grids (buffer storage): unchanged; they keep their required local
workgroup.
- Known losses kept: `max_pool2d` of 1x256x14x14 (`{8, 8, 1}`) is 1.19x slower
on S24 and neutral on S23, against 1.17–1.27x gains on the 1x64x378x504 case.
On Pixel 8 Pro, a few ops are 2–6% slower, e.g. `select_copy` of 1x256x14x14,
`avg_pool2d` and small binary ops (about 1 us).
- `etvk_ops_bench` registers `pick_balanced_lwg` so raw shader cases can
request it.
`default_pick_lwg` uses `LwgShape(6, 1, 0)` with the existing `fit_to_global`
refit, so it adapts to the grid like the other shared pickers.
Differential Revision: [D130014624](https://our.internmc.facebook.com/intern/diff/D130014624/)
ghstack-source-id: 466196984
Pull-Request: #24694
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24716
Note: Links to docs will display an error until the docs builds have been completed. ❌ 135 New Failures, 7 Unrelated Failures, 10 Unclassified FailuresAs of commit 271ff39 with merge base 728e13f ( 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:
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. |
This PR needs a
|
SS-JIA
approved these changes
Nov 6, 2026
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #24694 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/689/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/689/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/689/orig
Differential Revision: D130014624
@diff-train-skip-merge