From 055e74c4e0bdb9eab76d7035139449acf6eb4042 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:30:44 -0400 Subject: [PATCH 1/2] Intel XPU: build and package binary for Linux --- .github/scripts/build-xpu.sh | 22 ++++++++++++++++++++++ .github/workflows/python-package.yml | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 .github/scripts/build-xpu.sh diff --git a/.github/scripts/build-xpu.sh b/.github/scripts/build-xpu.sh new file mode 100755 index 000000000..d069e1230 --- /dev/null +++ b/.github/scripts/build-xpu.sh @@ -0,0 +1,22 @@ +#!/bin/bash +declare build_os + +set -xeuo pipefail + +# We currently only build XPU on Linux. +if [ "${build_os:0:6}" == ubuntu ]; then + # TODO: We might want to pre-build this as our own customized image in the future. + image=intel/deep-learning-essentials:2025.1.3-0-devel-ubuntu22.04 + echo "Using image $image" + docker run --rm -i \ + -w /src -v "$PWD:/src" "$image" sh -c \ + "apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + cmake bison intel-fw-gpu intel-ocloc \ + && cmake -DCOMPUTE_BACKEND=xpu . \ + && cmake --build . --config Release" +fi + +output_dir="output/${build_os}/x86_64" +mkdir -p "${output_dir}" +(shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} "${output_dir}") diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8207aa072..75aed29d3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -104,6 +104,24 @@ jobs: path: output/* retention-days: 7 + build-shared-libs-xpu: + strategy: + matrix: + os: [ubuntu-22.04] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Build C++ + run: bash .github/scripts/build-xpu.sh + env: + build_os: ${{ matrix.os }} + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: shared_library_xpu_${{ matrix.os }} + path: output/* + retention-days: 7 + build-shared-libs-rocm: strategy: matrix: @@ -153,6 +171,7 @@ jobs: - build-shared-libs - build-shared-libs-cuda - build-shared-libs-rocm + - build-shared-libs-xpu strategy: matrix: os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-latest] From 0c04a4ee7c7cba625c6faa949f973866e65f3b36 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:00:13 -0400 Subject: [PATCH 2/2] Update artifact name --- .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 75aed29d3..0cdf81854 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -118,7 +118,7 @@ jobs: - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: shared_library_xpu_${{ matrix.os }} + name: shared_library_xpu_${{ matrix.os }}_x86_64 path: output/* retention-days: 7