Skip to content

Vulkan: use the 1x1 depthwise output tile for 5x5 kernels on Mali too - #22784

Open
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-dw-5x5-mali-tile
Open

Vulkan: use the 1x1 depthwise output tile for 5x5 kernels on Mali too#22784
msluszniak wants to merge 1 commit into
pytorch:mainfrom
msluszniak:ms/vulkan-dw-5x5-mali-tile

Conversation

@msluszniak

@msluszniak msluszniak commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

The 3x3 depthwise shader already drops to a 1x1 output tile on Mali. The 5x5 one kept the default 4x2 tile, so each invocation held 8 accumulators and gathered a separate 25 tap window for every one of them. That spills, and the cost is easy to see next to a 3x3 in the same model: a 5x5 dispatch covering 6000 work items took 4.6 ms while a 3x3 covering 20000 took 0.27 ms, roughly 57x the time per work item for 2.8x the arithmetic.

Same rule as 3x3, so Adreno and every other device are untouched.

Measured on a Mali-G76 (Galaxy S10+), fp16, interleaved GPU timestamps over 3 to 4 rounds. Depthwise convolution time, median:

model before after
ssdlite320_mobilenet_v3_large 19.05 ms 12.08 ms
lraspp_mobilenet_v3_large 15.04 ms 11.49 ms
deeplabv3_mobilenet_v3_large 14.93 ms 11.52 ms

Ranges do not overlap on any of the three. The individual 5x5 dispatches go from 4.52-4.68 ms to 1.42-1.46 ms (3.2x) and from 0.87-1.12 ms to 0.34-0.44 ms (2.6x).

Output is bit identical before and after.

cc @SS-JIA @manuelcandales @digantdesai @cbilgin

The 3x3 depthwise shader already drops to a 1x1 output tile on Mali. The 5x5 one
kept the default 4x2 tile, so each invocation held 8 accumulators and gathered a
separate 25 tap window for every one of them. That spills, and the cost is easy
to see next to a 3x3 in the same model: a 5x5 dispatch covering 6000 work items
took 4.6 ms while a 3x3 covering 20000 took 0.27 ms, roughly 57x the time per
work item for 2.8x the arithmetic.

Same rule as 3x3, so Adreno and every other device are untouched.

Measured on a Mali-G76 (Galaxy S10+), fp16, interleaved GPU timestamps over 3 to
4 rounds. Depthwise convolution time, median:

| model | before | after |
| --- | --- | --- |
| ssdlite320_mobilenet_v3_large | 19.05 ms | 12.08 ms |
| lraspp_mobilenet_v3_large | 15.04 ms | 11.49 ms |
| deeplabv3_mobilenet_v3_large | 14.93 ms | 11.52 ms |

Ranges do not overlap on any of the three. The individual 5x5 dispatches go from
4.52-4.68 ms to 1.42-1.46 ms (3.2x) and from 0.87-1.12 ms to 0.34-0.44 ms (2.6x).
Output is bit identical before and after.
@msluszniak
msluszniak requested a review from SS-JIA as a code owner September 13, 2026 12:59
@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Sep 13, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 15 Awaiting Approval

As of commit a344e8a with merge base 14dab10 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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 Sep 13, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

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"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

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. module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants