commit
b46876ae5a
4 changed files with 36 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ default = []
|
||||||
raw-api = []
|
raw-api = []
|
||||||
coreml = ["whisper-rs-sys/coreml"]
|
coreml = ["whisper-rs-sys/coreml"]
|
||||||
cuda = ["whisper-rs-sys/cuda", "_gpu"]
|
cuda = ["whisper-rs-sys/cuda", "_gpu"]
|
||||||
|
hipblas = ["whisper-rs-sys/hipblas", "_gpu"]
|
||||||
opencl = ["whisper-rs-sys/opencl"]
|
opencl = ["whisper-rs-sys/opencl"]
|
||||||
openblas = ["whisper-rs-sys/openblas"]
|
openblas = ["whisper-rs-sys/openblas"]
|
||||||
metal = ["whisper-rs-sys/metal", "_gpu"]
|
metal = ["whisper-rs-sys/metal", "_gpu"]
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ All disabled by default unless otherwise specified.
|
||||||
**NOTE**: enabling this no longer guarantees semver compliance,
|
**NOTE**: enabling this no longer guarantees semver compliance,
|
||||||
as whisper-rs-sys may be upgraded to a breaking version in a patch release of whisper-rs.
|
as whisper-rs-sys may be upgraded to a breaking version in a patch release of whisper-rs.
|
||||||
* `cuda`: enable CUDA support. Implicitly enables hidden GPU flag at runtime.
|
* `cuda`: enable CUDA support. Implicitly enables hidden GPU flag at runtime.
|
||||||
|
* `hipblas`: enable ROCm/hipBLAS support. Only available on linux. Implicitly enables hidden GPU flag at runtime.
|
||||||
* `opencl`: enable OpenCL support. Upstream whisper.cpp does not treat OpenCL as a GPU, so it is always enabled at
|
* `opencl`: enable OpenCL support. Upstream whisper.cpp does not treat OpenCL as a GPU, so it is always enabled at
|
||||||
runtime.
|
runtime.
|
||||||
* `openblas`: enable OpenBLAS support.
|
* `openblas`: enable OpenBLAS support.
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ include = [
|
||||||
[features]
|
[features]
|
||||||
coreml = []
|
coreml = []
|
||||||
cuda = []
|
cuda = []
|
||||||
|
hipblas = []
|
||||||
opencl = []
|
opencl = []
|
||||||
openblas = []
|
openblas = []
|
||||||
metal = []
|
metal = []
|
||||||
|
|
|
||||||
33
sys/build.rs
33
sys/build.rs
|
|
@ -58,6 +58,29 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "hipblas")]
|
||||||
|
{
|
||||||
|
println!("cargo:rustc-link-lib=hipblas");
|
||||||
|
println!("cargo:rustc-link-lib=rocblas");
|
||||||
|
println!("cargo:rustc-link-lib=amdhip64");
|
||||||
|
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(target_os = "windows")] {
|
||||||
|
panic!("Due to a problem with the last revision of the ROCm 5.7 library, it is not possible to compile the library for the windows environment.\nSee https://github.com/ggerganov/whisper.cpp/issues/2202 for more details.")
|
||||||
|
} else {
|
||||||
|
println!("cargo:rerun-if-env-changed=HIP_PATH");
|
||||||
|
|
||||||
|
let hip_path = match env::var("HIP_PATH") {
|
||||||
|
Ok(path) =>PathBuf::from(path),
|
||||||
|
Err(_) => PathBuf::from("/opt/rocm"),
|
||||||
|
};
|
||||||
|
let hip_lib_path = hip_path.join("lib");
|
||||||
|
|
||||||
|
println!("cargo:rustc-link-search={}",hip_lib_path.display());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=wrapper.h");
|
println!("cargo:rerun-if-changed=wrapper.h");
|
||||||
|
|
||||||
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
@ -126,6 +149,16 @@ fn main() {
|
||||||
config.define("WHISPER_CUDA", "ON");
|
config.define("WHISPER_CUDA", "ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "hipblas") {
|
||||||
|
config.define("WHISPER_HIPBLAS", "ON");
|
||||||
|
config.define("CMAKE_C_COMPILER", "hipcc");
|
||||||
|
config.define("CMAKE_CXX_COMPILER", "hipcc");
|
||||||
|
println!("cargo:rerun-if-env-changed=AMDGPU_TARGETS");
|
||||||
|
if let Ok(gpu_targets) = env::var("AMDGPU_TARGETS") {
|
||||||
|
config.define("AMDGPU_TARGETS", gpu_targets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if cfg!(feature = "openblas") {
|
if cfg!(feature = "openblas") {
|
||||||
config.define("WHISPER_OPENBLAS", "ON");
|
config.define("WHISPER_OPENBLAS", "ON");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue