Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes crash in deformable convolutions (2598) #2604

Merged
merged 3 commits into from
Aug 24, 2020

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Aug 21, 2020

Fixes #2598

Description:

[x] Adjusted num_kernels and batch_size according to kMaxGridNum * CUDA_NUM_THREADS

  • Redefined kMaxGridNum as max grid according to current CUDA device
  • Added test to check the code from issue and compared grads CPU/CUDA

This PR adjusts num_kernels and batch_size to avoid the situation such that num_kernels > kMaxGridNum * CUDA_NUM_THREADS. If it is not possible to adjust batch_size (e.g. batch_size=0), an exception is raised.

- Adjusted num_kernels and batch_size according to kMaxGridNum * CUDA_NUM_THREADS
- Tests to add
@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #2604 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2604   +/-   ##
=======================================
  Coverage   71.65%   71.65%           
=======================================
  Files          94       94           
  Lines        8121     8121           
  Branches     1289     1289           
=======================================
  Hits         5819     5819           
  Misses       1896     1896           
  Partials      406      406           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e9ebe8...220f9c1. Read the comment docs.

@vfdev-5 vfdev-5 changed the title [WIP] Fixes crash in deformable convolutions (2598) Fixes crash in deformable convolutions (2598) Aug 24, 2020
- Added test to check the code from issue and compared grads CPU/CUDA
@vfdev-5 vfdev-5 force-pushed the vfdev-5/issue-2598 branch from 3f115e4 to d6fffe0 Compare August 24, 2020 10:32
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a lot!

I have one comment (which might be silly), let me know what you think

torchvision/csrc/cuda/DeformConv_cuda.cu Outdated Show resolved Hide resolved
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @vfdev-5 !

@fmassa fmassa merged commit 8c32666 into pytorch:master Aug 24, 2020
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
* [WIP] Fixes pytorch#2598
- Adjusted num_kernels and batch_size according to kMaxGridNum * CUDA_NUM_THREADS
- Tests to add

* - Redefined kMaxGridNum as max grid according to current CUDA device
- Added test to check the code from issue and compared grads CPU/CUDA

* Fixed static kMaxGridNum evaluation to dynamic
@vfdev-5 vfdev-5 deleted the vfdev-5/issue-2598 branch August 11, 2021 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ops.deform_conv2d causes CUDA illegal memory access
2 participants