Skip to content

Commit 701acf1

Browse files
author
root
committed
Merge remote-tracking branch 'upstream/multi-backend-refactor' into fix_docs
2 parents 64bc947 + e6cc109 commit 701acf1

File tree

9 files changed

+293
-53
lines changed

9 files changed

+293
-53
lines changed

.github/workflows/python-package.yml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
# This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64)
5959
##
6060
build-shared-libs-cuda:
61+
if: github.ref_name != 'multi-backend-refactor'
6162
strategy:
6263
matrix:
6364
os: [ubuntu-latest, windows-latest]
@@ -148,7 +149,7 @@ jobs:
148149
build-wheels:
149150
needs:
150151
- build-shared-libs
151-
- build-shared-libs-cuda
152+
# - build-shared-libs-cuda reduce the pkg size + build times for the preview release
152153
- build-shared-libs-rocm
153154
strategy:
154155
matrix:
@@ -166,6 +167,13 @@ jobs:
166167
runs-on: ${{ matrix.os }}
167168
steps:
168169
- uses: actions/checkout@v4
170+
with:
171+
fetch-depth: 1 # shallow clone
172+
- name: Fetch tags for dynamic versioning in setup.py
173+
run: |
174+
git fetch --depth=1 origin --tags
175+
echo "Available Git tags:"
176+
git tag -n
169177
- name: Download build artifact
170178
uses: actions/download-artifact@v4
171179
with:
@@ -183,7 +191,8 @@ jobs:
183191
python-version: ${{ matrix.python-version }}
184192
cache: pip
185193
- run: pip install build wheel
186-
- run: python -m build .
194+
# for now need to do the below instead of prior `python -m build .`, which didn't allow us to access git tags
195+
- run: python -m build --sdist && python -m build --wheel
187196
- name: Determine and Set Platform Tag, then Tag Wheel
188197
shell: bash
189198
run: |
@@ -197,6 +206,45 @@ jobs:
197206
path: dist/bitsandbytes-*.whl
198207
retention-days: 7
199208

209+
upload-pre-release-wheels:
210+
name: Create release and upload artifacts
211+
runs-on: ubuntu-latest
212+
if: github.ref_name == 'multi-backend-refactor'
213+
permissions:
214+
contents: write
215+
needs:
216+
- build-wheels
217+
steps:
218+
- name: Download and rename artifacts
219+
uses: actions/download-artifact@v4
220+
with:
221+
path: tmp/
222+
pattern: "bdist_wheel_*"
223+
merge-multiple: true
224+
- name: Inspect tmp directory after downloading artifacts
225+
run: ls -alFR tmp/
226+
- name: Move and rename wheel files with pattern replacement
227+
run: |
228+
mkdir -p wheels/
229+
find tmp/ -type f -name '*.whl' -print0 | while IFS= read -r -d '' wheel; do
230+
wheel_filename=$(basename "$wheel")
231+
# Remove the gith hash, e.g. `+1234567`, for a stable download link on the multi-backend pre-release
232+
cleaned_filename=$(echo "$wheel_filename" | sed -E 's/\+[0-9a-f]{7}-/-/g')
233+
mv "$wheel" "wheels/$cleaned_filename"
234+
done
235+
- name: Inspect wheels directory after renaming files
236+
run: ls -alFR wheels/
237+
- name: Create release and upload artifacts
238+
uses: softprops/[email protected]
239+
with:
240+
files: wheels/*.whl
241+
prerelease: true
242+
name: Multi-Backend Preview
243+
tag_name: continuous-release_multi-backend-refactor
244+
make_latest: false
245+
draft: false
246+
target_commitish: ${{ github.sha }}
247+
200248
audit-wheels:
201249
needs: build-wheels
202250
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ dmypy.json
151151
# vim
152152
*.swp
153153

154+
# BNB-specific stuff
154155
dependencies
155156
cuda_build
156157
output/
158+
bitsandbytes/_version.py

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ if(BUILD_CUDA)
8282
# This needs to be added *before* we try to enable the CUDA language so CMake's compiler check passes.
8383
if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL 1940)
8484
string(APPEND CMAKE_CUDA_FLAGS " --allow-unsupported-compiler")
85+
86+
# This is needed to build with VS2022 17.11+ and CUDA < 12.4.
87+
if (MSVC_VERSION VERSION_GREATER_EQUAL 1941)
88+
string(APPEND CMAKE_CUDA_FLAGS " -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH")
89+
endif()
8590
endif()
8691

8792
enable_language(CUDA) # This will fail if CUDA is not found

bitsandbytes/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
# Import the dynamically generated version from _version.py (see setup.py)
7+
from ._version import __version__ # isort: skip # type: ignore
8+
69
import torch
710

811
from . import research, utils
@@ -73,5 +76,3 @@
7376
"optim.optimizer.Optimizer8bit": False,
7477
"optim.optimizer.MockArgs": False,
7578
}
76-
77-
__version__ = "0.43.3.dev"

bitsandbytes/nn/modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ def forward(self, x: torch.Tensor):
471471
and not hasattr(self.weight.quant_state, "op_context")
472472
and self.weight.quant_state.shape[1] % self.weight.quant_state.blocksize == 0
473473
and self.weight.quant_state.quant_type == "nf4"
474+
and x.requires_grad == False
474475
):
475476
enable_ipex_fusion(self.weight, self.weight.quant_state)
476477

docs/source/contributing.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
### Setup pre-commit hooks
77
- Install pre-commit hooks with `pip install pre-commit`.
8-
- Run `pre-commit autoupdate` once to configure the hooks.
9-
- Re-run `pre-commit autoupdate` every time a new hook got added.
8+
- Run `pre-commit install` once to install the hooks, so they will be run on every commit.
9+
- If the hooks introduce changes, they'll be visible with `git diff`. Review them and `git add` them if everything is fine, then re-execute the before commit, it should pass now.
10+
- If you want to manually trigger the hooks, you may do `pre-commit run --all-files`
1011

1112
Now all the pre-commit hooks will be automatically run when you try to commit and if they introduce some changes, you need to re-add the changed files before being able to commit and push.
1213

0 commit comments

Comments
 (0)