From d4c99082ee1064fa7a224eecd04f38dcf8b3f854 Mon Sep 17 00:00:00 2001 From: HoloPengin Date: Wed, 27 Mar 2024 08:31:31 +0900 Subject: [PATCH] ci: support Vulkan build on Windows (#1726) * Fix vulkan build feature on Windows * Add Windows vulkan build to release.yml. Untested * Documentation changes * Fix library name on Windows, leave as is elsewhere * Update index.mdx * Update index.mdx --------- Co-authored-by: Meng Zhang --- .github/workflows/release.yml | 7 +++++++ CONTRIBUTING.md | 6 ++++++ crates/llama-cpp-bindings/build.rs | 8 ++++++-- website/docs/installation/windows/index.mdx | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 290128712ace..170d9f84e3d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,7 @@ jobs: - x86_64-manylinux2014-cuda122 - x86_64-manylinux2014-vulkan - x86_64-windows-msvc + - x86_64-windows-msvc-vulkan - x86_64-windows-msvc-cuda117 - x86_64-windows-msvc-cuda122 include: @@ -67,6 +68,12 @@ jobs: binary: x86_64-windows-msvc build_args: --features prod-db ext: .exe + - os: windows-latest + target: x86_64-pc-windows-msvc + binary: x86_64-windows-msvc-vulkan + ext: .exe + build_args: --features vulkan,prod-db + vulkan_sdk: '1.3.280.0' - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc-cuda117 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f209e04d233..c18aa9f8bc3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,6 +67,12 @@ To run Tabby locally with ROCm (AMD): cargo run --features rocm serve --model TabbyML/StarCoder-1B --device rocm ``` +To run Tabby locally with Vulkan: + +``` +cargo run --features vulkan serve --model TabbyML/StarCoder-1B --device vulkan +``` + To run Tabby locally with Metal (Apple M1/M2): ``` diff --git a/crates/llama-cpp-bindings/build.rs b/crates/llama-cpp-bindings/build.rs index dc3a942b1378..8c0da8a72326 100644 --- a/crates/llama-cpp-bindings/build.rs +++ b/crates/llama-cpp-bindings/build.rs @@ -91,10 +91,14 @@ fn build_llama_cpp() { } if cfg!(feature = "vulkan") { if let Ok(vulkan_sdk_path) = env::var("VULKAN_SDK") { - println!("cargo:rustc-link-search=native={}/lib", vulkan_sdk_path); + println!("cargo:rustc-link-search={}/lib", vulkan_sdk_path); } config.define("LLAMA_VULKAN", "ON"); - println!("cargo:rustc-link-lib=vulkan"); + if cfg!(target_os = "windows") { + println!("cargo:rustc-link-lib=vulkan-1"); + } else { + println!("cargo:rustc-link-lib=vulkan"); + } } // By default, this value is automatically inferred from Rust’s compilation profile. diff --git a/website/docs/installation/windows/index.mdx b/website/docs/installation/windows/index.mdx index 032af90278f9..a2de87ef6257 100644 --- a/website/docs/installation/windows/index.mdx +++ b/website/docs/installation/windows/index.mdx @@ -30,4 +30,4 @@ Open a command prompt or PowerShell window in the directory where you downloaded You should see the following output if the command runs successfully: ![Windows running output](./status.png) -You can also go to `http://localhost:8080/swagger-ui/` to check the available API endpoints. \ No newline at end of file +You can also go to `http://localhost:8080/swagger-ui/` to check the available API endpoints.