Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CUDA-specific compilation of mel spectrograms #2206

Merged
merged 7 commits into from
Jun 4, 2024

Conversation

iboB
Copy link
Collaborator

@iboB iboB commented Jun 3, 2024

The resulting code is about 5-6 times faster: from a median of 15 ms spent on mel spectrogram calculation on a high-end CPU, this works for about 2.2 ms. Given that the sizes are relatively small, the exact CUDA-capable GPU hardly matters. I see no significant difference between 4090 and 1660

HOWEVER this comes with the cost of adding new files and thus whisper.cpp is no longer a single h/cpp pair:

  • A C++ interface for mel spectrogram calculation.
    • It's not accessible through C. It can be, but either the model or the mel filters must be exposed as well.
    • Even as a C++ interface it's not strictly public too. With minor changes, it can be. What's missing for this is WHISPER_API declarations. The definition to WHISPER_API must be moved to yet another file.
  • Bespoke CUDA code. This could theoretically be moved to ggml if we add FFT functions to ggml itself.

@ggerganov ggerganov merged commit ffef323 into ggerganov:master Jun 4, 2024
52 checks passed
iThalay pushed a commit to iThalay/whisper.cpp that referenced this pull request Sep 23, 2024
)

* whisper : use polymorphic class to calculate mel spectrogram

* whisper : add cuda-specific mel spectrogram calculation

* whisper : conditionally compile cufftGetErrorString to avoid warnings

* build : add new files to makefile

* ruby : add new files to conf script

* build : fix typo in makefile

* whisper : suppress cub warning for deprecated C++ std in whisper-mel-cuda
iThalay pushed a commit to iThalay/whisper.cpp that referenced this pull request Sep 23, 2024
)

* whisper : use polymorphic class to calculate mel spectrogram

* whisper : add cuda-specific mel spectrogram calculation

* whisper : conditionally compile cufftGetErrorString to avoid warnings

* build : add new files to makefile

* ruby : add new files to conf script

* build : fix typo in makefile

* whisper : suppress cub warning for deprecated C++ std in whisper-mel-cuda
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.

2 participants