Skip to content

Commit 7b0c70f

Browse files
authored
Merge branch 'main' into build-cmake
2 parents b71b3e0 + 1abd5e7 commit 7b0c70f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+11139
-5176
lines changed

.clang-format

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
BasedOnStyle: LLVM
3+
AlignAfterOpenBracket: BlockIndent
4+
BinPackArguments: true
5+
BinPackParameters: true
6+
BracedInitializerIndentWidth: 4
7+
ColumnLimit: 120
8+
Cpp11BracedListStyle: true
9+
IndentWidth: 4
10+
IndentWrappedFunctionNames: true
11+
PointerAlignment: Left
12+
SeparateDefinitionBlocks: Always
13+
Standard: c++17
14+
StatementMacros:
15+
- 'MAKE_PreconditionOptimizer32bit1State'
16+
- 'MAKE_PreconditionOptimizer32bit2State'
17+
- 'MAKE_PreconditionStatic8bit1State'
18+
- 'MAKE_PreconditionStatic8bit2State'
19+
- 'MAKE_Optimizer32bit1State'
20+
- 'MAKE_optimizerStatic8bit1State'
21+
- 'MAKE_optimizerStatic8bit2State'
22+
- 'MAKE_OptimizerStatic8bit1StateBlockwise'
23+
- 'MAKE_OptimizerStatic8bit2StateBlockwise'
24+
- 'MAKE_kQuantizeBlockwise'
25+
- 'MAKE_BLOCKWISE8'
26+
- 'MAKE_ELEMENTWISE_FUNC'
27+
- 'CMAKE_ELEMENTWISE_FUNC'
28+
- 'MAKE_FUNC8'
29+
- 'MAKE_FUNC32'
30+
- 'MAKE_CBLOCKWISE8'
31+
- 'MAKE_CFUNC8'
32+
- 'MAKE_CFUNC32'
33+
34+
UseTab: Never
35+
36+
...

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ ea7c14f8ef64924f2d0ff80df3cdabf2c7299848
1515

1616
# CHANGELOG: to reverse chron order + mdformat
1717
4743ff0d43e04e4cc3e5d8b9e7cd016c0defa36d
18+
19+
# Apply clang-format
20+
4955d136ae083c2be1236d8915913166e1790aad

.github/scripts/build-cuda.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ if [[ -v cuda_targets ]]; then
1111
elif [ "${build_arch}" = "aarch64" ]; then
1212
build_capability="75;80;90"
1313

14-
# CUDA 12.8: Add sm100
15-
[[ "${cuda_version}" == 12.8.* ]] && build_capability="75;80;90;100"
14+
# CUDA 12.8+: Add sm100/sm120
15+
[[ "${cuda_version}" == 12.8.* || "${cuda_version}" == 12.9.* ]] && build_capability="75;80;90;100;120"
1616
else
1717
# By default, target Maxwell through Hopper.
1818
build_capability="50;52;60;61;70;75;80;86;89;90"
1919

20-
# CUDA 12.8: Add sm100 and sm120; remove < sm75 to align with PyTorch 2.7+cu128 minimum
21-
[[ "${cuda_version}" == 12.8.* ]] && build_capability="75;80;86;89;90;100;120"
20+
# CUDA 12.8+: Add sm100 and sm120; remove < sm75 to align with PyTorch 2.7+cu128 minimum
21+
[[ "${cuda_version}" == 12.8.* || "${cuda_version}" == 12.9.* ]] && build_capability="75;80;86;89;90;100;120"
2222
fi
2323

2424
[[ "${build_os}" = windows-* ]] && python3 -m pip install ninja

.github/scripts/build-rocm.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
declare build_arch
3+
declare build_os
4+
declare rocm_version
5+
6+
set -xeuo pipefail
7+
bnb_rocm_arch="gfx90a;gfx942;gfx1100"
8+
if [ "${build_os:0:6}" == ubuntu ]; then
9+
image=rocm/dev-ubuntu-22.04:${rocm_version}-complete
10+
echo "Using image $image"
11+
docker run --rm --platform "linux/$build_arch" -i \
12+
-w /src -v "$PWD:/src" "$image" sh -c \
13+
"apt-get update \
14+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake \
15+
&& cmake -DCOMPUTE_BACKEND=hip -DBNB_ROCM_ARCH=\"${bnb_rocm_arch}\" . \
16+
&& cmake --build ."
17+
fi
18+
19+
output_dir="output/${build_os}/${build_arch}"
20+
mkdir -p "${output_dir}"
21+
(shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} "${output_dir}")

.github/workflows/python-package.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ jobs:
7272
- os: windows-latest
7373
arch: x86_64
7474
cuda_version:
75-
["11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2", "12.4.1", "12.5.1", "12.6.3", "12.8.1"]
75+
["11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2", "12.4.1", "12.5.1", "12.6.3", "12.8.1", "12.9.1"]
7676
runs-on: ${{ matrix.os }}
7777
steps:
7878
- uses: actions/checkout@v4
7979
# Windows: We install Cuda on the agent (slow)
80-
- uses: Jimver/[email protected].22
80+
- uses: Jimver/cuda-toolkit@c35baa1a18fd1fc9dcf47c5bd839bf30559c0bc3 # v0.2.24
8181
if: startsWith(matrix.os, 'windows')
8282
id: cuda-toolkit
8383
with:
84-
cuda: ${{ matrix.cuda_version }}
84+
# Temporary: Use CUDA 12.9.0 for Windows until 12.9.1 is supported with this action.
85+
cuda: ${{ matrix.cuda_version == '12.9.1' && '12.9.0' || matrix.cuda_version }}
8586
method: "network"
8687
sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]'
8788
linux-local-args: '["--toolkit"]'
@@ -102,10 +103,55 @@ jobs:
102103
path: output/*
103104
retention-days: 7
104105

106+
build-shared-libs-rocm:
107+
strategy:
108+
matrix:
109+
os: [ubuntu-22.04]
110+
arch: [x86_64]
111+
rocm_version:
112+
["6.1.2", "6.2.4", "6.3.2"]
113+
runs-on: ${{ matrix.os }}
114+
steps:
115+
- uses: actions/checkout@v4
116+
- name: Set up Docker multiarch
117+
uses: docker/setup-qemu-action@v3
118+
- name: Clean up disk space
119+
run: |
120+
sudo rm -rf \
121+
/usr/share/dotnet \
122+
/opt/ghc \
123+
"/usr/local/share/boost" \
124+
"$AGENT_TOOLSDIRECTORY" \
125+
/opt/hostedtoolcache \
126+
/opt/google/chrome \
127+
/opt/microsoft/msedge \
128+
/opt/microsoft/powershell \
129+
/opt/pipx \
130+
/usr/lib/mono \
131+
/usr/local/julia* \
132+
/usr/local/lib/android \
133+
/usr/local/lib/node_modules \
134+
/usr/local/share/chromium \
135+
/usr/local/share/powershell \
136+
/usr/share/swift
137+
- name: Build C++
138+
run: bash .github/scripts/build-rocm.sh
139+
env:
140+
build_os: ${{ matrix.os }}
141+
build_arch: ${{ matrix.arch }}
142+
rocm_version: ${{ matrix.rocm_version }}
143+
- name: Upload build artifact
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: shared_library_rocm_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.rocm_version }}
147+
path: output/*
148+
retention-days: 7
149+
105150
build-wheels:
106151
needs:
107152
- build-shared-libs
108153
- build-shared-libs-cuda
154+
- build-shared-libs-rocm
109155
strategy:
110156
matrix:
111157
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-latest]
@@ -173,6 +219,7 @@ jobs:
173219
merge-multiple: true
174220

175221
- name: Inspect tmp directory after downloading artifacts
222+
176223
run: |
177224
ls -alFR tmp/
178225
WHEEL_COUNT=$(find tmp/ -type f -name "*.whl" | wc -l)
@@ -210,6 +257,7 @@ jobs:
210257
- uses: actions/checkout@v4
211258
with:
212259
path: repo
260+
213261
- name: Delete old pre-release (if exists)
214262
run: |
215263
cd repo && gh release delete continuous-release_main --cleanup-tag -y

0 commit comments

Comments
 (0)