feat: enable acceleration via vulkan
This commit is contained in:
parent
d45c29766e
commit
4a0353dd16
7 changed files with 33 additions and 18 deletions
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
branches:
|
||||
- feat.windows.support
|
||||
- feat/whisper.migration
|
||||
- feat/vulkan-support
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
|
@ -71,12 +72,12 @@ jobs:
|
|||
node-version: '24.1.0'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install CUDA Toolkit
|
||||
- name: Install Vulkan SDK
|
||||
if: matrix.os == 'windows'
|
||||
uses: Jimver/cuda-toolkit@v0.2.15
|
||||
uses: humbletim/install-vulkan-sdk@v1.2
|
||||
with:
|
||||
cuda: '12.4.1'
|
||||
method: 'network'
|
||||
version: 1.3.290.0
|
||||
cache: true
|
||||
|
||||
- name: Log Node.js architecture and platform
|
||||
run: |
|
||||
|
|
@ -98,11 +99,11 @@ jobs:
|
|||
GGML_NATIVE: OFF # CI mac runners lack i8mm support; keep CPU features conservative here
|
||||
run: pnpm --filter @amical/whisper-wrapper build:native
|
||||
|
||||
- name: Build whisper native binaries (cuda)
|
||||
- name: Build whisper native binaries (vulkan)
|
||||
if: matrix.os == 'windows'
|
||||
env:
|
||||
GGML_NATIVE: OFF
|
||||
run: pnpm --filter @amical/whisper-wrapper build:native:cuda
|
||||
run: pnpm --filter @amical/whisper-wrapper build:native:vulkan
|
||||
|
||||
- name: Download Node.js binaries
|
||||
working-directory: apps/desktop
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
v1.7.6
|
||||
v1.8.2
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ function variantFromName(name, platform, arch) {
|
|||
if (name.includes("-cuda")) {
|
||||
envOverrides.GGML_CUDA = "1";
|
||||
}
|
||||
if (name.includes("-vulkan")) {
|
||||
envOverrides.GGML_VULKAN = "1";
|
||||
}
|
||||
if (name.startsWith("darwin-")) {
|
||||
envOverrides.GGML_USE_ACCELERATE = envOverrides.GGML_USE_ACCELERATE || "1";
|
||||
}
|
||||
|
|
@ -262,6 +265,12 @@ for (const variant of variants) {
|
|||
};
|
||||
|
||||
propagateCMakeBool("GGML_NATIVE");
|
||||
propagateCMakeBool("GGML_VULKAN");
|
||||
propagateCMakeBool("GGML_METAL");
|
||||
propagateCMakeBool("GGML_CUDA");
|
||||
propagateCMakeBool("GGML_OPENBLAS");
|
||||
propagateCMakeBool("GGML_BLAS");
|
||||
propagateCMakeBool("GGML_USE_ACCELERATE");
|
||||
|
||||
run(cmakeParts.join(" "), {
|
||||
cwd: addonDir,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
"build": "tsc -p tsconfig.json",
|
||||
"postinstall": "node ./bin/build-addon.js",
|
||||
"build:native": "node ./scripts/build-native.js",
|
||||
"build:native:cuda": "node ./scripts/build-native.js --cuda"
|
||||
"build:native:cuda": "node ./scripts/build-native.js --cuda",
|
||||
"build:native:vulkan": "node ./scripts/build-native.js --vulkan"
|
||||
},
|
||||
"dependencies": {
|
||||
"cmake-js": "^7.3.1",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ function build(targets) {
|
|||
});
|
||||
}
|
||||
|
||||
if (process.argv.includes("--cuda")) {
|
||||
if (process.argv.includes("--vulkan")) {
|
||||
build(["win32-x64-vulkan", "win32-x64"]);
|
||||
} else if (process.argv.includes("--cuda")) {
|
||||
build(["win32-x64-cuda", "win32-x64"]);
|
||||
} else {
|
||||
build([]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
|
||||
const GPU_FIRST_CANDIDATES = ["metal", "openblas", "cuda"] as const;
|
||||
const GPU_FIRST_CANDIDATES = ["metal", "openblas", "cuda", "vulkan"] as const;
|
||||
|
||||
function candidateDirs(platform: string, arch: string): string[] {
|
||||
return [
|
||||
|
|
@ -66,13 +66,15 @@ export function loadBinding(): any {
|
|||
// Store the loaded binding info
|
||||
const bindingType = dir.includes("-cuda")
|
||||
? "cuda"
|
||||
: dir.includes("-metal")
|
||||
? "metal"
|
||||
: dir.includes("-openblas")
|
||||
? "openblas"
|
||||
: dir === "cpu-fallback"
|
||||
? "cpu-fallback"
|
||||
: "cpu";
|
||||
: dir.includes("-vulkan")
|
||||
? "vulkan"
|
||||
: dir.includes("-metal")
|
||||
? "metal"
|
||||
: dir.includes("-openblas")
|
||||
? "openblas"
|
||||
: dir === "cpu-fallback"
|
||||
? "cpu-fallback"
|
||||
: "cpu";
|
||||
loadedBindingInfo = {
|
||||
path: candidate,
|
||||
type: bindingType,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a8d002cfd879315632a579e73f0148d06959de36
|
||||
Subproject commit 4979e04f5dcaccb36057e059bbaed8a2f5288315
|
||||
Loading…
Add table
Add a link
Reference in a new issue