Skip to content

Commit c2de91f

Browse files
[Nightly] Enable Inductor UT
1 parent 8d76769 commit c2de91f

File tree

4 files changed

+70
-10
lines changed

4 files changed

+70
-10
lines changed

.github/actions/linux-uttest/action.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,37 @@ runs:
116116
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
117117
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
118118
cp *.xml ${{ github.workspace }}/ut_log
119+
- name: xpu_inductor
120+
shell: timeout 36000 bash -xe {0}
121+
if: ${{ inputs.ut_name == 'xpu_inductor' }}
122+
run: |
123+
export PYTORCH_TEST_WITH_SLOW=1
124+
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
125+
mkdir -p ut_log/xpu_inductor
126+
cd pytorch
127+
for file in "test/inductor"/*.py; do
128+
filename=$(basename "$file")
129+
echo "=== Starting test: $filename ==="
130+
start=$(date +%s)
131+
pytest -sv test/inductor/$filename --junit-xml=${{ github.workspace }}/ut_log/inductor_$filename.xml 2>${{ github.workspace }}/ut_log/xpu_inductor/xpu_inductor_$filename_test_error.log | \
132+
tee ${{ github.workspace }}/ut_log/xpu_inductor/xpu_inductor_$filename_test.log
133+
end=$(date +%s)
134+
echo -e "$filename duration: $((end - start))s"
135+
echo "=== Finished test: $filename ==="
136+
done
137+
- name: test_xpu
138+
shell: timeout 3600 bash -xe {0}
139+
if: ${{ inputs.ut_name == 'test_xpu' }}
140+
run: |
141+
export PYTORCH_TEST_WITH_SLOW=1
142+
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
143+
mkdir -p ut_log/test_xpu
144+
cd pytorch
145+
if [ -f "test/test_xpu.py" ]; then
146+
pytest -sv test/test_xpu.py --junit-xml=${{ github.workspace }}/ut_log/test_xpu.xml \
147+
2> ${{ github.workspace }}/ut_log/test_xpu/test_xpu_error.log | \
148+
tee ${{ github.workspace }}/ut_log/test_xpu/test_xpu.log
149+
fi
119150
- name: torch_xpu
120151
shell: timeout 3600 bash -xe {0}
121152
if: ${{ inputs.ut_name == 'torch_xpu' }}
@@ -124,12 +155,12 @@ runs:
124155
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
125156
mkdir -p ut_log/torch_xpu
126157
cd pytorch
127-
test_cmd="python test/run_test.py --include "
128-
for test in $(ls test/inductor | grep test); do test_cmd="${test_cmd} inductor/$test"; done
129-
for test in $(ls test/xpu | grep test); do test_cmd="${test_cmd} xpu/$test"; done
130-
if [ -f "test/test_xpu.py" ]; then test_cmd="${test_cmd} test_xpu.py"; fi
131-
eval $test_cmd 2> ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_test_error.log | \
132-
tee ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_test.log
158+
for file in "test/xpu"/*.py; do
159+
filename=$(basename "$file")
160+
pytest -sv test/xpu/$filename --junit-xml=${{ github.workspace }}/ut_log/torch_xpu_$filename.xml \
161+
2> ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_$filename_error.log | \
162+
tee ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_$filename.log
163+
done
133164
- name: xpu_profiling
134165
shell: timeout 3600 bash -xe {0}
135166
if: ${{ inputs.ut_name == 'xpu_profiling' }}

.github/scripts/check-ut.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ def get_message(case):
107107

108108
return " ; ".join(error_messages) if error_messages else f"{case.result[0].message.splitlines()[0]}"
109109

110+
def get_case_identifier(case):
111+
"""Generate a unique identifier for a test case to detect duplicates"""
112+
category = get_category_from_case(case)
113+
classname = get_classname(case)
114+
name = get_name(case)
115+
return f"{category}:{classname}:{name}"
116+
110117
def print_md_row(row, print_header=False, failure_list=None):
111118
if print_header:
112119
header = " | ".join([f"{key}" for key in row.keys()])
@@ -126,7 +133,15 @@ def print_failures(failure_list=None):
126133

127134
print("### Test Failures")
128135
print_header = True
136+
seen_cases = set()
137+
unique_failures = []
129138
for case in failures:
139+
case_id = get_case_identifier(case)
140+
if case_id not in seen_cases:
141+
seen_cases.add(case_id)
142+
unique_failures.append(case)
143+
144+
for case in unique_failures:
130145
print_md_row({
131146
'Category': get_category_from_case(case),
132147
'Class name': get_classname(case),
@@ -141,9 +156,15 @@ def generate_failures_log():
141156
if not failures:
142157
return
143158

159+
seen_cases = set()
160+
failures_by_category.clear()
161+
144162
for case in failures:
145-
category = get_category_from_case(case)
146-
failures_by_category[category].append(case)
163+
case_id = get_case_identifier(case)
164+
if case_id not in seen_cases:
165+
seen_cases.add(case_id)
166+
category = get_category_from_case(case)
167+
failures_by_category[category].append(case)
147168

148169
for category, category_failures in failures_by_category.items():
149170
if not category_failures:
@@ -247,6 +268,10 @@ def determine_category(ut):
247268
return 'op_transformers'
248269
elif ut == 'test_xpu':
249270
return 'test_xpu'
271+
elif ut == 'torch_xpu':
272+
return 'torch_xpu'
273+
elif 'inductor_' in ut:
274+
return 'xpu_inductor'
250275
elif 'op_ut' in ut:
251276
return 'op_ut'
252277
else:
@@ -343,6 +368,8 @@ def print_summary():
343368
}
344369

345370
for summary in summaries:
371+
if summary['Test cases'] == 0:
372+
continue
346373
print_md_row({
347374
'Category': summary['Category'],
348375
'UT': summary['UT'],

.github/scripts/ut_result_check.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ check_test_cases() {
8282
["op_regression_dev1"]=1
8383
["op_transformers"]=237
8484
["op_ut"]=120408
85+
["xpu_inductor"]=10330
8586
["test_xpu"]=69
87+
["torch_xpu"]=359
8688
)
8789

8890
if [[ ! -f "$log_file" ]]; then
@@ -124,7 +126,7 @@ check_test_cases() {
124126
}
125127

126128

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
129+
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' || "${ut_suite}" == 'xpu_inductor' || "${ut_suite}" == 'torch_xpu' ]]; then
128130
echo -e "========================================================================="
129131
echo -e "Show Failed cases in ${ut_suite}"
130132
echo -e "========================================================================="

.github/workflows/nightly_ondemand.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
echo "No such scheduler: ${{ github.event.schedule }}"
9696
exit 1
9797
fi
98-
ut='["basic","op_ut","skipped_ut","xpu_profiling","xpu_distributed"]'
98+
ut='["basic","op_ut","skipped_ut","xpu_profiling","xpu_inductor","torch_xpu","test_xpu","xpu_distributed"]'
9999
suite='["huggingface","timm_models","torchbench","pt2e"]'
100100
triton=''
101101
python='3.10'

0 commit comments

Comments
 (0)