Skip to content

Commit 9e29fde

Browse files
committed
fix: always use MSVC for Vulkan on Windows x64
1 parent c4c066b commit 9e29fde

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/guide/Vulkan.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ If you see `Vulkan used VRAM` in the output, it means that Vulkan support is wor
5959

6060
:::
6161

62+
* :::details Windows only: enable long paths support
63+
Open cmd as Administrator and run this command:
64+
```shell
65+
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v "LongPathsEnabled" /t REG_DWORD /d "1" /f
66+
```
67+
:::
68+
6269
### Building From Source
6370
When you use the [`getLlama`](../api/functions/getLlama) method, if there's no binary that matches the provided options, it'll automatically build `llama.cpp` from source.
6471

src/bindings/utils/compileLLamaCpp.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ export async function compileLlamaCpp(buildOptions: BuildOptions, compileOptions
5959
: buildFolderName.withoutCustomCmakeOptions;
6060
const useWindowsLlvm = (
6161
platform === "win" &&
62-
(buildOptions.gpu === false || buildOptions.gpu === "vulkan") &&
62+
(
63+
buildOptions.gpu === false ||
64+
(buildOptions.gpu === "vulkan" && buildOptions.arch === "arm64") // Vulkan can't be compiled on Windows x64 with LLVM ATM
65+
) &&
6366
!ignoreWorkarounds.includes("avoidWindowsLlvm") &&
6467
!buildOptions.customCmakeOptions.has("CMAKE_TOOLCHAIN_FILE") &&
6568
!requiresMsvcOnWindowsFlags.some((flag) => buildOptions.customCmakeOptions.has(flag))
@@ -105,7 +108,7 @@ export async function compileLlamaCpp(buildOptions: BuildOptions, compileOptions
105108

106109
if (toolchainFile != null &&
107110
buildOptions.gpu === "vulkan" &&
108-
useWindowsLlvm &&
111+
(useWindowsLlvm || (platform === "win" && buildOptions.arch === "arm64")) &&
109112
!cmakeCustomOptions.has("GGML_VULKAN_SHADERS_GEN_TOOLCHAIN")
110113
)
111114
cmakeToolchainOptions.set("GGML_VULKAN_SHADERS_GEN_TOOLCHAIN", toolchainFile);

0 commit comments

Comments
 (0)