Skip to content

Commit 3901ebf

Browse files
committed
Added CUDA 12.0 support; removed CC 3.0 support.
1 parent b3de192 commit 3901ebf

File tree

6 files changed

+92
-22
lines changed

6 files changed

+92
-22
lines changed

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ Features:
139139
Bug fixes:
140140
- Fixed a problem where warning messages would be displayed even though everything worked correctly.
141141

142-
143142
### 0.35.2
144143

145144
Bug fixes:
@@ -155,3 +154,38 @@ Bug fixes:
155154
Bug fixes:
156155
- Fixed a bug in the CUDA Setup failed with the cuda runtime was found, but not the cuda library.
157156
- Fixed a bug where not finding the cuda runtime led to an incomprehensible error.
157+
158+
159+
### 0.36.0
160+
161+
#### Improvements, Ada/Hopper support, fake k-bit quantization.
162+
163+
Features:
164+
- CUDA 11.8 and 12.0 support added
165+
- support for Ada and Hopper GPUs added (compute capability 8.9 and 9.0)
166+
- support for fake k-bit block-wise quantization for Int, Float, quantile quantization, and dynamic exponent data types added
167+
- Added CUDA instruction generator to fix some installations.
168+
- Added additional block sizes for quantization {64, 128, 256, 512, 1024}
169+
- Added SRAM Quantile algorithm to quickly estimate less than 256 quantiles
170+
- Added option to suppress the bitsandbytes welcome message (@Cyberes)
171+
172+
Regression:
173+
- Compute capability 3.0 removed: GTX 600s and 700s series is no longer supported (except GTX 780 and GTX 780 Ti)
174+
175+
Bug fixes:
176+
- fixed a bug where too long directory names would crash the CUDA SETUP #35 (@tomaarsen)
177+
- fixed a bug where CPU installations on Colab would run into an error #34 (@tomaarsen)
178+
- fixed an issue where the default CUDA version with fast-DreamBooth was not supported #52
179+
- fixed a bug where the CUDA setup failed due to a wrong function call.
180+
- fixed a bug in the CUDA Setup which led to an incomprehensible error if no GPU was detected.
181+
- fixed a bug in the CUDA Setup failed with the cuda runtime was found, but not the cuda library.
182+
- fixed a bug where not finding the cuda runtime led to an incomprehensible error.
183+
- fixed a bug where with missing CUDA the default was an error instead of the loading the CPU library
184+
- fixed a bug where the CC version of the GPU was not detected appropriately (@BlackHC)
185+
- fixed a bug in CPU quantization which lead to errors when the input buffer exceeded 2^31 elements
186+
187+
Improvements:
188+
- multiple improvements in formatting, removal of unused imports, and slight performance improvements (@tomaarsen)
189+
- StableEmbedding layer now has device and dtype parameters to make it 1:1 replaceable with regular Embedding layers (@lostmsu)
190+
- runtime performance of block-wise quantization slightly improved
191+
- added error message for the case multiple libcudart.so are installed and bitsandbytes picks the wrong one

Makefile

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,22 @@ BUILD_DIR:= $(ROOT_DIR)/build
2222
FILES_CUDA := $(CSRC)/ops.cu $(CSRC)/kernels.cu
2323
FILES_CPP := $(CSRC)/common.cpp $(CSRC)/cpu_ops.cpp $(CSRC)/pythonInterface.c
2424

25-
INCLUDE := -I $(CUDA_HOME)/include -I $(ROOT_DIR)/csrc -I $(CONDA_PREFIX)/include -I $(ROOT_DIR)/dependencies/cub -I $(ROOT_DIR)/include
25+
INCLUDE := -I $(CUDA_HOME)/include -I $(ROOT_DIR)/csrc -I $(CONDA_PREFIX)/include -I $(ROOT_DIR)/include
26+
INCLUDE_10x := -I $(CUDA_HOME)/include -I $(ROOT_DIR)/csrc -I $(ROOT_DIR)/dependencies/cub -I $(ROOT_DIR)/include
2627
LIB := -L $(CUDA_HOME)/lib64 -lcudart -lcublas -lcublasLt -lcurand -lcusparse -L $(CONDA_PREFIX)/lib
2728

2829
# NVIDIA NVCC compilation flags
29-
COMPUTE_CAPABILITY := -gencode arch=compute_35,code=sm_35 # Kepler
30-
COMPUTE_CAPABILITY += -gencode arch=compute_37,code=sm_37 # Kepler
3130
COMPUTE_CAPABILITY += -gencode arch=compute_50,code=sm_50 # Maxwell
3231
COMPUTE_CAPABILITY += -gencode arch=compute_52,code=sm_52 # Maxwell
3332
COMPUTE_CAPABILITY += -gencode arch=compute_60,code=sm_60 # Pascal
3433
COMPUTE_CAPABILITY += -gencode arch=compute_61,code=sm_61 # Pascal
3534
COMPUTE_CAPABILITY += -gencode arch=compute_70,code=sm_70 # Volta
3635
COMPUTE_CAPABILITY += -gencode arch=compute_72,code=sm_72 # Volta
3736

38-
# CUDA 9.2 supports CC 3.0, but CUDA >= 11.0 does not
39-
CC_CUDA92 := -gencode arch=compute_30,code=sm_30
37+
CC_KEPLER := -gencode arch=compute_35,code=sm_35 # Kepler
38+
CC_KEPLER += -gencode arch=compute_37,code=sm_37 # Kepler
4039

4140
# Later versions of CUDA support the new architectures
42-
CC_CUDA10x := -gencode arch=compute_30,code=sm_30
4341
CC_CUDA10x += -gencode arch=compute_75,code=sm_75
4442

4543
CC_CUDA110 := -gencode arch=compute_75,code=sm_75
@@ -49,37 +47,46 @@ CC_CUDA11x := -gencode arch=compute_75,code=sm_75
4947
CC_CUDA11x += -gencode arch=compute_80,code=sm_80
5048
CC_CUDA11x += -gencode arch=compute_86,code=sm_86
5149

50+
5251
CC_cublasLt110 := -gencode arch=compute_75,code=sm_75
5352
CC_cublasLt110 += -gencode arch=compute_80,code=sm_80
5453

5554
CC_cublasLt111 := -gencode arch=compute_75,code=sm_75
5655
CC_cublasLt111 += -gencode arch=compute_80,code=sm_80
5756
CC_cublasLt111 += -gencode arch=compute_86,code=sm_86
5857

58+
CC_ADA_HOPPER := -gencode arch=compute_89,code=sm_89
59+
CC_ADA_HOPPER += -gencode arch=compute_90,code=sm_90
60+
5961

6062
all: $(ROOT_DIR)/dependencies/cub $(BUILD_DIR) env
61-
$(NVCC) $(COMPUTE_CAPABILITY) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR)
62-
$(NVCC) $(COMPUTE_CAPABILITY) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
63+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_KEPLER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR)
64+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_KEPLER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
6365
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION).so $(LIB)
6466

6567
cuda92: $(ROOT_DIR)/dependencies/cub $(BUILD_DIR) env
66-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA92) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
67-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA92) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
68+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA92) $(CC_KEPLER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
69+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA92) $(CC_KEPLER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
6870
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION)_nocublaslt.so $(LIB)
6971

7072
cuda10x_nomatmul: $(ROOT_DIR)/dependencies/cub $(BUILD_DIR) env
71-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA10x) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
72-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA10x) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
73+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA10x) $(CC_KEPLER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE_10x) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
74+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA10x) $(CC_KEPLER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
7375
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION)_nocublaslt.so $(LIB)
7476

7577
cuda110_nomatmul: $(BUILD_DIR) env
76-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA110) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
77-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA110) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
78+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA110) $(CC_KEPLER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
79+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA110) $(CC_KEPLER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
7880
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION)_nocublaslt.so $(LIB)
7981

8082
cuda11x_nomatmul: $(BUILD_DIR) env
81-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
82-
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
83+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) $(CC_KEPLER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
84+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) $(CC_KEPLER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
85+
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION)_nocublaslt.so $(LIB)
86+
87+
cuda12x_nomatmul: $(BUILD_DIR) env
88+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) $(CC_ADA_HOPPER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR) -D NO_CUBLASLT
89+
$(NVCC) $(COMPUTE_CAPABILITY) $(CC_CUDA11x) $(CC_ADA_HOPPER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
8390
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION)_nocublaslt.so $(LIB)
8491

8592
cuda110: $(BUILD_DIR) env
@@ -92,6 +99,11 @@ cuda11x: $(BUILD_DIR) env
9299
$(NVCC) $(CC_cublasLt111) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
93100
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION).so $(LIB)
94101

102+
cuda12x: $(BUILD_DIR) env
103+
$(NVCC) $(CC_cublasLt111) $(CC_ADA_HOPPER) -Xcompiler '-fPIC' --use_fast_math -Xptxas=-v -dc $(FILES_CUDA) $(INCLUDE) $(LIB) --output-directory $(BUILD_DIR)
104+
$(NVCC) $(CC_cublasLt111) $(CC_ADA_HOPPER) -Xcompiler '-fPIC' -dlink $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o -o $(BUILD_DIR)/link.o
105+
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION).so $(LIB)
106+
95107
cpuonly: $(BUILD_DIR) env
96108
$(GPP) -std=c++14 -shared -fPIC -I $(ROOT_DIR)/csrc -I $(ROOT_DIR)/include $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cpu.so
97109

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Requirements: anaconda, cudatoolkit, pytorch
5050

5151
Hardware requirements:
5252
- LLM.int8(): NVIDIA Turing (RTX 20xx; T4) or Ampere GPU (RTX 30xx; A4-A100); (a GPU from 2018 or older).
53-
- 8-bit optimizers and quantization: NVIDIA Maxwell GPU or newer (>=GTX 9XX).
53+
- 8-bit optimizers and quantization: NVIDIA Kepler GPU or newer (>=GTX 78X).
5454

55-
Supported CUDA versions: 10.2 - 11.7
55+
Supported CUDA versions: 10.2 - 12.0
5656

5757
The bitsandbytes library is currently only supported on Linux distributions. Windows is not supported at the moment.
5858

cuda_install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ URL115=https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installer
1111
URL116=https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run
1212
URL117=https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
1313
URL118=https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
14+
URL120=https://developer.download.nvidia.com/compute/cuda/12.0.0/local_installers/cuda_12.0.0_525.60.13_linux.run
1415

1516

1617
CUDA_VERSION=$1
@@ -56,6 +57,9 @@ if [[ -n "$CUDA_VERSION" ]]; then
5657
elif [[ "$CUDA_VERSION" -eq "118" ]]; then
5758
URL=$URL118
5859
FOLDER=cuda-11.8
60+
elif [[ "$CUDA_VERSION" -eq "120" ]]; then
61+
URL=$URL120
62+
FOLDER=cuda-12.0
5963
else
6064
echo "argument error: No cuda version passed as input. Choose among: {111, 115}"
6165
fi

deploy.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,24 @@ fi
110110

111111
make clean
112112
export CUDA_HOME=$BASE_PATH/cuda-11.8
113-
make cuda11x CUDA_VERSION=118
113+
make cuda12x CUDA_VERSION=118
114114

115115
if [ ! -f "./bitsandbytes/libbitsandbytes_cuda118.so" ]; then
116116
# Control will enter here if $DIRECTORY doesn't exist.
117117
echo "Compilation unsuccessul!" 1>&2
118118
exit 64
119119
fi
120120

121+
make clean
122+
export CUDA_HOME=$BASE_PATH/cuda-12.0
123+
make cuda12x CUDA_VERSION=120
124+
125+
if [ ! -f "./bitsandbytes/libbitsandbytes_cuda120.so" ]; then
126+
# Control will enter here if $DIRECTORY doesn't exist.
127+
echo "Compilation unsuccessul!" 1>&2
128+
exit 64
129+
fi
130+
121131

122132
make clean
123133
export CUDA_HOME=$BASE_PATH/cuda-10.2
@@ -213,13 +223,23 @@ fi
213223

214224
make clean
215225
export CUDA_HOME=$BASE_PATH/cuda-11.8
216-
make cuda11x_nomatmul CUDA_VERSION=118
226+
make cuda12x_nomatmul CUDA_VERSION=118
217227

218228
if [ ! -f "./bitsandbytes/libbitsandbytes_cuda118_nocublaslt.so" ]; then
219229
# Control will enter here if $DIRECTORY doesn't exist.
220230
echo "Compilation unsuccessul!" 1>&2
221231
exit 64
222232
fi
223233

234+
make clean
235+
export CUDA_HOME=$BASE_PATH/cuda-12.0
236+
make cuda12x_nomatmul CUDA_VERSION=120
237+
238+
if [ ! -f "./bitsandbytes/libbitsandbytes_cuda120_nocublaslt.so" ]; then
239+
# Control will enter here if $DIRECTORY doesn't exist.
240+
echo "Compilation unsuccessul!" 1>&2
241+
exit 64
242+
fi
243+
224244
python -m build
225245
python -m twine upload dist/* --verbose

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def read(fname):
1818

1919
setup(
2020
name=f"bitsandbytes",
21-
version=f"0.35.4",
21+
version=f"0.36.0",
2222
author="Tim Dettmers",
2323
author_email="[email protected]",
2424
description="8-bit optimizers and matrix multiplication routines.",

0 commit comments

Comments
 (0)