diff --git a/.github/actions/linux-uttest/action.yml b/.github/actions/linux-uttest/action.yml index 9f3888694..272e14ab2 100644 --- a/.github/actions/linux-uttest/action.yml +++ b/.github/actions/linux-uttest/action.yml @@ -117,6 +117,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' }} @@ -125,12 +156,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' }} diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index 50b112a18..95c7ee4c0 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -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()]) @@ -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), @@ -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: @@ -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: @@ -345,6 +370,8 @@ def print_summary(): } for summary in summaries: + if summary['Test cases'] == 0: + continue print_md_row({ 'Category': summary['Category'], 'UT': summary['UT'], diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index fe6b1de66..774264b69 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -11,7 +11,9 @@ declare -A EXPECTED_CASES=( ["op_regression_dev1"]=1 ["op_transformers"]=237 ["op_ut"]=120408 - ["test_xpu"]=69 + ["xpu_inductor"]=20880 + ["test_xpu"]=73 + ["torch_xpu"]=396 ) # Tests that are known to randomly pass and should be ignored when detecting new passes # These are typically flaky tests that don't indicate real improvements @@ -253,7 +255,7 @@ run_distributed_tests() { } # Main dispatcher - route to appropriate test runner based on suite type case "$ut_suite" in - op_regression|op_regression_dev1|op_extended|op_transformers|op_ut|test_xpu) + op_regression|op_regression_dev1|op_extended|op_transformers|op_ut|test_xpu|xpu_inductor|torch_xpu) run_main_tests "$ut_suite" ;; xpu_distributed) diff --git a/.github/workflows/nightly_ondemand.yml b/.github/workflows/nightly_ondemand.yml index 932ad56a4..5cbea7eda 100644 --- a/.github/workflows/nightly_ondemand.yml +++ b/.github/workflows/nightly_ondemand.yml @@ -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'