diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..69b47b5ad --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.bat text eol=crlf diff --git a/.github/scripts/build-xpu-windows.bat b/.github/scripts/build-xpu-windows.bat new file mode 100644 index 000000000..c7317b8a7 --- /dev/null +++ b/.github/scripts/build-xpu-windows.bat @@ -0,0 +1,34 @@ +set INTEL_DLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/75d4eb97-914a-4a95-852c-7b9733d80f74/intel-deep-learning-essentials-2025.1.3.8_offline.exe +set INTEL_DLE_TMP=%RUNNER_TEMP%\intel_dle +set INTEL_DLE_LOG=%RUNNER_TEMP%\intel_dle_log.txt + +echo ::group::Intel Deep Learning Essentials Installation +curl -o intel-dle-installer.exe %INTEL_DLE_URL% +start /wait "Intel DLE Install" intel-dle-installer.exe -f %INTEL_DLE_TMP% -l %INTEL_DLE_LOG% --silent -a --eula=accept -p=NEED_VS2022_INTEGRATION=0 +type %INTEL_DLE_LOG% +if ERRORLEVEL 1 ( + echo Failed to install Intel Deep Learning Essentials + exit /b 1 +) +echo ::endgroup:: + +echo ::group::Build Environment Setup +call "%ProgramFiles(x86)%\Intel\oneAPI\setvars.bat" +cmake -G Ninja -DCOMPUTE_BACKEND=xpu -DCMAKE_BUILD_TYPE=Release . +if ERRORLEVEL 1 ( + echo Failed to setup environment + exit /b 1 +) +echo ::endgroup:: + +echo ::group::Building with XPU backend +cmake --build . --config Release +if ERRORLEVEL 1 ( + echo Build failed + exit /b 1 +) +echo ::endgroup:: + +set output_dir=output\%build_os%\x86_64 +if not exist "%output_dir%" mkdir "%output_dir%" +copy bitsandbytes\*.dll "%output_dir%\" 2>nul diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c79ce8c82..857590208 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -110,14 +110,21 @@ jobs: build-xpu: strategy: matrix: - os: [ubuntu-22.04] + os: [ubuntu-22.04, windows-2025] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Build C++ + - name: Build C++ (Linux) + if: runner.os == 'Linux' run: bash .github/scripts/build-xpu.sh env: build_os: ${{ matrix.os }} + - name: Build C++ (Windows) + if: runner.os == 'Windows' + run: .github/scripts/build-xpu-windows.bat + shell: cmd + env: + build_os: ${{ matrix.os }} - name: Upload build artifact uses: actions/upload-artifact@v4 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1c71e9f5..b17a4111d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,6 +17,7 @@ repos: - id: mixed-line-ending args: - --fix=lf + exclude: '\.bat$' - repo: https://github.com/crate-ci/typos rev: v1.26.0 hooks: