Skip to content

Commit 4f98b28

Browse files
committed
Separate cu128 compilation from the windows github action and supplement sm_87 sm101 compilation
1 parent 6ec4e64 commit 4f98b28

File tree

5 files changed

+140
-10
lines changed

5 files changed

+140
-10
lines changed

.github/workflows/build-wheels-cuda-win.yml renamed to .github/workflows/build-wheels-cu124-cu126-win.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Wheels (CUDA) for Windows
1+
name: Build Wheels (CU124-126) for Windows
22

33
on:
44
workflow_dispatch:
@@ -23,7 +23,7 @@ jobs:
2323
$matrix = @{
2424
'os' = @('windows-2022')
2525
'pyver' = @("3.10", "3.11", "3.12", "3.13")
26-
'cuda' = @("12.4.1","12.6.3","12.8.1")
26+
'cuda' = @("12.4.1","12.6.3")
2727
'releasetag' = @("AVX2")
2828
'cudaarch' = @("all")
2929
}
@@ -58,8 +58,7 @@ jobs:
5858
- uses: actions/checkout@v4
5959
with:
6060
submodules: "recursive"
61-
62-
61+
6362
# from kingbri1/flash-attention build-wheels.yml
6463
- name: Install CUDA ${{ matrix.cuda }}
6564
uses: N-Storm/cuda-toolkit@v0.2.28

.github/workflows/build-wheels-cu124-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
apt update
35-
apt install -y build-essential cmake curl git libgomp1 libcurl4-openssl-dev
35+
apt install -y build-essential cmake ccache curl git libgomp1 libcurl4-openssl-dev
3636
3737
- uses: actions/checkout@v4 # Checkout code
3838
with:
@@ -61,7 +61,7 @@ jobs:
6161
echo $LD_LIBRARY_PATH
6262
6363
# Add project-specific and feature flags
64-
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='70-real;75-real;80-real;86-real;89-real'"
64+
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='70-real;75-real;80-real;86-real;87-real;89-real'"
6565
CMAKE_ARGS="-DGGML_CUDA_FORCE_MMQ=ON ${CMAKE_ARGS}"
6666
CMAKE_ARGS="${CMAKE_ARGS} -DLLAMA_CURL=ON"
6767

.github/workflows/build-wheels-cu126-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
apt update
35-
apt install -y build-essential cmake curl git libgomp1 libcurl4-openssl-dev
35+
apt install -y build-essential cmake ccache curl git libgomp1 libcurl4-openssl-dev
3636
3737
- uses: actions/checkout@v4 # Checkout code
3838
with:
@@ -61,7 +61,7 @@ jobs:
6161
echo $LD_LIBRARY_PATH
6262
6363
# Add project-specific and feature flags
64-
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='70-real;75-real;80-real;86-real;89-real'"
64+
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='70-real;75-real;80-real;86-real;87-real;89-real'"
6565
CMAKE_ARGS="-DGGML_CUDA_FORCE_MMQ=ON ${CMAKE_ARGS}"
6666
CMAKE_ARGS="${CMAKE_ARGS} -DLLAMA_CURL=ON"
6767

.github/workflows/build-wheels-cu128-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
apt update
35-
apt install -y build-essential cmake curl git libgomp1 libcurl4-openssl-dev
35+
apt install -y build-essential ccache cmake curl git libgomp1 libcurl4-openssl-dev
3636
3737
- uses: actions/checkout@v4 # Checkout code
3838
with:
@@ -61,7 +61,7 @@ jobs:
6161
echo $LD_LIBRARY_PATH
6262
6363
# Add project-specific and feature flags
64-
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='75-real;80-real;86-real;89-real;90-real;100-real;120-real'"
64+
CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES='75-real;80-real;86-real;87-real;89-real;90-real;100-real;101-real;120-real'"
6565
CMAKE_ARGS="-DGGML_CUDA_FORCE_MMQ=ON ${CMAKE_ARGS}"
6666
CMAKE_ARGS="${CMAKE_ARGS} -DLLAMA_CURL=ON"
6767
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build Wheels (CU128) for Windows
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
define_matrix:
11+
name: Define Build Matrix
12+
runs-on: windows-2022
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
defaults:
16+
run:
17+
shell: pwsh
18+
19+
steps:
20+
- name: Define Job Output
21+
id: set-matrix
22+
run: |
23+
$matrix = @{
24+
'os' = @('windows-2022')
25+
'pyver' = @("3.10", "3.11", "3.12", "3.13")
26+
'cuda' = @("12.8.1")
27+
'releasetag' = @("AVX2")
28+
'cudaarch' = @("75-real;80-real;86-real;87-real;89-real;90-real;100-real;101-real;120-real")
29+
}
30+
31+
$matrixOut = ConvertTo-Json $matrix -Compress
32+
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT
33+
34+
build_wheels:
35+
name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ${{ matrix.cuda }} ${{ matrix.releasetag == 'wheels' && 'AVX2' || matrix.releasetag }}
36+
needs: define_matrix
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }}
40+
defaults:
41+
run:
42+
shell: pwsh
43+
env:
44+
CUDAVER: ${{ matrix.cuda }}
45+
AVXVER: ${{ matrix.releasetag }}
46+
CUDAARCHVER: ${{ matrix.cudaarch }}
47+
# https://cmake.org/cmake/help/latest/prop_tgt/CUDA_ARCHITECTURES.html
48+
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#gpu-feature-list
49+
# e.g. "all" "89"
50+
51+
steps:
52+
- name: Add MSBuild to PATH
53+
if: runner.os == 'Windows'
54+
uses: microsoft/setup-msbuild@v2
55+
with:
56+
msbuild-architecture: x64
57+
58+
- uses: actions/checkout@v4
59+
with:
60+
submodules: "recursive"
61+
62+
# from kingbri1/flash-attention build-wheels.yml
63+
- name: Install CUDA ${{ matrix.cuda }}
64+
uses: N-Storm/cuda-toolkit@v0.2.28
65+
id: cuda-toolkit
66+
with:
67+
cuda: "${{ matrix.cuda }}"
68+
use-github-cache: false
69+
70+
# from astral-sh/setup-uv
71+
- name: Install the latest version of uv and set the python version
72+
uses: astral-sh/setup-uv@v6
73+
with:
74+
python-version: ${{ matrix.pyver }}
75+
activate-environment: true
76+
enable-cache: true
77+
78+
- name: Install Dependencies
79+
run: |
80+
git config --system core.longpaths true
81+
uv pip install --upgrade build setuptools wheel packaging
82+
83+
- name: Build Wheel
84+
run: |
85+
# $cupath = 'CUDA_PATH_V' + $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','_')
86+
# echo "$cupath=$env:CONDA_PREFIX" >> $env:GITHUB_ENV
87+
88+
$cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','')
89+
# $env:CUDA_PATH = $env:CONDA_PREFIX
90+
$env:CUDA_HOME = $env:CUDA_PATH
91+
$env:CUDA_TOOLKIT_ROOT_DIR = $env:CUDA_PATH
92+
if ($IsLinux) {
93+
$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH
94+
}
95+
$env:VERBOSE = '1'
96+
$env:CMAKE_ARGS = '-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=' + $env:CUDAARCHVER
97+
$env:CMAKE_ARGS = "-DGGML_CUDA_FORCE_MMQ=ON $env:CMAKE_ARGS"
98+
$env:CMAKE_ARGS = "-DLLAMA_CURL=OFF $env:CMAKE_ARGS"
99+
if ($env:AVXVER -eq 'AVX') {
100+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX2=off -DGGML_FMA=off -DGGML_F16C=off'
101+
}
102+
if ($env:AVXVER -eq 'AVX2') {
103+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX2=on -DGGML_FMA=off -DGGML_F16C=off'
104+
}
105+
# if ($env:AVXVER -eq 'AVX512') {
106+
# $env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX512=on'
107+
# }
108+
# if ($env:AVXVER -eq 'basic') {
109+
# $env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX=off -DGGML_AVX2=off -DGGML_FMA=off -DGGML_F16C=off'
110+
# }
111+
python -m build --wheel
112+
# write the build tag to the output
113+
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
114+
115+
$wheel = (gi '.\dist\*.whl')[0]
116+
$tagVer = $wheel.name.split('-')[1]
117+
Write-Output "TAG_VERSION=$tagVer" >> $env:GITHUB_ENV
118+
119+
- name: Get Current Date
120+
id: get-date
121+
run: |
122+
$currentDate = Get-Date -UFormat "%Y%m%d"
123+
Write-Output "BUILD_DATE=$currentDate" >> $env:GITHUB_ENV
124+
125+
- uses: softprops/action-gh-release@v2.2.2
126+
with:
127+
files: dist/*
128+
# Set tag_name to <tag>-cu<cuda_version>-<date>-win
129+
tag_name: v${{ env.TAG_VERSION }}-cu${{ env.CUDA_VERSION }}-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)