Skip to content

Commit 88743cd

Browse files
authored
[CI] Port ut test_decomp.py from pytorch (#2262)
UT | Test cases | Passed | Skipped | Failures | Errors -- | -- | -- | -- | -- | -- test_decomp | 8886 | 8155 | 729 | 0 | 2 disable_distributed disable_e2e
1 parent 2b67d57 commit 88743cd

File tree

6 files changed

+1594
-8
lines changed

6 files changed

+1594
-8
lines changed

test/xpu/run_test_with_only.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,59 @@ def launch_test(test_case, skip_list=None, exe_list=None):
4242
"test_comprehensive_nn_functional_nll_loss_xpu_float64",
4343
"bincount",
4444
)
45-
res += launch_test("test_decomp_xpu.py", exe_list=execute_list)
45+
skip_list = (
46+
"test_comprehensive_baddbmm_xpu_float64",
47+
"test_comprehensive_logspace_tensor_overload_xpu_int16",
48+
"test_comprehensive_logspace_tensor_overload_xpu_int32",
49+
"test_comprehensive_logspace_tensor_overload_xpu_int64",
50+
"test_comprehensive_logspace_xpu_int16",
51+
"test_comprehensive_logspace_xpu_int32",
52+
"test_comprehensive_logspace_xpu_int64",
53+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_bfloat16",
54+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex128",
55+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex32",
56+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex64",
57+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float16",
58+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float32",
59+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float64",
60+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_bfloat16",
61+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex128",
62+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex32",
63+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex64",
64+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float16",
65+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float32",
66+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float64",
67+
"test_comprehensive_nn_functional_instance_norm_xpu_float64",
68+
"test_comprehensive_nn_functional_nll_loss_xpu_float16",
69+
"test_comprehensive_nn_functional_pad_reflect_xpu_bfloat16",
70+
"test_comprehensive_torch_ops_aten__flash_attention_forward_xpu_float16",
71+
"test_comprehensive_vdot_xpu_complex128",
72+
"test_comprehensive_vdot_xpu_complex64",
73+
"test_quick_addmm_xpu_float64",
74+
"test_quick_baddbmm_xpu_float64",
75+
"test_quick_core_backward_baddbmm_xpu_float64",
76+
"test_quick_core_backward_mv_xpu_float64",
77+
"test_quick_logspace_tensor_overload_xpu_int16",
78+
"test_quick_logspace_tensor_overload_xpu_int32",
79+
"test_quick_logspace_tensor_overload_xpu_int64",
80+
"test_quick_logspace_xpu_int16",
81+
"test_quick_logspace_xpu_int32",
82+
"test_quick_logspace_xpu_int64",
83+
"test_quick_vdot_xpu_complex128",
84+
"test_quick_vdot_xpu_complex64",
85+
"test_exponential_non_inf_xpu",
86+
"test_aten_core_operators",
87+
"test_has_decomposition",
88+
"test_comprehensive_diff_xpu_complex128",
89+
"test_comprehensive_ormqr_xpu_complex128",
90+
"test_quick_var_mean_xpu_float64",
91+
"test_comprehensive_diff_xpu_complex64",
92+
"test_comprehensive_ormqr_xpu_complex64",
93+
"test_quick_mean_xpu_complex128",
94+
"test_comprehensive_grid_sampler_2d_xpu_bfloat16",
95+
)
96+
# res += launch_test("test_decomp_xpu.py", exe_list=execute_list)
97+
res += launch_test("test_decomp.py", skip_list=skip_list)
4698

4799
if os.name == "nt":
48100
sys.exit(res)

test/xpu/run_test_with_skip.py

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,112 @@
1313
default="selected",
1414
help="Test cases scope",
1515
)
16+
# Add skip-cases parameter to import window skip dictionary
17+
parser.add_argument(
18+
"--skip-cases",
19+
action="store_true",
20+
default=False,
21+
help="Use window skip dictionary for test cases",
22+
)
1623
args = parser.parse_args()
1724

