feat: add intel-sycl support
Adding Intel Sycl with the feature flag `intel-sycl` to it. Static linking the intel sycl isn't possible, that's the reason why it's dynamic linked.
This commit is contained in:
parent
e3d67d513b
commit
5cbca18263
3 changed files with 30 additions and 5 deletions
|
|
@ -33,6 +33,7 @@ openblas = ["whisper-rs-sys/openblas"]
|
||||||
metal = ["whisper-rs-sys/metal", "_gpu"]
|
metal = ["whisper-rs-sys/metal", "_gpu"]
|
||||||
vulkan = ["whisper-rs-sys/vulkan", "_gpu"]
|
vulkan = ["whisper-rs-sys/vulkan", "_gpu"]
|
||||||
openmp = ["whisper-rs-sys/openmp"]
|
openmp = ["whisper-rs-sys/openmp"]
|
||||||
|
intel-sycl = ["whisper-rs-sys/intel-sycl", "_gpu"]
|
||||||
_gpu = []
|
_gpu = []
|
||||||
test-with-tiny-model = []
|
test-with-tiny-model = []
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ metal = []
|
||||||
vulkan = []
|
vulkan = []
|
||||||
force-debug = []
|
force-debug = []
|
||||||
openmp = []
|
openmp = []
|
||||||
|
intel-sycl = []
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cmake = "0.1"
|
cmake = "0.1"
|
||||||
|
|
|
||||||
33
sys/build.rs
33
sys/build.rs
|
|
@ -267,20 +267,39 @@ fn main() {
|
||||||
config.define("GGML_OPENMP", "OFF");
|
config.define("GGML_OPENMP", "OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "intel-sycl") {
|
||||||
|
config.define("BUILD_SHARED_LIBS", "ON");
|
||||||
|
config.define("GGML_SYCL", "ON");
|
||||||
|
config.define("GGML_SYCL_TARGET", "INTEL");
|
||||||
|
config.define("CMAKE_C_COMPILER", "icx");
|
||||||
|
config.define("CMAKE_CXX_COMPILER", "icpx");
|
||||||
|
}
|
||||||
|
|
||||||
let destination = config.build();
|
let destination = config.build();
|
||||||
|
|
||||||
add_link_search_path(&out.join("build")).unwrap();
|
add_link_search_path(&out.join("build")).unwrap();
|
||||||
|
|
||||||
println!("cargo:rustc-link-search=native={}", destination.display());
|
println!("cargo:rustc-link-search=native={}", destination.display());
|
||||||
println!("cargo:rustc-link-lib=static=whisper");
|
if cfg!(feature = "intel-sycl") {
|
||||||
println!("cargo:rustc-link-lib=static=ggml");
|
println!("cargo:rustc-link-lib=whisper");
|
||||||
println!("cargo:rustc-link-lib=static=ggml-base");
|
println!("cargo:rustc-link-lib=ggml");
|
||||||
println!("cargo:rustc-link-lib=static=ggml-cpu");
|
println!("cargo:rustc-link-lib=ggml-base");
|
||||||
|
println!("cargo:rustc-link-lib=ggml-cpu");
|
||||||
|
} else {
|
||||||
|
println!("cargo:rustc-link-lib=static=whisper");
|
||||||
|
println!("cargo:rustc-link-lib=static=ggml");
|
||||||
|
println!("cargo:rustc-link-lib=static=ggml-base");
|
||||||
|
println!("cargo:rustc-link-lib=static=ggml-cpu");
|
||||||
|
}
|
||||||
if cfg!(target_os = "macos") || cfg!(feature = "openblas") {
|
if cfg!(target_os = "macos") || cfg!(feature = "openblas") {
|
||||||
println!("cargo:rustc-link-lib=static=ggml-blas");
|
println!("cargo:rustc-link-lib=static=ggml-blas");
|
||||||
}
|
}
|
||||||
if cfg!(feature = "vulkan") {
|
if cfg!(feature = "vulkan") {
|
||||||
println!("cargo:rustc-link-lib=static=ggml-vulkan");
|
if cfg!(feature = "intel-sycl") {
|
||||||
|
println!("cargo:rustc-link-lib=ggml-vulkan");
|
||||||
|
} else {
|
||||||
|
println!("cargo:rustc-link-lib=static=ggml-vulkan");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "hipblas") {
|
if cfg!(feature = "hipblas") {
|
||||||
|
|
@ -299,6 +318,10 @@ fn main() {
|
||||||
println!("cargo:rustc-link-lib=static=ggml-blas");
|
println!("cargo:rustc-link-lib=static=ggml-blas");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "intel-sycl") {
|
||||||
|
println!("cargo:rustc-link-lib=ggml-sycl");
|
||||||
|
}
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"cargo:WHISPER_CPP_VERSION={}",
|
"cargo:WHISPER_CPP_VERSION={}",
|
||||||
get_whisper_cpp_version(&whisper_root)
|
get_whisper_cpp_version(&whisper_root)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue