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

merge UT test script for all devices #916

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
15 changes: 13 additions & 2 deletions test/xpu/extended/run_test_with_skip.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import os
import sys
from skip_list_common import skip_dict
from skip_list_win import skip_dict as skip_dict_win
from os.path import abspath, join, dirname
sys.path.insert(0, join(abspath(dirname(__file__)), ".."))
from extended.skip_list_common import skip_dict
from extended.skip_list_win import skip_dict as skip_dict_win
from xpu_test_utils import get_device_name

IS_WINDOWS = sys.platform == "win32"
dev_name = get_device_name()
if dev_name == "ARC":
from extended.skip_list_arc import skip_dict as skip_dict_specifical
from extended.skip_list_win_arc import skip_dict as skip_dict_win_arc

skip_list = skip_dict["test_ops_xpu.py"]
if dev_name == "ARC":
skip_list += skip_dict_specifical["test_ops_xpu.py"]
if IS_WINDOWS:
skip_list += skip_dict_win_arc["test_ops_xpu.py"]
if IS_WINDOWS:
skip_list += skip_dict_win["test_ops_xpu.py"]

Expand Down
24 changes: 0 additions & 24 deletions test/xpu/extended/run_test_with_skip_arc.py

This file was deleted.

24 changes: 22 additions & 2 deletions test/xpu/run_test_with_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,42 @@
import sys

from skip_list_common import skip_dict
from xpu_test_utils import launch_test
from xpu_test_utils import get_device_name, launch_test

dev_name = get_device_name()
if dev_name == "ARC":
from skip_list_arc import skip_dict as skip_dict_specifical
from skip_list_win import skip_dict as skip_dict_win
from skip_list_win_arc import skip_dict as skip_dict_win_arc
elif dev_name == "MTL":
from skip_list_mtl import skip_dict as skip_dict_specifical
from skip_list_win import skip_dict as skip_dict_win

res = 0
fail_test = []
IS_WINDOWS = sys.platform == "win32"

for key in skip_dict:
skip_list = skip_dict[key]
if dev_name == "ARC":
if key in skip_dict_specifical:
skip_list += skip_dict_specifical[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_arc:
skip_list += skip_dict_win_arc[key]
elif dev_name == "MTL":
if key in skip_dict_specifical:
skip_list += skip_dict_specifical[key]
if IS_WINDOWS and key in skip_dict_win:
skip_list += skip_dict_win[key]
fail = launch_test(key, skip_list)
res += fail
if fail:
fail_test.append(key)
if fail_test:
print(",".join(fail_test) + " have failures")


if os.name == "nt":
sys.exit(res)
else:
Expand Down
27 changes: 0 additions & 27 deletions test/xpu/run_test_with_skip_arc.py

This file was deleted.

23 changes: 0 additions & 23 deletions test/xpu/run_test_with_skip_mtl.py

This file was deleted.

15 changes: 15 additions & 0 deletions test/xpu/xpu_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@
}


ARC_DEVICE_MAPPING = [
"Intel(R) Arc(TM) Pro A60 Graphics",
"Intel(R) Arc(TM) A770 Graphics",
"Intel(R) Arc(TM) A750 Graphics",
]
MTL_DEVICE_MAPPING = [
"Intel(R) Arc(TM) Graphics",
]


def get_device_name():
dev = torch.xpu.get_device_name()
return "ARC" if dev in ARC_DEVICE_MAPPING else "MTL" if dev in MTL_DEVICE_MAPPING else "PVC"


def get_wrapped_fn(fn):
if hasattr(fn, "__wrapped__"):
wrapped = fn.__wrapped__
Expand Down
Loading