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
[executorch][cuda] Route 2-D depthwise and few-channel grouped convolutions to a Triton direct-stencil kernel - #25085
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.
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 14, 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):
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::convolutiontemplate: 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; andgrp_reduce, a parallel reduction over taps for few outputs. The router takes a call only inside the rangebenchmarks/conv/benchmark_depthwise.pymeasures as faster than Inductor; grouped convolutions whose per-group matrix product suits Inductor's tensor-core template stay there. The CUDA workflow adds a smalldepthwise_convmodel, which.ci/scripts/test_cuda_clean_runtime.shruns 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!