numba: cannot determine Numba type of
Numba version: numba==0.44.1
System: armhf (arm 32bits) build of debian stretch running on an aarch64 kernel. I experienced some problem to properly import jit from numba, but it appeared to be solved at the end of https://github.com/numba/llvmlite/issues/497
MWE:
from pywi.processing.transform import starlet
import scipy.misc as misc
img=misc.face()[:,:,0]
t = starlet.wavelet_transform(img, number_of_scales=5)
Actual log:
python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type “help”, “copyright”, “credits” or “license” for more information.
from pywi.processing.transform import starlet import scipy.misc as misc img=misc.face()[:,:,0] t = starlet.wavelet_transform(img, number_of_scales=5) /home/rock/.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py:237: NumbaWarning: Compilation is falling back to object mode WITH looplifting enabled because Function “wavelet_transform” failed type inference due to: Internal error at <numba.typeinfer.CallConstraint object at 0xedcb6030>: –%<---------------------------------------------------------------------------- Traceback (most recent call last): File “/home/rock/.local/lib/python3.5/site-packages/numba/errors.py”, line 661, in new_error_context yield File “/home/rock/.local/lib/python3.5/site-packages/numba/typeinfer.py”, line 455, in call self.resolve(typeinfer, typevars, fnty) File “/home/rock/.local/lib/python3.5/site-packages/numba/typeinfer.py”, line 474, in resolve sig = typeinfer.resolve_call(fnty, pos_args, kw_args) File “/home/rock/.local/lib/python3.5/site-packages/numba/typeinfer.py”, line 1314, in resolve_call return self.context.resolve_function_type(fnty, pos_args, kw_args) File “/home/rock/.local/lib/python3.5/site-packages/numba/typing/context.py”, line 186, in resolve_function_type res = self._resolve_user_function_type(func, args, kws) File “/home/rock/.local/lib/python3.5/site-packages/numba/typing/context.py”, line 238, in _resolve_user_function_type return func.get_call_type(self, args, kws) File “/home/rock/.local/lib/python3.5/site-packages/numba/types/functions.py”, line 214, in get_call_type out = template.apply(args, kws) File “/home/rock/.local/lib/python3.5/site-packages/numba/typing/templates.py”, line 225, in apply sig = generic(args, kws) File “/home/rock/.local/lib/python3.5/site-packages/numba/typing/templates.py”, line 778, in generic sig = method_resolver(self, ty, args, kws) File “/home/rock/.local/lib/python3.5/site-packages/numba/typing/arraydecl.py”, line 442, in resolve_astype assert not kws AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/home/rock/.local/lib/python3.5/site-packages/numba/typeinfer.py”, line 144, in propagate constraint(typeinfer) File “/home/rock/.local/lib/python3.5/site-packages/numba/typeinfer.py”, line 455, in call self.resolve(typeinfer, typevars, fnty) File “/usr/lib/python3.5/contextlib.py”, line 77, in exit self.gen.throw(type, value, traceback) File “/home/rock/.local/lib/python3.5/site-packages/numba/errors.py”, line 669, in new_error_context six.reraise(type(newerr), newerr, tb) File “/home/rock/.local/lib/python3.5/site-packages/numba/six.py”, line 659, in reraise raise value numba.errors.InternalError: [1] During: resolving callee type: BoundFunction(array.astype for readonly array(uint8, 2d, A)) [2] During: typing of call at /home/rock/.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py (298)
–%<----------------------------------------------------------------------------
File “.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py”, line 298: def wavelet_transform(input_image, <source elided>
input_image = input_image.astype('float64', copy=True) ^@jit /home/rock/.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py:237: NumbaWarning: Compilation is falling back to object mode WITHOUT looplifting enabled because Function “wavelet_transform” failed type inference due to: cannot determine Numba type of <class ‘numba.dispatcher.LiftedLoop’>
File “.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py”, line 315: def wavelet_transform(input_image, <source elided>
for scale_index in range(number_of_scales - 1): ^@jit Traceback (most recent call last): File “/home/rock/.local/lib/python3.5/site-packages/numba/errors.py”, line 661, in new_error_context yield File “/home/rock/.local/lib/python3.5/site-packages/numba/lowering.py”, line 258, in lower_block self.lower_inst(inst) File “/home/rock/.local/lib/python3.5/site-packages/numba/pylowering.py”, line 176, in lower_inst raise NotImplementedError(type(inst), inst) NotImplementedError: (<class ‘numba.ir.StaticRaise’>, <numba.ir.StaticRaise object at 0xedc40350>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/rock/.local/lib/python3.5/site-packages/numba/dispatcher.py”, line 370, in _compile_for_args raise e File “/home/rock/.local/lib/python3.5/site-packages/numba/dispatcher.py”, line 327, in _compile_for_args return self.compile(tuple(argtypes)) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler_lock.py”, line 32, in _acquire_compile_lock return func(*args, **kwargs) File “/home/rock/.local/lib/python3.5/site-packages/numba/dispatcher.py”, line 659, in compile cres = self._compiler.compile(args, return_type) File “/home/rock/.local/lib/python3.5/site-packages/numba/dispatcher.py”, line 83, in compile pipeline_class=self.pipeline_class) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 955, in compile_extra return pipeline.compile_extra(func) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 377, in compile_extra return self._compile_bytecode() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 886, in _compile_bytecode return self._compile_core() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 873, in _compile_core res = pm.run(self.status) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler_lock.py”, line 32, in _acquire_compile_lock return func(*args, **kwargs) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 254, in run raise patched_exception File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 245, in run stage() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 463, in stage_objectmode_frontend cres = self.frontend_looplift() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 435, in frontend_looplift lifted=tuple(loops), lifted_from=None) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 1017, in compile_ir lifted_from=lifted_from) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 385, in compile_ir return self._compile_ir() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 893, in _compile_ir return self._compile_core() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 873, in _compile_core res = pm.run(self.status) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler_lock.py”, line 32, in _acquire_compile_lock return func(*args, **kwargs) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 254, in run raise patched_exception File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 245, in run stage() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 711, in stage_objectmode_backend self._backend(lowerfn, objectmode=True) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 687, in _backend lowered = lowerfn() File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 659, in backend_object_mode self.flags) File “/home/rock/.local/lib/python3.5/site-packages/numba/compiler.py”, line 1148, in py_lowering_stage lower.lower() File “/home/rock/.local/lib/python3.5/site-packages/numba/lowering.py”, line 177, in lower self.lower_normal_function(self.fndesc) File “/home/rock/.local/lib/python3.5/site-packages/numba/lowering.py”, line 218, in lower_normal_function entry_block_tail = self.lower_function_body() File “/home/rock/.local/lib/python3.5/site-packages/numba/lowering.py”, line 243, in lower_function_body self.lower_block(block) File “/home/rock/.local/lib/python3.5/site-packages/numba/lowering.py”, line 258, in lower_block self.lower_inst(inst) File “/usr/lib/python3.5/contextlib.py”, line 77, in exit self.gen.throw(type, value, traceback) File “/home/rock/.local/lib/python3.5/site-packages/numba/errors.py”, line 669, in new_error_context six.reraise(type(newerr), newerr, tb) File “/home/rock/.local/lib/python3.5/site-packages/numba/six.py”, line 659, in reraise raise value numba.errors.LoweringError: Failed in object mode pipeline (step: object mode frontend) Failed in object mode pipeline (step: object mode backend) (<class ‘numba.ir.StaticRaise’>, <numba.ir.StaticRaise object at 0xedc40350>)
File “.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py”, line 302: def wavelet_transform(input_image, <source elided> msg = “The data should be a 2D array.” raise WrongDimensionError(msg) ^
[1] During: lowering “raise <class ‘pywi.processing.transform.starlet.WrongDimensionError’>(‘The data should be a 2D array.’)” at /home/rock/.local/lib/python3.5/site-packages/pywi/processing/transform/starlet.py (302)
This should not have happened, a problem has occurred in Numba’s internals.
Please report the error message and traceback, along with a minimal reproducer at: https://github.com/numba/numba/issues/new
If more help is needed please feel free to speak to the Numba core developers directly at: https://gitter.im/numba/numba
Thanks in advance for your help in improving Numba!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (7 by maintainers)
I don’t think either of those tools impact the JIT functionality, so I don’t think LLVM is at fault here. (Or at least, not in a way their tests can detect.) We don’t have any test environments where kernel pointer size != process pointer size, so it is quite possible some assumptions have crept into the Numba code base.
We ship with the test suite, so you can run the unit tests this way:
The second
-mtells it to run multiprocess, since there are 8000 tests. If things seem to be crashing or freezing, you might need to drop that and run single process. Our Raspberry Pi 3 takes 70-80 minutes to complete the test suite in multiprocess mode.Feel free to post that to a gist and it might give us some more ideas as to where compilation is going wrong.