cuda - update npp calls to use the new NppStreamContext API if available #3803
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.
Requires changes in opencv/opencv#26245
Update calls to Nvidia's NPP library to use the newer NppStreamContext API introduced in CUDA 10.1 (release notes)
Although this was introduced in CUDA 10.1 at that point not all of the functions either had a
_Ctx
version which took aNppStreamContext
or an implementation present in the NPP library. Therefore in this PR theUSE_NPP_STREAM_CTX
flag which selects the new API is only enabled for versions of NPP >= 12205 (the version included with CUDA toolkit 12.4) which I have verified as working. Currently the only function called inside OpenCV which does not work with the new API isnppiEvenLevelsHost_32s_Ctx
which doesn't have an implementation inside nppist.lib or libnppist.so as of CUDA 12.6.Tested locally on Ubuntu 20.04 with both CUDA toolkits 12.3 and 12.4.
Adds changes discussed in #3338 to all Npp functions called by OpenCV.
Fixes #3798
@tomoaki0705 I have re-introduced streaming in https://github.com/tomoaki0705/opencv/blob/f4e5d777e856f751c4318f0c633dcce37cfa66f2/modules/cudaarithm/src/reductions.cpp#L161 which you disabled in opencv/opencv#11064 because it looks like you fixed it with opencv/opencv#11550 is this correct?
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.