Skip to content

[executorch][cuda] Route 2-D depthwise and few-channel grouped convolutions to a Triton direct-stencil kernel - #25085

Open
Gasoonjia wants to merge 2 commits into
gh/Gasoonjia/111/basefrom
gh/Gasoonjia/111/head
Open

Gasoonjia wants to merge 2 commits into
gh/Gasoonjia/111/basefrom
gh/Gasoonjia/111/head

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Inductor's Triton conv template is two to three orders of magnitude slower than a direct stencil on depthwise convolutions, and up to twenty times slower on grouped convolutions with few channels per group.

This diff adds the first triton::convolution template: a direct stencil for 2-D depthwise convolutions and grouped convolutions with up to 8 input channels per group and any channel multiplier, with dilation 1 and kernels up to 9x9, in fp32, fp16 or bf16, with NCHW- or channels-last-ordered inputs, an optional bias and asymmetric padding. Five schedules are timed at compile time: dw_flat, the portable base; dw_row8, a register sliding window for channel-contiguous inputs; dw_mult, all output channels of an input channel per load, for multipliers up to 16; grp_plane, one output channel per program with shared weights; and grp_reduce, a parallel reduction over taps for few outputs. The router takes a call only inside the range benchmarks/conv/benchmark_depthwise.py measures as faster than Inductor; grouped convolutions whose per-group matrix product suits Inductor's tensor-core template stay there. The CUDA workflow adds a small depthwise_conv model, which .ci/scripts/test_cuda_clean_runtime.sh runs with only the prebuilt runner and checks against eager.

Tests run every schedule against an FP64 reference, including a multiplier above dw_mult's bound, lower depthwise and grouped blocks with both lowering APIs, and cover routed and kept calls.

This diff was authored with Claude Code.

Differential Revision: D129596197

NOTE FOR REVIEWERS: This PR has internal Meta-specific changes or comments, please review them on Phabricator!

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Pending, 1 Unrelated Failure

As of commit cfc5893 with merge base dea39f0 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@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.

[ghstack-poisoned]
@Gasoonjia
Gasoonjia deployed to upload-benchmark-results November 15, 2026 14:55 — with GitHub Actions Active

This branch was successfully deployed

1 active and 1 inactive deployments
upload-benchmark-results — cfc58931 Deployed Nov 15, 2026 by Gasoonjia via upload-benchmark-results #22539
cadence — cfc58931 Deployed Nov 15, 2026 by Gasoonjia via hifi-op-test / hifi4 #38441
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.

1 participant