@stuartarchibald following up to Numba 0.53.0 and llvmlite 0.36.0 Release Candidates - #6 by ryanchien.
Hopefully this illustrates the break.
#Numba 0.52.0, llvmlite 0.35.0
@nb.njit('Tuple((f8, f8)) ()', fastmath = True, nogil = True)
def foo():
increment = 0.0
foo_sum = 0.0
i = 2
while foo_sum < 100:
a = [np.random.normal(1) for _ in range(i)]
a = np.array(a)
increment = np.sum(a)
increment = np.abs(increment)
foo_sum += increment
i += 1
return (foo_sum, i)
foo()
> (119.8389803524032, 16.0)
# Numba 0.53.0rc1, llvmlite 0.36.0rc1
@nb.njit('Tuple((f8, f8)) ()', fastmath = True, nogil = True)
def foo():
increment = 0.0
foo_sum = 0.0
i = 2
while foo_sum < 100:
a = [np.random.normal(1) for _ in range(i)]
a = np.array(a)
increment = np.sum(a)
increment = np.abs(increment)
foo_sum += increment
i += 1
return (foo_sum, i)
foo()
> ---------------------------------------------------------------------------
TypingError Traceback (most recent call last)
<ipython-input-16-9ae2843261d2> in <module>
1 @nb.njit('Tuple((f8, f8)) ()', fastmath = True, nogil = True)
----> 2 def foo():
3 increment = 0.0
4 foo_sum = 0.0
5 i = 2
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/decorators.py in wrapper(func)
219 with typeinfer.register_dispatcher(disp):
220 for sig in sigs:
--> 221 disp.compile(sig)
222 disp.disable_compile()
223 return disp
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/dispatcher.py in compile(self, sig)
907 with ev.trigger_event("numba:compile", data=ev_details):
908 try:
--> 909 cres = self._compiler.compile(args, return_type)
910 except errors.ForceLiteralArg as e:
911 def folded(args, kws):
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/dispatcher.py in compile(self, args, return_type)
81 return retval
82 else:
---> 83 raise retval
84
85 def _compile_cached(self, args, return_type):
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/dispatcher.py in _compile_cached(self, args, return_type)
91
92 try:
---> 93 retval = self._compile_core(args, return_type)
94 except errors.TypingError as e:
95 self._failed_cache[key] = e
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/dispatcher.py in _compile_core(self, args, return_type)
104
105 impl = self._get_implementation(args, {})
--> 106 cres = compiler.compile_extra(self.targetdescr.typing_context,
107 self.targetdescr.target_context,
108 impl,
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
604 pipeline = pipeline_class(typingctx, targetctx, library,
605 args, return_type, flags, locals)
--> 606 return pipeline.compile_extra(func)
607
608
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler.py in compile_extra(self, func)
351 self.state.lifted = ()
352 self.state.lifted_from = None
--> 353 return self._compile_bytecode()
354
355 def compile_ir(self, func_ir, lifted=(), lifted_from=None):
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler.py in _compile_bytecode(self)
413 """
414 assert self.state.func_ir is None
--> 415 return self._compile_core()
416
417 def _compile_ir(self):
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler.py in _compile_core(self)
393 self.state.status.fail_reason = e
394 if is_final_pipeline:
--> 395 raise e
396 else:
397 raise CompilerError("All available pipelines exhausted")
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler.py in _compile_core(self)
384 res = None
385 try:
--> 386 pm.run(self.state)
387 if self.state.cr is not None:
388 break
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler_machinery.py in run(self, state)
337 (self.pipeline_name, pass_desc)
338 patched_exception = self._patch_error(msg, e)
--> 339 raise patched_exception
340
341 def dependency_analysis(self):
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler_machinery.py in run(self, state)
328 pass_inst = _pass_registry.get(pss).pass_inst
329 if isinstance(pass_inst, CompilerPass):
--> 330 self._runPass(idx, pass_inst, state)
331 else:
332 raise BaseException("Legacy pass in use")
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
33 def _acquire_compile_lock(*args, **kwargs):
34 with self:
---> 35 return func(*args, **kwargs)
36 return _acquire_compile_lock
37
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler_machinery.py in _runPass(self, index, pss, internal_state)
287 mutated |= check(pss.run_initialization, internal_state)
288 with SimpleTimer() as pass_time:
--> 289 mutated |= check(pss.run_pass, internal_state)
290 with SimpleTimer() as finalize_time:
291 mutated |= check(pss.run_finalizer, internal_state)
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/compiler_machinery.py in check(func, compiler_state)
260
261 def check(func, compiler_state):
--> 262 mangled = func(compiler_state)
263 if mangled not in (True, False):
264 msg = ("CompilerPass implementations should return True/False. "
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/typed_passes.py in run_pass(self, state)
102 % (state.func_id.func_name,)):
103 # Type inference
--> 104 typemap, return_type, calltypes, errs = type_inference_stage(
105 state.typingctx,
106 state.func_ir,
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/typed_passes.py in type_inference_stage(typingctx, interp, args, return_type, locals, raise_errors)
81 # return errors in case of partial typing
82 errs = infer.propagate(raise_errors=raise_errors)
---> 83 typemap, restype, calltypes = infer.unify(raise_errors=raise_errors)
84
85 # Output all Numba warnings
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/typeinfer.py in unify(self, raise_errors)
1202 others = set(self.typevars) - temps
1203 for var in sorted(others):
-> 1204 check_var(var)
1205 for var in sorted(temps):
1206 check_var(var)
/opt/conda/envs/numbastats/lib/python3.8/site-packages/numba/core/typeinfer.py in check_var(name)
1172 msg = ("Type of variable '%s' cannot be determined, "
1173 "operation: %s, location: %s")
-> 1174 raise TypingError(msg % (var, val, loc), loc)
1175 else:
1176 typdict[var] = types.unknown
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Type of variable 'a' cannot be determined, operation: call $42load_method.9(a, func=$42load_method.9, args=[Var(a, <ipython-input-16-9ae2843261d2>:8)], kws=(), vararg=None), location: <ipython-input-16-9ae2843261d2> (9)
File "<ipython-input-16-9ae2843261d2>", line 9:
def foo():
<source elided>
a = [np.random.normal(1) for _ in range(i)]
a = np.array(a)
^
Both images are otherwise identical: CentOS7, icc_rt 2020.2, conda 4.8.3, running on Docker 19.03.13.
Hope this helps!