Skip to content

Commit a9f74c5

Browse files
committed
revert to stable 0.75
1 parent 61d1105 commit a9f74c5

File tree

9 files changed

+310
-118
lines changed

9 files changed

+310
-118
lines changed

.cargo/config.toml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
[target.x86_64-pc-windows-msvc]
2-
linker = 'link.exe'
3-
4-
[build]
5-
target-dir = 'D:/temp/cargo-target'
6-
71
[env]
8-
# Ensure we use the correct toolchain paths
9-
CC_x86_64_pc_windows_msvc = 'cl.exe'
10-
CXX_x86_64_pc_windows_msvc = 'cl.exe'
11-
AR_x86_64_pc_windows_msvc = 'lib.exe'
2+
MACOSX_DEPLOYMENT_TARGET = { value = "14.2", force = true }
3+
4+
[target.'cfg(all(windows, target_env = "msvc"))']
5+
rustflags = [
6+
"-C",
7+
"target-feature=-crt-static",
8+
]

Cargo.lock

Lines changed: 44 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/src-tauri/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ hypr-db-user = { workspace = true }
2929
hypr-host = { workspace = true }
3030
hypr-intercept = { workspace = true }
3131
hypr-turso = { workspace = true }
32-
hypr-whisper-local = { workspace = true }
3332
hypr-whisper-local-model = { workspace = true }
3433

3534
tauri-plugin-analytics = { workspace = true }

apps/desktop/src-tauri/src/commands.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,3 @@ pub fn set_individualization_needed<R: tauri::Runtime>(
7979
.set(StoreKey::IndividualizationNeeded, v)
8080
.map_err(|e| e.to_string())
8181
}
82-
83-
#[tauri::command]
84-
#[specta::specta]
85-
#[cfg(target_os = "windows")]
86-
pub fn check_cpu_avx_support() -> Result<bool, String> {
87-
Ok(hypr_whisper_local::cpu_supports_avx())
88-
}

