Skip to content

Commit 541c083

Browse files
adabeytaNicolasHug
andauthored
Port deform_conv2d (CUDA) to stable ABI. (#9626)
Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
1 parent 2f411e7 commit 541c083

4 files changed

Lines changed: 624 additions & 368 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ set(TORCHVISION_STABLE_SOURCES
119119
${TVCPP}/ops/cuda/ps_roi_align_kernel.cu
120120
${TVCPP}/ops/deform_conv2d.cpp
121121
${TVCPP}/ops/cpu/deform_conv2d_kernel.cpp
122+
${TVCPP}/ops/cuda/deform_conv2d_kernel.cu
122123
${TVCPP}/io/image/cuda/decode_jpegs_cuda.cpp
123124
${TVCPP}/io/image/cuda/encode_jpegs_cuda.cpp
124125
${TVCPP}/io/image/cpu/encode_png.cpp

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def get_macros_and_flags():
187187
)
188188
STABLE_SOURCES.add(CSRS_DIR / ("ops/hip/roi_pool_kernel.hip" if IS_ROCM else "ops/cuda/roi_pool_kernel.cu"))
189189
STABLE_SOURCES.add(CSRS_DIR / ("ops/hip/roi_align_kernel.hip" if IS_ROCM else "ops/cuda/roi_align_kernel.cu"))
190+
STABLE_SOURCES.add(CSRS_DIR / ("ops/hip/deform_conv2d_kernel.hip" if IS_ROCM else "ops/cuda/deform_conv2d_kernel.cu"))
190191
STABLE_SOURCES.add(CSRS_DIR / ("ops/hip/ps_roi_pool_kernel.hip" if IS_ROCM else "ops/cuda/ps_roi_pool_kernel.cu"))
191192
STABLE_SOURCES.add(CSRS_DIR / ("ops/hip/ps_roi_align_kernel.hip" if IS_ROCM else "ops/cuda/ps_roi_align_kernel.cu"))
192193

torchvision/_autograd_registrations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def _deform_conv2d_setup_context(ctx, inputs, output):
169169

170170

171171
def _deform_conv2d_backward(ctx, grad_output):
172+
if grad_output.device.type == "cuda":
173+
torch._prims_common.alert_not_deterministic("compute_grad_input")
172174
input, weight, offset, mask, bias = ctx.saved_tensors
173175
grad_input, grad_weight, grad_offset, grad_mask, grad_bias = torch.ops.torchvision._deform_conv2d_backward(
174176
grad_output,

0 commit comments

Comments
 (0)