feat: add vulkan with new whisper.cpp structure

Co-authored-by: newfla <newfla@hotmail.it>
This commit is contained in:
thewh1teagle 2024-08-18 21:23:46 +03:00
parent 044e085555
commit e33cc3eb22
No known key found for this signature in database
5 changed files with 22 additions and 1 deletions

View file

@ -31,6 +31,7 @@ cuda = ["whisper-rs-sys/cuda", "_gpu"]
hipblas = ["whisper-rs-sys/hipblas", "_gpu"] hipblas = ["whisper-rs-sys/hipblas", "_gpu"]
openblas = ["whisper-rs-sys/openblas"] openblas = ["whisper-rs-sys/openblas"]
metal = ["whisper-rs-sys/metal", "_gpu"] metal = ["whisper-rs-sys/metal", "_gpu"]
vulkan = ["whisper-rs-sys/vulkan", "_gpu"]
_gpu = [] _gpu = []
test-with-tiny-model = [] test-with-tiny-model = []
whisper-cpp-log = ["dep:log"] whisper-cpp-log = ["dep:log"]

View file

@ -74,6 +74,7 @@ All disabled by default unless otherwise specified.
* `hipblas`: enable ROCm/hipBLAS support. Only available on linux. Implicitly enables hidden GPU flag at runtime. * `hipblas`: enable ROCm/hipBLAS support. Only available on linux. Implicitly enables hidden GPU flag at runtime.
* `openblas`: enable OpenBLAS support. * `openblas`: enable OpenBLAS support.
* `metal`: enable Metal support. Implicitly enables hidden GPU flag at runtime. * `metal`: enable Metal support. Implicitly enables hidden GPU flag at runtime.
* `vulkan`: enable Vulkan support. Implicitly enables hidden GPU flag at runtime.
* `whisper-cpp-log`: allows hooking into whisper.cpp's log output and sending it to the `log` backend. Requires calling * `whisper-cpp-log`: allows hooking into whisper.cpp's log output and sending it to the `log` backend. Requires calling
* `whisper-cpp-tracing`: allows hooking into whisper.cpp's log output and sending it to the `tracing` backend. * `whisper-cpp-tracing`: allows hooking into whisper.cpp's log output and sending it to the `tracing` backend.

View file

@ -45,6 +45,7 @@ cuda = []
hipblas = [] hipblas = []
openblas = [] openblas = []
metal = [] metal = []
vulkan = []
force-debug = [] force-debug = []
openmp = [] openmp = []

View file

@ -166,6 +166,24 @@ fn main() {
} }
} }
if cfg!(feature = "vulkan") {
config.define("GGML_VULKAN", "ON");
if cfg!(windows) {
println!("cargo:rerun-if-env-changed=VULKAN_SDK");
println!("cargo:rustc-link-lib=vulkan-1");
let vulkan_path = match env::var("VULKAN_SDK") {
Ok(path) => PathBuf::from(path),
Err(_) => panic!(
"Please install Vulkan SDK and ensure that VULKAN_SDK env variable is set"
),
};
let vulkan_lib_path = vulkan_path.join("Lib");
println!("cargo:rustc-link-search={}", vulkan_lib_path.display());
} else {
println!("cargo:rustc-link-lib=vulkan");
}
}
if cfg!(feature = "openblas") { if cfg!(feature = "openblas") {
config.define("GGML_BLAS", "ON"); config.define("GGML_BLAS", "ON");
} }

@ -1 +1 @@
Subproject commit 4b7de08bfdc1bdd07d7727bc4f299b9bffec8f2a Subproject commit fe36c909715e6751277ddb020e7892c7670b61d4