Repository navigation
CPU Instruction Sets
whisper, stemsplit and lyricsalign run on ggml. ggml is compiled once per instruction-set level. Most platform binaries carry several levels and pick one the first time a ggml filter runs.
Nobody has to choose a build. An old machine keeps working. A modern machine runs several times faster.
A cross-compiled build defaults to the bare x86-64 or ARMv8.0 baseline. The project measured that as 8 to 14 times slower for whisper and 2.4 times slower for stemsplit than a build for a modern CPU. Raising the level for everyone would break older machines. So the build carries several levels and chooses at run time.
| Platform | Levels carried | Selection |
|---|---|---|
| linux-x86_64, windows-x86_64, freebsd-x86_64 |
x64, sse42, ivybridge (AVX and F16C), haswell (AVX2 and FMA) |
Automatic |
| linux-aarch64 |
armv8.0, armv8.2+dotprod+fp16, armv8.2+dotprod+fp16+i8mm
|
Automatic |
| windows-aarch64 |
armv8.0, armv8.2+dotprod+fp16
|
Automatic |
| darwin-x86_64 |
ivybridge only |
Fixed at build time |
| darwin-arm64 |
armv8.4+dotprod+fp16 only |
Fixed at build time |
windows-aarch64 has no i8mm level. Windows has no feature flag for it. The only fallback is to infer it from the SVE flag, and that is wrong on Qualcomm Oryon cores. The build stops one level short instead of risking an illegal instruction.
The two macOS builds do not switch. Apple controls which machines run them, so the floor is known. darwin-x86_64 is compiled once for Ivy Bridge (AVX and F16C, no AVX2). darwin-arm64 is compiled once for the instructions every Apple Silicon chip has.
The choice is logged once at -v info:
stemsplit: ggml cpu variant 'haswell'.
It is also frame metadata, so a program can record it without reading logs.
| Key | Filter |
|---|---|
lavfi.stemsplit.cpu_variant |
stemsplit |
lavfi.whisper.cpu_variant |
whisper |
lavfi.lyricsalign.cpu_variant |
lyricsalign |
NOMERCY_GGML_CPU=<name> forces a level. Use it for support cases and for A/B timing on one machine.
NOMERCY_GGML_CPU=x64 ffmpeg -v info -i in.flac -af "stemsplit=model=spleeter-2stems-f16.gguf:stem=vocals" -f null - 2>&1 | grep "cpu variant"A name that is unknown, or that the CPU does not support, is ignored. The automatic choice stays. The variable can never stop ffmpeg from starting.
On the two macOS builds the variable has nothing to switch.
Both tables were measured by the project on its own machines.
30 s of the same audio, automatic selection against the same binary forced back to its baseline level.
| Platform | Automatic | Forced baseline | Speed-up |
|---|---|---|---|
| linux-x86_64 | 1927 ms | 5723 ms | 2.97 times |
| windows-x86_64 | 2.047 s | 5.877 s | 2.87 times |
No ARM hardware has been measured.
Same model, same audio, 8 threads, total run time per level.
| Level | Compared with x64
|
|---|---|
x64 |
1 times |
sse42 |
1.3 times |
ivybridge |
8 times |
haswell |
9 times |
The big step is F16C, not AVX2. whisper models are stored as 16-bit floats. Without F16C every weight must be converted to 32-bit in scalar code first. sse42 alone buys almost nothing.
Enabling FMA changes how additions round. On a 30 s stemsplit run, 123 of 2,646,000 output samples differ between levels. The largest difference is 1 LSB at 16 bits, about 103 dB below the signal. It is inaudible.
Two machines with different CPUs therefore do not always give byte-identical output for the same input. If you hash stemsplit or whisper output for caching or deduplication, do not expect the hashes to match across machines.
Users
Filters and components
- Filter-stemsplit
- Filter-lyricsalign
- Whisper-Language-Detection
- Whisper-Word-Timestamps
- Filter-trailingsilence
- Filter-keydetect
- Filter-beatdetect
- Filter-rubberband
- Muxer-Sprite-Sheet
- Muxer-Chapter-VTT
- Muxer-VOBsub
- Protocol-dvdread
- Protocol-OmniDrive
- Auto-Create-Directories
- AACS-and-BDplus
- HLS-Master-Playlist
- Subtitles-OCR
- HEVC-Alpha
Acceleration and codecs
Contributors