keep cufftPlan2d across ConvolveImpl::convolve calls#3386
Merged
Conversation
on some CUDA versions creating/destroying cufftPlan2d is very time consuming we now create them in ConvolveImpl::create() and destroy them in the dtor this solves issue opencv#3385
asmorkalov
approved these changes
Dec 14, 2022
asmorkalov
left a comment
Contributor
There was a problem hiding this comment.
👍 Thanks a lot for the contribution. Tested manually with Ubuntu 18.04, CUDA 10.2, GF 1080. Performance improvement is visible even with existing OpenCV perf tests:
Geometric mean (ms)
Name of Test default after after
cufft cufft
fix fix
vs
default
(x-factor)
Convolve::Sz_KernelSz_Ccorr::(1280x720, 17, false) 1.242 0.558 2.23
Convolve::Sz_KernelSz_Ccorr::(1280x720, 17, true) 1.233 0.567 2.18
Convolve::Sz_KernelSz_Ccorr::(1280x720, 27, false) 1.200 0.641 1.87
Convolve::Sz_KernelSz_Ccorr::(1280x720, 27, true) 1.206 0.523 2.30
Convolve::Sz_KernelSz_Ccorr::(1280x720, 32, false) 1.197 0.527 2.27
Convolve::Sz_KernelSz_Ccorr::(1280x720, 32, true) 1.181 0.600 1.97
Convolve::Sz_KernelSz_Ccorr::(1280x720, 64, false) 1.178 0.524 2.25
Convolve::Sz_KernelSz_Ccorr::(1280x720, 64, true) 1.197 0.524 2.28
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 17, false) 1.423 0.816 1.74
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 17, true) 1.419 0.813 1.74
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 27, false) 1.428 0.825 1.73
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 27, true) 1.428 0.825 1.73
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 32, false) 1.419 0.820 1.73
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 32, true) 1.439 0.821 1.75
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 64, false) 1.416 0.829 1.71
Convolve::Sz_KernelSz_Ccorr::(1280x1024, 64, true) 1.433 0.821 1.74
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 17, false) 1.978 1.278 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 17, true) 1.972 1.275 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 27, false) 1.993 1.289 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 27, true) 1.980 1.281 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 32, false) 1.979 1.280 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 32, true) 1.978 1.276 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 64, false) 1.985 1.281 1.55
Convolve::Sz_KernelSz_Ccorr::(1920x1080, 64, true) 1.984 1.278 1.55
4 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
on some CUDA versions creating/destroying cufftPlan2d is very time consuming we now create/destroy them in ConvolveImpl::create() when
dft_sizechange and destroy them in the dtorthis solves issue #3385
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.