Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/support numba0.60 #1482

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added
* Support for Numba 0.60

## [0.23.0] - 2024-05-28

### Fixed
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- defaults
- dppy/label/dev
- numba
- intel
- numba/label/dev
- nodefaults
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion environment/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- gcc_linux-64
- dpcpp_linux-64>=2024.2
- sysroot_linux-64=2.28
- numba==0.59*
- numba==0.60*
- dpctl
- dpnp
- dpcpp-llvm-spirv
Expand Down
2 changes: 1 addition & 1 deletion environment/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- gcc_linux-64
- dpcpp_linux-64>=2024.2
- sysroot_linux-64=2.28
- numba==0.59*
- numba==0.60*
- scikit-build>=0.15*
- cmake>=3.26*
- ninja
Expand Down
2 changes: 1 addition & 1 deletion environment/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channels:
- nodefaults
dependencies:
- libffi
- numba==0.59*
- numba==0.60*
- dpctl>=0.16*
- dpnp>=0.14*
- dpcpp-llvm-spirv
Expand Down
3 changes: 0 additions & 3 deletions numba_dpex/kernel_api_impl/spirv/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ def add_overload(self, cres):
self.overloads[args] = cres

def compile(self, sig) -> any:
disp = self._get_dispatcher_for_current_target()
if disp is not self:
return disp.compile(sig)

with ExitStack() as scope:
cres = None
Expand Down
18 changes: 17 additions & 1 deletion numba_dpex/kernel_api_impl/spirv/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,23 @@ def load_additional_registries(self):
target context.

"""
# pylint: disable=import-outside-toplevel
# pylint: disable=import-outside-toplevel, unused-import, too-many-locals
from numba.cpython import (
builtins,
charseq,
enumimpl,
hashing,
heapq,
iterators,
listobj,
numbers,
rangeobj,
setobj,
slicing,
tupleobj,
unicode,
)

from numba_dpex.dpctl_iface import dpctlimpl
from numba_dpex.dpnp_iface import dpnpimpl

Expand Down
2 changes: 1 addition & 1 deletion numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def func(shape, queue):
)
return c

with pytest.raises(errors.TypingError):
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
func(10, queue)

Expand Down
5 changes: 1 addition & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,10 @@ def func1(x, queue):
y = dpnp.empty_like(x, sycl_queue=queue, device=device)
return y

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
a = dpnp.ones(10, dtype=dpnp.float32)
func1(a, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

@dpjit
def func2(x):
Expand Down
5 changes: 1 addition & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ def func(shape, fill_value, queue):
c = dpnp.ones(shape, fill_value, sycl_queue=queue, device=device)
return c

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
func(10, 7, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
13 changes: 2 additions & 11 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_full_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,10 @@ def func1(x, fill_value, queue):
y = dpnp.full_like(x, 7, sycl_queue=queue, device=device)
return y

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
a = dpnp.zeros(10)
func1(a, 7, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

@dpjit
def func2(x, fill_value):
Expand Down Expand Up @@ -241,11 +238,5 @@ def func(shape, fill_value):
x = dpnp.full_like(shape, fill_value)
return x

try:
with pytest.raises((errors.TypingError, AttributeError)):
func(shape, 7)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert (
"No implementation of function Function(<function full_like"
in str(e)
)
5 changes: 1 addition & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ def func(shape, queue):
c = dpnp.ones(shape, sycl_queue=queue, device=device)
return c

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
func(10, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
13 changes: 2 additions & 11 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_ones_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,10 @@ def func1(x, queue):
y = dpnp.ones_like(x, sycl_queue=queue, device=device)
return y

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
a = dpnp.zeros(10, dtype=dpnp.float32)
func1(a, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

@dpjit
def func2(x):
Expand Down Expand Up @@ -198,11 +195,5 @@ def func(shape):
x = dpnp.ones_like(shape)
return x

try:
with pytest.raises((errors.TypingError, TypeError)):
func(shape)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert (
"No implementation of function Function(<function ones_like"
in str(e)
)
5 changes: 1 addition & 4 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ def func(shape, queue):
c = dpnp.zeros(shape, sycl_queue=queue, device=device)
return c

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
func(10, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)
13 changes: 2 additions & 11 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_zeros_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ def func1(x, queue):
y = dpnp.zeros_like(x, sycl_queue=queue, device=device)
return y

try:
with pytest.raises((errors.TypingError, TypeError)):
queue = dpctl.SyclQueue()
a = dpnp.ones(10, dtype=dpnp.float32)
func1(a, queue)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert "`device` and `sycl_queue` are exclusive keywords" in str(e)

@dpjit
def func2(x):
Expand Down Expand Up @@ -199,11 +196,5 @@ def func(shape):
x = dpnp.zeros_like(shape)
return x

try:
with pytest.raises((errors.TypingError, TypeError)):
func(shape)
except Exception as e:
assert isinstance(e, errors.TypingError)
assert (
"No implementation of function Function(<function zeros_like"
in str(e)
)
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def intrinsic_bar():
def test_dpex_overload_from_njit():
bar_njit = njit(bar)

with pytest.raises(errors.TypingError):
with pytest.raises((errors.TypingError, errors.UnsupportedError)):
bar_njit()


Expand All @@ -72,7 +72,7 @@ def test_dpex_overload_from_dpjit():
def test_dpex_intrinsic_from_njit():
bar_njit = njit(intrinsic_bar)

with pytest.raises(errors.TypingError):
with pytest.raises((errors.TypingError, errors.UnsupportedError)):
bar_njit()


Expand Down
2 changes: 1 addition & 1 deletion numba_dpex/tests/kernel_tests/test_async_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_async_dependent_add_list_exception():

# TODO: should capture ValueError, but numba captures it and generates
# TypingError. ValueError is still readable there.
with pytest.raises(TypingError):
with pytest.raises((TypingError, ValueError)):
dpex.call_kernel_async(
add,
Range(size),
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires = [
# We need dpctl for UsmNdArray integration for dpcpp code
"dpctl>=0.16.1",
# We need numba for runtime cpp headers
"numba>=0.59.0,<0.60.0a0",
"numba>=0.60.0,<0.61.0a0",
"llvmlite>=0.42.0",
# Do we need dpnp at build time?
"dpnp >=0.14",
Expand Down Expand Up @@ -40,9 +40,9 @@ dependencies = [
# This restrictions are for dependabot, actual restrictions are set with
# conda. TODO: populate it during build process
# TODO: do we have to set sycl runtime dependencies here
# "dpcpp-cpp-rt>=0.59.0",
# "intel-cmplr-lib-rt>=0.59.0"
"numba>=0.59.0",
# "dpcpp-cpp-rt>=xxxx",
# "intel-cmplr-lib-rt>=xxxx"
"numba>=0.60.0,<0.61.0a0",
"llvmlite>=0.42.0",
"dpctl>=0.16.1",
"dpnp>=0.14.0",
Expand Down
Loading