Stream waits in corners.cu before textures destruction #4052
+5
−1
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.
Using a texture handle after calling cudaDestroyTextureObject results in undefined behavior.
In GFTT/corners, we had the following sequence:
At step 4, we must guarantee that kernel K launched on stream S has completed and that T is no longer used before it is destroyed. Thats why I added stream synchronization before function return.
Relevant description from the CUDA SDK documentation:
https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT__1_gae41ef138ba69d54b91068247f8f6c4e8:~:text=Use%20of%20the%20handle%20after%20this%20call%20is%20undefined%20behavior.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.