Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows CI #1028

Open
wants to merge 66 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a534830
initial windows build
RUIJIEZHONG66166 Aug 16, 2024
a223974
add windows build in pull.yml
RUIJIEZHONG66166 Aug 16, 2024
c862d02
set ut input as not required
RUIJIEZHONG66166 Aug 16, 2024
4484288
remove unsupported cmd
RUIJIEZHONG66166 Aug 16, 2024
d9da71a
add for conda activate
RUIJIEZHONG66166 Aug 16, 2024
9dd866a
add call for all conda cmd
RUIJIEZHONG66166 Aug 19, 2024
033a1f3
update rm to rmdir
RUIJIEZHONG66166 Aug 20, 2024
b147bb7
change pytorch check
RUIJIEZHONG66166 Aug 20, 2024
b635f1e
update copy torch-xpu-ops
RUIJIEZHONG66166 Aug 20, 2024
101a922
add dependancy
RUIJIEZHONG66166 Aug 20, 2024
2154a60
add USE_XPU=1
RUIJIEZHONG66166 Aug 20, 2024
9bd6019
use USE_KINETO=0
RUIJIEZHONG66166 Aug 22, 2024
01bde37
update install_oneapi_bundle.bat
RUIJIEZHONG66166 Aug 22, 2024
6a78ba1
update VS2022INSTALLDIR
RUIJIEZHONG66166 Aug 22, 2024
ed47a31
add upload windows binary
RUIJIEZHONG66166 Aug 23, 2024
c2f7790
update some name
RUIJIEZHONG66166 Aug 23, 2024
62e4c7c
update upload path
RUIJIEZHONG66166 Aug 23, 2024
0a125e7
add build log upload
RUIJIEZHONG66166 Aug 23, 2024
b40fd42
add build log upload
RUIJIEZHONG66166 Aug 23, 2024
99f95ff
update pti install
RUIJIEZHONG66166 Aug 27, 2024
372a4d6
update bundle install check and call
RUIJIEZHONG66166 Aug 27, 2024
73069bc
add uninstall print
RUIJIEZHONG66166 Aug 27, 2024
ad85632
add VS2022INSTALLDIR set
RUIJIEZHONG66166 Aug 28, 2024
d6a44bb
update msvc call
RUIJIEZHONG66166 Aug 28, 2024
784bcba
update msvc call
RUIJIEZHONG66166 Aug 28, 2024
bc27288
update '' to for msvc
RUIJIEZHONG66166 Aug 28, 2024
4cfbbbf
rebase windows build
RUIJIEZHONG66166 Sep 6, 2024
c567a9d
update windows build
RUIJIEZHONG66166 Oct 30, 2024
f6d7cd2
remove useless env
RUIJIEZHONG66166 Oct 30, 2024
9c9af90
modify the conda activate
RUIJIEZHONG66166 Oct 30, 2024
0a38ed8
update runner name
RUIJIEZHONG66166 Oct 30, 2024
57f489d
add long path fix
RUIJIEZHONG66166 Oct 30, 2024
c2d9c7d
update windows runner
RUIJIEZHONG66166 Oct 30, 2024
b246a08
fix pip install issue
RUIJIEZHONG66166 Oct 30, 2024
0d62401
update pip install packages
RUIJIEZHONG66166 Oct 30, 2024
44f5598
try unuse path fix
RUIJIEZHONG66166 Oct 30, 2024
ae8447e
fix conda install issue
RUIJIEZHONG66166 Oct 31, 2024
8b010a9
change runner name
RUIJIEZHONG66166 Nov 6, 2024
d597cfd
right runner label
RUIJIEZHONG66166 Nov 6, 2024
7168880
set conda env path
RUIJIEZHONG66166 Nov 13, 2024
172efa1
set shell = cmd
RUIJIEZHONG66166 Nov 13, 2024
f8e7d3c
update conda env path
RUIJIEZHONG66166 Nov 13, 2024
fc40e6a
update conda env path
RUIJIEZHONG66166 Nov 13, 2024
d6c2f37
remove unuseless path set
RUIJIEZHONG66166 Nov 13, 2024
24a6e43
update miniforge path
RUIJIEZHONG66166 Nov 28, 2024
b649d95
set max_job and add extend ut test
RUIJIEZHONG66166 Nov 28, 2024
07e58d8
set MAX_JOBS=4
RUIJIEZHONG66166 Nov 29, 2024
1dfdfc1
set MAX_JOBS=2
RUIJIEZHONG66166 Nov 29, 2024
9d1d641
set MAX_JOBS=1
RUIJIEZHONG66166 Dec 2, 2024
c8a42f3
set MAX_JOBS=4
RUIJIEZHONG66166 Dec 9, 2024
7ad0695
update torch install
RUIJIEZHONG66166 Dec 10, 2024
98e8720
add rust install
RUIJIEZHONG66166 Dec 10, 2024
36bde23
remove timeout set
RUIJIEZHONG66166 Dec 11, 2024
293c28c
update basekit install
RUIJIEZHONG66166 Dec 12, 2024
933b1d8
update preci-windows name
RUIJIEZHONG66166 Dec 12, 2024
cc8475d
add build label for windows
RUIJIEZHONG66166 Dec 17, 2024
60775e9
set new label for windows ci
RUIJIEZHONG66166 Dec 17, 2024
49ad112
update label set
RUIJIEZHONG66166 Dec 17, 2024
09d8a5f
update torch-xpu-ops commit
RUIJIEZHONG66166 Dec 25, 2024
7715f84
add commit print
RUIJIEZHONG66166 Dec 25, 2024
91e1c87
debug print
RUIJIEZHONG66166 Dec 25, 2024
26029cb
update commit
RUIJIEZHONG66166 Dec 25, 2024
2d97916
update copy path
RUIJIEZHONG66166 Dec 26, 2024
ae680b5
update copy path
RUIJIEZHONG66166 Dec 26, 2024
1cbe7ad
update torch-xpu-ops replace
RUIJIEZHONG66166 Dec 26, 2024
7656cab
update extend file
RUIJIEZHONG66166 Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/scripts/install_xpu.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
@echo on
REM Description: Install Intel Support Packages on Windows
REM BKM reference: https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpus.html

set XPU_INSTALL_MODE=%~1
if "%XPU_INSTALL_MODE%"=="" goto xpu_bundle_install_start
if "%XPU_INSTALL_MODE%"=="bundle" goto xpu_bundle_install_start
if "%XPU_INSTALL_MODE%"=="driver" goto xpu_driver_install_start
if "%XPU_INSTALL_MODE%"=="all" goto xpu_driver_install_start

:arg_error

echo Illegal XPU installation mode. The value can be "bundle"/"driver"/"all"
echo If keep the value as space, will use default "bundle" mode
exit /b 1

:xpu_driver_install_start
:: TODO Need more testing for driver installation
set XPU_DRIVER_LINK=https://downloadmirror.intel.com/830975/gfx_win_101.5972.exe
curl -o xpu_driver.exe --retry 3 --retry-all-errors -k %XPU_DRIVER_LINK%
echo "XPU Driver installing..."
start /wait "Intel XPU Driver Installer" "xpu_driver.exe"
if errorlevel 1 exit /b 1
del xpu_driver.exe
if "%XPU_INSTALL_MODE%"=="driver" goto xpu_install_end

:xpu_bundle_install_start

set XPU_BUNDLE_PARENT_DIR=C:\Program Files (x86)\Intel\oneAPI
set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-for-pytorch-gpu-dev_p_0.5.3.37_offline.exe
set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.intel-for-pytorch-gpu-dev.product
set XPU_BUNDLE_VERSION=0.5.3+31
set XPU_BUNDLE_INSTALLED=0
set XPU_BUNDLE_UNINSTALL=0
set XPU_EXTRA_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-pti-dev_p_0.9.0.37_offline.exe
set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.intel-pti-dev.product
set XPU_EXTRA_VERSION=0.9.0+36
set XPU_EXTRA_INSTALLED=0
set XPU_EXTRA_UNINSTALL=0

if not [%XPU_VERSION%]==[] if [%XPU_VERSION%]==[2025.0] (
set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/efc86abd-cb77-452e-a03f-a741895b8ece/intel-deep-learning-essentials-2025.0.0.336_offline.exe
set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.deep-learning-essentials.product
set XPU_BUNDLE_VERSION=2025.0.0+335
set XPU_BUNDLE_INSTALLED=0
set XPU_BUNDLE_UNINSTALL=0
set XPU_EXTRA_URL=NULL
set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.compiler.product
set XPU_EXTRA_VERSION=2025.0.1+1226
set XPU_EXTRA_INSTALLED=0
set XPU_EXTRA_UNINSTALL=0
)

:: Check if XPU bundle is target version or already installed
if exist "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" goto xpu_bundle_ver_check
goto xpu_bundle_install

:xpu_bundle_ver_check

"%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --list-products > xpu_bundle_installed_ver.log

for /f "tokens=1,2" %%a in (xpu_bundle_installed_ver.log) do (
if "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" (
echo %%a Installed Version: %%b
set XPU_BUNDLE_INSTALLED=1
if not "%XPU_BUNDLE_VERSION%"=="%%b" (
start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle
set XPU_BUNDLE_UNINSTALL=1
)
)
if "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" (
echo %%a Installed Version: %%b
set XPU_EXTRA_INSTALLED=1
if not "%XPU_EXTRA_VERSION%"=="%%b" (
start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle
set XPU_EXTRA_UNINSTALL=1
)
)
if not "%%b" == "Version" if not [%%b]==[] if not "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" if not "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" (
echo "Uninstalling...."
start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle
)
)
if errorlevel 1 exit /b 1
if exist xpu_bundle_installed_ver.log del xpu_bundle_installed_ver.log
if exist uninstall_bundle rmdir /s /q uninstall_bundle
if "%XPU_BUNDLE_INSTALLED%"=="0" goto xpu_bundle_install
if "%XPU_BUNDLE_UNINSTALL%"=="1" goto xpu_bundle_install

:xpu_extra_check

if "%XPU_EXTRA_URL%"=="NULL" goto xpu_install_end
if "%XPU_EXTRA_INSTALLED%"=="0" goto xpu_extra_install
if "%XPU_EXTRA_UNINSTALL%"=="1" goto xpu_extra_install
goto xpu_install_end

:xpu_bundle_install

curl -o xpu_bundle.exe --retry 3 --retry-all-errors -k %XPU_BUNDLE_URL%
echo "XPU Bundle installing..."
start /wait "Intel Pytorch Bundle Installer" "xpu_bundle.exe" --action=install --eula=accept --silent --log-dir install_bundle
if errorlevel 1 exit /b 1
del xpu_bundle.exe
goto xpu_extra_check

:xpu_extra_install

curl -o xpu_extra.exe --retry 3 --retry-all-errors -k %XPU_EXTRA_URL%
echo "Intel XPU EXTRA installing..."
start /wait "Intel XPU EXTRA Installer" "xpu_extra.exe" --action=install --eula=accept --silent --log-dir install_bundle
if errorlevel 1 exit /b 1
del xpu_extra.exe

:xpu_install_end
148 changes: 148 additions & 0 deletions .github/workflows/_windows_ut.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Windows Test

on:
workflow_call:
inputs:
pytorch:
required: false
type: string
default: 'main'
description: Pytorch branch/commit
keep_torch_xpu_ops:
required: false
type: string
default: 'false'
description: Keep torch-xpu-ops pin. `true` means use pined commit
ut:
required: true
type: string
default: ''
description: UT scope. `op_regression,op_regression_dev1,op_extended,op_ut,torch_xpu` Delimiter is comma
python:
required: false
type: string
default: '3.10'
description: Python version
runner:
required: true
type: string
default: 'Windows_CI'
description: Runner label
xpu_version:
required: false
type: string
default: '2025.0'
description: Python version

permissions: read-all

env:
USE_XPU: 1

