diff --git a/.github/workflows/_windows_ut.yml b/.github/workflows/_windows_ut.yml index 217a3fe70..1d44fdd14 100644 --- a/.github/workflows/_windows_ut.yml +++ b/.github/workflows/_windows_ut.yml @@ -74,7 +74,7 @@ jobs: ut_test: runs-on: ${{ inputs.runner }} if: ${{ inputs.src_changed == 'true' || inputs.has_label == 'true' }} - timeout-minutes: 900 + timeout-minutes: 2000 steps: - name: Checkout torch-xpu-ops uses: actions/checkout@v4 @@ -90,6 +90,7 @@ jobs: 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 @@ -263,45 +264,21 @@ jobs: if not exist "%GITHUB_WORKSPACE%\ut_log" mkdir "%GITHUB_WORKSPACE%\ut_log" copy test_xpu.xml %GITHUB_WORKSPACE%\ut_log /Y - - name: UT Test Results Summary + - name: Run OP UT + if: contains(inputs.ut, 'op_ut') || 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 - pip install junitparser - echo "GITHUB_WORKSPACE: %GITHUB_WORKSPACE%" - for %%i in ("%GITHUB_WORKSPACE%\ut_log\*.xml") do ( - python .\.github\scripts\check-ut.py -n windows -i "%%i" >> "%GITHUB_STEP_SUMMARY%" - ) - @echo off - - REM Check the failure logs - if exist "%GITHUB_WORKSPACE%\failures*.log" ( - echo Exist Failure logs - echo Found Failure logs as below: - for %%f in ("%GITHUB_WORKSPACE%\failures*.log") do ( - echo - %%f - copy "%%f" "%GITHUB_WORKSPACE%\ut_log\" - ) - echo Failure logs Copied - ) else ( - echo No Failure logs - ) - - REM Copied the passed logs - if exist "passed*.log" ( - copy "passed*.log" "%GITHUB_WORKSPACE%\ut_log\" - echo Passed logs Copied - ) else ( - echo No Passed logs - ) - - REM Copied the Summary logs - if exist "category*.log" ( - copy "category*.log" "%GITHUB_WORKSPACE%\ut_log\" - echo Category logs Copied - ) else ( - echo No Category logs - ) + 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 (op_ut_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 @@ -314,6 +291,63 @@ jobs: 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: + name: 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 + 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 + 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: diff --git a/.github/workflows/nightly_ondemand.yml b/.github/workflows/nightly_ondemand.yml index 932ad56a4..ff4d75c0c 100644 --- a/.github/workflows/nightly_ondemand.yml +++ b/.github/workflows/nightly_ondemand.yml @@ -210,7 +210,7 @@ jobs: secrets: inherit uses: ./.github/workflows/_windows_ut.yml with: - ut: 'op_extended,test_xpu' + ut: 'op_extended,test_xpu,op_ut' python: ${{ needs.Conditions-Filter.outputs.python }} src_changed: false has_label: true diff --git a/test/xpu/run_test_with_windows_nighltly.py b/test/xpu/run_test_with_windows_nighltly.py new file mode 100644 index 000000000..f789843c4 --- /dev/null +++ b/test/xpu/run_test_with_windows_nighltly.py @@ -0,0 +1,84 @@ +import os +import sys + +from skip_list_common import skip_dict +from skip_list_win import skip_dict as skip_dict_win +from skip_list_win_lnl import skip_dict as skip_dict_win_lnl +from xpu_test_utils import launch_test + +res = 0 +IS_WINDOWS = sys.platform == "win32" + +skip_files_list = [ + "test_autocast_xpu.py", + "test_autograd_fallback_xpu.py", + "test_autograd_xpu.py", + # "test_binary_ufuncs_xpu.py", + "test_comparison_utils_xpu.py", + "test_complex_xpu.py", + "test_content_store_xpu.py", + "test_dataloader_xpu.py", + "test_decomp.py", + "test_decomp_xpu.py", + "test_distributions_xpu.py", + "test_dynamic_shapes_xpu.py", + "test_foreach_xpu.py", + # "test_indexing_xpu.py", + "test_linalg_xpu.py", + "test_maskedtensor_xpu.py", + # "test_masked_xpu.py", + "test_matmul_cuda_xpu.py", + "test_meta_xpu.py", + # "test_modules_xpu.py", + "test_namedtensor_xpu.py", + "test_native_functions_xpu.py", + "test_native_mha_xpu.py", + "test_nestedtensor_xpu.py", + "test_nn_xpu.py", + "test_ops_fwd_gradients_xpu.py", + # "test_ops_gradients_xpu.py", + # "test_ops_xpu.py", + "test_optim_xpu.py", + # "test_reductions_xpu.py", + # "test_scatter_gather_ops_xpu.py", + "test_segment_reductions_xpu.py", + "test_shape_ops_xpu.py", + "test_sort_and_select_xpu.py", + "test_sparse_csr_xpu.py", + "test_sparse_xpu.py", + "test_spectral_ops_xpu.py", + "test_tensor_creation_ops_xpu.py", + # "test_torch_xpu.py", + # "test_transformers_xpu.py", + "test_type_promotion_xpu.py", + # "test_unary_ufuncs_xpu.py", + # "test_view_ops_xpu.py", + "functorch/test_ops_xpu.py", +] + +print("Current working directory:", os.getcwd()) +print("Files in directory:") +for file in os.listdir("."): + if file.endswith(".py"): + print(f" {file}") + +for key in skip_dict: + # Check if key is in skip list + if key in skip_files_list: + print(f"\n=== Skipping test file: {key} ===") + continue + + skip_list = skip_dict[key] + if IS_WINDOWS and key in skip_dict_win: + skip_list += skip_dict_win[key] + if IS_WINDOWS and key in skip_dict_win_lnl: + skip_list += skip_dict_win_lnl[key] + + print(f"\n=== Processing test case: {key} ===") + res += launch_test(key, skip_list=skip_list) + +if os.name == "nt": + sys.exit(res) +else: + exit_code = os.WEXITSTATUS(res) + sys.exit(exit_code)