@@ -158,7 +158,7 @@ def bar(x, y):
158158 target = options .pop ('target' )
159159 warnings .warn ("The 'target' keyword argument is deprecated." , NumbaDeprecationWarning )
160160 else :
161- target = options .pop ('_target' , 'cpu' )
161+ target = options .pop ('_target' , None )
162162
163163 options ['boundscheck' ] = boundscheck
164164
@@ -195,28 +195,17 @@ def bar(x, y):
195195jit_registry [hardware_registry ['cpu' ]] = jit
196196
197197def _jit (sigs , locals , target , cache , targetoptions , ** dispatcher_args ):
198-
199198 dispatcher = resolve_dispatcher_from_str (target )
200199
201- def wrapper (func ):
202- if extending .is_jitted (func ):
203- raise TypeError (
204- "A jit decorator was called on an already jitted function "
205- f"{ func } . If trying to access the original python "
206- f"function, use the { func } .py_func attribute."
207- )
208-
209- if not inspect .isfunction (func ):
210- raise TypeError (
211- "The decorated object is not a function (got type "
212- f"{ type (func )} )."
213- )
214-
200+ def wrapper (func , dispatcher ):
215201 if config .ENABLE_CUDASIM and target == 'cuda' :
216202 from numba import cuda
217203 return cuda .jit (func )
218204 if config .DISABLE_JIT and not target == 'npyufunc' :
219205 return func
206+ if target == 'dppl' :
207+ from . import dppl
208+ return dppl .jit (func )
220209 disp = dispatcher (py_func = func , locals = locals ,
221210 targetoptions = targetoptions ,
222211 ** dispatcher_args )
@@ -232,7 +221,42 @@ def wrapper(func):
232221 disp .disable_compile ()
233222 return disp
234223
235- return wrapper
224+ def __wrapper (func ):
225+ if extending .is_jitted (func ):
226+ raise TypeError (
227+ "A jit decorator was called on an already jitted function "
228+ f"{ func } . If trying to access the original python "
229+ f"function, use the { func } .py_func attribute."
230+ )
231+
232+ if not inspect .isfunction (func ):
233+ raise TypeError (
234+ "The decorated object is not a function (got type "
235+ f"{ type (func )} )."
236+ )
237+
238+ is_numba_dppy_present = False
239+ try :
240+ import numba_dppy .config as dppy_config
241+
242+ is_numba_dppy_present = dppy_config .dppy_present
243+ except ImportError :
244+ pass
245+
246+ if (not is_numba_dppy_present
247+ or target == 'npyufunc' or targetoptions .get ('no_cpython_wrapper' )
248+ or sigs or config .DISABLE_JIT or not targetoptions .get ('nopython' )):
249+ target_ = target
250+ if target_ is None :
251+ target_ = 'cpu'
252+ disp = registry .dispatcher_registry [target_ ]
253+ return wrapper (func , disp )
254+
255+ from numba_dppy .target_dispatcher import TargetDispatcher
256+ disp = TargetDispatcher (func , wrapper , target , targetoptions .get ('parallel' ))
257+ return disp
258+
259+ return __wrapper
236260
237261
238262def generated_jit (function = None , target = 'cpu' , cache = False ,
0 commit comments