Repository navigation
Conversation
calculate_motion_score_kernel_16bpc set add_before_shift_y to pow(2, (src.bpc - 1)), a double-precision pow() in every thread. 1u << (src.bpc - 1) is the same value in integer arithmetic.
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 master,
calculate_motion_score_kernel_16bpc(libvmaf/src/feature/cuda/integer_motion/motion_score.cu:88) sets the rounding offset within every thread, so every pixel of a 10-bit frame pays for a double-precision
pow(). Consumer GPUs run FP64 slowly (1/64 of the FP32 rate on the RTX 3090's GA102), and in the 10-bit run below the motion kernel is the most expensive kernel, 53% of all GPU kernel time. The 8-bit kernel doesn't have this.This PR replaces it with
1u << (src.bpc - 1), which is the same value for every supported bit depth.Kernel times from Nsight Systems (
nsys profile -t cuda, then thecuda_gpu_kern_sumreport), RTX 3090, driver 615.71.09, libvmaf built with CUDA 13.1. The input is 96 frames of 1080p 10-bit 4:2:0: FFmpeg'stestsrc2as the reference and a noised and blurred copy as the distorted clip, scored withvmaf -b 10 -m path=model/vmaf_v0.6.1.json --gpumask 0. Lower is better.calculate_motion_score_kernel_16bpc, mean per frameEvery per-frame feature and VMAF score in the CSV output is the same as master on this clip and on an 8-bit version of it.
This is the only
pow()in the CUDA device code. The otherpow()calls underlibvmaf/src/feature/cuda/are ininteger_adm_cuda.cand run on the host.Validation
libvmaf built with
-Denable_cuda=true -Denable_float=true -Dbuilt_in_models=true(CUDA 13.1, GCC 13), master 229f247 against this branch. The unit tests give the same result on both: 30 of 31 pass, andtest_cuda_pic_preallocationsegfaults intest_cuda_picture_preallocation_method_host_pinnedon master too.