1825

26+
def should_skip_entire_file(skip_list):
27+
"""Check if the skip list contains any entire file skip pattern (*.py::)"""
28+
if not skip_list:
29+
return False
30+
return any(item.endswith(".py::") for item in skip_list)
31+
32+
33+
# Import window skip dictionary if skip-cases is True
34+
if args.skip_cases:
35+
try:
36+
# Import the window skip dictionary module
37+
from window_skip_dict import skip_dict as window_skip_dict
38+
39+
# Merge the window skip dictionary with the default one using intelligent strategy
40+
merged_skip_dict = {}
41+
42+
# First, copy all keys from default skip_dict
43+
for key in skip_dict:
44+
merged_skip_dict[key] = skip_dict[key].copy() if skip_dict[key] else []
45+
46+
# Then merge with window_skip_dict using intelligent strategy
47+
for key in window_skip_dict:
48+
window_skip_list = window_skip_dict[key]
49+
50+
if key in merged_skip_dict:
51+
default_skip_list = merged_skip_dict[key]
52+
53+
# Intelligent merge strategy:
54+
if should_skip_entire_file(window_skip_list):
55+
# If Windows wants to skip entire file, use ONLY Windows skip list
56+
merged_skip_dict[key] = window_skip_list
57+
print(
58+
f"Windows entire file skip detected for {key}, using: {window_skip_list}"
59+
)
60+
else:
61+
# Otherwise, merge both lists and remove duplicates
62+
combined_list = default_skip_list + [
63+
item
64+
for item in window_skip_list
65+
if item not in default_skip_list
66+
]
67+
merged_skip_dict[key] = combined_list
68+
print(f"Windows merging skip lists for {key}: {combined_list}")
69+
else:
70+
# Add new key-value pair from window_skip_dict
71+
merged_skip_dict[key] = window_skip_list
72+
print(f"Windows adding new skip key: {key} with {window_skip_list}")
73+
74+
print("Using intelligently merged skip dictionary")
75+
76+
except ImportError:
77+
print(
78+
"Warning: window_skip_dict module not found, using default skip dictionary"
79+
)
80+
merged_skip_dict = skip_dict
81+
except Exception as e:
82+
print(f"Error importing window skip dictionary: {e}")
83+
merged_skip_dict = skip_dict
84+
else:
85+
merged_skip_dict = skip_dict
86+
print("Using default skip dictionary")
87+
1988
res = 0
2089
fail_test = []
2190

22-
for key in skip_dict:
23-
skip_list = skip_dict[key]
91+
for key in merged_skip_dict:
92+
skip_list = merged_skip_dict[key]
2493
exe_list = None
94+
2595
if args.test_cases == "skipped":
96+
# When running only skipped cases, use skip_list as exe_list
2697
exe_list = skip_list
2798
skip_list = None
28-
if exe_list is None:
99+
if not exe_list: # Check if exe_list is empty
100+
print(f"Skipping {key} as no tests to execute")
29101
continue
30102
elif args.test_cases == "all":
103+
# When running all cases, don't skip any
31104
skip_list = None
105+
# For "selected" case, use the skip_list as is
106+
107+
print(f"Running test case: {key}")
108+
if skip_list:
109+
print(f"Skip list: {skip_list}")
110+
if exe_list:
111+
print(f"Execute list: {exe_list}")
112+
32113
fail = launch_test(key, skip_list=skip_list, exe_list=exe_list)
33114
res += fail
34115
if fail:
35116
fail_test.append(key)
117+
36118
if fail_test:
37119
print(",".join(fail_test) + " have failures")
38-
120+
else:
121+
print("All tests passed!")
39122

40123
if os.name == "nt":
41124
sys.exit(res)

