feat(ops): add PyTorch-aligned convolution operators - #882
Merged
Conversation
voltjia
force-pushed
the
feat/add-conv-operators
branch
from
August 6, 2026 02:17
7521a86 to
302ffe9
Compare
voltjia
force-pushed
the
feat/add-conv-operators
branch
from
August 6, 2026 06:33
302ffe9 to
40caf51
Compare
voltjia
marked this pull request as ready for review
August 6, 2026 07:20
This was referenced Aug 6, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Conv1d,Conv2d,Conv3d, andConvolutionoperators.ops/convolutionpath.ConvInfinilmpublic API and tests while reusing the same dimension-independent kernel.std::stringandstd::vector<int64_t>overloads distinct in generated Python bindings, with focused regression coverage.Motivation
ConvInfinilmwas introduced for InfiniLM integration and is now deprecated. The new operators provide standard public replacements aligned with PyTorch while retaining InfiniOps' trailing explicit output convention.The shared CUDA implementation previously lived under
ops/conv, even though no corresponding publicConvoperator existed. This revision adds the real PyTorch-alignedConvolutionoperator and places the shared implementation underops/convolution.API Alignment
conv1dconv1d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) -> Tensorconv1d(input, weight, bias, stride, padding, dilation, groups, out);paddingis eithervector<int64_t>orstringconv1dconv2dconv2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) -> Tensorconv2d(input, weight, bias, stride, padding, dilation, groups, out);paddingis eithervector<int64_t>orstringconv2dconv3dconv3d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) -> Tensorconv3d(input, weight, bias, stride, padding, dilation, groups, out);paddingis eithervector<int64_t>orstringconv3dconvolutionconvolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups) -> Tensorconvolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups, out)torch.convolution, fixed ATen schemaThe explicit
outtensor is placed after inputs and attributes perCONTRIBUTING.md. Numeric scalar/default convenience forms are intentionally not added. String padding acceptsvalidandsame, andsamerequires unit stride as in PyTorch.The
Convolutioninterface represents every upstream parameter. This PR intentionally reuses only the existing forward 1D/2D/3D kernel: descriptor construction asserts fortransposed=trueand for nonzerooutput_paddingvalues. Transposed convolution implementation is outside this PR's scope.Type of Change
feat- new feature / new operator / new platformfix- bug fixperf- performance improvement (no behavioral change)refactor- code restructuring without behavior changetest- adding or fixing tests onlydocs- documentation onlybuild/ci- build system or CI configurationchore- tooling, formatting, or other non-code changesPlatforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Smoke Test Result
Current revision:
40caf513.Local interface and formatting checks passed. A fresh NVIDIA build and runtime test is pending because
ssh nvidiacurrently times out before authentication at172.22.163.40:14735.The preceding revision
302ffe99passed an NVIDIA A100-SXM4-80GB smoke build and smoke tests inaccelerator-dev/nvidia:latest:Test Results on Supported Platforms
Current revision checks:
Preceding revision focused NVIDIA runtime result:
Benchmark / Performance Impact
N/A. The public operators reuse the existing
ConvInfinilmCUDA kernel; this PR does not claim a performance change.Notes for Reviewers
ConvInfinilmremains public, deprecated, and covered by its existing tests.src/native/cuda/ops/convolution/kernel.{h,cuh}; there is no unmatchedops/convdirectory and no forwarding header.Conv1d,Conv2d, andConv3din separate operator directories. The newConvolutionregistration is also separate.int. This prevents a recognizedstd::string paddingoverload from being rewritten as a vector.torch_ops.yamlor generated artifact is changed.