Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add xpu test for windows #1375

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
10 changes: 10 additions & 0 deletions .github/workflows/_windows_ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,13 @@ jobs:
set PYTORCH_TEST_WITH_SLOW=1
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
python run_test_with_skip_mtl.py

- name: Run Test XPU UT
if: contains(inputs.ut, 'torch_xpu') || github.event_name == 'schedule'
shell: cmd
run: |
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
call conda activate windows_ci
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
python run_test_win_with_skip_mtl.py
2 changes: 1 addition & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ jobs:
needs: preci-lint-check
uses: ./.github/workflows/_windows_ut.yml
with:
ut: op_extended
ut: op_extended,torch_xpu
runner: Windows_CI
17 changes: 17 additions & 0 deletions test/xpu/run_test_win_with_skip_mtl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys

import pytest
from skip_list_win_mtl import skip_dict

IS_WINDOWS = sys.platform == "win32"

skip_list = skip_dict["test_xpu_xpu.py"]

skip_options = "not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option

test_command = ["-k", skip_options, "test_xpu_xpu.py", "-v"]
res = pytest.main(test_command)
sys.exit(res)
8 changes: 8 additions & 0 deletions test/xpu/skip_list_win_mtl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
skip_dict = {
# failed on MTL windows, skip first for Preci
"test_xpu_xpu.py": (
"test_lazy_init_xpu",
"test_mem_get_info_xpu",
"test_wrong_xpu_fork_xpu",
),
}
18 changes: 18 additions & 0 deletions test/xpu/test_xpu_xpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Owner(s): ["module: intel"]

from torch.testing._internal.common_device_type import instantiate_device_type_tests
from torch.testing._internal.common_utils import run_tests, TestCase

try:
from xpu_test_utils import XPUPatchForImport
except Exception as e:
from .xpu_test_utils import XPUPatchForImport

with XPUPatchForImport(False):
from test_xpu import TestXpu, TestXpuAutocast, TestXpuTrace # noqa: F401

instantiate_device_type_tests(TestXpu, globals(), only_for="xpu", allow_xpu=True)

if __name__ == "__main__":
TestCase._default_dtype_check_enabled = True
run_tests()
Loading