Skip to content
Merged
102 changes: 91 additions & 11 deletions .github/workflows/_windows_ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
required: false
type: string
default: 'main'
description: Pytorch branch/commit
description: Pytorch main by default, or 'commit/branch', or 'repo@commit/repo@branch'
torch_xpu_ops:
required: false
type: string
default: 'false'
description: Keep torch-xpu-ops pin. `true` means use pined commit
default: 'main'
description: Torch-xpu-ops main by default, 'commit/branch', or 'repo@commit/repo@branch', or 'pinned' for pytorch pin
ut:
required: true
type: string
Expand Down Expand Up @@ -48,6 +48,27 @@ permissions: read-all

env:
USE_XPU: 1
PYTORCH_EXTRA_INSTALL_REQUIREMENTS: >-
intel-cmplr-lib-rt==2025.2.1 |
intel-cmplr-lib-ur==2025.2.1 |
intel-cmplr-lic-rt==2025.2.1 |
intel-sycl-rt==2025.2.1 |
oneccl-devel==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
oneccl==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
impi-rt==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
onemkl-sycl-blas==2025.2.0 |
onemkl-sycl-dft==2025.2.0 |
onemkl-sycl-lapack==2025.2.0 |
onemkl-sycl-rng==2025.2.0 |
onemkl-sycl-sparse==2025.2.0 |
dpcpp-cpp-rt==2025.2.1 |
intel-opencl-rt==2025.2.1 |
mkl==2025.2.0 |
intel-openmp==2025.2.1 |
tbb==2022.2.0 |
tcmlib==1.4.0 |
umf==0.11.0 |
intel-pti==0.13.1

jobs:
ut_test:
Expand Down Expand Up @@ -77,8 +98,57 @@ jobs:
if exist "pytorch" (
rmdir /s /q pytorch
)
git clone https://github.com/pytorch/pytorch pytorch
cd pytorch && git checkout ${{ inputs.pytorch }}
set pytorch=${{ inputs.pytorch }}
set torch_xpu_ops=${{ inputs.torch_xpu_ops }}
echo %pytorch% | findstr /C:"https://" >nul
if %errorlevel% equ 0 (
echo %pytorch% | findstr "@" >nul
if %errorlevel% equ 0 (
for /f "tokens=1,2 delims=@" %%a in ("%pytorch%") do (
set PYTORCH_REPO=%%a
set PYTORCH_COMMIT=%%b
)
) else (
set PYTORCH_REPO=%pytorch%
set PYTORCH_COMMIT=main
)
) else (
set PYTORCH_REPO=https://github.com/pytorch/pytorch.git
set PYTORCH_COMMIT=%pytorch%
)

echo %torch_xpu_ops% | findstr /C:"https://" >nul
if %errorlevel% equ 0 (
echo %torch_xpu_ops% | findstr "@" >nul
if %errorlevel% equ 0 (
for /f "tokens=1,2 delims=@" %%a in ("%torch_xpu_ops%") do (
set TORCH_XPU_OPS_REPO=%%a
set TORCH_XPU_OPS_COMMIT=%%b
)
) else (
set TORCH_XPU_OPS_REPO=%torch_xpu_ops%
set TORCH_XPU_OPS_COMMIT=main
)
) else (
set TORCH_XPU_OPS_REPO=https://github.com/intel/torch-xpu-ops.git
set TORCH_XPU_OPS_COMMIT=%torch_xpu_ops%
)

echo PYTORCH_REPO=%PYTORCH_REPO% > temp_vars.txt
echo PYTORCH_COMMIT=%PYTORCH_COMMIT% >> temp_vars.txt
echo TORCH_XPU_OPS_REPO=%TORCH_XPU_OPS_REPO% >> temp_vars.txt
echo TORCH_XPU_OPS_COMMIT=%TORCH_XPU_OPS_COMMIT% >> temp_vars.txt

echo File contents:
type temp_vars.txt
del temp_vars.txt

echo PYTORCH_REPO: %PYTORCH_REPO%
echo PYTORCH_COMMIT: %PYTORCH_COMMIT%
echo TORCH_XPU_OPS_REPO: %TORCH_XPU_OPS_REPO%
echo TORCH_XPU_OPS_COMMIT: %TORCH_XPU_OPS_COMMIT%
git clone %PYTORCH_REPO% pytorch
cd pytorch && git checkout %PYTORCH_COMMIT%
pip install pyyaml requests pytest-timeout
call conda install -y libuv
call conda install -y rust
Expand All @@ -89,7 +159,7 @@ jobs:
git status
git show -s
git submodule sync && git submodule update --init --recursive
if ${{ inputs.torch_xpu_ops }} == 'pinned' (
if %TORCH_XPU_OPS_COMMIT% == 'pinned' (
echo "Don't replace torch-xpu-ops!"
) else (
echo "Replace torch-xpu-ops!"
Expand All @@ -98,7 +168,14 @@ jobs:
rmdir /s /q torch-xpu-ops
)
cd ..
Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
if "%GITHUB_EVENT_NAME%" == "pull_request" (
Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
) else (
git clone "%TORCH_XPU_OPS_REPO%" "third_party\torch-xpu-ops"
cd "third_party\torch-xpu-ops"
git checkout "%TORCH_XPU_OPS_COMMIT%"
cd ../..
)
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
Expand All @@ -125,7 +202,13 @@ jobs:
python setup.py clean
set MAX_JOBS=32
set TORCH_XPU_ARCH_LIST=mtl-h,bmg,lnl-m
python setup.py bdist_wheel > build_torch_wheel_log.log
python setup.py bdist_wheel > build_torch_wheel_log.log 2>&1
set EXIT_CODE=%errorlevel%
if %EXIT_CODE% neq 0 (
echo "[INFO] Build failed with exit code %EXIT_CODE%"
exit /b %EXIT_CODE%
)
echo "[INFO] Build Successfully"
echo "[INFO] begin to install torch whls"
for /r C:\actions-runner\_work\torch-xpu-ops\pytorch\dist %%i in (torch*.whl) do (
set TORCH_WHL=%%i
Expand All @@ -138,7 +221,6 @@ jobs:
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())"
Expand All @@ -162,7 +244,6 @@ jobs:
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.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
Expand All @@ -177,7 +258,6 @@ jobs:
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
python run_test_win_with_skip_mtl.py

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly_ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,5 @@ jobs:
src_changed: false
has_label: true
runner: Windows_CI
torch_xpu_ops: ${{ needs.Conditions-Filter.outputs.torch_xpu_ops }}
pytorch: ${{ needs.Conditions-Filter.outputs.pytorch }}
1 change: 1 addition & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ jobs:
runner: Windows_CI
src_changed: ${{ needs.conditions-filter.outputs.src_changed }}
has_label: ${{ needs.conditions-filter.outputs.has_label }}
pytorch: ${{ needs.conditions-filter.outputs.pytorch }}