Skip to content

cuda4dnn(concat): fix stream not being set for concat wrappers after fusion #17359

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
YashasSamaga:cuda4dnn-fix-default-stream-wrappers
May 27, 2020
Merged

cuda4dnn(concat): fix stream not being set for concat wrappers after fusion #17359
opencv-pushbot merged 1 commit intoopencv:masterfrom
YashasSamaga:cuda4dnn-fix-default-stream-wrappers

Conversation

@YashasSamaga
Copy link
Copy Markdown
Contributor

@YashasSamaga YashasSamaga commented May 24, 2020

Bug introduced in #16161

The concat fusion logic creates new wrappers. I forgot to set the streams of the newly created wrappers after fusion. This makes the wrappers use the default stream for copying.

#17349 dropped support for default streams and added assertions to catch the accidental use of default streams.

The new assertions are triggered when blobs of concat layer are being transferred from host to device or vice versa. Unfortunately, this situation does not happen in any test case. Hence, the bug wasn't caught.

This PR removes the need to set streams manually (very error-prone and easy to forget) and instead does it automatically in wrap. Ideally, it is best if this was done inside wrapMat but it's a static function and doesn't have access to impl. The setStream code has to be copied wherever wrapMat is used. So there is a risk of new bugs in the future.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom
buildworker:Custom=linux-4
build_image:Custom=ubuntu-cuda:18.04

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants