Skip to content

Commit f1e287e

Browse files
authored
Add Windows CUDA llama.cpp release asset
Adds a Windows x64 CUDA release asset for the llama.cpp SenseVoice runtime, with CUDA Toolkit setup, architecture-86 build flags, focused SenseVoice target packaging, docs, and workflow regression tests. Manual workflow dispatch 29656771776 passed all build matrix jobs including build-windows-x64-cuda.
1 parent 57721fc commit f1e287e

4 files changed

Lines changed: 109 additions & 7 deletions

File tree

.github/workflows/build-llamacpp-binaries.yml

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,72 @@ jobs:
8282
-DGGML_FMA=ON
8383
-DGGML_F16C=ON
8484
-DGGML_BMI2=ON
85+
- os: windows-latest
86+
name: windows-x64-cuda
87+
cuda: true
88+
cuda_version: '13.2.0'
89+
cuda_architectures: '86'
90+
build_target: llama-funasr-sensevoice
91+
timeout_minutes: 90
92+
cmake_flags: >-
93+
-DGGML_NATIVE=OFF
94+
-DGGML_CUDA=ON
95+
-DGGML_CUDA_FORCE_CUBLAS=ON
96+
-DGGML_CUDA_FA=OFF
97+
-DGGML_CUDA_NCCL=OFF
98+
-DGGML_CUDA_GRAPHS=OFF
99+
-DGGML_AVX=OFF
100+
-DGGML_AVX2=OFF
101+
-DGGML_AVX_VNNI=OFF
102+
-DGGML_AVX512=OFF
103+
-DGGML_AVX512_VBMI=OFF
104+
-DGGML_AVX512_VNNI=OFF
105+
-DGGML_AVX512_BF16=OFF
106+
-DGGML_FMA=OFF
107+
-DGGML_F16C=OFF
108+
-DGGML_BMI2=OFF
85109
runs-on: ${{ matrix.os }}
110+
timeout-minutes: ${{ matrix.timeout_minutes || 30 }}
86111
defaults:
87112
run:
88113
shell: bash
89114
working-directory: runtime/llama.cpp
90115
steps:
91116
- uses: actions/checkout@v4
117+
- name: Install CUDA Toolkit
118+
if: matrix.cuda
119+
uses: Jimver/cuda-toolkit@v0.2.35
120+
with:
121+
cuda: ${{ matrix.cuda_version }}
122+
method: network
123+
log-file-suffix: ${{ matrix.name }}.txt
124+
- name: Show CUDA compiler
125+
if: matrix.cuda
126+
run: nvcc --version
92127
- name: Configure and build
93128
run: |
94129
# Release binaries must be portable across user machines, not tuned to
95130
# the ephemeral CI runner CPU. A native ggml build may emit AVX512 or
96131
# AVX-VNNI instructions and then crash with SIGILL on ordinary CPUs.
97132
# Keep the default x64 package conservative, and publish explicit
98133
# x64-avx2 assets for machines that support AVX2/FMA/F16C/BMI2.
99-
cmake -B build -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_flags }}
100-
cmake --build build --config Release -j 2
134+
# The CUDA release asset is SenseVoiceSmall-specific for now; building
135+
# only that target keeps the Windows CUDA job bounded and matches the
136+
# backend currently exposed by `--backend cuda`.
137+
cmake_args=(
138+
-B build
139+
-DCMAKE_BUILD_TYPE=Release
140+
${{ matrix.cmake_flags }}
141+
)
142+
if [ -n "${{ matrix.cuda_architectures }}" ]; then
143+
cmake_args+=("-DCMAKE_CUDA_ARCHITECTURES=${{ matrix.cuda_architectures }}")
144+
fi
145+
cmake "${cmake_args[@]}"
146+
if [ -n "${{ matrix.build_target }}" ]; then
147+
cmake --build build --config Release -j 2 --target "${{ matrix.build_target }}"
148+
else
149+
cmake --build build --config Release -j 2
150+
fi
101151
- name: Package
102152
run: |
103153
mkdir -p pkg
@@ -135,4 +185,4 @@ jobs:
135185
gh release create "$tag" dist/* \
136186
--repo "${{ github.repository }}" \
137187
--title "FunASR llama.cpp runtime $version" \
138-
--notes "Prebuilt self-contained binaries for the FunASR llama.cpp / GGUF runtime: SenseVoice, Paraformer and Fun-ASR-Nano with built-in FSMN-VAD. Download the default quantized model with \`bash download-funasr-model.sh <sensevoice|paraformer|nano>\` (the helper requires the Hugging Face CLI: \`pip install -U huggingface_hub\`), then run \`llama-funasr-cli\` / \`llama-funasr-sensevoice\` / \`llama-funasr-paraformer\`. Use the default x64 asset for maximum CPU compatibility; use the x64-avx2 asset on CPUs with AVX2/FMA/F16C/BMI2 for higher throughput. No Python ASR runtime or local build is required. Docs: $docs"
188+
--notes "Prebuilt self-contained binaries for the FunASR llama.cpp / GGUF runtime: SenseVoice, Paraformer and Fun-ASR-Nano with built-in FSMN-VAD. Download the default quantized model with \`bash download-funasr-model.sh <sensevoice|paraformer|nano>\` (the helper requires the Hugging Face CLI: \`pip install -U huggingface_hub\`), then run \`llama-funasr-cli\` / \`llama-funasr-sensevoice\` / \`llama-funasr-paraformer\`. Use the default x64 asset for maximum CPU compatibility; use the x64-avx2 asset on CPUs with AVX2/FMA/F16C/BMI2 for higher throughput. The Windows CUDA asset is \`windows-x64-cuda\`; it requires an NVIDIA driver compatible with the CUDA Toolkit version configured by the release workflow, targets CUDA architecture 86, and enables SenseVoiceSmall graph execution with \`llama-funasr-sensevoice ... --backend cuda\`. Build from source for other GPU architectures. No Python ASR runtime or local build is required. Docs: $docs"

runtime/llama.cpp/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2424
endif()
2525

2626
include(FetchContent)
27+
if(POLICY CMP0169)
28+
cmake_policy(SET CMP0169 OLD)
29+
endif()
2730
set(LLAMA_BUILD_TESTS OFF CACHE BOOL "" FORCE)
2831
set(LLAMA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
2932
set(LLAMA_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
@@ -32,7 +35,11 @@ set(LLAMA_CURL OFF CACHE BOOL "" FORCE)
3235
FetchContent_Declare(llama
3336
GIT_REPOSITORY https://github.com/ggml-org/llama.cpp.git
3437
GIT_TAG 8086439a4cea94c71a5dfb8fe4ad1546aebd640f)
35-
FetchContent_MakeAvailable(llama)
38+
FetchContent_GetProperties(llama)
39+
if(NOT llama_POPULATED)
40+
FetchContent_Populate(llama)
41+
add_subdirectory(${llama_SOURCE_DIR} ${llama_BINARY_DIR})
42+
endif()
3643

3744
find_package(Threads REQUIRED)
3845
set(FUNASR_COMMON ${CMAKE_CURRENT_SOURCE_DIR}/funasr-common)

runtime/llama.cpp/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ cmake --build build-cuda -j --target llama-funasr-sensevoice
7272
-m sensevoice-small-f16.gguf -a sample.wav --backend cuda
7373
```
7474

75-
`--backend cpu` remains the default and is what the current cross-platform
76-
prebuilt binaries use. A binary built without `-DGGML_CUDA=ON` exits with a clear
77-
message if `--backend cuda` is requested.
75+
`--backend cpu` remains the default and is what the portable cross-platform
76+
prebuilt binaries use. Tagged runtime releases also publish a
77+
`funasr-llamacpp-windows-x64-cuda.zip` package when the Windows CUDA release job
78+
passes; it requires an NVIDIA driver compatible with the CUDA Toolkit version
79+
configured by that release job and targets CUDA architecture 86. Build from source
80+
for other GPU architectures. A binary built without `-DGGML_CUDA=ON` exits with a
81+
clear message if `--backend cuda` is requested.
7882

7983
## Build (shared)
8084
```bash
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from pathlib import Path
2+
3+
4+
ROOT = Path(__file__).resolve().parents[3]
5+
WORKFLOW = ROOT / ".github" / "workflows" / "build-llamacpp-binaries.yml"
6+
7+
8+
def test_windows_cuda_release_asset_is_in_matrix():
9+
workflow = WORKFLOW.read_text(encoding="utf-8")
10+
11+
assert "name: windows-x64-cuda" in workflow
12+
assert "cuda: true" in workflow
13+
assert "windows-x64-cuda" in workflow
14+
assert "cuda_architectures: '86'" in workflow
15+
assert "build_target: llama-funasr-sensevoice" in workflow
16+
assert "timeout_minutes: 90" in workflow
17+
18+
19+
def test_windows_cuda_build_uses_cuda_toolkit_and_flags():
20+
workflow = WORKFLOW.read_text(encoding="utf-8")
21+
22+
assert "Jimver/cuda-toolkit" in workflow
23+
assert "if: matrix.cuda" in workflow
24+
assert "-DGGML_CUDA=ON" in workflow
25+
assert "-DGGML_CUDA_FORCE_CUBLAS=ON" in workflow
26+
assert "-DGGML_CUDA_FA=OFF" in workflow
27+
assert "-DGGML_CUDA_NCCL=OFF" in workflow
28+
assert "CMAKE_CUDA_ARCHITECTURES=${{ matrix.cuda_architectures }}" in workflow
29+
assert "cmake \"${cmake_args[@]}\"" in workflow
30+
assert "--target \"${{ matrix.build_target }}\"" in workflow
31+
32+
33+
def test_release_notes_explain_cpu_and_cuda_windows_assets():
34+
readme = (ROOT / "runtime" / "llama.cpp" / "README.md").read_text(encoding="utf-8")
35+
36+
assert "windows-x64-cuda" in readme
37+
assert "--backend cuda" in readme
38+
assert "Windows CUDA" in readme
39+
assert "CUDA architecture 86" in readme
40+
assert "Build from source" in readme
41+
assert "other GPU architectures" in readme

0 commit comments

Comments
 (0)