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
6 changes: 4 additions & 2 deletions .github/scripts/check-ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def determine_category(ut):
return 'op_transformers'
elif ut == 'test_xpu':
return 'test_xpu'
elif 'op_ut' in ut:
elif 'op_ut_windows' in ut:
return 'op_ut_windows'
elif 'op_ut' in ut and 'windows' not in ut:
return 'op_ut'
else:
return 'unknown'
Expand All @@ -262,7 +264,7 @@ def process_log_file(log_file):
def process_xml_file(xml_file):
try:
xml = JUnitXml.fromfile(xml_file)
parts = os.path.basename(xml_file).rsplit('.', 2)
parts = os.path.basename(xml_file).rsplit('.', 1)
ut = parts[0]
parts_category = os.path.basename(xml_file).split('.')[0]
category = determine_category(parts_category)
Expand Down
7 changes: 4 additions & 3 deletions .github/scripts/ut_result_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Test Suite Runner for Intel Torch-XPU-Ops
# Usage: ./script.sh <test_suite>

# Available suites: op_regression, op_extended, op_ut, test_xpu, xpu_distributed, skipped_ut
# Available suites: op_regression, op_extended, op_ut, test_xpu, op_ut_windows, xpu_distributed, skipped_ut
readonly ut_suite="${1:-op_regression}" # Default to op_regression if no suite specified
readonly inputs_pytorch="${2:-nightly_wheel}"
readonly REPO="intel/torch-xpu-ops"
Expand All @@ -16,6 +16,7 @@ declare -A EXPECTED_CASES=(
["op_transformers"]=262
["op_ut"]=178548
["test_xpu"]=69
["op_ut_windows"]=91741
)

# Tests that are known to randomly pass and should be ignored when detecting new passes
Expand Down Expand Up @@ -343,7 +344,7 @@ mark_passed_issue() {

# 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|op_ut_windows)
run_main_tests "$ut_suite"
;;
xpu_distributed)
Expand All @@ -358,6 +359,6 @@ case "$ut_suite" in
*)
echo "❌ Unknown test suite: ${ut_suite}" >&2
printf "💡 Available: op_regression, op_regression_dev1, op_extended, op_transformers, " >&2
printf "op_ut, test_xpu, xpu_distributed, skipped_ut, xpu_profiling\n" >&2
printf "op_ut, test_xpu, xpu_distributed, skipped_ut, xpu_profiling, op_ut_windows\n" >&2
;;
esac
114 changes: 77 additions & 37 deletions .github/workflows/_windows_ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
ut_test:
runs-on: ${{ inputs.runner }}
if: ${{ inputs.src_changed == 'true' || inputs.has_label == 'true' }}
timeout-minutes: 900
timeout-minutes: 1000
steps:
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
Expand All @@ -88,6 +88,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
Expand Down Expand Up @@ -261,45 +262,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_windows') || 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 (test*.xml 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
Expand All @@ -312,6 +289,64 @@ 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:
pattern: 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
find . -type f -name "*.xml" -exec mv {} ${{ github.workspace }}/ut_log/ \; || true
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-${{ github.run_id }}-${{ github.run_attempt }}
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:
Expand All @@ -329,6 +364,11 @@ jobs:
cd ${{ github.workspace }}/ut_log
latest_dir=$(find . -type d -name "Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-Windows-*" |sort -V |tail -n 1)
cd "${latest_dir}"
find "${{ github.workspace }}/ut_log" -type f \
\( -name "failures_*.log" -o \
-name "passed_*.log" -o \
-name "category_*.log" \) \
-exec mv {} ./ \; || true

# get skipped known issues
count=$(gh api --paginate "repos/${{ github.repository }}/issues?labels=skipped_windows" --jq 'length')
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 @@ -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_windows'
python: ${{ needs.Conditions-Filter.outputs.python }}
src_changed: false
has_label: true
Expand Down
140 changes: 140 additions & 0 deletions test/xpu/run_test_with_windows_nighltly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
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

res = 0
IS_WINDOWS = sys.platform == "win32"


def launch_test(test_case, skip_list=None, exe_list=None):
os.environ["PYTORCH_TEST_WITH_SLOW"] = "1"
module_name = test_case.replace(".py", "").replace("/", ".").replace("\\", ".")
if skip_list is not None:
if skip_list:
skip_options = ' -k "not ' + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += '"'
test_command = (
f"pytest --junit-xml=./op_ut_windows_with_skip.{module_name}.xml "
+ test_case
)
test_command += skip_options
else:
test_command = (
f"pytest --junit-xml=./op_ut_windows_with_all.{module_name}.xml "
+ test_case
)
elif exe_list is not None:
if exe_list:
exe_options = ' -k "' + exe_list[0]
for exe_case in exe_list[1:]:
exe_option = " or " + exe_case
exe_options += exe_option
exe_options += '"'
test_command = (
f"pytest --junit-xml=./op_ut_windows_with_exe.{module_name}.xml "
+ test_case
)
test_command += exe_options
else:
test_command = (
f"pytest --junit-xml=./op_ut_windows_with_all.{module_name}.xml "
+ test_case
)
else:
test_command = (
f"pytest --junit-xml=./op_ut_windows_with_all.{module_name}.xml "
+ test_case
)
return os.system(test_command)


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.get(key)
if skip_list is None:
skip_list = []

if IS_WINDOWS and key in skip_dict_win:
win_skip_list = skip_dict_win[key]
if isinstance(win_skip_list, tuple):
skip_list.extend(list(win_skip_list))
elif win_skip_list is not None:
skip_list.extend(win_skip_list)
if IS_WINDOWS and key in skip_dict_win_lnl:
win_lnl_skip_list = skip_dict_win_lnl[key]
if isinstance(win_lnl_skip_list, tuple):
skip_list.extend(list(win_lnl_skip_list))
elif win_lnl_skip_list is not None:
skip_list.extend(win_lnl_skip_list)

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)
Loading