77 required : false
88 type : string
99 default : ' main'
10- description : Pytorch branch/ commit
10+ description : Pytorch main by default, or 'commit/branch', or 'repo@ commit/repo@branch'
1111 torch_xpu_ops :
1212 required : false
1313 type : string
14- default : ' false '
15- description : Keep torch -xpu-ops pin. `true` means use pined commit
14+ default : ' main '
15+ description : Torch -xpu-ops main by default, 'commit/branch', or 'repo@ commit/repo@branch', or 'pinned' for pytorch pin
1616 ut :
1717 required : true
1818 type : string
@@ -48,6 +48,27 @@ permissions: read-all
4848
4949env :
5050 USE_XPU : 1
51+ PYTORCH_EXTRA_INSTALL_REQUIREMENTS : >-
52+ intel-cmplr-lib-rt==2025.2.1 |
53+ intel-cmplr-lib-ur==2025.2.1 |
54+ intel-cmplr-lic-rt==2025.2.1 |
55+ intel-sycl-rt==2025.2.1 |
56+ oneccl-devel==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
57+ oneccl==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
58+ impi-rt==2021.16.1; platform_system == 'Linux' and platform_machine == 'x86_64' |
59+ onemkl-sycl-blas==2025.2.0 |
60+ onemkl-sycl-dft==2025.2.0 |
61+ onemkl-sycl-lapack==2025.2.0 |
62+ onemkl-sycl-rng==2025.2.0 |
63+ onemkl-sycl-sparse==2025.2.0 |
64+ dpcpp-cpp-rt==2025.2.1 |
65+ intel-opencl-rt==2025.2.1 |
66+ mkl==2025.2.0 |
67+ intel-openmp==2025.2.1 |
68+ tbb==2022.2.0 |
69+ tcmlib==1.4.0 |
70+ umf==0.11.0 |
71+ intel-pti==0.13.1
5172
5273jobs :
5374 ut_test :
7798 if exist "pytorch" (
7899 rmdir /s /q pytorch
79100 )
80- git clone https://github.com/pytorch/pytorch pytorch
81- cd pytorch && git checkout ${{ inputs.pytorch }}
101+ set pytorch=${{ inputs.pytorch }}
102+ set torch_xpu_ops=${{ inputs.torch_xpu_ops }}
103+ echo %pytorch% | findstr /C:"https://" >nul
104+ if %errorlevel% equ 0 (
105+ echo %pytorch% | findstr "@" >nul
106+ if %errorlevel% equ 0 (
107+ for /f "tokens=1,2 delims=@" %%a in ("%pytorch%") do (
108+ set PYTORCH_REPO=%%a
109+ set PYTORCH_COMMIT=%%b
110+ )
111+ ) else (
112+ set PYTORCH_REPO=%pytorch%
113+ set PYTORCH_COMMIT=main
114+ )
115+ ) else (
116+ set PYTORCH_REPO=https://github.com/pytorch/pytorch.git
117+ set PYTORCH_COMMIT=%pytorch%
118+ )
119+
120+ echo %torch_xpu_ops% | findstr /C:"https://" >nul
121+ if %errorlevel% equ 0 (
122+ echo %torch_xpu_ops% | findstr "@" >nul
123+ if %errorlevel% equ 0 (
124+ for /f "tokens=1,2 delims=@" %%a in ("%torch_xpu_ops%") do (
125+ set TORCH_XPU_OPS_REPO=%%a
126+ set TORCH_XPU_OPS_COMMIT=%%b
127+ )
128+ ) else (
129+ set TORCH_XPU_OPS_REPO=%torch_xpu_ops%
130+ set TORCH_XPU_OPS_COMMIT=main
131+ )
132+ ) else (
133+ set TORCH_XPU_OPS_REPO=https://github.com/intel/torch-xpu-ops.git
134+ set TORCH_XPU_OPS_COMMIT=%torch_xpu_ops%
135+ )
136+
137+ echo PYTORCH_REPO=%PYTORCH_REPO% > temp_vars.txt
138+ echo PYTORCH_COMMIT=%PYTORCH_COMMIT% >> temp_vars.txt
139+ echo TORCH_XPU_OPS_REPO=%TORCH_XPU_OPS_REPO% >> temp_vars.txt
140+ echo TORCH_XPU_OPS_COMMIT=%TORCH_XPU_OPS_COMMIT% >> temp_vars.txt
141+
142+ echo File contents:
143+ type temp_vars.txt
144+ del temp_vars.txt
145+
146+ echo PYTORCH_REPO: %PYTORCH_REPO%
147+ echo PYTORCH_COMMIT: %PYTORCH_COMMIT%
148+ echo TORCH_XPU_OPS_REPO: %TORCH_XPU_OPS_REPO%
149+ echo TORCH_XPU_OPS_COMMIT: %TORCH_XPU_OPS_COMMIT%
150+ git clone %PYTORCH_REPO% pytorch
151+ cd pytorch && git checkout %PYTORCH_COMMIT%
82152 pip install pyyaml requests pytest-timeout
83153 call conda install -y libuv
84154 call conda install -y rust
89159 git status
90160 git show -s
91161 git submodule sync && git submodule update --init --recursive
92- if ${{ inputs.torch_xpu_ops }} == 'pinned' (
162+ if %TORCH_XPU_OPS_COMMIT% == 'pinned' (
93163 echo "Don't replace torch-xpu-ops!"
94164 ) else (
95165 echo "Replace torch-xpu-ops!"
@@ -98,7 +168,14 @@ jobs:
98168 rmdir /s /q torch-xpu-ops
99169 )
100170 cd ..
101- Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
171+ if "%GITHUB_EVENT_NAME%" == "pull_request" (
172+ Xcopy ..\torch-xpu-ops third_party\torch-xpu-ops /E/H/Y/F/I
173+ ) else (
174+ git clone "%TORCH_XPU_OPS_REPO%" "third_party\torch-xpu-ops"
175+ cd "third_party\torch-xpu-ops"
176+ git checkout "%TORCH_XPU_OPS_COMMIT%"
177+ cd ../..
178+ )
102179 powershell -Command "(Get-Content caffe2/CMakeLists.txt) -replace 'checkout --quiet \${TORCH_XPU_OPS_COMMIT}', 'log -n 1' | Set-Content caffe2/CMakeLists.txt"
103180 )
104181 - name : Build Pytorch XPU
@@ -125,7 +202,13 @@ jobs:
125202 python setup.py clean
126203 set MAX_JOBS=32
127204 set TORCH_XPU_ARCH_LIST=mtl-h,bmg,lnl-m
128- python setup.py bdist_wheel > build_torch_wheel_log.log
205+ python setup.py bdist_wheel > build_torch_wheel_log.log 2>&1
206+ set EXIT_CODE=%errorlevel%
207+ if %EXIT_CODE% neq 0 (
208+ echo "[INFO] Build failed with exit code %EXIT_CODE%"
209+ exit /b %EXIT_CODE%
210+ )
211+ echo "[INFO] Build Successfully"
129212 echo "[INFO] begin to install torch whls"
130213 for /r C:\actions-runner\_work\torch-xpu-ops\pytorch\dist %%i in (torch*.whl) do (
131214 set TORCH_WHL=%%i
@@ -138,7 +221,6 @@ jobs:
138221 run : |
139222 call "C:\ProgramData\miniforge3\Scripts\activate.bat"
140223 call conda activate windows_ci
141- call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
142224 python -c "import torch; print(torch.__config__.show())"
143225 python -c "import torch; print(torch.__config__.parallel_info())"
144226 python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
@@ -162,7 +244,6 @@ jobs:
162244 call "C:\ProgramData\miniforge3\Scripts\activate.bat"
163245 call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
164246 call conda activate windows_ci
165- call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
166247 set PYTORCH_TEST_WITH_SLOW=1
167248 cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
168249 python run_test_with_skip_mtl.py
@@ -177,7 +258,6 @@ jobs:
177258 call "C:\ProgramData\miniforge3\Scripts\activate.bat"
178259 call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
179260 call conda activate windows_ci
180- call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
181261 cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
182262 python run_test_win_with_skip_mtl.py
183263
0 commit comments