|
19 | 19 | import numpy as np
|
20 | 20 | import types as pytypes
|
21 | 21 |
|
| 22 | +from numba_dpcomp.mlir.settings import _readenv |
22 | 23 | from numba_dpcomp import njit, jit, vectorize
|
23 | 24 |
|
24 | 25 | from numba_dpcomp.mlir.passes import (
|
|
31 | 32 |
|
32 | 33 |
|
33 | 34 | def _gen_tests():
|
| 35 | + if not _readenv("DPCOMP_ENABLE_PARFOR_TESTS", int, 0): |
| 36 | + return |
| 37 | + |
34 | 38 | testcases = [
|
35 | 39 | numba.tests.test_parfors.TestPrangeBasic,
|
36 | 40 | numba.tests.test_parfors.TestPrangeSpecific,
|
37 | 41 | numba.tests.test_parfors.TestParforsVectorizer,
|
| 42 | + numba.tests.test_parfors.TestParforBasic, |
| 43 | + numba.tests.test_parfors.TestParforNumericalMisc, |
| 44 | + numba.tests.test_parfors.TestParforNumPy, |
| 45 | + numba.tests.test_parfors.TestParfors, |
| 46 | + numba.tests.test_parfors.TestParforsLeaks, |
| 47 | + numba.tests.test_parfors.TestParforsSlice, |
| 48 | + # numba.tests.test_parfors.TestParforsOptions, |
| 49 | + numba.tests.test_parfors.TestParforsBitMask, |
| 50 | + numba.tests.test_parfors.TestParforsMisc, |
| 51 | + # numba.tests.test_parfors.TestParforsDiagnostics, |
38 | 52 | ]
|
39 | 53 |
|
40 | 54 | xfail_tests = {
|
@@ -71,21 +85,125 @@ def _gen_tests():
|
71 | 85 | "test_prange_two_instances_same_reduction_var",
|
72 | 86 | "test_prange_conflicting_reduction_ops",
|
73 | 87 | "test_ssa_false_reduction",
|
74 |
| - "test_prange26", |
75 | 88 | "test_prange_two_conditional_reductions",
|
76 | 89 | "test_argument_alias_recarray_field",
|
77 | 90 | "test_mutable_list_param",
|
78 | 91 | "test_signed_vs_unsigned_vec_asm",
|
79 | 92 | "test_unsigned_refusal_to_vectorize",
|
80 | 93 | "test_vectorizer_fastmath_asm",
|
| 94 | + "test_kde_example", |
| 95 | + "test_prange27", |
| 96 | + "test_simple09", |
| 97 | + "test_simple01", |
| 98 | + "test_simple10", |
| 99 | + "test_kmeans", |
| 100 | + "test_simple14", |
| 101 | + "test_simple04", |
| 102 | + "test_ndarray_fill", |
| 103 | + "test_fuse_argmin_argmax_max_min", |
| 104 | + "test_max", |
| 105 | + "test_arange", |
| 106 | + "test_min", |
| 107 | + "test_pi", |
| 108 | + "test_simple20", |
| 109 | + "test_simple24", |
| 110 | + "test_0d_array", |
| 111 | + "test_argmin", |
| 112 | + "test_simple07", |
| 113 | + "test_ndarray_fill2d", |
| 114 | + "test_argmax", |
| 115 | + "test_simple02", |
| 116 | + "test_simple18", |
| 117 | + "test_linspace", |
| 118 | + "test_std", |
| 119 | + "test_reshape_with_neg_one", |
| 120 | + "test_mvdot", |
| 121 | + "test_array_tuple_concat", |
| 122 | + "test_namedtuple1", |
| 123 | + "test_0d_broadcast", |
| 124 | + "test_var", |
| 125 | + "test_reshape_with_too_many_neg_one", |
| 126 | + "test_namedtuple2", |
| 127 | + "test_simple19", |
| 128 | + "test_no_hoisting_with_member_function_call", |
| 129 | + "test_reduction_var_reuse", |
| 130 | + "test_parfor_dtype_type", |
| 131 | + "test_tuple3", |
| 132 | + "test_parfor_array_access3", |
| 133 | + "test_np_func_direct_import", |
| 134 | + "test_preparfor_canonicalize_kws", |
| 135 | + "test_parfor_array_access4", |
| 136 | + "test_tuple_concat_with_reverse_slice", |
| 137 | + "test_reduce", |
| 138 | + "test_two_d_array_reduction", |
| 139 | + "test_tuple_concat", |
| 140 | + "test_two_d_array_reduction_with_float_sizes", |
| 141 | + "test_reduction", |
| 142 | + "test_multiple_reduction_vars", |
| 143 | + "test_two_d_array_reduction_reuse", |
| 144 | + "test_parfor_slice21", |
| 145 | + "test_parfor_array_access_lower_slice", |
| 146 | + "test_size_assertion", |
| 147 | + "test_parfor_slice19", |
| 148 | + "test_parfor_slice23", |
| 149 | + "test_parfor_slice18", |
| 150 | + "test_parfor_slice20", |
| 151 | + "test_simple12", |
| 152 | + "test_parfor_slice2", |
| 153 | + "test_parfor_slice6", |
| 154 | + "test_parfor_slice22", |
| 155 | + "test_parfor_bitmask3", |
| 156 | + "test_simple13", |
| 157 | + "test_parfor_bitmask1", |
| 158 | + "test_parfor_bitmask4", |
| 159 | + "test_issue3169", |
| 160 | + "test_parfor_bitmask5", |
| 161 | + "test_issue3748", |
| 162 | + "test_parfor_bitmask6", |
| 163 | + "test_issue5001", |
| 164 | + "test_issue6774", |
| 165 | + "test_issue5167", |
| 166 | + "test_issue6095_numpy_max", |
| 167 | + "test_issue5065", |
| 168 | + "test_no_state_change_in_gufunc_lowering_on_error", |
| 169 | + "test_namedtuple3", |
| 170 | + "test_issue6102", |
| 171 | + "test_oversized_tuple_as_arg_to_kernel", |
| 172 | + "test_issue5942_2", |
| 173 | + "test_reshape_with_large_neg", |
| 174 | + "test_parfor_ufunc_typing", |
| 175 | + "test_issue_5098", |
| 176 | + "test_parfor_slice27", |
| 177 | + "test_ufunc_expr", |
| 178 | + "test_parfor_generate_fuse", |
| 179 | + "test_parfor_slice7", |
| 180 | + "test_parfor_bitmask2", |
| 181 | + "test_parfor_alias2", |
| 182 | + "test_one_d_array_reduction", |
81 | 183 | }
|
82 | 184 |
|
83 | 185 | skip_tests = {
|
84 |
| - "test_kde_example", |
85 |
| - "test_prange27", |
86 | 186 | "test_copy_global_for_parfor",
|
| 187 | + "test_high_dimension1", |
| 188 | + "test_three_d_array_reduction", |
| 189 | + "test_prange26", |
87 | 190 | }
|
88 | 191 |
|
| 192 | + def countParfors(test_func, args, **kws): |
| 193 | + pytest.xfail() |
| 194 | + |
| 195 | + def countArrays(test_func, args, **kws): |
| 196 | + pytest.xfail() |
| 197 | + |
| 198 | + def countArrayAllocs(test_func, args, **kws): |
| 199 | + pytest.xfail() |
| 200 | + |
| 201 | + def countNonParforArrayAccesses(test_func, args, **kws): |
| 202 | + pytest.xfail() |
| 203 | + |
| 204 | + def get_optimized_numba_ir(test_func, args, **kws): |
| 205 | + pytest.xfail() |
| 206 | + |
89 | 207 | def _wrap_test_class(test_base):
|
90 | 208 | class _Wrapper(test_base):
|
91 | 209 | def _gen_normal(self, func):
|
@@ -125,14 +243,20 @@ def get_gufunc_asm(self, func, schedule_type, *args, **kwargs):
|
125 | 243 |
|
126 | 244 | def prange_tester(self, pyfunc, *args, **kwargs):
|
127 | 245 | patch_instance = kwargs.pop("patch_instance", None)
|
| 246 | + |
| 247 | + pyfunc = self.generate_prange_func(pyfunc, patch_instance) |
| 248 | + return self._check_impl(pyfunc, *args, **kwargs) |
| 249 | + |
| 250 | + def check(self, pyfunc, *args, **kwargs): |
| 251 | + return self._check_impl(pyfunc, *args, **kwargs) |
| 252 | + |
| 253 | + def _check_impl(self, pyfunc, *args, **kwargs): |
128 | 254 | scheduler_type = kwargs.pop("scheduler_type", None)
|
129 | 255 | check_fastmath = kwargs.pop("check_fastmath", False)
|
130 | 256 | check_fastmath_result = kwargs.pop("check_fastmath_result", False)
|
131 | 257 | check_scheduling = kwargs.pop("check_scheduling", True)
|
132 | 258 | check_args_for_equality = kwargs.pop("check_arg_equality", None)
|
133 |
| - assert not kwargs, "Unhandled kwargs: " + str(kwargs) |
134 |
| - |
135 |
| - pyfunc = self.generate_prange_func(pyfunc, patch_instance) |
| 259 | + # assert not kwargs, "Unhandled kwargs: " + str(kwargs) |
136 | 260 |
|
137 | 261 | cfunc = self._gen_normal(pyfunc)
|
138 | 262 | cpfunc = self._gen_parallel(pyfunc)
|
@@ -206,6 +330,14 @@ def _gen_test_func(func):
|
206 | 330 | _replace_global(func, "njit", njit)
|
207 | 331 | _replace_global(func, "vectorize", vectorize)
|
208 | 332 |
|
| 333 | + _replace_global(func, "countParfors", countParfors) |
| 334 | + _replace_global(func, "countArrays", countArrays) |
| 335 | + _replace_global(func, "countArrayAllocs", countArrayAllocs) |
| 336 | + _replace_global( |
| 337 | + func, "countNonParforArrayAccesses", countNonParforArrayAccesses |
| 338 | + ) |
| 339 | + _replace_global(func, "get_optimized_numba_ir", get_optimized_numba_ir) |
| 340 | + |
209 | 341 | def wrapper():
|
210 | 342 | return func()
|
211 | 343 |
|
|
0 commit comments