apps/desktop/src-tauri/src/lib.rs

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ use tracing_subscriber::{
1515

1616
#[tokio::main]
1717
pub async fn main() {
18-
// Set up CPU-aware DLL loading for Windows before any whisper-rs initialization
19-
#[cfg(target_os = "windows")]
20-
setup_cpu_aware_dll_loading();
21-
2218
tauri::async_runtime::set(tokio::runtime::Handle::current());
2319

2420
{
@@ -357,7 +353,7 @@ fn create_quit_handler(app_handle: tauri::AppHandle) -> impl Fn() -> bool {
357353
}
358354

359355
fn make_specta_builder<R: tauri::Runtime>() -> tauri_specta::Builder<R> {
360-
let mut builder = tauri_specta::Builder::<R>::new()
356+
tauri_specta::Builder::<R>::new()
361357
.commands(tauri_specta::collect_commands![
362358
commands::sentry_dsn::<tauri::Wry>,
363359
commands::is_onboarding_needed::<tauri::Wry>,
@@ -366,45 +362,8 @@ fn make_specta_builder<R: tauri::Runtime>() -> tauri_specta::Builder<R> {
366362
commands::set_autostart::<tauri::Wry>,
367363
commands::is_individualization_needed::<tauri::Wry>,
368364
commands::set_individualization_needed::<tauri::Wry>,
369-
]);
370-
371-
#[cfg(target_os = "windows")]
372-
{
373-
builder = builder.commands(tauri_specta::collect_commands![
374-
commands::check_cpu_avx_support,
375-
]);
376-
}
377-
378-
builder.error_handling(tauri_specta::ErrorHandlingMode::Throw)
379-
}
380-
381-
/// Set up CPU-aware DLL loading for Windows to ensure compatibility across different systems
382-
#[cfg(target_os = "windows")]
383-
fn setup_cpu_aware_dll_loading() {
384-
use std::path::PathBuf;
385-
use hypr_whisper_local::cpu_supports_avx;
386-
387-
// Select the appropriate DLL file in the same directory as the executable
388-
let dll_filename = if cpu_supports_avx() {
389-
tracing::info!("CPU supports AVX2, using optimized whisper DLL");
390-
"whisper_avx.dll"
391-
} else {
392-
tracing::info!("CPU does not support AVX2, using scalar whisper DLL");
393-
"whisper_scalar.dll"
394-
};
395-
396-
let dll_path = std::path::PathBuf::from("./").join(dll_filename);
397-
398-
// Add the current directory to PATH if the DLL exists
399-
if dll_path.exists() {
400-
let current_path = std::env::var("PATH").unwrap_or_default();
401-
let new_path = format!(".;{}", current_path);
402-
std::env::set_var("PATH", new_path);
403-
404-
tracing::info!("Updated PATH to include current directory for DLL: {}", dll_filename);
405-
} else {
406-
tracing::warn!("DLL file not found: {} - using system defaults", dll_path.display());
407-
}
365+
])
366+
.error_handling(tauri_specta::ErrorHandlingMode::Throw)
408367
}
409368

410369
#[cfg(test)]

crates/whisper-local/Cargo.toml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ edition = "2021"
66
# https://github.com/tazz4843/whisper-rs/blob/e3d67d5/Cargo.toml
77
[features]
88
default = []
9-
# Features kept for compatibility but without whisper-rs dependency
10-
coreml = []
11-
cuda = []
12-
hipblas = []
13-
openblas = []
14-
metal = []
15-
vulkan = []
16-
openmp = []
9+
coreml = ["whisper-rs/coreml"]
10+
cuda = ["whisper-rs/cuda"]
11+
hipblas = ["whisper-rs/hipblas"]
12+
openblas = ["whisper-rs/openblas"]
13+
metal = ["whisper-rs/metal"]
14+
vulkan = ["whisper-rs/vulkan"]
15+
openmp = ["whisper-rs/openmp"]
1716

1817
[dev-dependencies]
1918
hypr-data = { workspace = true }
@@ -29,7 +28,7 @@ hypr-whisper = { workspace = true }
2928
dasp = { workspace = true }
3029
kalosm-sound = { workspace = true, default-features = false }
3130
rodio = { workspace = true }
32-
raw-cpuid = "11.0.1"
31+
whisper-rs = { version = "0.15.0", features = ["raw-api", "tracing_backend"] }
3332

3433
futures-util = { workspace = true }
3534
tracing = { workspace = true }

crates/whisper-local/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use serde::{ser::Serializer, Serialize};
44
pub enum Error {
55
#[error("model_not_found")]
66
ModelNotFound,
7-
#[error("whisper_error: {0}")]
8-
WhisperError(String),
7+
#[error(transparent)]
8+
LocalWhisperError(#[from] whisper_rs::WhisperError),
99
}
1010

1111
impl Serialize for Error {

crates/whisper-local/src/lib.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ pub struct GgmlBackend {
1919
}
2020

2121
// https://github.com/ggml-org/llama.cpp/blob/3a9457d/common/arg.cpp#L2300
22-
// Temporarily disabled until whisper-rs builds correctly
2322
pub fn list_ggml_backends() -> Vec<GgmlBackend> {
24-
// Return empty list for now to allow building without whisper-rs
25-
Vec::new()
26-
27-
// TODO: Re-enable when whisper-rs builds correctly
28-
/*
2923
use whisper_rs::whisper_rs_sys::{
3024
ggml_backend_dev_count, ggml_backend_dev_description, ggml_backend_dev_get,
3125
ggml_backend_dev_memory, ggml_backend_dev_name, ggml_backend_dev_type,
@@ -70,33 +64,4 @@ pub fn list_ggml_backends() -> Vec<GgmlBackend> {
7064
}
7165

7266
devices
73-
*/
74-
}
75-
76-
/// Check if the CPU supports AVX2 instructions for optimal whisper-rs performance
77-
/// Returns true if AVX2 is supported, false otherwise
78-
pub fn cpu_supports_avx() -> bool {
79-
#[cfg(target_arch = "x86_64")]
80-
{
81-
// Use CPUID to check for AVX2 support on x86_64
82-
let cpuid = raw_cpuid::CpuId::new();
83-
if let Some(feature_info) = cpuid.get_feature_info() {
84-
// Check for AVX support (bit 28 in ECX)
85-
let avx_supported = feature_info.has_avx();
86-
87-
// Check for AVX2 support (bit 5 in EBX of leaf 7)
88-
if let Some(extended_features) = cpuid.get_extended_feature_info() {
89-
let avx2_supported = extended_features.has_avx2();
90-
return avx_supported && avx2_supported;
91-
}
92-
93-
return avx_supported;
94-
}
95-
false
96-
}
97-
#[cfg(not(target_arch = "x86_64"))]
98-
{
99-
// For non-x86_64 architectures, assume no AVX support
100-
false
101-
}
10267
}

0 commit comments

Comments
 (0)