From 15014752723dd7050d331c3bf877487058ceb03c Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:38:09 -0400 Subject: [PATCH 1/7] XPU: Build SYCL kernels on Windows --- .gitattributes | 1 + .github/scripts/build-xpu-windows.bat | 27 +++++++++++++++++++++++++++ .github/workflows/python-package.yml | 10 ++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/scripts/build-xpu-windows.bat 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..7cf89171a --- /dev/null +++ b/.github/scripts/build-xpu-windows.bat @@ -0,0 +1,27 @@ + +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 + +curl -o intel-dle-installer.exe %INTEL_DLE_URL% +start /wait "Intel DLE Install" intel-dle-installer.exe --eula=accept --silent +if ERRORLEVEL 1 ( + echo Failed to install Intel Deep Learning Essentials + exit /b 1 +) + +call %ProgramFiles(x86)%\Intel\oneAPI\setvars.bat +if ERRORLEVEL 1 ( + echo Failed to setup environment + exit /b 1 +) + +cmake -G Ninja -DCOMPUTE_BACKEND=xpu -DCMAKE_BUILD_TYPE=Release . +cmake --build . --config Release + +if ERRORLEVEL 1 ( + echo Build failed + exit /b 1 +) + +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..533b2d375 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -110,14 +110,20 @@ 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 + env: + build_os: ${{ matrix.os }} - name: Upload build artifact uses: actions/upload-artifact@v4 with: From 2112d475fe288ef568b79ff0439f7ff5ebc55a38 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:56:15 -0400 Subject: [PATCH 2/7] Use shell for Windows XPU build --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 533b2d375..857590208 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -122,6 +122,7 @@ jobs: - 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 From 3f8977c56c2bd839fb405c5112d4f961e0d09707 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:29:17 -0400 Subject: [PATCH 3/7] Update XPU Windows script --- .github/scripts/build-xpu-windows.bat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/scripts/build-xpu-windows.bat b/.github/scripts/build-xpu-windows.bat index 7cf89171a..0a6101cf0 100644 --- a/.github/scripts/build-xpu-windows.bat +++ b/.github/scripts/build-xpu-windows.bat @@ -2,13 +2,15 @@ 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 curl -o intel-dle-installer.exe %INTEL_DLE_URL% -start /wait "Intel DLE Install" intel-dle-installer.exe --eula=accept --silent +start /wait "Intel DLE Install" intel-dle-installer.exe -r -a --eula=accept -p=NEED_VS2022_INTEGRATION=0 > intel_dle_log.txt 2>&1 +type intel_dle_log.txt + if ERRORLEVEL 1 ( echo Failed to install Intel Deep Learning Essentials exit /b 1 ) -call %ProgramFiles(x86)%\Intel\oneAPI\setvars.bat +call "%ProgramFiles(x86)%\Intel\oneAPI\setvars.bat" if ERRORLEVEL 1 ( echo Failed to setup environment exit /b 1 From c8cf8decb672190ddb8623d8b1059c6c45faae5e Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:07:51 -0400 Subject: [PATCH 4/7] Update XPU Windows script --- .github/scripts/build-xpu-windows.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/build-xpu-windows.bat b/.github/scripts/build-xpu-windows.bat index 0a6101cf0..00aa2c81a 100644 --- a/.github/scripts/build-xpu-windows.bat +++ b/.github/scripts/build-xpu-windows.bat @@ -1,8 +1,11 @@ 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 +REM for debugging +set + curl -o intel-dle-installer.exe %INTEL_DLE_URL% -start /wait "Intel DLE Install" intel-dle-installer.exe -r -a --eula=accept -p=NEED_VS2022_INTEGRATION=0 > intel_dle_log.txt 2>&1 +start /wait "Intel DLE Install" intel-dle-installer.exe -r --log indel_dle_log.txt -a --silent --eula=accept -p=NEED_VS2022_INTEGRATION=0 type intel_dle_log.txt if ERRORLEVEL 1 ( From 7ef5f954b8bddb30a114281dcacbc7f455d84977 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:21:38 -0400 Subject: [PATCH 5/7] Update XPU Windows script --- .github/scripts/build-xpu-windows.bat | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/scripts/build-xpu-windows.bat b/.github/scripts/build-xpu-windows.bat index 00aa2c81a..d7dc7eb72 100644 --- a/.github/scripts/build-xpu-windows.bat +++ b/.github/scripts/build-xpu-windows.bat @@ -1,26 +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 -REM for debugging +echo ::group::Debugging Information +echo Current Directory: %CD% set +echo ::endgroup:: curl -o intel-dle-installer.exe %INTEL_DLE_URL% -start /wait "Intel DLE Install" intel-dle-installer.exe -r --log indel_dle_log.txt -a --silent --eula=accept -p=NEED_VS2022_INTEGRATION=0 -type intel_dle_log.txt +echo ::group::Intel Deep Learning Essentials Installation +start /wait "Intel DLE Install" intel-dle-installer.exe -r yes --log intel_dle_log.txt --silent -a --eula=accept -p=NEED_VS2022_INTEGRATION=0 +type intel_dle_log.txt if ERRORLEVEL 1 ( echo Failed to install Intel Deep Learning Essentials exit /b 1 ) +echo ::endgroup:: +echo ::group::Environment Setup call "%ProgramFiles(x86)%\Intel\oneAPI\setvars.bat" if ERRORLEVEL 1 ( echo Failed to setup environment exit /b 1 ) +echo ::endgroup:: +echo ::group::Building with XPU backend cmake -G Ninja -DCOMPUTE_BACKEND=xpu -DCMAKE_BUILD_TYPE=Release . cmake --build . --config Release +echo ::endgroup:: if ERRORLEVEL 1 ( echo Build failed From 8f19d4befc8b92ca301d8c3c0ee610e6afe446a9 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:42:53 -0400 Subject: [PATCH 6/7] Update XPU Windows script --- .github/scripts/build-xpu-windows.bat | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/scripts/build-xpu-windows.bat b/.github/scripts/build-xpu-windows.bat index d7dc7eb72..c7317b8a7 100644 --- a/.github/scripts/build-xpu-windows.bat +++ b/.github/scripts/build-xpu-windows.bat @@ -1,24 +1,20 @@ - 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 - -echo ::group::Debugging Information -echo Current Directory: %CD% -set -echo ::endgroup:: - -curl -o intel-dle-installer.exe %INTEL_DLE_URL% +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 -start /wait "Intel DLE Install" intel-dle-installer.exe -r yes --log intel_dle_log.txt --silent -a --eula=accept -p=NEED_VS2022_INTEGRATION=0 -type intel_dle_log.txt +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::Environment Setup +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 @@ -26,14 +22,12 @@ if ERRORLEVEL 1 ( echo ::endgroup:: echo ::group::Building with XPU backend -cmake -G Ninja -DCOMPUTE_BACKEND=xpu -DCMAKE_BUILD_TYPE=Release . cmake --build . --config Release -echo ::endgroup:: - 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%" From 333fdb6437d737196a97dbc1343a97dc32ac7dc4 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:06:34 -0400 Subject: [PATCH 7/7] Update pre-commit to allow crlf line ending on windows batch files --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) 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: