Skip to content

Add optional CUDA acceleration for ViSQOL - #146

Open
lingfengyao wants to merge 2 commits into
google:masterfrom
lingfengyao:cuda-acceleration
Open

lingfengyao wants to merge 2 commits into
google:masterfrom
lingfengyao:cuda-acceleration

Conversation

@lingfengyao

Copy link
Copy Markdown

Adds optional CUDA acceleration for Gammatone spectrogram construction and
NSIM candidate scoring, enabled through --use_cuda or
VisqolConfig.options.use_cuda. CPU execution remains the default.

Also reduces CPU overhead in patch selection and FFT-based alignment.
README includes CUDA build and usage instructions.

Validation

  • All 28 CPU/Python test targets and all 13 CUDA tests pass.
  • All 200 tested pairs produce byte-identical complete results across
    upstream CPU, optimized CPU and optimized GPU, including MOS, VNSIM,
    frequency statistics and patch timestamps.

Performance

Tested on NVIDIA H100 80GB and a single Intel Xeon Platinum 8468 CPU thread.
Results are averaged over two runs.

Dataset Upstream CPU Optimized GPU Speedup
100 speech pairs 115.054 s 2.887 s 39.85×
100 audio pairs 459.920 s 8.277 s 55.56×
Total 574.974 s 11.165 s 51.50×

Speech uses LibriSpeech at 16 kHz; audio uses FMA and Clotho at 48 kHz,
with 3–10 second clips and controlled degradations.

@google-cla

google-cla Bot commented Oct 2, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Add an opt-in CUDA path (--use_cuda / VisqolConfig.options.use_cuda) that
builds Gammatone spectrograms and scores candidate patches during the patch
search on the GPU. Spectrograms recreated during realignment are processed
in batches of up to 16 patch pairs. Kernels use FP64 and follow the CPU order
of operations; selected-patch statistics and MOS mapping stay on the CPU.
Builds without --config=cuda use stubs and do not link the CUDA runtime.

Also speed up the CPU parts that dominate once the GPU path is enabled: the
patch DP keeps a running maximum instead of rescanning predecessors, and the
envelope and cross-correlation in alignment use PFFFT's packed real spectrum
with a reusable per-thread FftManager.

On 200 speech/audio pairs on an H100 the CUDA path is 51.5x faster than
upstream CPU, with byte-identical results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant