Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 5cbca18

Browse files
author
Daniél Kerkmann
committed
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.
1 parent e3d67d5 commit 5cbca18

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ openblas = ["whisper-rs-sys/openblas"]
3333
metal = ["whisper-rs-sys/metal", "_gpu"]
3434
vulkan = ["whisper-rs-sys/vulkan", "_gpu"]
3535
openmp = ["whisper-rs-sys/openmp"]
36+
intel-sycl = ["whisper-rs-sys/intel-sycl", "_gpu"]
3637
_gpu = []
3738
test-with-tiny-model = []
3839

sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ metal = []
3535
vulkan = []
3636
force-debug = []
3737
openmp = []
38+
intel-sycl = []
3839

3940
[build-dependencies]
4041
cmake = "0.1"

sys/build.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,39 @@ fn main() {
267267
config.define("GGML_OPENMP", "OFF");
268268
}
269269

270+
if cfg!(feature = "intel-sycl") {
271+
config.define("BUILD_SHARED_LIBS", "ON");
272+
config.define("GGML_SYCL", "ON");
273+
config.define("GGML_SYCL_TARGET", "INTEL");
274+
config.define("CMAKE_C_COMPILER", "icx");
275+
config.define("CMAKE_CXX_COMPILER", "icpx");
276+
}
277+
270278
let destination = config.build();
271279

272280
add_link_search_path(&out.join("build")).unwrap();
273281

274282
println!("cargo:rustc-link-search=native={}", destination.display());
275-
println!("cargo:rustc-link-lib=static=whisper");
276-
println!("cargo:rustc-link-lib=static=ggml");
277-
println!("cargo:rustc-link-lib=static=ggml-base");
278-
println!("cargo:rustc-link-lib=static=ggml-cpu");
283+
if cfg!(feature = "intel-sycl") {
284+
println!("cargo:rustc-link-lib=whisper");
285+
println!("cargo:rustc-link-lib=ggml");
286+
println!("cargo:rustc-link-lib=ggml-base");
287+
println!("cargo:rustc-link-lib=ggml-cpu");
288+
} else {
289+
println!("cargo:rustc-link-lib=static=whisper");
290+
println!("cargo:rustc-link-lib=static=ggml");
291+
println!("cargo:rustc-link-lib=static=ggml-base");
292+
println!("cargo:rustc-link-lib=static=ggml-cpu");
293+
}
279294
if cfg!(target_os = "macos") || cfg!(feature = "openblas") {
280295
println!("cargo:rustc-link-lib=static=ggml-blas");
281296
}
282297
if cfg!(feature = "vulkan") {
283-
println!("cargo:rustc-link-lib=static=ggml-vulkan");
298+
if cfg!(feature = "intel-sycl") {
299+
println!("cargo:rustc-link-lib=ggml-vulkan");
300+
} else {
301+
println!("cargo:rustc-link-lib=static=ggml-vulkan");
302+
}
284303
}
285304

286305
if cfg!(feature = "hipblas") {
@@ -299,6 +318,10 @@ fn main() {
299318
println!("cargo:rustc-link-lib=static=ggml-blas");
300319
}
301320

321+
if cfg!(feature = "intel-sycl") {
322+
println!("cargo:rustc-link-lib=ggml-sycl");
323+
}
324+
302325
println!(
303326
"cargo:WHISPER_CPP_VERSION={}",
304327
get_whisper_cpp_version(&whisper_root)

0 commit comments

Comments
 (0)