diff --git a/crates/llm/Cargo.toml b/crates/llm/Cargo.toml index a523bcc..a6a6067 100644 --- a/crates/llm/Cargo.toml +++ b/crates/llm/Cargo.toml @@ -3,11 +3,22 @@ name = "kon-llm" version = "0.1.0" edition = "2021" +[features] +# Default desktop build keeps the existing openmp + vulkan acceleration. +# Mobile / CPU-only targets can drop one or both via: +# cargo build -p kon-llm --no-default-features +# These are independent so an Android Vulkan build can opt into vulkan +# without openmp (the NDK ships OpenMP libs but the toolchain configuration +# is fragile across NDK versions). +default = ["gpu-vulkan", "openmp"] +gpu-vulkan = ["llama-cpp-2/vulkan"] +openmp = ["llama-cpp-2/openmp"] + [dependencies] kon-core = { path = "../core" } encoding_rs = "0.8" futures-util = "0.3" -llama-cpp-2 = { version = "0.1.144", default-features = false, features = ["openmp", "vulkan"] } +llama-cpp-2 = { version = "0.1.144", default-features = false } num_cpus = "1" reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream"] } serde = { version = "1", features = ["derive"] } diff --git a/crates/transcription/Cargo.toml b/crates/transcription/Cargo.toml index d012d14..1b9e240 100644 --- a/crates/transcription/Cargo.toml +++ b/crates/transcription/Cargo.toml @@ -6,13 +6,19 @@ description = "Speech-to-text engine wrappers, model management, and inference c build = "build.rs" [features] -# Whisper backend (direct whisper-rs, vulkan-accelerated). Default on — -# gating it exists so a future Windows non-AVX2 build, or a cloud-only -# ASR configuration, can drop whisper-rs-sys entirely per brief item -# #13. Disabling this feature also drops the WhisperRsBackend module -# and the load_whisper entry point. -default = ["whisper"] +# Whisper backend (direct whisper-rs). Default on — gating it exists so +# a future Windows non-AVX2 build, or a cloud-only ASR configuration, +# can drop whisper-rs-sys entirely per brief item #13. Disabling this +# feature also drops the WhisperRsBackend module and the load_whisper +# entry point. +# +# `whisper-vulkan` is a separate feature so a non-Vulkan target (Android +# without GPU drivers, a CPU-only Windows build) can pull in whisper-rs +# but skip the Vulkan backend. Build CPU-only with: +# cargo build -p kon-transcription --no-default-features --features whisper +default = ["whisper", "whisper-vulkan"] whisper = ["dep:whisper-rs", "dep:num_cpus"] +whisper-vulkan = ["whisper-rs?/vulkan"] [dependencies] kon-core = { path = "../core" } @@ -30,8 +36,9 @@ futures-util = "0.3" # Download integrity verification sha2 = "0.10" -# Gated behind the `whisper` feature (see [features] above). -whisper-rs = { version = "0.16", default-features = false, features = ["vulkan"], optional = true } +# Gated behind the `whisper` feature (see [features] above). Vulkan is +# additive via the `whisper-vulkan` feature so non-GPU targets can drop it. +whisper-rs = { version = "0.16", default-features = false, optional = true } # Direct whisper-rs backend (WhisperRsBackend): thread pool sizing. # Gated alongside whisper-rs since no other code in this crate needs it.