Skip to content

Commit f6588df

Browse files
authored
Merge branch 'main' into xiangdong/dist_cases
2 parents 685d288 + 693a4a8 commit f6588df

File tree

7 files changed

+124
-40
lines changed

7 files changed

+124
-40
lines changed

.github/scripts/check-ut.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def print_failures(failure_list=None):
138138

139139
def generate_failures_log():
140140
if not failures:
141-
print("No failures found, skipping log file creation.")
142141
return
143142

144143
for case in failures:
@@ -245,6 +244,8 @@ def determine_category(ut):
245244
return 'op_extended'
246245
elif ut == 'op_transformers':
247246
return 'op_transformers'
247+
elif ut == 'test_xpu':
248+
return 'test_xpu'
248249
elif 'op_ut' in ut:
249250
return 'op_ut'
250251
else:
@@ -296,7 +297,6 @@ def process_xml_file(xml_file):
296297

297298
def generate_passed_log():
298299
if not passed_cases:
299-
print("No passed cases found, skipping log file creation.")
300300
return
301301

302302
for category, category_passed in passed_by_category.items():

.github/scripts/ut_result_check.sh

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ check_new_failed() {
2525

2626
# Filter the same content from file_UT as file_known_issue
2727
echo "Filtering $file_known_issue for $file_UT"
28+
if grep -q $'\r' "$file_UT"; then
29+
echo "Detected log from windows"
30+
sed -i 's/\r$//' "$file_UT"
31+
fi
2832
grep -vFxf "$file_known_issue" "$file_UT" > "$output_file"
2933

3034
echo -e "\n\033[1;31m[New failed cases Summary]\033[0m"
@@ -54,6 +58,10 @@ check_passed_known_issues() {
5458
return 1
5559
fi
5660
echo "Checking for known issues that are now passing in $file_passed_UT"
61+
if grep -q $'\r' "$file_passed_UT"; then
62+
echo "Detected log from windows"
63+
sed -i 's/\r$//' "$file_passed_UT"
64+
fi
5765
grep -Fxf "$file_passed_UT" "$file_known_issue" > "$output_file"
5866
echo -e "\n\033[1;32m[New passed cases Summary]\033[0m"
5967
if [[ -s "$output_file" ]]; then
@@ -74,6 +82,7 @@ check_test_cases() {
7482
["op_regression_dev1"]=1
7583
["op_transformers"]=237
7684
["op_ut"]=120408
85+
["test_xpu"]=69
7786
)
7887

7988
if [[ ! -f "$log_file" ]]; then
@@ -115,7 +124,7 @@ check_test_cases() {
115124
}
116125

117126

118-
if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut' ]]; then
127+
if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut' || "${ut_suite}" == 'test_xpu' ]]; then
119128
echo -e "========================================================================="
120129
echo -e "Show Failed cases in ${ut_suite}"
121130
echo -e "========================================================================="
@@ -188,35 +197,6 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1'
188197
fi
189198
fi
190199

191-
if [[ "${ut_suite}" == 'torch_xpu' ]]; then
192-
echo "Pytorch XPU binary UT checking"
193-
cd ../../pytorch || exit
194-
for xpu_case in build/bin/*{xpu,sycl}*; do
195-
if [[ "$xpu_case" != *"*"* && "$xpu_case" != *.so && "$xpu_case" != *.a ]]; then
196-
case_name=$(basename "$xpu_case")
197-
cd ../ut_log/torch_xpu || exit
198-
grep -E "FAILED" binary_ut_"${ut_suite}"_"${case_name}"_test.log | awk '{print $2}' > ./binary_ut_"${ut_suite}"_"${case_name}"_failed.log
199-
wc -l < "./binary_ut_${ut_suite}_${case_name}_failed.log" | tee -a ./binary_ut_"${ut_suite}"_failed_summary.log
200-
grep -E "PASSED|Pass" binary_ut_"${ut_suite}"_"${case_name}"_test.log | awk '{print $2}' > ./binary_ut_"${ut_suite}"_"${case_name}"_passed.log
201-
wc -l < "./binary_ut_${ut_suite}_${case_name}_passed.log" | tee -a ./binary_ut_"${ut_suite}"_passed_summary.log
202-
cd - || exit
203-
fi
204-
done
205-
echo -e "========================================================================="
206-
echo -e "Show Failed cases in ${ut_suite}"
207-
echo -e "========================================================================="
208-
cd ../ut_log/torch_xpu || exit
209-
cat "./binary_ut_${ut_suite}_${case_name}_failed.log"
210-
num_failed_binary_ut=$(awk '{sum += $1};END {print sum}' binary_ut_"${ut_suite}"_failed_summary.log)
211-
num_passed_binary_ut=$(awk '{sum += $1};END {print sum}' binary_ut_"${ut_suite}"_passed_summary.log)
212-
((num_failed=num_failed_binary_ut))
213-
if [[ $num_failed -gt 0 ]] || [[ $num_passed_binary_ut -le 0 ]]; then
214-
echo -e "[ERROR] UT ${ut_suite} test Fail"
215-
exit 1
216-
else
217-
echo -e "[PASS] UT ${ut_suite} test Pass"
218-
fi
219-
fi
220200
if [[ "${ut_suite}" == 'xpu_distributed' ]]; then
221201
grep -E "^FAILED" xpu_distributed_test.log | awk '{print $3}' > ./"${ut_suite}"_xpu_distributed_test_failed.log
222202
sed -i '/^[^.]\+/d' ./"${ut_suite}"_xpu_distributed_test_failed.log

.github/workflows/_windows_ut.yml

Lines changed: 108 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
call conda activate windows_ci
113113
cd ../pytorch
114114
pip install -r requirements.txt
115-
pip install cmake setuptools==72.1.0 clang-format
115+
pip install cmake setuptools clang-format
116116
pip install mkl-static mkl-include
117117
set USE_STATIC_MKL=1
118118
copy "%CONDA_PREFIX%\Library\bin\libiomp*5md.dll" .\torch\lib
@@ -123,7 +123,8 @@ jobs:
123123
set CMAKE_PREFIX_PATH="%CONDA_PREFIX%\Library"
124124
)
125125
python setup.py clean
126-
set MAX_JOBS=4
126+
set MAX_JOBS=32
127+
set TORCH_XPU_ARCH_LIST=mtl-h,bmg,lnl-m
127128
python setup.py bdist_wheel > build_torch_wheel_log.log
128129
echo "[INFO] begin to install torch whls"
129130
for /r C:\actions-runner\_work\torch-xpu-ops\pytorch\dist %%i in (torch*.whl) do (
@@ -141,24 +142,22 @@ jobs:
141142
python -c "import torch; print(torch.__config__.show())"
142143
python -c "import torch; print(torch.__config__.parallel_info())"
143144
python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
144-
145145
- name: Upload Windows build log
146146
if: ${{ ! cancelled() }}
147147
uses: actions/upload-artifact@v4
148148
with:
149149
name: Torch-XPU-Windows-Log-${{ github.event.pull_request.number || github.sha }}
150150
path: 'C:\actions-runner\_work\torch-xpu-ops\pytorch\build_torch_wheel_log.log'
151-
152151
- name: Upload Windows binary
153152
if: ${{ ! cancelled() }}
154153
uses: actions/upload-artifact@v4
155154
with:
156155
name: Torch-XPU-Windows-Binary-${{ github.event.pull_request.number || github.sha }}
157156
path: 'C:\actions-runner\_work\torch-xpu-ops\pytorch\dist'
158-
159157
- name: Run XPU OP Extended UT
160158
if: contains(inputs.ut, 'op_extended') || github.event_name == 'schedule'
161159
shell: cmd
160+
continue-on-error: true
162161
run: |
163162
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
164163
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
@@ -168,13 +167,116 @@ jobs:
168167
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
169168
python run_test_with_skip_mtl.py
170169
170+
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
171+
copy op_extended.xml %GITHUB_WORKSPACE%\ut_log /Y
171172
- name: Run Test XPU UT
172-
if: contains(inputs.ut, 'torch_xpu') || github.event_name == 'schedule'
173+
if: contains(inputs.ut, 'test_xpu') || github.event_name == 'schedule'
173174
shell: cmd
175+
continue-on-error: true
174176
run: |
175177
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
176178
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
177179
call conda activate windows_ci
178180
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
179181
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
180182
python run_test_win_with_skip_mtl.py
183+
184+
if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log"
185+
copy test_xpu.xml %GITHUB_WORKSPACE%\ut_log /Y
186+
- name: UT Test Results Summary
187+
shell: cmd
188+
run: |
189+
call conda activate windows_ci
190+
pip install junitparser
191+
echo "GITHUB_WORKSPACE: %GITHUB_WORKSPACE%"
192+
for %%i in ("%GITHUB_WORKSPACE%\ut_log\*.xml") do (
193+
python .\.github\scripts\check-ut.py "%%i" >> "%GITHUB_STEP_SUMMARY%"
194+
)
195+
@echo off
196+
197+
REM Check the failure logs
198+
if exist "%GITHUB_WORKSPACE%\failures*.log" (
199+
echo Exist Failure logs
200+
echo Found Failure logs as below:
201+
for %%f in ("%GITHUB_WORKSPACE%\failures*.log") do (
202+
echo - %%f
203+
copy "%%f" "%GITHUB_WORKSPACE%\ut_log\"
204+
)
205+
echo Failure logs Copied
206+
) else (
207+
echo No Failure logs
208+
)
209+
210+
REM Copied the passed logs
211+
if exist "passed*.log" (
212+
copy "passed*.log" "%GITHUB_WORKSPACE%\ut_log\"
213+
echo Passed logs Copied
214+
) else (
215+
echo No Passed logs
216+
)
217+
218+
REM Copied the Summary logs
219+
if exist "category*.log" (
220+
copy "category*.log" "%GITHUB_WORKSPACE%\ut_log\"
221+
echo Category logs Copied
222+
) else (
223+
echo No Category logs
224+
)
225+
- name: Upload Inductor XPU UT Log
226+
if: ${{ ! cancelled() }}
227+
uses: actions/upload-artifact@v4
228+
with:
229+
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows
230+
path: "${{ github.workspace }}/ut_log"
231+
if-no-files-found: ignore
232+
233+
summary:
234+
needs: [ut_test]
235+
runs-on: ubuntu-24.04
236+
timeout-minutes: 30
237+
env:
238+
GH_TOKEN: ${{ github.token }}
239+
steps:
240+
- name: Checkout torch-xpu-ops
241+
uses: actions/checkout@v4
242+
- name: Download XPU UT Logs
243+
uses: actions/download-artifact@v4
244+
with:
245+
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows
246+
path: ${{ github.workspace }}/ut_log
247+
- name: Check UT Results
248+
shell: bash
249+
run: |
250+
ls -al ${{ github.workspace }}/ut_log
251+
cd ${{ github.workspace }}/ut_log
252+
253+
# get skipped known issues
254+
count=$(gh api "repos/${{ github.repository }}/issues?labels=skipped_windows" --jq 'length')
255+
if [ "$count" -gt 0 ]; then
256+
echo -e "$count issues with skipped label found"
257+
gh api "repos/${{ github.repository }}/issues?labels=skipped_windows" \
258+
--jq '.[] | select(.pull_request == null) | "Issue #\(.number): \(.title)\n\(.body)\n"' > issues.log
259+
fi
260+
261+
cp ${{ github.workspace }}/.github/scripts/ut_result_check.sh ./
262+
for ut_name in $(echo ${{ inputs.ut }} |sed 's/,/ /g')
263+
do
264+
touch Known_issue.log
265+
if [ -f "issues.log" ]; then
266+
awk -v r="${ut_name}" 'BEGIN{ print_row = 0 }{
267+
if ( ! ( $0 ~ /[a-zA-Z0-9]/ ) ) { print_row = 0 };
268+
if ( print_row == 1 && $1 ~ r ) { print $0 };
269+
if ( $0 ~ /Cases:/ ) { print_row = 1 };
270+
}' issues.log > Known_issue.log
271+
else
272+
echo "Info: issues.log not found or empty, using empty Known_issue.log"
273+
fi
274+
bash ut_result_check.sh ${ut_name}
275+
done
276+
- name: Upload Inductor XPU UT Log
277+
if: ${{ ! cancelled() }}
278+
uses: actions/upload-artifact@v4
279+
with:
280+
name: Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows
281+
path: ${{ github.workspace }}/ut_log
282+
overwrite: true

.github/workflows/nightly_ondemand.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
secrets: inherit
210210
uses: ./.github/workflows/_windows_ut.yml
211211
with:
212-
ut: 'op_extended,torch_xpu'
212+
ut: 'op_extended,test_xpu'
213213
python: ${{ needs.Conditions-Filter.outputs.python }}
214214
src_changed: false
215215
has_label: true

.github/workflows/pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
secrets: inherit
160160
uses: ./.github/workflows/_windows_ut.yml
161161
with:
162-
ut: op_extended,torch_xpu
162+
ut: op_extended,test_xpu
163163
runner: Windows_CI
164164
src_changed: ${{ needs.conditions-filter.outputs.src_changed }}
165165
has_label: ${{ needs.conditions-filter.outputs.has_label }}

test/xpu/extended/run_test_with_skip_mtl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919

2020
os.environ["PYTORCH_TEST_WITH_SLOW"] = "1"
2121
test_command = ["-k", skip_options, "test_ops_xpu.py", "-v"]
22+
test_command.extend(["--junit-xml", "./op_extended.xml"])
2223
res = pytest.main(test_command)
2324
sys.exit(res)

test/xpu/run_test_win_with_skip_mtl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
sys.stdout = StringIO()
1919

2020
test_command = ["-k", skip_options, "../../../../test/test_xpu.py", "-v"]
21+
test_command.extend(["--junit-xml", "./test_xpu.xml"])
2122
res = pytest.main(test_command)
2223

2324
output = sys.stdout.getvalue()

0 commit comments

Comments
 (0)