-
Notifications
You must be signed in to change notification settings - Fork 105
423 lines (407 loc) · 17.7 KB
/
_windows_ut.yml
File metadata and controls
423 lines (407 loc) · 17.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
name: Windows Test
on:
workflow_call:
inputs:
pytorch:
required: false
type: string
default: 'main'
description: Pytorch main by default, or 'commit/branch', or 'repo@commit/repo@branch'
torch_xpu_ops:
required: false
type: string
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
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.3'
description: Python version
src_changed:
required: true
type: string
default: 'false'
description: Check if filtered file changed
has_label:
required: true
type: string
default: 'false'
description: Check if labelled
permissions: read-all
env:
USE_XPU: 1
PYTORCH_EXTRA_INSTALL_REQUIREMENTS: >-
intel-cmplr-lib-rt==2025.3.2 |
intel-cmplr-lib-ur==2025.3.2 |
intel-cmplr-lic-rt==2025.3.2 |
intel-sycl-rt==2025.3.2 |
onemkl-license==2025.3.1 |
onemkl-sycl-blas==2025.3.1 |
onemkl-sycl-dft==2025.3.1 |
onemkl-sycl-lapack==2025.3.1 |
onemkl-sycl-rng==2025.3.1 |
onemkl-sycl-sparse==2025.3.1 |
dpcpp-cpp-rt==2025.3.2 |
intel-opencl-rt==2025.3.2 |
mkl==2025.3.1 |
intel-openmp==2025.3.2 |
tbb==2022.3.1 |
tcmlib==1.4.1 |
umf==1.0.3 |
intel-pti==0.16.0
jobs:
ut_test:
runs-on: ${{ inputs.runner }}
if: ${{ inputs.src_changed == 'true' || inputs.has_label == 'true' }}
timeout-minutes: 1000
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"
rmdir /s /q "C:\ProgramData\miniforge3\envs\windows_ci"
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
)
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
git config --system core.longpaths true
git config --global core.symlinks true
git config --global core.fsmonitor false
powershell -Command "Set-ItemProperty -Path "HKLM:\\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1"
git status
git show -s
git submodule sync && git submodule update --init --recursive
if %TORCH_XPU_OPS_COMMIT% == 'pinned' (
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 ..
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
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 "C:\Program Files (x86)\Intel\oneAPI\pti\latest\env\vars.bat"
call conda activate windows_ci
cd ../pytorch
pip install -r requirements.txt
pip install cmake setuptools clang-format
pip install mkl-static mkl-include
set USE_STATIC_MKL=1
copy "%CONDA_PREFIX%\Library\bin\libiomp*5md.dll" .\torch\lib
copy "%CONDA_PREFIX%\Library\bin\uv.dll" .\torch\lib
if defined CMAKE_PREFIX_PATH (
set CMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library;%CMAKE_PREFIX_PATH%"
) else (
set CMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library"
)
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 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
)
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
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 }}-${{ github.run_id }}-${{ github.run_attempt }}
path: 'C:\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 }}-${{ github.run_id }}-${{ github.run_attempt }}
path: 'C:\actions-runner\_work\torch-xpu-ops\pytorch\dist'
- name: Run CPP Extensions AOT SYCL UT
if: contains(inputs.ut, 'op_extended') || github.event_name == 'schedule'
shell: cmd
continue-on-error: true
run: |
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
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
python -m pytest test_cpp_extensions_aot_xpu.py -v --junit-xml=test_cpp_extensions_aot_xpu.xml
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
copy test_cpp_extensions_aot_xpu.xml %GITHUB_WORKSPACE%\ut_log /Y
- name: Run XPU OP Extended UT
if: contains(inputs.ut, 'op_extended') || github.event_name == 'schedule'
shell: cmd
continue-on-error: true
run: |
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
set PYTORCH_TEST_WITH_SLOW=1
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
python run_test_with_skip_mtl.py
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
copy op_extended.xml %GITHUB_WORKSPACE%\ut_log /Y
- name: Run Test XPU UT
if: contains(inputs.ut, 'test_xpu') || github.event_name == 'schedule'
shell: cmd
continue-on-error: true
run: |
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
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
python run_test_win_with_skip_mtl.py
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
copy test_xpu.xml %GITHUB_WORKSPACE%\ut_log /Y
- name: Run OP UT
if: contains(inputs.ut, 'op_ut_windows') || github.event_name == 'schedule'
shell: cmd
continue-on-error: true
run: |
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
set PYTORCH_TEST_WITH_SLOW=1
set PYTORCH_ENABLE_XPU_FALLBACK=1
set PYTEST_ADDOPTS=-v --timeout 600 --timeout_method=thread --max-worker-restart 1000000 -n 1
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
python run_test_with_windows_nighltly.py
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
for /r . %%f in (test*.xml op_ut_windows_with_*.xml) do move "%%f" "%GITHUB_WORKSPACE%\ut_log\" >nul 2>&1 || echo "File move completed"
- name: Upload Inductor XPU UT Log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-${{ github.run_id }}-${{ github.run_attempt }}
path: "${{ github.workspace }}/ut_log"
if-no-files-found: ignore
summary:
needs: [ut_test]
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
- name: Setup python-${{ inputs.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}
- name: Download XPU UT Logs
uses: actions/download-artifact@v4
with:
pattern: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-*
path: ${{ github.workspace }}/ut_log
- name: UT Test Results Summary
shell: bash
run: |
pip install junitparser
find . -type f -name "*.xml" -exec mv {} ${{ github.workspace }}/ut_log/ \; || true
python ./.github/scripts/check-ut.py -n ${{ inputs.ut }} -i ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true
# Check the failure logs
if ls ${{ github.workspace }}/failures*.log 1> /dev/null 2>&1; then
echo -e "Exist Failure logs"
echo "Found Failure logs as below: "
for file in ${{ github.workspace }}/failures*.log; do
echo " - $file"
cp "$file" ${{ github.workspace }}/ut_log
done
echo -e "Failure logs Copied"
else
echo -e "No Failure logs"
fi
# Copied the passed logs
if ls passed*.log 1> /dev/null 2>&1; then
cp passed*.log ${{ github.workspace }}/ut_log
echo -e "Passed logs Copied"
else
echo -e "No Passed logs"
fi
# Copied the Summary logs
if ls category*.log 1> /dev/null 2>&1; then
cp category*.log ${{ github.workspace }}/ut_log
echo -e "Category logs Copied"
else
echo -e "No Category logs"
fi
- name: Upload Inductor XPU UT Log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/ut_log
overwrite: true
summary_check:
needs: [summary]
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
- name: Download XPU UT Logs
uses: actions/download-artifact@v4
with:
pattern: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-*
path: ${{ github.workspace }}/ut_log
- name: Check UT Results
shell: bash
run: |
ls -al ${{ github.workspace }}/ut_log
cd ${{ github.workspace }}/ut_log
latest_dir=$(find . -type d -name "Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-*" |sort -V |tail -n 1)
cd "${latest_dir}"
find "${{ github.workspace }}/ut_log" -type f \
\( -name "failures_*.log" -o \
-name "passed_*.log" -o \
-name "category_*.log" \) \
-exec mv {} ./ \; || true
# get skipped known issues on Linux
count_linux=$(gh api "search/issues?q=repo:$GITHUB_REPOSITORY+label:skipped+state:open" --jq '.total_count')
if [ "$count_linux" -gt 0 ]; then
echo -e "$count_linux issues on linux with skipped label found"
gh api --paginate "repos/${{ github.repository }}/issues?labels=skipped" \
--jq '.[] | select(.pull_request == null) | "Issue #\(.number): \(.title)\n\(.body)\n"' > issues.log
fi
# get skipped known issues only on Windows
count_windows_only=$(gh api "search/issues?q=repo:$GITHUB_REPOSITORY+label:skipped_windows+state:open" --jq '.total_count')
if [ "$count_windows_only" -gt 0 ]; then
echo -e "$count_windows_only windows only issues with skipped label found"
gh api --paginate "repos/${{ github.repository }}/issues?labels=skipped_windows" \
--jq '.[] | select(.pull_request == null) | "Issue #\(.number): \(.title)\n\(.body)\n"' >> issues.log
fi
cp ${{ github.workspace }}/.github/scripts/ut_result_check.sh ./
for ut_name in $(echo ${{ inputs.ut }} |sed 's/,/ /g')
do
touch Known_issue.log
if [ -f "issues.log" ]; then
awk -v r="${ut_name}" 'BEGIN{ print_row = 0 }{
if ( ! ( $0 ~ /[a-zA-Z0-9]/ ) ) { print_row = 0 };
if ( print_row == 1 && $1 ~ r ) { print $0 };
if ( $0 ~ /Cases:/ ) { print_row = 1 };
}' issues.log > Known_issue.log
else
echo "Info: issues.log not found or empty, using empty Known_issue.log"
fi
bash ut_result_check.sh ${ut_name}
done
- name: Upload Inductor XPU UT Log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/ut_log
overwrite: true