Skip to content

Commit e3323ee

Browse files
author
Diptorup Deb
committed
Merge branch 'release0.20' into gold/2021
2 parents e45a4eb + 55c233f commit e3323ee

File tree

77 files changed

+12606
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+12606
-1234
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ exclude =
1818
__pycache__,
1919
_version.py,
2020
lowerer.py,
21+
parfor.py

CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,72 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.20.0] - 2023-03-06
8+
9+
### Added
10+
* New dpjit decorator supporting dpnp compilation (#887)
11+
* Boxing and unboxing functionality for dpnp.ndarray to numba_dpex (#902)
12+
* New DpexTarget and dispatcher for compiling dpnp using numba-dpex (#887)
13+
* Overload implementation for dpnp.empty (#902)
14+
* Overload implementation for dpnp.empty_like, dpnp.zeros_like and
15+
dpnp.ones_like inside dpjit (#928)
16+
* Overload implementation for dpnp.zeros and dpnp.ones inside dpjit (#923)
17+
* Compilation and offload support for dpnp vector style expressions using Numba
18+
parfors (#957)
19+
* Compilation of over 70 ufuncs for dpnp inside dpjit (#957)
20+
* Backported the split parfor pass from upstream Numba. (#949)
21+
* Numba type aliases to numba_dpex. (#851)
22+
* Numba prange alias inside numba_dpex. (#957)
23+
* New LRU cache for kernels (#804) and funcs (#877)
24+
* New Range and NdRange classes for kernel submission that follow sycl's range
25+
and ndrange syntax. (#888)
26+
* Monkey pacthes to Numba 0.56.4 to support dpnp ufuncs, allocating dpnp
27+
arrays (#954)
28+
* New config flag (NUMBA_DPEX_DUMP_KERNEL_LLVM) to dump a kernel's
29+
LLVM IR (#924)
30+
* A badge to our gitter chatroom (#919)
31+
* A small script to update copyright headers (#917)
32+
* A new dpexrt_python extension to support USM allocators for Numba
33+
NRT_MemInfo (#902)
34+
* Updated examples for kernel API demonstrating compute-follows-data programming
35+
model. (#826)
36+
37+
### Changed
38+
* `CLK_GLOBAL_MEM_FENCE` and `CLK_LOCAL_MEM_FENCE` flags renamed to
39+
`GLOBAL_MEM_FENCE` and `LOCAL_MEM_FENCE`. (#844)
40+
* Switched from Ubuntu-latest to Ubuntu-20.04 for conda package build (#836)
41+
* Rename USMNdArrayType to USMNdArray (#851)
42+
* Changes to the Numba type to represent dpnp ndarray typess now renamed to
43+
DpnpNdarray (#880)
44+
* Improved exceptions and user errors (#804)
45+
* Updated internal API for kernel interface with improved support for
46+
`__sycl_usm_array_interface__` protocol (#804)
47+
* Pin generated spirv version for kernels to 1.1 (#885)
48+
* Rename DpexContext and DpexTypingContext to DpexKernelTarget and
49+
DpexKernelTypingContext (#887)
50+
* Renamed existing dpnp overloads that used stubs to dpnp_stubs_impl.py (#953)
51+
* Dpctl version requirement mismatch is now a warning and not an
52+
ImportError (#925)
53+
* Update to versioneer 0.28 (#827)
54+
* Update to dpctl 0.14 (#858)
55+
* Update linters: black to 23.1.0, isort to 5.12.0 (#900)
56+
* License in setup.py to match actual project licensing (#904)
57+
### Fixed
58+
* Kernel specialization, compute follows data programming model for
59+
kernels (#804)
60+
* Dispatcher/caching rewrite to address performance regression (#912, #896)
61+
* func decorator qualname ambiguation fix (#905)
62+
63+
### Removed
64+
* Removes the numpy_usm_shared module from numba_dpex. (#841)
65+
* Removes the usage of llvmlite.llvmpy (#932)
66+
67+
### Deprecated
68+
* Support for NumPy arrays as kernel arguments (#804)
69+
* Kernel argument access specifiers (#804)
70+
* Support for dpctl.device_context to launch kernels and njit offloading (#804)
71+
* Dpnp overloads using stubs. (#953)
72+
773
## [0.19.0] - 2022-11-21
874

975
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
22
[![Coverage Status](https://coveralls.io/repos/github/IntelPython/numba-dpex/badge.svg?branch=main)](https://coveralls.io/github/IntelPython/numba-dpex?branch=main)
33
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
4-
4+
[![Join the chat at https://matrix.to/#/#Data-Parallel-Python_community:gitter.im](https://badges.gitter.im/Join%20Chat.svg)](https://app.gitter.im/#/room/#Data-Parallel-Python_community:gitter.im)
55
<img align="left" src="https://spec.oneapi.io/oneapi-logo-white-scaled.jpg" alt="oneAPI logo" width="75"/>
66
<br/>
77
<br/>

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# -- Project information -----------------------------------------------------
2222

2323
project = "numba-dpex"
24-
copyright = "2021,2022 Intel"
24+
copyright = "2021-2023 Intel Corporation"
2525
author = "Intel"
2626

2727
# The full version, including alpha/beta/rc tags
@@ -40,8 +40,12 @@
4040
"sphinx.ext.todo",
4141
"sphinx.ext.intersphinx",
4242
"sphinxcontrib.apidoc",
43+
"sphinxcontrib.googleanalytics",
4344
]
4445

46+
googleanalytics_id = "G-LGGL0NJK6P"
47+
googleanalytics_enabled = True
48+
4549
todo_include_todos = True
4650

4751
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}

environment/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies:
3131
- recommonmark
3232
- sphinx-rtd-theme
3333
- sphinxcontrib-apidoc
34+
- sphinxcontrib-googleanalytics
3435
variables:
3536
CHANNELS: -c defaults -c numba -c intel -c numba/label/dev -c dppy/label/dev --override-channels
3637
CHANNELS_DEV: -c dppy/label/dev -c defaults -c numba -c intel -c numba/label/dev --override-channels

numba_dpex/__init__.py

Lines changed: 113 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,132 @@
55
"""
66
The numba-dpex extension module adds data-parallel offload support to Numba.
77
"""
8+
import glob
9+
import logging
10+
import os
11+
import platform as plt
812

9-
import numba_dpex.core.dpjit_dispatcher
10-
import numba_dpex.core.offload_dispatcher
13+
import dpctl
14+
import llvmlite.binding as ll
15+
import numba
16+
from numba.core import ir_utils
17+
from numba.np import arrayobj
18+
from numba.np.ufunc import array_exprs
19+
from numba.np.ufunc.decorators import Vectorize
20+
21+
from numba_dpex._patches import _empty_nd_impl, _is_ufunc, _mk_alloc
22+
from numba_dpex.vectorizers import Vectorize as DpexVectorize
23+
24+
# Monkey patches
25+
array_exprs._is_ufunc = _is_ufunc
26+
ir_utils.mk_alloc = _mk_alloc
27+
arrayobj._empty_nd_impl = _empty_nd_impl
28+
29+
30+
def load_dpctl_sycl_interface():
31+
"""Permanently loads the ``DPCTLSyclInterface`` library provided by dpctl.
32+
The ``DPCTLSyclInterface`` library provides C wrappers over SYCL functions
33+
that are directly invoked from the LLVM modules generated by numba_dpex.
34+
We load the library once at the time of initialization using llvmlite's
35+
load_library_permanently function.
36+
Raises:
37+
ImportError: If the ``DPCTLSyclInterface`` library could not be loaded.
38+
"""
39+
40+
platform = plt.system()
41+
if platform == "Windows":
42+
paths = glob.glob(
43+
os.path.join(
44+
os.path.dirname(dpctl.__file__), "*DPCTLSyclInterface.dll"
45+
)
46+
)
47+
else:
48+
paths = glob.glob(
49+
os.path.join(
50+
os.path.dirname(dpctl.__file__), "*DPCTLSyclInterface.so.0"
51+
)
52+
)
53+
54+
if len(paths) == 1:
55+
ll.load_library_permanently(paths[0])
56+
else:
57+
raise ImportError
58+
59+
Vectorize.target_registry.ondemand["dpex"] = lambda: DpexVectorize
60+
61+
62+
numba_version = tuple(map(int, numba.__version__.split(".")[:3]))
63+
if numba_version < (0, 56, 4):
64+
logging.warning(
65+
"numba_dpex needs numba 0.56.4, using "
66+
f"numba={numba_version} may cause unexpected behavior"
67+
)
68+
69+
70+
dpctl_version = tuple(map(int, dpctl.__version__.split(".")[:2]))
71+
if dpctl_version < (0, 14):
72+
logging.warning(
73+
"numba_dpex needs dpctl 0.14 or greater, using "
74+
f"dpctl={dpctl_version} may cause unexpected behavior"
75+
)
76+
77+
from numba import prange # noqa E402
78+
79+
import numba_dpex.core.dpjit_dispatcher # noqa E402
80+
import numba_dpex.core.offload_dispatcher # noqa E402
1181

1282
# Initialize the _dpexrt_python extension
13-
import numba_dpex.core.runtime
14-
import numba_dpex.core.targets.dpjit_target
83+
import numba_dpex.core.runtime # noqa E402
84+
import numba_dpex.core.targets.dpjit_target # noqa E402
1585

1686
# Re-export types itself
17-
import numba_dpex.core.types as types
18-
from numba_dpex.core.kernel_interface.utils import *
87+
import numba_dpex.core.types as types # noqa E402
88+
from numba_dpex import config # noqa E402
89+
from numba_dpex.core.kernel_interface.indexers import ( # noqa E402
90+
NdRange,
91+
Range,
92+
)
1993

2094
# Re-export all type names
21-
from numba_dpex.core.types import *
22-
from numba_dpex.retarget import offload_to_sycl_device
23-
24-
from . import config
95+
from numba_dpex.core.types import * # noqa E402
96+
from numba_dpex.dpnp_iface import dpnpimpl # noqa E402
97+
from numba_dpex.retarget import offload_to_sycl_device # noqa E402
2598

2699
if config.HAS_NON_HOST_DEVICE:
27-
from .device_init import *
100+
# Re export
101+
from .core.targets import dpjit_target, kernel_target
102+
from .decorators import dpjit, func, kernel
103+
104+
# We are importing dpnp stub module to make Numba recognize the
105+
# module when we rename Numpy functions.
106+
from .dpnp_iface.stubs import dpnp
107+
from .ocl.stubs import (
108+
GLOBAL_MEM_FENCE,
109+
LOCAL_MEM_FENCE,
110+
atomic,
111+
barrier,
112+
get_global_id,
113+
get_global_size,
114+
get_group_id,
115+
get_local_id,
116+
get_local_size,
117+
get_num_groups,
118+
get_work_dim,
119+
local,
120+
mem_fence,
121+
private,
122+
sub_group_barrier,
123+
)
124+
125+
DEFAULT_LOCAL_SIZE = []
126+
load_dpctl_sycl_interface()
127+
del load_dpctl_sycl_interface
28128
else:
29129
raise ImportError("No non-host SYCL device found to execute kernels.")
30130

31-
32-
from ._version import get_versions
131+
from numba_dpex._version import get_versions # noqa E402
33132

34133
__version__ = get_versions()["version"]
35134
del get_versions
36135

37-
__all__ = ["offload_to_sycl_device"] + types.__all__
136+
__all__ = types.__all__ + ["offload_to_sycl_device"] + ["Range", "NdRange"]

0 commit comments

Comments
 (0)