You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ET-VK][conv2d] Use row-aligned work groups for non-reducing pointwise convs on Mali - #24859
Optimizing the FP16 1x1 convolutions of the DSR model on Mali (Pixel 9 Pro XL).
Rationale
What: On Mali, Half wide tile conv2d_pw_tiled convolutions with at least as many 4-channel output slices as input slices, 8, 16, 32 or 64 channel tiles and at least 8192 pixel tiles use work groups of up to 896 threads: y spans the channel tiles and x divides the row of pixel tiles. Other convolutions keep the 512 thread picks. On every GPU, wide tile work groups also keep x large enough for the work group count on x to stay within the device limit.
Why: The six DSR 1x1 layers that qualify take 0.771 to 1.005 of the time with these work groups on a Pixel 9 Pro XL (Mali-G715), and the nine 1x1 layers of the model take 0.928. Applied to every convolution with at least as many output as input slices, the same work groups took up to 1.11 of the time on other channel tile counts and 0.92 to 1.06 on outputs below 8192 pixel tiles, so those shapes keep their current work groups. The rule stays on Mali: on an earlier version of this stack, Adreno 740, 750 and 840 took 1.030, 1.038 and 1.045 of the time over the nine layers with it (G7 up to 1.33), and Xclipse 940 up to 1.99 per layer.
Details
Before: Mali Half wide tile dispatches use 512 thread work groups: y is the channel tile count rounded up to a power of two (at most 32), and x takes the rest.
After: with N4 = ceil(C_out / 4), K4 = ceil(C_in / 4) and P = ceil(N4 / 2) (the channel tiles), a convolution with N4 >= K4, P equal to 8, 16, 32 or 64 and at least 8192 pixel tiles (ceil(W / 2) * ceil(H / 2)) uses the local size {x, P, 1}, where x is the largest divisor of ceil(W / 2) with x * P <= 896, or floor(896 / P) if that divisor is below half of it. The 896 threads are halved while they exceed the device's work group invocation or x size limit, as the 512 thread pick already is. No shader changes; Adreno, Xclipse, Float and the narrow tile are unchanged.
Work group count on x
Before: Wide tile dispatches put every pixel tile on x, and nothing bounds the resulting work group count. With 64 thread work groups (GPUs other than Mali and Adreno, x = 4 above 8 channel tiles), a 1024x1024 output already needs 65536 work groups on x, one more than the usual maxComputeWorkGroupCount[0], and the dispatch throws.
After: x is at least ceil(pixel tiles / maxComputeWorkGroupCount[0]). The row-aligned pick falls back to floor(896 / P) when its divisor is smaller, and the other picks raise min_x to the smallest power of two at or above it, up to the thread count. Below the limit, every pick is unchanged.
meta-claBot
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
Nov 10, 2026
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"
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
CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.meta-exported
1 participant
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.
Stack from ghstack (oldest at bottom):
Ulterior Motive
Optimizing the FP16 1x1 convolutions of the DSR model on Mali (Pixel 9 Pro XL).
Rationale
What: On Mali, Half wide tile
conv2d_pw_tiledconvolutions with at least as many 4-channel output slices as input slices, 8, 16, 32 or 64 channel tiles and at least 8192 pixel tiles use work groups of up to 896 threads: y spans the channel tiles and x divides the row of pixel tiles. Other convolutions keep the 512 thread picks. On every GPU, wide tile work groups also keep x large enough for the work group count on x to stay within the device limit.Why: The six DSR 1x1 layers that qualify take 0.771 to 1.005 of the time with these work groups on a Pixel 9 Pro XL (Mali-G715), and the nine 1x1 layers of the model take 0.928. Applied to every convolution with at least as many output as input slices, the same work groups took up to 1.11 of the time on other channel tile counts and 0.92 to 1.06 on outputs below 8192 pixel tiles, so those shapes keep their current work groups. The rule stays on Mali: on an earlier version of this stack, Adreno 740, 750 and 840 took 1.030, 1.038 and 1.045 of the time over the nine layers with it (G7 up to 1.33), and Xclipse 940 up to 1.99 per layer.
Details
maxComputeWorkGroupCount[0], and the dispatch throws.maxComputeWorkGroupCount[0]). The row-aligned pick falls back to floor(896 / P) when its divisor is smaller, and the other picks raise min_x to the smallest power of two at or above it, up to the thread count. Below the limit, every pick is unchanged.Differential Revision: D130986963