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

Commit 8714d3b

Browse files
author
Daniél Kerkmann
committed
feat: add sycl support
1 parent e3d67d5 commit 8714d3b

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
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+
sycl = ["whisper-rs-sys/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+
sycl = []
3839

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

sys/build.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn main() {
164164

165165
config
166166
.profile("Release")
167-
.define("BUILD_SHARED_LIBS", "OFF")
167+
.define("BUILD_SHARED_LIBS", "ON")
168168
.define("WHISPER_ALL_WARNINGS", "OFF")
169169
.define("WHISPER_ALL_WARNINGS_3RD_PARTY", "OFF")
170170
.define("WHISPER_BUILD_TESTS", "OFF")
@@ -267,32 +267,43 @@ fn main() {
267267
config.define("GGML_OPENMP", "OFF");
268268
}
269269

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

272279
add_link_search_path(&out.join("build")).unwrap();
273280

274281
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");
282+
println!("cargo:rustc-link-lib=whisper");
283+
println!("cargo:rustc-link-lib=ggml");
284+
println!("cargo:rustc-link-lib=ggml-base");
285+
println!("cargo:rustc-link-lib=ggml-cpu");
279286
if cfg!(target_os = "macos") || cfg!(feature = "openblas") {
280-
println!("cargo:rustc-link-lib=static=ggml-blas");
287+
println!("cargo:rustc-link-lib=ggml-blas");
281288
}
282289
if cfg!(feature = "vulkan") {
283-
println!("cargo:rustc-link-lib=static=ggml-vulkan");
290+
println!("cargo:rustc-link-lib=ggml-vulkan");
284291
}
285292

286293
if cfg!(feature = "hipblas") {
287294
println!("cargo:rustc-link-lib=static=ggml-hip");
288295
}
289296

290297
if cfg!(feature = "metal") {
291-
println!("cargo:rustc-link-lib=static=ggml-metal");
298+
println!("cargo:rustc-link-lib=ggml-metal");
292299
}
293300

294301
if cfg!(feature = "cuda") {
295-
println!("cargo:rustc-link-lib=static=ggml-cuda");
302+
println!("cargo:rustc-link-lib=ggml-cuda");
303+
}
304+
305+
if cfg!(feature = "sycl") {
306+
println!("cargo:rustc-link-lib=ggml-sycl");
296307
}
297308

298309
if cfg!(feature = "openblas") {

0 commit comments

Comments
 (0)