Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stream waits in corners.cu before textures destruction#4052

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
asmorkalov merged 1 commit intoopencv:4.xfromgagicb:4.x
Dec 16, 2025

Conversation

@gagicb
Copy link
Contributor

@gagicbgagicb commentedDec 11, 2025
edited by asmorkalov
Loading

Using a texture handle after calling cudaDestroyTextureObject results in undefined behavior.
In GFTT/corners, we had the following sequence:

Enter function FCreate texture TLaunch kernel K on stream SReturn from function F, which destroys texture T

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 athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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

@asmorkalov
Copy link
Contributor

cc@cudawarped

@asmorkalov
Copy link
Contributor

@gagicb Could you add some issue description and why you add the synchronization for non-default stream. Some reference to documentation is useful too.

@gagicb
Copy link
ContributorAuthor

@gagicb Could you add some issue description and why you add the synchronization for non-default stream. Some reference to documentation is useful too.

Hi@asmorkalov,

Using a texture handle after calling cudaDestroyTextureObject results in undefined behavior.
In GFTT/corners, we had the following sequence:

  1. Enter function F
  2. Create texture T
  3. Launch kernel K on stream S
  4. Return from function F, which destroys texture T

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.

Best regards,
gagik

asmorkalov reacted with thumbs up emoji

@asmorkalovasmorkalov self-assigned thisDec 16, 2025
@asmorkalovasmorkalov merged commitd99ad2a intoopencv:4.xDec 16, 2025
23 of 25 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asmorkalovasmorkalovasmorkalov approved these changes

Assignees

@asmorkalovasmorkalov

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@gagicb@asmorkalov

[8]ページ先頭

©2009-2025 Movatter.jp