From 534120b8470ffafd7299c034c28e33bcb72fde48 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Wed, 17 Mar 2021 03:44:37 -0500 Subject: [PATCH 1/2] Fix context --- numba/core/typing/context.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/numba/core/typing/context.py b/numba/core/typing/context.py index 720cbbb258e..1e2de0bf018 100644 --- a/numba/core/typing/context.py +++ b/numba/core/typing/context.py @@ -234,6 +234,13 @@ def _resolve_user_function_type(self, func, args, kws, literals=None): if functy is not None: func = functy + if isinstance(func, CPUDispatcher) and func is not CPUDispatcher: + # if we are here it's numba-dppy case and we got TargetDispatcher, so get compiled version + func = func.get_compiled() + functy = self._lookup_global(func) + if functy is not None: + func = functy + if isinstance(func, types.Type): # If it's a type, it may support a __call__ method func_type = self.resolve_getattr(func, "__call__") From 2be92d18044596a6ff9723bca2b9bc4d97e75f13 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Wed, 17 Mar 2021 08:06:58 -0500 Subject: [PATCH 2/2] Add import --- numba/core/typing/context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/numba/core/typing/context.py b/numba/core/typing/context.py index 1e2de0bf018..8860e442fae 100644 --- a/numba/core/typing/context.py +++ b/numba/core/typing/context.py @@ -234,6 +234,7 @@ def _resolve_user_function_type(self, func, args, kws, literals=None): if functy is not None: func = functy + from numba.core.registry import CPUDispatcher if isinstance(func, CPUDispatcher) and func is not CPUDispatcher: # if we are here it's numba-dppy case and we got TargetDispatcher, so get compiled version func = func.get_compiled()