jobs:
Torch-XPU-Windows-UT:
runs-on: ${{ inputs.runner }}
timeout-minutes: 900
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
- name: Install oneAPI
shell: cmd
run: |
set XPU_VERSION=${{ inputs.xpu_version }}
call .github\scripts\install_xpu.bat
if errorlevel 1 exit /b 1
- name: Prepare Stock Pytorch
shell: cmd
run: |
echo "C:\ProgramData\miniforge3\Scripts" >> "$GITHUB_PATH"
echo "C:\ProgramData\miniforge3\Library\bin" >> "$GITHUB_PATH"
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda clean -ay
call conda remove --all -y -n windows_ci
call conda create -n windows_ci python=${{ inputs.python }} cmake ninja -y
call conda activate windows_ci
cd ..
if exist "pytorch" (
rmdir /s /q pytorch
)
git clone https://github.com/pytorch/pytorch pytorch
cd pytorch && git checkout ${{ inputs.pytorch }}
pip install pyyaml requests
call conda install -y libuv
call conda install -y rust
git config --system core.longpaths true
git status
git show -s
git submodule sync && git submodule update --init --recursive
if ${{ inputs.keep_torch_xpu_ops }} == 'true' (
echo "Don't replace torch-xpu-ops!"
) else (
echo "Replace torch-xpu-ops!"
cd third_party
if exist "torch-xpu-ops" (
rmdir /s /q torch-xpu-ops
)
cd ..
Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
powershell -Command "(Get-Content caffe2/CMakeLists.txt) -replace 'checkout --quiet \${TORCH_XPU_OPS_COMMIT}', 'log -n 1' | Set-Content caffe2/CMakeLists.txt"
)
- name: Build Pytorch XPU
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat"
call "C:\Program Files (x86)\Intel\oneAPI\ocloc\latest\env\vars.bat"
call conda activate windows_ci
cd ../pytorch
pip install -r requirements.txt
pip install cmake setuptools==72.1.0 clang-format
set USE_KINETO=0
set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE
set CMAKE_MODULE_LINKER_FLAGS=/FORCE:MULTIPLE
set CMAKE_EXE_LINKER_FLAGS=/FORCE:MULTIPLE
python setup.py clean
set MAX_JOBS=4
python setup.py bdist_wheel > build_torch_wheel_log.log
echo "[INFO] begin to install torch whls"
for /r C:\runner\actions-runner\_work\torch-xpu-ops\pytorch\dist %%i in (torch*.whl) do (
set TORCH_WHL=%%i
)
echo "[INFO] the torch version is %TORCH_WHL%"
python -m pip install %TORCH_WHL%
pip install -r .ci\docker\requirements-ci.txt
- name: Torch Config
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
python -c "import torch; print(torch.__config__.show())"
python -c "import torch; print(torch.__config__.parallel_info())"
python -c "import torch; print(torch.__config__.torch.xpu.device_count())"

- name: Upload Windows build log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Windows-Log-${{ github.event.pull_request.number || github.sha }}
path: 'C:\runner\actions-runner\_work\torch-xpu-ops\pytorch\build_torch_wheel_log.log'

- name: Upload Windows binary
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Windows-Binary-${{ github.event.pull_request.number || github.sha }}
path: 'C:\runner\actions-runner\_work\torch-xpu-ops\pytorch\dist'

- name: Run XPU OP Extended UT
if: contains(inputs.ut, 'op_extended') || github.event_name == 'schedule'
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
set PYTORCH_TEST_WITH_SLOW=1
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
python run_test_with_skip_mtl.py
9 changes: 9 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- converted_to_draft
- ready_for_review
- labeled
branches:
- main
- release/*
Expand Down Expand Up @@ -35,6 +36,14 @@ jobs:
abi: 0
ut: op_extended
runner: linux.idc.xpu

preci-windows:
# Don't run on forked repos and draft PRs
if: ${{ (github.repository_owner == 'intel') && (github.event.pull_request.draft == false) }} && contains(github.event.pull_request.labels.*.name, 'windows_ci')
uses: ./.github/workflows/_windows_ut.yml
with:
ut: op_extended
runner: Windows_CI

Inductor-XPU-E2E-CI-Tests:
runs-on: pvc_e2e
Expand Down
Loading