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..0cdf81854 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 }}_x86_64 + 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]