Skip to content

Commit 7ebd06c

Browse files
committed
Resolve some of the code review issues. Not explicitly checking Numba MemInfo. We'll have to add __sycl_usm_array_interface__ property to Numba objects to get this equivalent behavior without this dependency in the wrong direction.
1 parent efcfcd9 commit 7ebd06c

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

dpctl/dparray.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def dprint(*args):
1919
functions_list = [o[0] for o in getmembers(np) if isfunction(o[1]) or isbuiltin(o[1])]
2020
class_list = [o for o in getmembers(np) if isclass(o[1])]
2121

22-
array_interface_property = "__array_interface__"
22+
array_interface_property = "__sycl_usm_array_interface__"
2323

2424

2525
def has_array_interface(x):
@@ -119,30 +119,10 @@ def __array_finalize__(self, obj):
119119
# subclass of ndarray, including our own.
120120
if hasattr(obj, array_interface_property):
121121
return
122-
if isinstance(obj, numba.core.runtime._nrt_python._MemInfo):
123-
mobj = obj
124-
while isinstance(mobj, numba.core.runtime._nrt_python._MemInfo):
125-
dprint("array_finalize got Numba MemInfo")
126-
ea = mobj.external_allocator
127-
d = mobj.data
128-
dprint("external_allocator:", hex(ea), type(ea))
129-
dprint("data:", hex(d), type(d))
130-
dppl_rt_allocator = numba.dppl._dppl_rt.get_external_allocator()
131-
dprint(
132-
"dppl external_allocator:",
133-
hex(dppl_rt_allocator),
134-
type(dppl_rt_allocator),
135-
)
136-
dprint(dir(mobj))
137-
if ea == dppl_rt_allocator:
138-
return
139-
mobj = mobj.parent
140-
if isinstance(mobj, ndarray):
141-
mobj = mobj.base
142122
if isinstance(obj, np.ndarray):
143123
ob = self
144124
while isinstance(ob, np.ndarray):
145-
if hasattr(obj, array_interface_property):
125+
if hasattr(ob, array_interface_property):
146126
return
147127
ob = ob.base
148128

0 commit comments

Comments
 (0)