A free, open source, and extensible speech-to-text application that works completely offline.
fix: list compute devices off the startup path (#2160)
Aktan Azat29bd2c0d6b4b
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex facc9786..6a3baf45 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -915,6 +915,7 @@ pub fn run(cli_args: CliArgs) {app_handle.manage(model_manager);app_handle.manage(transcription_manager);managers::transcription::init_transcribe_backend();+ managers::transcription::report_compute_devices();managers::transcription::apply_accelerator_settings(&app_handle);let handle = app_handle.clone();@@ -1023,11 +1024,14 @@ pub fn run(cli_args: CliArgs) {);// Pre-warm GPU/accelerator enumeration on a background thread. The first- // get_available_accelerators call enumerates ORT execution providers and- // transcribe-cpp compute devices, which can take a moment; without this+ // device listing opens the GPU, which on macOS loads ggml's Metal library+ // and compiles it when the system shader cache does not have it yet, so it+ // stays off the startup path. get_available_accelerators then enumerates+ // ORT execution providers and transcribe-cpp compute devices; without this// the cost is paid synchronously when the user first opens Advanced// settings, freezing the UI. Result is cached in a OnceLock.std::thread::spawn(|| {+ crate::managers::transcription::report_compute_devices();let _ = crate::managers::transcription::get_available_accelerators();});diff --git a/src-tauri/src/managers/transcription.rs b/src-tauri/src/managers/transcription.rsindex bed8d92c..a8d0dddd 100644--- a/src-tauri/src/managers/transcription.rs+++ b/src-tauri/src/managers/transcription.rs@@ -1891,21 +1891,31 @@ pub fn init_transcribe_backend() {disabling transcribe.cpp GPU acceleration and using CPU");}- let devices = transcribe_compute_devices();- info!(- "transcribe-cpp initialized with {} compute device(s): [{}]",- devices.len(),- devices- .iter()- .map(|d| format!("{} ({})", d.name, d.kind))- .collect::<Vec<_>>()- .join(", ")- );}Err(e) => warn!("Failed to initialize transcribe-cpp backends: {}", e),}}+/// Log the compute devices [`init_transcribe_backend`] registered.+///+/// Listing devices is what first opens the GPU. On macOS that loads ggml's+/// Metal library, which is compiled from source whenever the system's shader+/// cache does not hold it yet (the first launch after an install or update),+/// so the app calls this from a background thread instead of its startup+/// path. A model load that comes first waits on the same one-time compile.+pub fn report_compute_devices() {+ let devices = transcribe_compute_devices();+ info!(+ "transcribe-cpp initialized with {} compute device(s): [{}]",+ devices.len(),+ devices+ .iter()+ .map(|d| format!("{} ({})", d.name, d.kind))+ .collect::<Vec<_>>()+ .join(", ")+ );+}+/// Human-readable list of the transcribe-cpp compute devices registered at/// startup, for the `--list-devices` flag. The reported `index` is the/// value to pass to `--device-index`. Backends must be initialized first