55from dpctl import SyclQueue
66from numba import types
77from numba .core import cgutils
8- from numba .extending import (
9- NativeValue ,
10- as_numba_type ,
11- box ,
12- type_callable ,
13- typeof_impl ,
14- unbox ,
15- )
8+ from numba .extending import NativeValue , box , unbox
169
1710from numba_dpex .core .exceptions import UnreachableError
1811from numba_dpex .core .runtime import context as dpxrtc
1912
2013
21- class SyclQueueType (types .Type ):
14+ class DpctlSyclQueue (types .Type ):
2215 """A Numba type to represent a dpctl.SyclQueue PyObject.
2316
2417 For now, a dpctl.SyclQueue is represented as a Numba opaque type that allows
@@ -27,56 +20,10 @@ class SyclQueueType(types.Type):
2720 """
2821
2922 def __init__ (self ):
30- super (SyclQueueType , self ).__init__ (name = "SyclQueue" )
23+ super (DpctlSyclQueue , self ).__init__ (name = "SyclQueue" )
3124
3225
33- # sycl_queue_type = SyclQueueType()
34-
35-
36- # @typeof_impl.register(SyclQueue)
37- # def typeof_index(val, c):
38- # return sycl_queue_type
39-
40-
41- # as_numba_type.register(SyclQueue, sycl_queue_type)
42-
43-
44- @type_callable (SyclQueue )
45- def type_sycl_queue (context ):
46- def typer (args ):
47- if isinstance (args , types .Tuple ):
48- if len (args ) > 0 :
49- if (
50- isinstance (args [0 ], types .PyObject )
51- and isinstance (args [1 ], types .StringLiteral )
52- and isinstance (args [2 ], types .PyObject )
53- ):
54- return SyclQueueType ()
55- else :
56- return SyclQueueType ()
57- elif isinstance (args , types .NoneType ):
58- return SyclQueueType ()
59- else :
60- raise ValueError ("Couldn't do type inference for 'SycleQueue'." )
61-
62- return typer
63-
64-
65- # @lower_builtin(SyclQueue, types.PyObject, types.StringLiteral, types.PyObject)
66- # def impl_interval(context, builder, sig, args):
67- # typ = sig.return_type
68- # if len(args) > 0:
69- # ctx, dev, property = args
70- # sycl_queue = cgutils.create_struct_proxy(typ)(context, builder)
71- # sycl_queue.ctx = ctx
72- # sycl_queue.dev = dev
73- # sycl_queue.property = property
74- # else:
75- # sycl_queue = cgutils.create_struct_proxy(typ)(context, builder)
76- # return sycl_queue._getvalue()
77-
78-
79- @unbox (SyclQueueType )
26+ @unbox (DpctlSyclQueue )
8027def unbox_sycl_queue (typ , obj , c ):
8128 """
8229 Convert a SyclQueue object to a native structure.
@@ -89,7 +36,6 @@ def unbox_sycl_queue(typ, obj, c):
8936 errcode = dpexrtCtx .queuestruct_from_python (c .pyapi , obj , ptr )
9037 else :
9138 raise UnreachableError
92-
9339 is_error = cgutils .is_not_null (c .builder , errcode )
9440 # Handle error
9541 with c .builder .if_then (is_error , likely = False ):
0 commit comments