feat(transcription): whisper threads use Workload::Whisper + GPU detection

Wires the whisper backend through the new tuning helper. gpu_offloaded
combines a compile-time feature check (whisper-vulkan, in default
features) with a runtime libvulkan probe via the hardware module. If
libvulkan1 is missing on Linux, whisper-rs's vulkan backend silently
falls back to CPU, so we should not reduce threads in that case.

The old magnotia_core::constants::inference_thread_count import is
replaced by tuning::{inference_thread_count, Workload}. The constants
module's helper is removed in Task 6.1 once the LLM call site has
also migrated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jars
2026-05-09 12:21:33 +01:00
parent d6bde52d6e
commit e715da3b54
2 changed files with 6 additions and 3 deletions

View File

@@ -10,8 +10,9 @@ use std::path::Path;
use whisper_rs::{FullParams, SamplingStrategy, WhisperContext, WhisperContextParameters};
use magnotia_core::constants::inference_thread_count;
use magnotia_core::error::{MagnotiaError, Result};
use magnotia_core::hardware::vulkan_loader_available;
use magnotia_core::tuning::{inference_thread_count, Workload};
use magnotia_core::types::{Segment, TranscriptionOptions};
use crate::transcriber::{Transcriber, TranscriberCapabilities};
@@ -78,7 +79,8 @@ impl Transcriber for WhisperRsBackend {
params.set_initial_prompt(prompt);
}
}
params.set_n_threads(inference_thread_count() as i32);
let gpu_offloaded = cfg!(feature = "whisper-vulkan") && vulkan_loader_available();
params.set_n_threads(inference_thread_count(Workload::Whisper, gpu_offloaded) as i32);
params.set_print_special(false);
params.set_print_progress(false);
params.set_print_realtime(false);