From 5ecf0d4e3e155811a42b110555f0925e20a9d522 Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Mon, 24 Oct 2022 14:06:50 -0400 Subject: [PATCH 1/9] LLVM14 --- numba/core/callconv.py | 24 ++++++++++------------ numba/core/codegen.py | 23 +++++++++++++-------- numba/cuda/tests/cudapy/test_dispatcher.py | 6 +++--- numba/misc/llvm_pass_timings.py | 15 ++++++++++---- numba/tests/test_array_reductions.py | 5 +++++ numba/tests/test_debuginfo.py | 15 ++++++++++---- numba/tests/test_np_functions.py | 14 +++++++++++++ numba/tests/test_np_randomgen.py | 6 ++++++ numba/tests/test_parfors.py | 18 ++++------------ numba/tests/test_refop_pruning.py | 4 ++-- numba/tests/test_svml.py | 12 +---------- 11 files changed, 82 insertions(+), 60 deletions(-) diff --git a/numba/core/callconv.py b/numba/core/callconv.py index 9347b92b1f8..b69c189996f 100644 --- a/numba/core/callconv.py +++ b/numba/core/callconv.py @@ -9,7 +9,7 @@ from llvmlite import ir from numba.core import types, cgutils -from numba.core.base import PYOBJECT, GENERIC_POINTER +from numba.core.base import GENERIC_POINTER TryStatus = namedtuple('TryStatus', ['in_try', 'excinfo']) @@ -90,7 +90,7 @@ def return_native_none(self, builder): self._return_errcode_raw(builder, RETCODE_NONE) def return_exc(self, builder): - self._return_errcode_raw(builder, RETCODE_EXC, mark_exc=True) + self._return_errcode_raw(builder, RETCODE_EXC) def return_stop_iteration(self, builder): self._return_errcode_raw(builder, RETCODE_STOPIT) @@ -207,12 +207,12 @@ def return_user_exc(self, builder, exc, exc_args=None, loc=None, call_helper = self._get_call_helper(builder) exc_id = call_helper._add_exception(exc, exc_args, locinfo) - self._return_errcode_raw(builder, _const_int(exc_id), mark_exc=True) + self._return_errcode_raw(builder, _const_int(exc_id)) def return_status_propagate(self, builder, status): self._return_errcode_raw(builder, status.code) - def _return_errcode_raw(self, builder, code, mark_exc=False): + def _return_errcode_raw(self, builder, code): if isinstance(code, int): code = _const_int(code) builder.ret(code) @@ -395,7 +395,9 @@ def set_static_user_exc(self, builder, exc, exc_args=None, loc=None, exc = (exc, exc_args, locinfo) struct_gv = pyapi.serialize_object(exc) excptr = self._get_excinfo_argument(builder.function) - builder.store(struct_gv, excptr) + store = builder.store(struct_gv, excptr) + md = builder.module.add_metadata([ir.IntType(1)(1)]) + store.set_metadata("numba_exception_output", md) def return_user_exc(self, builder, exc, exc_args=None, loc=None, func_name=None): @@ -409,7 +411,7 @@ def return_user_exc(self, builder, exc, exc_args=None, loc=None, builder.branch(try_info['target']) else: # Return from the current function - self._return_errcode_raw(builder, RETCODE_USEREXC, mark_exc=True) + self._return_errcode_raw(builder, RETCODE_USEREXC) def _get_try_state(self, builder): try: @@ -457,14 +459,10 @@ def return_status_propagate(self, builder, status): excptr = self._get_excinfo_argument(builder.function) builder.store(status.excinfoptr, excptr) with builder.if_then(builder.not_(trystatus.in_try)): - self._return_errcode_raw(builder, status.code, mark_exc=True) + self._return_errcode_raw(builder, status.code) - def _return_errcode_raw(self, builder, code, mark_exc=False): - ret = builder.ret(code) - - if mark_exc: - md = builder.module.add_metadata([ir.IntType(1)(1)]) - ret.set_metadata("ret_is_raise", md) + def _return_errcode_raw(self, builder, code): + builder.ret(code) def _get_return_status(self, builder, code, excinfoptr): """ diff --git a/numba/core/codegen.py b/numba/core/codegen.py index e988fab1263..2d694901780 100644 --- a/numba/core/codegen.py +++ b/numba/core/codegen.py @@ -234,7 +234,7 @@ def init_digraph(name, fname, fontsize): nrt_meminfo = re.compile("@NRT_MemInfo") ll_intrin_calls = re.compile(r".*call.*@llvm\..*") ll_function_call = re.compile(r".*call.*@.*") - ll_raise = re.compile(r"ret i32.*\!ret_is_raise.*") + ll_raise = re.compile(r"store .*\!numba_exception_output.*") ll_return = re.compile("ret i32 [^1],?.*") # wrapper function for line wrapping LLVM lines @@ -1215,14 +1215,19 @@ def _module_pass_manager(self, **kwargs): # This knocks loops into rotated form early to reduce the likelihood # of vectorization failing due to unknown PHI nodes. pm.add_loop_rotate_pass() - # LLVM 11 added LFTR to the IV Simplification pass, this interacted - # badly with the existing use of the InstructionCombiner here and - # ended up with PHI nodes that prevented vectorization from - # working. The desired vectorization effects can be achieved - # with this in LLVM 11 (and also < 11) but at a potentially - # slightly higher cost: - pm.add_licm_pass() - pm.add_cfg_simplification_pass() + if ll.llvm_version_info[0] < 12: + # LLVM 11 added LFTR to the IV Simplification pass, + # this interacted badly with the existing use of the + # InstructionCombiner here and ended up with PHI nodes that + # prevented vectorization from working. The desired + # vectorization effects can be achieved with this in LLVM 11 + # (and also < 11) but at a potentially slightly higher cost: + pm.add_licm_pass() + pm.add_cfg_simplification_pass() + else: + pm.add_instruction_combining_pass() + pm.add_jump_threading_pass() + if config.LLVM_REFPRUNE_PASS: pm.add_refprune_pass(_parse_refprune_flags()) return pm diff --git a/numba/cuda/tests/cudapy/test_dispatcher.py b/numba/cuda/tests/cudapy/test_dispatcher.py index 0cb427c7f6f..2e9bcd5a3e2 100644 --- a/numba/cuda/tests/cudapy/test_dispatcher.py +++ b/numba/cuda/tests/cudapy/test_dispatcher.py @@ -312,9 +312,9 @@ def test_explicit_signatures_ambiguous_resolution(self): self.assertRegexpMatches( str(cm.exception), r"Ambiguous overloading for ]*> " - r"\(array\(float64, 1d, C\), float64, float64\):\n" - r"\(array\(float64, 1d, C\), float32, float64\) -> none\n" - r"\(array\(float64, 1d, C\), float64, float32\) -> none" + r"\([Aa]rray\(float64, 1d?, [^)]*\), float64, float64\):\n" + r"\([Aa]rray\(float64, 1d?, [^)]*\), float32, float64\) -> none\n" + r"\([Aa]rray\(float64, 1d?, [^)]*\), float64, float32\) -> none" ) # The integer signature is not part of the best matches self.assertNotIn("int64", str(cm.exception)) diff --git a/numba/misc/llvm_pass_timings.py b/numba/misc/llvm_pass_timings.py index c9ebb8ec6b6..427d0e202fa 100644 --- a/numba/misc/llvm_pass_timings.py +++ b/numba/misc/llvm_pass_timings.py @@ -52,6 +52,7 @@ def get(self): "wall_time", "wall_percent", "pass_name", + "instruction", ], ) @@ -216,6 +217,7 @@ def parse(raw_data): "System Time": "system", "User+System": "user_system", "Wall Time": "wall", + "Instr": "instruction", "Name": "pass_name", } for ln in line_iter: @@ -229,17 +231,22 @@ def parse(raw_data): assert headers[-1] == 'pass_name' # compute the list of available attributes from the column headers attrs = [] + n = r"\s*((?:[0-9]+\.)?[0-9]+)" + pat = "" for k in headers[:-1]: - attrs.append(f"{k}_time") - attrs.append(f"{k}_percent") + if k == "instruction": + pat += n + else: + attrs.append(f"{k}_time") + attrs.append(f"{k}_percent") + pat += f"\\s+(?:{n}\\s*\\({n}%\\)|-+)" + # put default value 0.0 to all missing attributes missing = {} for k in PassTimingRecord._fields: if k not in attrs and k != 'pass_name': missing[k] = 0.0 # parse timings - n = r"\s*((?:[0-9]+\.)?[0-9]+)" - pat = f"\\s+(?:{n}\\s*\\({n}%\\)|-+)" * (len(headers) - 1) pat += r"\s*(.*)" for ln in line_iter: m = re.match(pat, ln) diff --git a/numba/tests/test_array_reductions.py b/numba/tests/test_array_reductions.py index 36e5a67d7ec..414060e5d60 100644 --- a/numba/tests/test_array_reductions.py +++ b/numba/tests/test_array_reductions.py @@ -1000,6 +1000,8 @@ def assert_raises(arr, axis): assert_raises(arr1d, -2) assert_raises(arr2d, -3) assert_raises(arr2d, 2) + # Exceptions leak references + self.disable_leak_check() def test_argmax_axis_must_be_integer(self): arr = np.arange(6) @@ -1073,6 +1075,9 @@ def assert_raises(arr, axis): assert_raises(arr2d, -3) assert_raises(arr2d, 2) + # Exceptions leak references + self.disable_leak_check() + def test_argmin_axis_must_be_integer(self): arr = np.arange(6) diff --git a/numba/tests/test_debuginfo.py b/numba/tests/test_debuginfo.py index 1386021058b..a0e3326c31a 100644 --- a/numba/tests/test_debuginfo.py +++ b/numba/tests/test_debuginfo.py @@ -184,7 +184,7 @@ def test_DILocation(self): @njit(debug=True, error_model='numpy') def foo(a): b = a + 1.23 - c = a * 2.34 + c = b * 2.34 d = b / c print(d) return d @@ -223,9 +223,16 @@ def foo(a): # Find non-call instr and check the sequence is as expected instrs = [x for x in block.instructions if x.opcode != 'call'] - op_seq = [x.opcode for x in instrs] - op_expect = ('fadd', 'fmul', 'fdiv') - self.assertIn(''.join(op_expect), ''.join(op_seq)) + op_expect = {'fadd', 'fmul', 'fdiv'} + started = False + for x in instrs: + if x.opcode in op_expect: + op_expect.remove(x.opcode) + if not started: + started = True + elif op_expect and started: + self.assertTrue(False, "Math opcodes are not contiguous") + self.assertFalse(op_expect, "Math opcodes were not found") # Parse out metadata from end of each line, check it monotonically # ascends with LLVM source line. Also store all the dbg references, diff --git a/numba/tests/test_np_functions.py b/numba/tests/test_np_functions.py index 1480c7579ab..df8dcd5597c 100644 --- a/numba/tests/test_np_functions.py +++ b/numba/tests/test_np_functions.py @@ -538,6 +538,8 @@ def test_sinc_exceptions(self): cfunc('str') self.assertIn('Argument "x" must be a Number or array-like', str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_contains(self): def arrs(): @@ -642,6 +644,8 @@ def test_angle_exceptions(self): cfunc('hello') self.assertIn('Argument "z" must be a complex or Array[complex]', str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_array_equal(self): def arrays(): @@ -769,6 +773,8 @@ def test_np_append_exceptions(self): 'The third argument "axis" must be an integer', str(raises.exception) ) + # Exceptions leak references + self.disable_leak_check() def test_delete(self): @@ -832,6 +838,8 @@ def test_delete_exceptions(self): 'obj must be less than the len(arr)', str(raises.exception), ) + # Exceptions leak references + self.disable_leak_check() def diff_arrays(self): """ @@ -885,6 +893,8 @@ def test_diff2_exceptions(self): with self.assertRaises(ValueError) as raises: cfunc(arr, n) self.assertIn("order must be non-negative", str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_isscalar(self): def values(): @@ -1089,6 +1099,8 @@ def test_bincount1_exceptions(self): cfunc([2, -1]) self.assertIn("first argument must be non-negative", str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_bincount2(self): pyfunc = bincount2 @@ -4866,6 +4878,8 @@ def not_literal_axis(a, i, axis): with self.assertRaises(ValueError) as raises: gen(0)(arr2d, np.ones((2, 3), dtype=np.uint64)) self.assertIn("dimensions don't match", str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_nan_to_num(self): # Test cases are from diff --git a/numba/tests/test_np_randomgen.py b/numba/tests/test_np_randomgen.py index 26bd4e8c197..8fd92fdb0a5 100644 --- a/numba/tests/test_np_randomgen.py +++ b/numba/tests/test_np_randomgen.py @@ -1094,6 +1094,8 @@ def test_noncentral_chisquare(self): curr_args[2] = -1 nb_dist_func(*curr_args) self.assertIn('nonc < 0', str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_noncentral_f(self): # For this test dtype argument is never used, so we pass [None] as dtype @@ -1138,6 +1140,8 @@ def test_noncentral_f(self): curr_args[3] = -1 nb_dist_func(*curr_args) self.assertIn('nonc < 0', str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() def test_logseries(self): # For this test dtype argument is never used, so we pass [None] as dtype @@ -1170,6 +1174,8 @@ def test_logseries(self): curr_args[1] = _p nb_dist_func(*curr_args) self.assertIn('p < 0, p >= 1 or p is NaN', str(raises.exception)) + # Exceptions leak references + self.disable_leak_check() class TestGeneratorCaching(TestCase, SerialMixin): diff --git a/numba/tests/test_parfors.py b/numba/tests/test_parfors.py index b232e30e367..4094db123b2 100644 --- a/numba/tests/test_parfors.py +++ b/numba/tests/test_parfors.py @@ -415,7 +415,7 @@ def _get_fast_instructions(ir): return fast_inst def _assert_fast(instrs): - ops = ('fadd', 'fsub', 'fmul', 'fdiv', 'frem', 'fcmp') + ops = ('fadd', 'fsub', 'fmul', 'fdiv', 'frem', 'fcmp', 'call') for inst in instrs: count = 0 for op in ops: @@ -4462,11 +4462,6 @@ def get_gufunc_asm(self, func, schedule_type, *args, **kwargs): return asm - # this is a common match pattern for something like: - # \n\tvsqrtpd\t-192(%rbx,%rsi,8), %zmm0\n - # to check vsqrtpd operates on zmm - match_vsqrtpd_on_zmm = re.compile('\n\s+vsqrtpd\s+.*zmm.*\n') - @linux_only def test_vectorizer_fastmath_asm(self): """ This checks that if fastmath is set and the underlying hardware @@ -4490,22 +4485,19 @@ def will_vectorize(A): fastmath=True) slow_asm = self.get_gufunc_asm(will_vectorize, 'unsigned', arg, fastmath=False) - for v in fast_asm.values(): # should unwind and call vector sqrt then vector add # all on packed doubles using zmm's self.assertTrue('vaddpd' in v) - self.assertTrue('vsqrtpd' in v) + self.assertTrue('vsqrtpd' in v or '__svml_sqrt' in v) self.assertTrue('zmm' in v) - # make sure vsqrtpd operates on zmm - self.assertTrue(len(self.match_vsqrtpd_on_zmm.findall(v)) > 1) for v in slow_asm.values(): # vector variants should not be present self.assertTrue('vaddpd' not in v) self.assertTrue('vsqrtpd' not in v) # check scalar variant is present - self.assertTrue('vsqrtsd' in v) + self.assertTrue('vsqrtsd' in v and '__svml_sqrt' not in v) self.assertTrue('vaddsd' in v) # check no zmm addressing is present self.assertTrue('zmm' not in v) @@ -4550,11 +4542,9 @@ def will_vectorize(A): for v in vec_asm.values(): # should unwind and call vector sqrt then vector mov # all on packed doubles using zmm's - self.assertTrue('vsqrtpd' in v) + self.assertTrue('vsqrtpd' in v or '__svml_sqrt' in v) self.assertTrue('vmovupd' in v) self.assertTrue('zmm' in v) - # make sure vsqrtpd operates on zmm - self.assertTrue(len(self.match_vsqrtpd_on_zmm.findall(v)) > 1) @linux_only # needed as 32bit doesn't have equivalent signed/unsigned instruction diff --git a/numba/tests/test_refop_pruning.py b/numba/tests/test_refop_pruning.py index 04433bf80f5..6cd7fdafa7c 100644 --- a/numba/tests/test_refop_pruning.py +++ b/numba/tests/test_refop_pruning.py @@ -118,9 +118,9 @@ def func(n): raise ValueError return x - with set_refprune_flags('per_bb,fanout_raise'): + with set_refprune_flags('per_bb,fanout'): self.check(func, (types.intp), basicblock=True, diamond=False, - fanout=False, fanout_raise=True) + fanout=True, fanout_raise=False) class TestRefPruneFlags(TestCase): diff --git a/numba/tests/test_svml.py b/numba/tests/test_svml.py index 1822b2e3f0a..327de2938e8 100644 --- a/numba/tests/test_svml.py +++ b/numba/tests/test_svml.py @@ -73,13 +73,12 @@ "round": [], # round], "sind": [], "sinh": [np.sinh, math.sinh], - "sqrt": [np.sqrt, math.sqrt], "tan": [np.tan, math.tan], "tanh": [np.tanh, math.tanh], "trunc": [], # np.trunc, math.trunc], } # TODO: these functions are not vectorizable with complex types -complex_funcs_exclude = ["sqrt", "tan", "log10", "expm1", "log1p", "tanh", "log"] +complex_funcs_exclude = ["tan", "log10", "expm1", "log1p", "tanh", "log"] # remove untested entries svml_funcs = {k: v for k, v in svml_funcs.items() if len(v) > 0} @@ -130,15 +129,6 @@ def func_patterns(func, args, res, dtype, mode, vlen, fastmath, pad=' '*8): # generating the failsafe scalar paths if vlen != 8 and (is_f32 or dtype == 'int32'): # Issue #3016 avoids += ['%zmm', '__svml_%s%d%s,' % (f, v*2, prec_suff)] - # special handling - if func == 'sqrt': - if mode == "scalar": - contains = ['sqrts'] - avoids = [scalar_func, svml_func] # LLVM uses CPU instruction - elif vlen == 8: - contains = ['vsqrtp'] - avoids = [scalar_func, svml_func] # LLVM uses CPU instruction - # else expect use of SVML for older architectures return body, contains, avoids From f0e9adbbfd200a2dc88392ba87cfd51dcdc7252c Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Thu, 2 Feb 2023 13:57:40 -0500 Subject: [PATCH 2/9] DO NOT MERGE: LLVM14 TESTING INFRASTRUCTURE --- buildscripts/condarecipe.local/meta.yaml | 4 ++-- buildscripts/incremental/setup_conda_environment.cmd | 2 +- buildscripts/incremental/setup_conda_environment.sh | 2 +- numba/__init__.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buildscripts/condarecipe.local/meta.yaml b/buildscripts/condarecipe.local/meta.yaml index 3b3232d457a..807e7d60f14 100644 --- a/buildscripts/condarecipe.local/meta.yaml +++ b/buildscripts/condarecipe.local/meta.yaml @@ -34,7 +34,7 @@ requirements: - setuptools - importlib_metadata # [py<39] # On channel https://anaconda.org/numba/ - - llvmlite >=0.40.0dev0,<0.40 + - llvmlite >=0.40.0dev0llvm14,<0.40 # TBB devel version is to match TBB libs. # 2020.3 is the last version with the "old" ABI # NOTE: 2021.1..2021.5 are API compatible for Numba's purposes. @@ -48,7 +48,7 @@ requirements: - setuptools - importlib_metadata # [py<39] # On channel https://anaconda.org/numba/ - - llvmlite >=0.40.0dev0,<0.40 + - llvmlite ==0.40.0dev0llvm14 run_constrained: # If TBB is present it must be at least version 2021 - tbb >=2021 # [not (aarch64 or ppc64le)] diff --git a/buildscripts/incremental/setup_conda_environment.cmd b/buildscripts/incremental/setup_conda_environment.cmd index 4518ec38547..4b382b0fa1c 100644 --- a/buildscripts/incremental/setup_conda_environment.cmd +++ b/buildscripts/incremental/setup_conda_environment.cmd @@ -25,7 +25,7 @@ conda create -n %CONDA_ENV% -q -y python=%PYTHON% numpy=%NUMPY% cffi pip scipy j call activate %CONDA_ENV% @rem Install latest llvmlite build -%CONDA_INSTALL% -c numba/label/dev llvmlite=0.40 +%CONDA_INSTALL% -c numba/label/dev "llvmlite=0.40.0dev0llvm14*" @rem Install required backports for older Pythons if %PYTHON% LSS 3.9 (%CONDA_INSTALL% importlib_metadata) @rem Install dependencies for building the documentation diff --git a/buildscripts/incremental/setup_conda_environment.sh b/buildscripts/incremental/setup_conda_environment.sh index 8a1adf666d5..dca44001852 100755 --- a/buildscripts/incremental/setup_conda_environment.sh +++ b/buildscripts/incremental/setup_conda_environment.sh @@ -62,7 +62,7 @@ elif [[ $(uname) == Darwin ]]; then fi # Install latest correct build -$CONDA_INSTALL -c numba/label/dev llvmlite=0.40 +$CONDA_INSTALL -c numba/label/dev "llvmlite=0.40.0dev0llvm14*" # Install importlib-metadata for Python < 3.9 if [ $PYTHON \< "3.9" ]; then $CONDA_INSTALL importlib_metadata; fi diff --git a/numba/__init__.py b/numba/__init__.py index 691e08c4b0e..3bd14fea801 100644 --- a/numba/__init__.py +++ b/numba/__init__.py @@ -143,7 +143,7 @@ def test(argv, **kwds): _min_llvmlite_version = (0, 40, 0) -_min_llvm_version = (11, 0, 0) +_min_llvm_version = (14, 0, 0) def _ensure_llvm(): """ From 5b45803cefb4724046b2a7e10becba35a3fb90a1 Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Fri, 10 Feb 2023 16:40:46 -0500 Subject: [PATCH 3/9] Add additional refprune test As titled --- numba/tests/test_refop_pruning.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/numba/tests/test_refop_pruning.py b/numba/tests/test_refop_pruning.py index 6cd7fdafa7c..a0e8621d7d5 100644 --- a/numba/tests/test_refop_pruning.py +++ b/numba/tests/test_refop_pruning.py @@ -122,6 +122,22 @@ def func(n): self.check(func, (types.intp), basicblock=True, diamond=False, fanout=True, fanout_raise=False) + def test_fanout_3(self): + # fanout with raise + def func(n): + ary = np.arange(n) + # basically an impl of array.sum + c = 0 + # The raise is from StopIteration of next(iterator) implicit in + # the for loop + for v in np.nditer(ary): + c += v.item() + return 1 + + with set_refprune_flags('per_bb,fanout_raise'): + self.check(func, (types.intp), basicblock=True, diamond=False, + fanout=False, fanout_raise=True) + class TestRefPruneFlags(TestCase): def setUp(self): From 08c336649005e55b7bdb62493de25f579aa5f409 Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Wed, 15 Feb 2023 07:49:09 -0500 Subject: [PATCH 4/9] Use better assertion logic As titled. Co-authored-by: stuartarchibald --- numba/tests/test_debuginfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numba/tests/test_debuginfo.py b/numba/tests/test_debuginfo.py index a0e3326c31a..d306d5f46ef 100644 --- a/numba/tests/test_debuginfo.py +++ b/numba/tests/test_debuginfo.py @@ -231,7 +231,7 @@ def foo(a): if not started: started = True elif op_expect and started: - self.assertTrue(False, "Math opcodes are not contiguous") + self.fail("Math opcodes are not contiguous") self.assertFalse(op_expect, "Math opcodes were not found") # Parse out metadata from end of each line, check it monotonically From 1e42a0bf843f7f5957f1141c521e016b76e02a9a Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Tue, 28 Feb 2023 13:46:51 -0500 Subject: [PATCH 5/9] Change LLVM version in documentation As titled. --- docs/source/user/installing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/user/installing.rst b/docs/source/user/installing.rst index d2a88a52ee6..f45f575fae8 100644 --- a/docs/source/user/installing.rst +++ b/docs/source/user/installing.rst @@ -257,7 +257,7 @@ information. +----------++--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+ | Numba | Release date | Python | NumPy | llvmlite | LLVM | TBB | +===========+==============+===========================+============================+==============================+===================+=============================+ -| 0.57.x | TBC | 3.8.x <= version < 3.12 | 1.19 <= version < 1.24 | 0.40.x | 11.x | 2021.x | +| 0.57.x | TBC | 3.8.x <= version < 3.12 | 1.19 <= version < 1.24 | 0.40.x | 11.x-14.x | 2021.x | +-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+ | 0.56.4 | 2022-11-03 | 3.7.x <= version < 3.11 | 1.18 <= version < 1.24 | 0.39.x | 11.x | 2021.x | +-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+ From e09828bbffdba8732c4155490387fd8c2712fbba Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Thu, 9 Mar 2023 20:00:07 -0500 Subject: [PATCH 6/9] Allow LLVM 14 for Linux AArch64 compatibility As titled. --- numba/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numba/__init__.py b/numba/__init__.py index 3bd14fea801..691e08c4b0e 100644 --- a/numba/__init__.py +++ b/numba/__init__.py @@ -143,7 +143,7 @@ def test(argv, **kwds): _min_llvmlite_version = (0, 40, 0) -_min_llvm_version = (14, 0, 0) +_min_llvm_version = (11, 0, 0) def _ensure_llvm(): """ From bcf35f224ffa99257b728999993aa2be52724a8d Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Mon, 13 Mar 2023 14:48:44 -0400 Subject: [PATCH 7/9] Remove LLVM14 build scaffolding As titled. --- buildscripts/condarecipe.local/meta.yaml | 2 +- buildscripts/incremental/setup_conda_environment.cmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildscripts/condarecipe.local/meta.yaml b/buildscripts/condarecipe.local/meta.yaml index 807e7d60f14..6f4bf96a5da 100644 --- a/buildscripts/condarecipe.local/meta.yaml +++ b/buildscripts/condarecipe.local/meta.yaml @@ -34,7 +34,7 @@ requirements: - setuptools - importlib_metadata # [py<39] # On channel https://anaconda.org/numba/ - - llvmlite >=0.40.0dev0llvm14,<0.40 + - llvmlite >=0.40,<0.40 # TBB devel version is to match TBB libs. # 2020.3 is the last version with the "old" ABI # NOTE: 2021.1..2021.5 are API compatible for Numba's purposes. diff --git a/buildscripts/incremental/setup_conda_environment.cmd b/buildscripts/incremental/setup_conda_environment.cmd index 8d000a7247c..c6062a1b014 100644 --- a/buildscripts/incremental/setup_conda_environment.cmd +++ b/buildscripts/incremental/setup_conda_environment.cmd @@ -29,7 +29,7 @@ conda create -n %CONDA_ENV% -q -y python=%PYTHON% %NUMPY_CHANNEL_PKG%=%NUMPY% cf call activate %CONDA_ENV% @rem Install latest llvmlite build -%CONDA_INSTALL% -c numba/label/dev "llvmlite=0.40.0dev0llvm14*" +%CONDA_INSTALL% -c numba/label/dev llvmlite=0.40 @rem Install required backports for older Pythons if %PYTHON% LSS 3.9 (%CONDA_INSTALL% importlib_metadata) @rem Install dependencies for building the documentation From 7dd0ab6f2b815834b7247fbcf5e8a8f490811b42 Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Mon, 13 Mar 2023 14:49:01 -0400 Subject: [PATCH 8/9] Add documentation for LLVM 14 passes As titled. --- numba/core/codegen.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/numba/core/codegen.py b/numba/core/codegen.py index 2d694901780..ced9e87aac7 100644 --- a/numba/core/codegen.py +++ b/numba/core/codegen.py @@ -1225,6 +1225,8 @@ def _module_pass_manager(self, **kwargs): pm.add_licm_pass() pm.add_cfg_simplification_pass() else: + # These passes are required to get SVML to vectorize tests + # properly on LLVM 14 pm.add_instruction_combining_pass() pm.add_jump_threading_pass() From 03cf85955a88096ae9dfa0660d44268be23b93ac Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Mon, 13 Mar 2023 14:52:37 -0400 Subject: [PATCH 9/9] Remove more LLVM 14 build scaffolding As titled. --- buildscripts/condarecipe.local/meta.yaml | 2 +- buildscripts/incremental/setup_conda_environment.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildscripts/condarecipe.local/meta.yaml b/buildscripts/condarecipe.local/meta.yaml index 6f4bf96a5da..2c9bf8f6c17 100644 --- a/buildscripts/condarecipe.local/meta.yaml +++ b/buildscripts/condarecipe.local/meta.yaml @@ -48,7 +48,7 @@ requirements: - setuptools - importlib_metadata # [py<39] # On channel https://anaconda.org/numba/ - - llvmlite ==0.40.0dev0llvm14 + - llvmlite >=0.40.0dev0,<0.40 run_constrained: # If TBB is present it must be at least version 2021 - tbb >=2021 # [not (aarch64 or ppc64le)] diff --git a/buildscripts/incremental/setup_conda_environment.sh b/buildscripts/incremental/setup_conda_environment.sh index 13a08697748..bc554421b3d 100755 --- a/buildscripts/incremental/setup_conda_environment.sh +++ b/buildscripts/incremental/setup_conda_environment.sh @@ -72,7 +72,7 @@ elif [[ $(uname) == Darwin ]]; then fi # Install latest correct build -$CONDA_INSTALL -c numba/label/dev "llvmlite=0.40.0dev0llvm14*" +$CONDA_INSTALL -c numba/label/dev llvmlite=0.40 # Install importlib-metadata for Python < 3.9 if [ $PYTHON \< "3.9" ]; then $CONDA_INSTALL importlib_metadata; fi