Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions numba/core/extending.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def generic(self):


# By default, an *overload* does not have a cpython wrapper because it is not
# callable from python.
_overload_default_jit_options = {'no_cpython_wrapper': True}
# callable from python. It also has `nopython=True`, this has been default since
# its inception!
_overload_default_jit_options = {'no_cpython_wrapper': True,
'nopython':True}


def overload(func, jit_options={}, strict=True, inline='never',
Expand Down
55 changes: 24 additions & 31 deletions numba/core/typing/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,37 +716,30 @@ def _get_impl(self, args, kws):
def _get_jit_decorator(self):
"""Gets a jit decorator suitable for the current target"""

jitter_str = self.metadata.get('target', None)
if jitter_str is None:
from numba import jit
# There is no target requested, use default, this preserves
# original behaviour
jitter = lambda *args, **kwargs: jit(*args, nopython=True, **kwargs)
else:
from numba.core.target_extension import (target_registry,
get_local_target,
jit_registry)

# target has been requested, see what it is...
jitter = jit_registry.get(jitter_str, None)

if jitter is None:
# No JIT known for target string, see if something is
# registered for the string and report if not.
target_class = target_registry.get(jitter_str, None)
if target_class is None:
msg = ("Unknown target '{}', has it been ",
"registered?")
raise ValueError(msg.format(jitter_str))

target_hw = get_local_target(self.context)

# check that the requested target is in the hierarchy for the
# current frame's target.
if not issubclass(target_hw, target_class):
msg = "No overloads exist for the requested target: {}."

jitter = jit_registry[target_hw]
from numba.core.target_extension import (target_registry,
get_local_target,
jit_registry)

jitter_str = self.metadata.get('target', 'generic')
jitter = jit_registry.get(jitter_str, None)

if jitter is None:
# No JIT known for target string, see if something is
# registered for the string and report if not.
target_class = target_registry.get(jitter_str, None)
if target_class is None:
msg = ("Unknown target '{}', has it been ",
"registered?")
raise ValueError(msg.format(jitter_str))

target_hw = get_local_target(self.context)

# check that the requested target is in the hierarchy for the
# current frame's target.
if not issubclass(target_hw, target_class):
msg = "No overloads exist for the requested target: {}."

jitter = jit_registry[target_hw]

if jitter is None:
raise ValueError("Cannot find a suitable jit decorator")
Expand Down