Skip to content

Commit

Permalink
Merge pull request #170 from thewh1teagle/feat/vulkan
Browse files Browse the repository at this point in the history
Feat/vulkan
  • Loading branch information
tazz4843 authored Sep 13, 2024
2 parents 59dea7e + e78460d commit d8b6aef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cuda = ["whisper-rs-sys/cuda", "_gpu"]
hipblas = ["whisper-rs-sys/hipblas", "_gpu"]
openblas = ["whisper-rs-sys/openblas"]
metal = ["whisper-rs-sys/metal", "_gpu"]
vulkan = ["whisper-rs-sys/vulkan", "_gpu"]
_gpu = []
test-with-tiny-model = []
whisper-cpp-log = ["dep:log"]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* `openblas`: enable OpenBLAS support.
* `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-tracing`: allows hooking into whisper.cpp's log output and sending it to the `tracing` backend.

Expand Down
1 change: 1 addition & 0 deletions sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cuda = []
hipblas = []
openblas = []
metal = []
vulkan = []
force-debug = []
openmp = []

Expand Down
18 changes: 18 additions & 0 deletions sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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") {
config.define("GGML_BLAS", "ON");
}
Expand Down

0 comments on commit d8b6aef

Please sign in to comment.