pytorch / pytorch/vision

Add Fused Separable Convolution

Open
#7,675 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🚀 The feature

Add a fused separable convolution op for fast Gaussian blur, and many other kernels.

ops.separable_conv2d(x, fx, fy, stride=1, padding=0)
ops.separable_conv_transposed2d(x, fx, fy, stride=1, padding=0)
ops.separable_conv3d(x, fx, fy, fz, stride=1, padding=0)
ops.separable_conv_transposed3d(x, fx, fy, fz, bias=b, stride=1, padding=0)
Motivation, pitch

Many filters can be implemented as separable filters. Gaussian, sinc, sobel, etc.

Right now the approach is to launch multiple consecutive F.conv2d, but this is often slower than a single full filter due to the overhead of kernel launch, memory writes, etc.

Separable convolutions can be written as a single CUDA kernel.

I believe there is already a function in CUDA, see: https://developer.download.nvidia.com/compute/cuda/1.1-Beta/x86_64_website/projects/convolutionSeparable/doc/convolutionSeparable.pdf

Alternatives

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue proposes new ops.separable_conv2d, ops.separable_conv_transposed2d, ops.separable_conv3d, and ops.separable_conv_transposed3d APIs, replacing multiple F.conv2d launches with fused kernels. Start by locating the existing F.conv2d path and reviewing the linked CUDA separable-convolution reference; the issue names no repository files or tests, so the implementation scope and validation plan need to be established first.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.