Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions .github/actions/linux-uttest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,37 @@ runs:
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
cp *.xml ${{ github.workspace }}/ut_log
- name: xpu_inductor
shell: timeout 36000 bash -xe {0}
if: ${{ inputs.ut_name == 'xpu_inductor' }}
run: |
export PYTORCH_TEST_WITH_SLOW=1
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
mkdir -p ut_log/xpu_inductor
cd pytorch
for file in "test/inductor"/test*.py; do
filename=$(basename "$file")
echo "=== Starting test: $filename ==="
start=$(date +%s)
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 | \
tee ${{ github.workspace }}/ut_log/xpu_inductor/xpu_inductor_${filename}_test.log
end=$(date +%s)
echo -e "$filename duration: $((end - start))s"
echo "=== Finished test: $filename ==="
done
- name: test_xpu
shell: timeout 3600 bash -xe {0}
if: ${{ inputs.ut_name == 'test_xpu' }}
run: |
export PYTORCH_TEST_WITH_SLOW=1
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
mkdir -p ut_log/test_xpu
cd pytorch
if [ -f "test/test_xpu.py" ]; then
pytest -sv test/test_xpu.py --junit-xml=${{ github.workspace }}/ut_log/test_xpu.xml \
2> ${{ github.workspace }}/ut_log/test_xpu/test_xpu_error.log | \
tee ${{ github.workspace }}/ut_log/test_xpu/test_xpu.log
fi
- name: torch_xpu
shell: timeout 3600 bash -xe {0}
if: ${{ inputs.ut_name == 'torch_xpu' }}
Expand All @@ -124,12 +155,12 @@ runs:
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
mkdir -p ut_log/torch_xpu
cd pytorch
test_cmd="python test/run_test.py --include "
for test in $(ls test/inductor | grep test); do test_cmd="${test_cmd} inductor/$test"; done
for test in $(ls test/xpu | grep test); do test_cmd="${test_cmd} xpu/$test"; done
if [ -f "test/test_xpu.py" ]; then test_cmd="${test_cmd} test_xpu.py"; fi
eval $test_cmd 2> ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_test_error.log | \
tee ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_test.log
for file in "test/xpu"/test*.py; do
filename=$(basename "$file")
pytest -sv test/xpu/$filename --junit-xml=${{ github.workspace }}/ut_log/torch_xpu_$filename.xml \
2> ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_${filename}_error.log | \
tee ${{ github.workspace }}/ut_log/torch_xpu/torch_xpu_${filename}.log
done
- name: xpu_profiling
shell: timeout 3600 bash -xe {0}
if: ${{ inputs.ut_name == 'xpu_profiling' }}
Expand Down
31 changes: 29 additions & 2 deletions .github/scripts/check-ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ def get_message(case):

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

def get_case_identifier(case):
"""Generate a unique identifier for a test case to detect duplicates"""
category = get_category_from_case(case)
classname = get_classname(case)
name = get_name(case)
return f"{category}:{classname}:{name}"

def print_md_row(row, print_header=False, failure_list=None):
if print_header:
header = " | ".join([f"{key}" for key in row.keys()])
Expand All @@ -126,7 +133,15 @@ def print_failures(failure_list=None):

print("### Test Failures")
print_header = True
seen_cases = set()
unique_failures = []
for case in failures:
case_id = get_case_identifier(case)
if case_id not in seen_cases:
seen_cases.add(case_id)
unique_failures.append(case)

for case in unique_failures:
print_md_row({
'Category': get_category_from_case(case),
'Class name': get_classname(case),
Expand All @@ -141,9 +156,15 @@ def generate_failures_log():
if not failures:
return

seen_cases = set()
failures_by_category.clear()

for case in failures:
category = get_category_from_case(case)
failures_by_category[category].append(case)
case_id = get_case_identifier(case)
if case_id not in seen_cases:
seen_cases.add(case_id)
category = get_category_from_case(case)
failures_by_category[category].append(case)

for category, category_failures in failures_by_category.items():
if not category_failures:
Expand Down Expand Up @@ -247,6 +268,10 @@ def determine_category(ut):
return 'op_transformers'
elif ut == 'test_xpu':
return 'test_xpu'
elif 'torch_xpu_' in ut:
return 'torch_xpu'
elif 'inductor_' in ut:
return 'xpu_inductor'
elif 'op_ut' in ut:
return 'op_ut'
else:
Expand Down Expand Up @@ -343,6 +368,8 @@ def print_summary():
}

for summary in summaries:
if summary['Test cases'] == 0:
continue
print_md_row({
'Category': summary['Category'],
'UT': summary['UT'],
Expand Down
6 changes: 4 additions & 2 deletions .github/scripts/ut_result_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ check_test_cases() {
["op_regression_dev1"]=1
["op_transformers"]=237
["op_ut"]=120408
["test_xpu"]=69
["xpu_inductor"]=20880
["test_xpu"]=73
["torch_xpu"]=396
)

if [[ ! -f "$log_file" ]]; then
Expand Down Expand Up @@ -124,7 +126,7 @@ check_test_cases() {
}


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
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
echo -e "========================================================================="
echo -e "Show Failed cases in ${ut_suite}"
echo -e "========================================================================="
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
echo "No such scheduler: ${{ github.event.schedule }}"
exit 1
fi
ut='["basic","op_ut","skipped_ut","xpu_profiling","xpu_distributed"]'
ut='["basic","op_ut","skipped_ut","xpu_profiling","xpu_inductor","torch_xpu","test_xpu","xpu_distributed"]'
suite='["huggingface","timm_models","torchbench","pt2e"]'
triton=''
python='3.10'
Expand Down