test/xpu/skip_list_common.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,70 @@
737737
# CUDA specific case
738738
"test_cufft_plan_cache_xpu_float64",
739739
),
740+
"test_decomp.py": (
741+
# AssertionError: Tensor-likes are not close! ; Exception: Tensor-likes are not close!
742+
"test_comprehensive_baddbmm_xpu_float64",
743+
"test_comprehensive_logspace_tensor_overload_xpu_int16",
744+
"test_comprehensive_logspace_tensor_overload_xpu_int32",
745+
"test_comprehensive_logspace_tensor_overload_xpu_int64",
746+
"test_comprehensive_logspace_xpu_int16",
747+
"test_comprehensive_logspace_xpu_int32",
748+
"test_comprehensive_logspace_xpu_int64",
749+
# RuntimeError: could not create a primitive descriptor for the deconvolution forward propagation primitive.
750+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_bfloat16",
751+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex128",
752+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex32",
753+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_complex64",
754+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float16",
755+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float32",
756+
"test_comprehensive_nn_functional_conv_transpose2d_xpu_float64",
757+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_bfloat16",
758+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex128",
759+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex32",
760+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_complex64",
761+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float16",
762+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float32",
763+
"test_comprehensive_nn_functional_conv_transpose3d_xpu_float64",
764+
# AssertionError: Tensor-likes are not close! ; Exception: Tensor-likes are not close!
765+
"test_comprehensive_nn_functional_instance_norm_xpu_float64",
766+
# RuntimeError: Difference from float64 is larger with decomposition nll_loss_forward.default than original on output 0.
767+
"test_comprehensive_nn_functional_nll_loss_xpu_float16",
768+
"test_comprehensive_nn_functional_pad_reflect_xpu_bfloat16",
769+
# NotImplementedError: Could not run 'aten::_flash_attention_forward' with arguments from the 'CPU' backend.
770+
"test_comprehensive_torch_ops_aten__flash_attention_forward_xpu_float16",
771+
# AssertionError: Scalars are not close! ; Exception: Scalars are not close!
772+
"test_comprehensive_vdot_xpu_complex128",
773+
"test_comprehensive_vdot_xpu_complex64",
774+
# AssertionError: Tensor-likes are not close! ; Exception: Tensor-likes are not close!
775+
"test_quick_addmm_xpu_float64",
776+
"test_quick_baddbmm_xpu_float64",
777+
"test_quick_core_backward_baddbmm_xpu_float64",
778+
# Exception: Jacobian mismatch for output 0 with respect to input 0
779+
"test_quick_core_backward_mv_xpu_float64",
780+
# AssertionError: Tensor-likes are not equal! ; Exception: Tensor-likes are not equal!
781+
"test_quick_logspace_tensor_overload_xpu_int16",
782+
"test_quick_logspace_tensor_overload_xpu_int32",
783+
"test_quick_logspace_tensor_overload_xpu_int64",
784+
"test_quick_logspace_xpu_int16",
785+
"test_quick_logspace_xpu_int32",
786+
"test_quick_logspace_xpu_int64",
787+
# AssertionError: Scalars are not close! ; Exception: Scalars are not close!
788+
"test_quick_vdot_xpu_complex128",
789+
"test_quick_vdot_xpu_complex64",
790+
# AssertionError: Tensor-likes are not close!
791+
"test_exponential_non_inf_xpu",
792+
# RuntimeError: I got this output for HasDecompTest.test_aten_core_operators:
793+
"test_aten_core_operators",
794+
"test_has_decomposition",
795+
# AssertionError: Tensor-likes are not close!
796+
"test_comprehensive_diff_xpu_complex128",
797+
"test_comprehensive_ormqr_xpu_complex128",
798+
"test_quick_var_mean_xpu_float64",
799+
"test_comprehensive_diff_xpu_complex64",
800+
"test_comprehensive_ormqr_xpu_complex64",
801+
"test_quick_mean_xpu_complex128",
802+
"test_comprehensive_grid_sampler_2d_xpu_bfloat16",
803+
),
740804
"functorch/test_ops_xpu.py": None,
741805
"test_sparse_xpu.py": None,
742806
"test_sparse_csr_xpu.py": None,

0 commit comments

Comments
 (0)