From 3d373bd591e9cbd3983392b60820b33a683d105f Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 11:13:10 -0400 Subject: [PATCH 01/11] Update workflow for packaging * Run the workflow when files change in `.github/scripts/**` * Shorter names for build jobs * Change Windows CUDA install back to "network" using subpackages --- .github/workflows/python-package.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0cdf81854..fe6170944 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -6,12 +6,13 @@ on: branches: [main] paths: - ".github/workflows/python-package.yml" + - ".github/scripts/**" - "bitsandbytes/**" - "csrc/**" - "include/**" - "tests/**" - "CMakeLists.txt" - - "requirements*.txt" + - "MANIFEST.in" - "setup.py" - "pyproject.toml" release: @@ -25,9 +26,9 @@ concurrency: jobs: ## - # This job matrix builds the non-CUDA versions of the libraries for all supported platforms. + # This job matrix builds the CPU versions of the libraries for all supported platforms. ## - build-shared-libs: + build-cpu: strategy: matrix: include: @@ -56,10 +57,11 @@ jobs: name: shared_library_${{ matrix.os }}_${{ matrix.arch }} path: output/* retention-days: 7 + ## # This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64) ## - build-shared-libs-cuda: + build-cuda: strategy: fail-fast: false matrix: @@ -77,14 +79,14 @@ jobs: steps: - uses: actions/checkout@v4 # Windows: We install Cuda on the agent (slow) - #- uses: Jimver/cuda-toolkit@433d453c1fa37d10a3254452fa8e284441c9192d # v0.2.27 - uses: N-Storm/cuda-toolkit@d68ba29a800229200a2c3f572f9e816d7f67cdb4 # v0.2.24m if: startsWith(matrix.os, 'windows') id: cuda-toolkit with: # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} - method: "local" + method: "network" + sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' use-github-cache: false use-local-cache: false log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt @@ -104,7 +106,7 @@ jobs: path: output/* retention-days: 7 - build-shared-libs-xpu: + build-xpu: strategy: matrix: os: [ubuntu-22.04] @@ -122,7 +124,7 @@ jobs: path: output/* retention-days: 7 - build-shared-libs-rocm: + build-rocm: strategy: matrix: os: [ubuntu-22.04] @@ -168,10 +170,10 @@ jobs: build-wheels: needs: - - build-shared-libs - - build-shared-libs-cuda - - build-shared-libs-rocm - - build-shared-libs-xpu + - build-cpu + - build-cuda + - build-rocm + - build-xpu strategy: matrix: os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-latest] @@ -185,7 +187,7 @@ jobs: - os: macos-latest arch: arm64 # The specific Python version is irrelevant in this context as we are only packaging non-C extension - # code. This ensures compatibility across Python versions, including Python 3.9, as compatibility is + # code. This ensures compatibility across Python versions, as compatibility is # dictated by the packaged code itself, not the Python version used for packaging. python-version: ["3.10"] runs-on: ${{ matrix.os }} From b2aa522aa128e96f6d20846f13203bf08d1d30f2 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:02:54 -0400 Subject: [PATCH 02/11] Update --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fe6170944..bc9bb644e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -86,7 +86,7 @@ jobs: # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} method: "network" - sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' + sub-packages: '["nvcc","crt","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' use-github-cache: false use-local-cache: false log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt From 1da8b3aa5d486c23a09cd380bbfd1815d1c33088 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:16:58 -0400 Subject: [PATCH 03/11] Modify sub-packages for CUDA version handling Updated sub-packages to conditionally include 'crt' for CUDA 13. --- .github/workflows/python-package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bc9bb644e..5a2974cb9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -86,7 +86,8 @@ jobs: # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} method: "network" - sub-packages: '["nvcc","crt","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' + # The "crt" component is added for CUDA 13. + sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt"' || '') }} sub-packages: '["nvcc","crt","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' use-github-cache: false use-local-cache: false log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt From 34c30f07a2e56811a5ec1d02d796d4f44da9399a Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:18:10 -0400 Subject: [PATCH 04/11] Update CUDA sub-packages in workflow configuration --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5a2974cb9..f625e24e9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -87,7 +87,7 @@ jobs: cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} method: "network" # The "crt" component is added for CUDA 13. - sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt"' || '') }} sub-packages: '["nvcc","crt","cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]' + sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt"' || '') }} use-github-cache: false use-local-cache: false log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt From cb950d70b3fe69843d66f89571e0139229269127 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:59:09 -0400 Subject: [PATCH 05/11] Change CUDA install method to 'local' for version 13 on Windows --- .github/workflows/python-package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f625e24e9..771badb9b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -85,7 +85,8 @@ jobs: with: # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} - method: "network" + # TODO: Build fails when using "network" on CUDA 13. + method: ${{ startsWith(matrix.cuda_version, '13.') && 'local' || 'network' }} # The "crt" component is added for CUDA 13. sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt"' || '') }} use-github-cache: false From 705367bf3816d5981d2c84a01ee54df6236a3494 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 13:15:13 -0400 Subject: [PATCH 06/11] Modify CUDA sub-packages for version 13 support --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 771badb9b..0884bf7ad 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -87,8 +87,8 @@ jobs: cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} # TODO: Build fails when using "network" on CUDA 13. method: ${{ startsWith(matrix.cuda_version, '13.') && 'local' || 'network' }} - # The "crt" component is added for CUDA 13. - sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt"' || '') }} + # The "crt" "nvvm" and "nvptxcompiler" components are added for CUDA 13. + sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt","nvvm","nvptxcompiler"' || '') }} use-github-cache: false use-local-cache: false log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt From b736f9845ff49cf34ecfebdeb585338e22ffd9ef Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 13:35:21 -0400 Subject: [PATCH 07/11] Change CUDA install method to 'network' in workflow --- .github/workflows/python-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0884bf7ad..b0f23836e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -85,8 +85,7 @@ jobs: with: # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} - # TODO: Build fails when using "network" on CUDA 13. - method: ${{ startsWith(matrix.cuda_version, '13.') && 'local' || 'network' }} + method: "network" # The "crt" "nvvm" and "nvptxcompiler" components are added for CUDA 13. sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt","nvvm","nvptxcompiler"' || '') }} use-github-cache: false From 49297eccc5d49a8a45c004a955f1b3fe0db1a8fb Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:12:55 -0400 Subject: [PATCH 08/11] CUDA build script: only install security updates in container --- .github/scripts/build-cuda.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/build-cuda.sh b/.github/scripts/build-cuda.sh index 9eed06896..58f38f186 100644 --- a/.github/scripts/build-cuda.sh +++ b/.github/scripts/build-cuda.sh @@ -32,8 +32,8 @@ if [ "${build_os:0:6}" == ubuntu ]; then echo "Using image $image" docker run -i -w /src -v "$PWD:/src" "$image" bash -c \ - "dnf update -y \ - && dnf install cmake gcc-toolset-11 -y \ + "dnf -y --refresh update --security \ + && dnf -y install cmake gcc-toolset-11 --setopt=install_weak_deps=False --setopt=tsflags=nodocs && source scl_source enable gcc-toolset-11 \ && cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" . \ && cmake --build . --config Release" From 23d1ad1f42b60601486b7bb1879c420193858e33 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:15:53 -0400 Subject: [PATCH 09/11] CUDA build script: only install security updates in container --- .github/scripts/build-cuda.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build-cuda.sh b/.github/scripts/build-cuda.sh index 58f38f186..81fd410ac 100644 --- a/.github/scripts/build-cuda.sh +++ b/.github/scripts/build-cuda.sh @@ -33,7 +33,7 @@ if [ "${build_os:0:6}" == ubuntu ]; then docker run -i -w /src -v "$PWD:/src" "$image" bash -c \ "dnf -y --refresh update --security \ - && dnf -y install cmake gcc-toolset-11 --setopt=install_weak_deps=False --setopt=tsflags=nodocs + && dnf -y install cmake gcc-toolset-11 --setopt=install_weak_deps=False --setopt=tsflags=nodocs \ && source scl_source enable gcc-toolset-11 \ && cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" . \ && cmake --build . --config Release" From c86b76a6a9aa1c20dfe4e6400d904301d360b845 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:54:34 -0400 Subject: [PATCH 10/11] Pin macos build runner to macos-15 and windows to windows-2025 --- .github/workflows/python-package.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b0f23836e..24b934303 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -36,9 +36,9 @@ jobs: arch: x86_64 - os: ubuntu-22.04-arm arch: aarch64 - - os: windows-latest + - os: windows-2025 arch: x86_64 - - os: macos-latest + - os: macos-15 arch: arm64 runs-on: ${{ matrix.os }} steps: @@ -65,13 +65,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest] + os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025] include: - os: ubuntu-22.04 arch: x86_64 - os: ubuntu-22.04-arm arch: aarch64 - - os: windows-latest + - os: windows-2025 arch: x86_64 cuda_version: ["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", "13.0.1"] @@ -177,15 +177,15 @@ jobs: - build-xpu strategy: matrix: - os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-latest] + os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025, macos-15] include: - os: ubuntu-22.04 arch: x86_64 - os: ubuntu-22.04-arm arch: aarch64 - - os: windows-latest + - os: windows-2025 arch: x86_64 - - os: macos-latest + - os: macos-15 arch: arm64 # The specific Python version is irrelevant in this context as we are only packaging non-C extension # code. This ensures compatibility across Python versions, as compatibility is From b87bb7e46703f0ef3af46578d1aeef6642e445bf Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 26 Sep 2025 16:29:27 -0400 Subject: [PATCH 11/11] ROCm build: remove unneeded build step --- .github/workflows/python-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 24b934303..44f92cf12 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -135,8 +135,6 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Set up Docker multiarch - uses: docker/setup-qemu-action@v3 - name: Clean up disk space run: | sudo rm -rf \