Skip to content

Commit d88e548

Browse files
author
Diptorup Deb
committed
Changes to add support for numba 0.60 to numba-dpex.
1 parent e01f13b commit d88e548

12 files changed

+31
-57
lines changed

numba_dpex/kernel_api_impl/spirv/dispatcher.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@ def add_overload(self, cres):
363363
self.overloads[args] = cres
364364

365365
def compile(self, sig) -> any:
366-
disp = self._get_dispatcher_for_current_target()
367-
if disp is not self:
368-
return disp.compile(sig)
369366

370367
with ExitStack() as scope:
371368
cres = None

numba_dpex/kernel_api_impl/spirv/target.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,23 @@ def load_additional_registries(self):
293293
target context.
294294
295295
"""
296-
# pylint: disable=import-outside-toplevel
296+
# pylint: disable=import-outside-toplevel, unused-import, too-many-locals
297+
from numba.cpython import (
298+
builtins,
299+
charseq,
300+
enumimpl,
301+
hashing,
302+
heapq,
303+
iterators,
304+
listobj,
305+
numbers,
306+
rangeobj,
307+
setobj,
308+
slicing,
309+
tupleobj,
310+
unicode,
311+
)
312+
297313
from numba_dpex.dpctl_iface import dpctlimpl
298314
from numba_dpex.dpnp_iface import dpnpimpl
299315

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def func(shape, queue):
136136
)
137137
return c
138138

139-
with pytest.raises(errors.TypingError):
139+
with pytest.raises((errors.TypingError, TypeError)):
140140
queue = dpctl.SyclQueue()
141141
func(10, queue)
142142

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty_like.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,10 @@ def func1(x, queue):
154154
y = dpnp.empty_like(x, sycl_queue=queue, device=device)
155155
return y
156156

157-
try:
157+
with pytest.raises((errors.TypingError, TypeError)):
158158
queue = dpctl.SyclQueue()
159159
a = dpnp.ones(10, dtype=dpnp.float32)
160160
func1(a, queue)
161-
except Exception as e:
162-
assert isinstance(e, errors.TypingError)
163-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
164161

165162
@dpjit
166163
def func2(x):

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ def func(shape, fill_value, queue):
178178
c = dpnp.ones(shape, fill_value, sycl_queue=queue, device=device)
179179
return c
180180

181-
try:
181+
with pytest.raises((errors.TypingError, TypeError)):
182182
queue = dpctl.SyclQueue()
183183
func(10, 7, queue)
184-
except Exception as e:
185-
assert isinstance(e, errors.TypingError)
186-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full_like.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,10 @@ def func1(x, fill_value, queue):
195195
y = dpnp.full_like(x, 7, sycl_queue=queue, device=device)
196196
return y
197197

198-
try:
198+
with pytest.raises((errors.TypingError, TypeError)):
199199
queue = dpctl.SyclQueue()
200200
a = dpnp.zeros(10)
201201
func1(a, 7, queue)
202-
except Exception as e:
203-
assert isinstance(e, errors.TypingError)
204-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
205202

206203
@dpjit
207204
def func2(x, fill_value):
@@ -241,11 +238,5 @@ def func(shape, fill_value):
241238
x = dpnp.full_like(shape, fill_value)
242239
return x
243240

244-
try:
241+
with pytest.raises((errors.TypingError, AttributeError)):
245242
func(shape, 7)
246-
except Exception as e:
247-
assert isinstance(e, errors.TypingError)
248-
assert (
249-
"No implementation of function Function(<function full_like"
250-
in str(e)
251-
)

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ def func(shape, queue):
129129
c = dpnp.ones(shape, sycl_queue=queue, device=device)
130130
return c
131131

132-
try:
132+
with pytest.raises((errors.TypingError, TypeError)):
133133
queue = dpctl.SyclQueue()
134134
func(10, queue)
135-
except Exception as e:
136-
assert isinstance(e, errors.TypingError)
137-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones_like.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,10 @@ def func1(x, queue):
152152
y = dpnp.ones_like(x, sycl_queue=queue, device=device)
153153
return y
154154

155-
try:
155+
with pytest.raises((errors.TypingError, TypeError)):
156156
queue = dpctl.SyclQueue()
157157
a = dpnp.zeros(10, dtype=dpnp.float32)
158158
func1(a, queue)
159-
except Exception as e:
160-
assert isinstance(e, errors.TypingError)
161-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
162159

163160
@dpjit
164161
def func2(x):
@@ -198,11 +195,5 @@ def func(shape):
198195
x = dpnp.ones_like(shape)
199196
return x
200197

201-
try:
198+
with pytest.raises((errors.TypingError, TypeError)):
202199
func(shape)
203-
except Exception as e:
204-
assert isinstance(e, errors.TypingError)
205-
assert (
206-
"No implementation of function Function(<function ones_like"
207-
in str(e)
208-
)

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ def func(shape, queue):
130130
c = dpnp.zeros(shape, sycl_queue=queue, device=device)
131131
return c
132132

133-
try:
133+
with pytest.raises((errors.TypingError, TypeError)):
134134
queue = dpctl.SyclQueue()
135135
func(10, queue)
136-
except Exception as e:
137-
assert isinstance(e, errors.TypingError)
138-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros_like.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,10 @@ def func1(x, queue):
153153
y = dpnp.zeros_like(x, sycl_queue=queue, device=device)
154154
return y
155155

156-
try:
156+
with pytest.raises((errors.TypingError, TypeError)):
157157
queue = dpctl.SyclQueue()
158158
a = dpnp.ones(10, dtype=dpnp.float32)
159159
func1(a, queue)
160-
except Exception as e:
161-
assert isinstance(e, errors.TypingError)
162-
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
163160

164161
@dpjit
165162
def func2(x):
@@ -199,11 +196,5 @@ def func(shape):
199196
x = dpnp.zeros_like(shape)
200197
return x
201198

202-
try:
199+
with pytest.raises((errors.TypingError, TypeError)):
203200
func(shape)
204-
except Exception as e:
205-
assert isinstance(e, errors.TypingError)
206-
assert (
207-
"No implementation of function Function(<function zeros_like"
208-
in str(e)
209-
)

numba_dpex/tests/dpjit_tests/test_dpex_target_overload_isolation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def intrinsic_bar():
6060
def test_dpex_overload_from_njit():
6161
bar_njit = njit(bar)
6262

63-
with pytest.raises(errors.TypingError):
63+
with pytest.raises((errors.TypingError, errors.UnsupportedError)):
6464
bar_njit()
6565

6666

@@ -72,7 +72,7 @@ def test_dpex_overload_from_dpjit():
7272
def test_dpex_intrinsic_from_njit():
7373
bar_njit = njit(intrinsic_bar)
7474

75-
with pytest.raises(errors.TypingError):
75+
with pytest.raises((errors.TypingError, errors.UnsupportedError)):
7676
bar_njit()
7777

7878

numba_dpex/tests/kernel_tests/test_async_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_async_dependent_add_list_exception():
8282

8383
# TODO: should capture ValueError, but numba captures it and generates
8484
# TypingError. ValueError is still readable there.
85-
with pytest.raises(TypingError):
85+
with pytest.raises((TypingError, ValueError)):
8686
dpex.call_kernel_async(
8787
add,
8888
Range(size),

0 commit comments

Comments
 (0)