Add Vulkan Whisper backend and GPU concurrency tooling
This commit is contained in:
1 parent
405fa6cdf4
commit
b3f8baa7ca
18 files changed
+1326
-12
No files matched your search
@@ -0,0 +1,118 @@
|
||||
# Explicit Whisper CPU and Vulkan execution
|
||||
|
||||
Meeting Lab retains whisper.cpp, large-v3-turbo, the canonical audio preparation,
|
||||
and all language, thread, flash-attention and JSON-output parameters. Transcription acceleration needs no ROCm or GPU power changes. The separate
|
||||
fertigungski concurrency policy changes only Ollama resident/parallel limits.
|
||||
|
||||
`transcribe_audio(..., backend=...)`, `MvpMeetingConfig.whisper_backend`, and
|
||||
`--whisper-backend` on both transcription/MVP CLIs support:
|
||||
|
||||
- `cpu`: always pass `--no-gpu`, including when using a Vulkan-capable binary.
|
||||
- `vulkan`: require successful inference and diagnostics identifying a selected
|
||||
Vulkan backend and hardware device. Enumeration alone, failed initialization,
|
||||
software renderers, and missing diagnostic evidence fail clearly.
|
||||
- `auto` (portable default): attempt Vulkan; if successful execution lacks hardware
|
||||
evidence, or a recognized Vulkan/backend failure occurs, retry once with
|
||||
`--no-gpu`. Emit a warning and record the reason. Unrelated inference/model
|
||||
failures are not retried. CPU fallback uses the selected binary's CPU backend.
|
||||
|
||||
This policy is deliberately tied to the pinned CLI's diagnostic format. If a
|
||||
future CLI changes its logs, explicit Vulkan fails closed and auto reports CPU
|
||||
fallback. Runtime evidence establishes backend initialization and completed
|
||||
inference, not that every operation ran on the GPU. Host validation must also
|
||||
observe Radeon utilization.
|
||||
|
||||
Each attempt preserves its command, exit status and combined output in
|
||||
`backend_diagnostics.json` and `whisper_attempt_N.log`. Failed runs also retain
|
||||
these diagnostics. Successful `runtime_metadata.json` retains the existing
|
||||
`backend: whisper.cpp` field and adds requested/actual backend, device name,
|
||||
fallback reason, executable path/checksum and model checksum. Transcript formats
|
||||
are unchanged. Attempt commands contain a temporary output prefix that is removed
|
||||
at completion; the original JSON is preserved as `whisper_raw.json`.
|
||||
|
||||
## Reproducible separate host build
|
||||
|
||||
Run from the Meeting Lab checkout with normal host write/device access:
|
||||
|
||||
```bash
|
||||
python3 scripts/build_whisper_vulkan.py --source /opt/whisper.cpp --jobs 4
|
||||
```
|
||||
|
||||
The script refuses a dirty source tree, a revision other than
|
||||
`978113305b2ead22249b881deafa131dc8884911`, or an existing `build-vulkan`
|
||||
directory. It creates `/opt/whisper.cpp/build-vulkan` with:
|
||||
|
||||
```text
|
||||
CMAKE_BUILD_TYPE=Release
|
||||
GGML_VULKAN=ON
|
||||
GGML_CPU=ON
|
||||
GGML_HIP=OFF
|
||||
GGML_CUDA=OFF
|
||||
WHISPER_BUILD_TESTS=OFF
|
||||
WHISPER_BUILD_SERVER=OFF
|
||||
```
|
||||
|
||||
It records compiler/CMake versions, source status/diff, build commands/logs,
|
||||
CPU/Vulkan CMake caches, and SHA256 values. Original CPU binary, cache and model
|
||||
checksums are checked again after building. It never installs packages or alters
|
||||
the original `build` directory or model. Do not copy just the new executable:
|
||||
its companion shared libraries must remain with it.
|
||||
|
||||
The observed Debian prerequisites are build-essential, CMake, Vulkan development
|
||||
files/loader, Mesa Vulkan drivers, glslc and SPIR-V headers. They are already
|
||||
installed on fertigungski. The build uses host CPU tuning; rebuild on another host
|
||||
rather than assuming the resulting binary is portable.
|
||||
|
||||
## Hardware validation and benchmark
|
||||
|
||||
Check `vulkaninfo --summary` on the host: it must expose the Radeon AI PRO R9700,
|
||||
not only llvmpipe. Check device permissions and library resolution. Run a fresh
|
||||
benchmark outside all existing meeting runs:
|
||||
|
||||
```bash
|
||||
python3 scripts/benchmark_whisper_backends.py /opt/whisper.cpp/samples/jfk.wav \
|
||||
--model /opt/whisper.cpp/models/ggml-large-v3-turbo.bin \
|
||||
--cpu-executable /opt/whisper.cpp/build/bin/whisper-cli \
|
||||
--vulkan-executable /opt/whisper.cpp/build-vulkan/bin/whisper-cli \
|
||||
--language en --threads 4 --repeats 3 \
|
||||
--output-dir /tmp/whisper-r9700-benchmark-001
|
||||
```
|
||||
|
||||
The benchmark refuses an existing output directory. It uses identical audio,
|
||||
model, language, threads and decoding parameters; creates only transcription
|
||||
artifacts; and makes no LLM calls. Its JSON records timing, real-time factor,
|
||||
actual backend, device and failures. The first run includes possible cold-start
|
||||
costs. Never claim GPU speedup from forced-CPU or software Vulkan results.
|
||||
|
||||
Observe utilization, peak VRAM, power and temperature using existing host tools.
|
||||
Repeat on reviewed German/English clips, checking WER/CER, names, numbers,
|
||||
omissions, repetition and timestamps. Verify explicit CPU, explicit unavailable
|
||||
Vulkan and auto fallback. Test contention with resident Ollama models without
|
||||
changing Ollama configuration or power limits. Keep the model unchanged; GPU
|
||||
floating-point differences can affect decoding and diarization alignment.
|
||||
|
||||
## Rollback
|
||||
|
||||
Select `cpu` and `/opt/whisper.cpp/build/bin/whisper-cli`. Keep the same model.
|
||||
The separate Vulkan build can remain unused; no service restart or package
|
||||
rollback is required for this configuration change. Existing artifacts remain
|
||||
unchanged. Apply paired Assistant/Lab revisions together.
|
||||
|
||||
|
||||
## GPU memory failures and concurrent load
|
||||
|
||||
Transcription metadata additionally records `gpu_out_of_memory_detected` and
|
||||
`memory_error_kind`. A confirmed Vulkan device OOM fails explicit Vulkan or
|
||||
triggers the documented Auto CPU retry, retaining its OOM evidence. Host or
|
||||
unqualified memory errors are not silently treated as GPU OOM. Ollama HTTP/JSON
|
||||
memory errors are classified and surfaced without retrying LLM generation.
|
||||
|
||||
`scripts/benchmark_gpu_concurrency.py` measures serial and parallel workloads
|
||||
using two qwen3.8:27b requests with 32768-token contexts and strict Vulkan Whisper.
|
||||
It performs six generation requests and two transcriptions in a new directory,
|
||||
records independent request windows and read-only VRAM/utilization/power/thermal
|
||||
and Ollama `/api/ps` samples, and stops after a failed case. Supply representative
|
||||
canonical audio and two complete protocol prompts within the 29000 estimated
|
||||
input-token budget. No shared production GPU lock or scheduler is introduced.
|
||||
See the paired Assistant's `docs/gpu-concurrency.md` for the host service policy,
|
||||
benchmark command, server-side overlap verification and rollback procedure.
|
||||
Reference in new issue
Block a user