Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,11 @@ void deformable_im2col(
out_w >
std::numeric_limits<int32_t>::max());

const cudaStream_t stream = at::cuda::getCurrentCUDAStream();
if (use_64bits_indexing) {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
input.scalar_type(), "deformable_im2col", ([&] {
deformable_im2col_kernel<scalar_t, int64_t><<<blocks, threads>>>(
deformable_im2col_kernel<scalar_t, int64_t><<<blocks, threads, 0, stream>>>(
num_kernels,
input.data_ptr<scalar_t>(),
data_offset.data_ptr<scalar_t>(),
Expand All @@ -277,7 +278,7 @@ void deformable_im2col(
} else {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
input.scalar_type(), "deformable_im2col", ([&] {
deformable_im2col_kernel<scalar_t, int><<<blocks, threads>>>(
deformable_im2col_kernel<scalar_t, int><<<blocks, threads, 0, stream>>>(
num_kernels,
input.data_ptr<scalar_t>(),
data_offset.data_ptr<scalar_t>(),
Expand Down Expand Up @@ -436,10 +437,11 @@ void compute_grad_input(

at::globalContext().alertNotDeterministic("compute_grad_input");

const cudaStream_t stream = at::cuda::getCurrentCUDAStream();
if (use_64bits_indexing) {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
columns.scalar_type(), "compute_grad_input", ([&] {
deformable_col2im_kernel<scalar_t, int64_t><<<blocks, threads>>>(
deformable_col2im_kernel<scalar_t, int64_t><<<blocks, threads, 0, stream>>>(
num_kernels,
columns.data_ptr<scalar_t>(),
offset.data_ptr<scalar_t>(),
Expand All @@ -465,7 +467,7 @@ void compute_grad_input(
} else {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
columns.scalar_type(), "compute_grad_input", ([&] {
deformable_col2im_kernel<scalar_t, int><<<blocks, threads>>>(
deformable_col2im_kernel<scalar_t, int><<<blocks, threads, 0, stream>>>(
num_kernels,
columns.data_ptr<scalar_t>(),
offset.data_ptr<scalar_t>(),
Expand Down Expand Up @@ -678,11 +680,12 @@ void compute_grad_offset_and_mask(
((int64_t)channels * weight_h * weight_w * parallel_imgs * out_h * out_w >
std::numeric_limits<int32_t>::max());

const cudaStream_t stream = at::cuda::getCurrentCUDAStream();
if (use_64bits_indexing) {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
columns.scalar_type(), "compute_grad_offset_and_mask", ([&] {
deformable_col2im_coord_kernel<scalar_t, int64_t>
<<<blocks, threads>>>(
<<<blocks, threads, 0, stream>>>(
num_kernels,
columns.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
Expand Down Expand Up @@ -711,7 +714,7 @@ void compute_grad_offset_and_mask(
} else {
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
columns.scalar_type(), "compute_grad_offset_and_mask", ([&] {
deformable_col2im_coord_kernel<scalar_t, int><<<blocks, threads>>>(
deformable_col2im_coord_kernel<scalar_t, int><<<blocks, threads, 0, stream>>>(
num_kernels,
columns.data_ptr<scalar_t>(),
input.data_ptr<scalar_t>(),
Expand Down