Skip to content

Commit

Permalink
Merge branch 'release0.20' into gold/2021
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptorup Deb committed Mar 6, 2023
2 parents e45a4eb + 55c233f commit e3323ee
Show file tree
Hide file tree
Showing 77 changed files with 12,606 additions and 1,234 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ exclude =
__pycache__,
_version.py,
lowerer.py,
parfor.py
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,72 @@ 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).

## [0.20.0] - 2023-03-06

### Added
* New dpjit decorator supporting dpnp compilation (#887)
* Boxing and unboxing functionality for dpnp.ndarray to numba_dpex (#902)
* New DpexTarget and dispatcher for compiling dpnp using numba-dpex (#887)
* Overload implementation for dpnp.empty (#902)
* Overload implementation for dpnp.empty_like, dpnp.zeros_like and
dpnp.ones_like inside dpjit (#928)
* Overload implementation for dpnp.zeros and dpnp.ones inside dpjit (#923)
* Compilation and offload support for dpnp vector style expressions using Numba
parfors (#957)
* Compilation of over 70 ufuncs for dpnp inside dpjit (#957)
* Backported the split parfor pass from upstream Numba. (#949)
* Numba type aliases to numba_dpex. (#851)
* Numba prange alias inside numba_dpex. (#957)
* New LRU cache for kernels (#804) and funcs (#877)
* New Range and NdRange classes for kernel submission that follow sycl's range
and ndrange syntax. (#888)
* Monkey pacthes to Numba 0.56.4 to support dpnp ufuncs, allocating dpnp
arrays (#954)
* New config flag (NUMBA_DPEX_DUMP_KERNEL_LLVM) to dump a kernel's
LLVM IR (#924)
* A badge to our gitter chatroom (#919)
* A small script to update copyright headers (#917)
* A new dpexrt_python extension to support USM allocators for Numba
NRT_MemInfo (#902)
* Updated examples for kernel API demonstrating compute-follows-data programming
model. (#826)

### Changed
* `CLK_GLOBAL_MEM_FENCE` and `CLK_LOCAL_MEM_FENCE` flags renamed to
`GLOBAL_MEM_FENCE` and `LOCAL_MEM_FENCE`. (#844)
* Switched from Ubuntu-latest to Ubuntu-20.04 for conda package build (#836)
* Rename USMNdArrayType to USMNdArray (#851)
* Changes to the Numba type to represent dpnp ndarray typess now renamed to
DpnpNdarray (#880)
* Improved exceptions and user errors (#804)
* Updated internal API for kernel interface with improved support for
`__sycl_usm_array_interface__` protocol (#804)
* Pin generated spirv version for kernels to 1.1 (#885)
* Rename DpexContext and DpexTypingContext to DpexKernelTarget and
DpexKernelTypingContext (#887)
* Renamed existing dpnp overloads that used stubs to dpnp_stubs_impl.py (#953)
* Dpctl version requirement mismatch is now a warning and not an
ImportError (#925)
* Update to versioneer 0.28 (#827)
* Update to dpctl 0.14 (#858)
* Update linters: black to 23.1.0, isort to 5.12.0 (#900)
* License in setup.py to match actual project licensing (#904)
### Fixed
* Kernel specialization, compute follows data programming model for
kernels (#804)
* Dispatcher/caching rewrite to address performance regression (#912, #896)
* func decorator qualname ambiguation fix (#905)

### Removed
* Removes the numpy_usm_shared module from numba_dpex. (#841)
* Removes the usage of llvmlite.llvmpy (#932)

### Deprecated
* Support for NumPy arrays as kernel arguments (#804)
* Kernel argument access specifiers (#804)
* Support for dpctl.device_context to launch kernels and njit offloading (#804)
* Dpnp overloads using stubs. (#953)

## [0.19.0] - 2022-11-21

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Coverage Status](https://coveralls.io/repos/github/IntelPython/numba-dpex/badge.svg?branch=main)](https://coveralls.io/github/IntelPython/numba-dpex?branch=main)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)

[![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)
<img align="left" src="https://spec.oneapi.io/oneapi-logo-white-scaled.jpg" alt="oneAPI logo" width="75"/>
<br/>
<br/>
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# -- Project information -----------------------------------------------------

project = "numba-dpex"
copyright = "2021,2022 Intel"
copyright = "2021-2023 Intel Corporation"
author = "Intel"

# The full version, including alpha/beta/rc tags
Expand All @@ -40,8 +40,12 @@
"sphinx.ext.todo",
"sphinx.ext.intersphinx",
"sphinxcontrib.apidoc",
"sphinxcontrib.googleanalytics",
]

googleanalytics_id = "G-LGGL0NJK6P"
googleanalytics_enabled = True

todo_include_todos = True

source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
Expand Down
1 change: 1 addition & 0 deletions environment/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies:
- recommonmark
- sphinx-rtd-theme
- sphinxcontrib-apidoc
- sphinxcontrib-googleanalytics
variables:
CHANNELS: -c defaults -c numba -c intel -c numba/label/dev -c dppy/label/dev --override-channels
CHANNELS_DEV: -c dppy/label/dev -c defaults -c numba -c intel -c numba/label/dev --override-channels
127 changes: 113 additions & 14 deletions numba_dpex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,132 @@
"""
The numba-dpex extension module adds data-parallel offload support to Numba.
"""
import glob
import logging
import os
import platform as plt

import numba_dpex.core.dpjit_dispatcher
import numba_dpex.core.offload_dispatcher
import dpctl
import llvmlite.binding as ll
import numba
from numba.core import ir_utils
from numba.np import arrayobj
from numba.np.ufunc import array_exprs
from numba.np.ufunc.decorators import Vectorize

from numba_dpex._patches import _empty_nd_impl, _is_ufunc, _mk_alloc
from numba_dpex.vectorizers import Vectorize as DpexVectorize

# Monkey patches
array_exprs._is_ufunc = _is_ufunc
ir_utils.mk_alloc = _mk_alloc
arrayobj._empty_nd_impl = _empty_nd_impl


def load_dpctl_sycl_interface():
"""Permanently loads the ``DPCTLSyclInterface`` library provided by dpctl.
The ``DPCTLSyclInterface`` library provides C wrappers over SYCL functions
that are directly invoked from the LLVM modules generated by numba_dpex.
We load the library once at the time of initialization using llvmlite's
load_library_permanently function.
Raises:
ImportError: If the ``DPCTLSyclInterface`` library could not be loaded.
"""

platform = plt.system()
if platform == "Windows":
paths = glob.glob(
os.path.join(
os.path.dirname(dpctl.__file__), "*DPCTLSyclInterface.dll"
)
)
else:
paths = glob.glob(
os.path.join(
os.path.dirname(dpctl.__file__), "*DPCTLSyclInterface.so.0"
)
)

if len(paths) == 1:
ll.load_library_permanently(paths[0])
else:
raise ImportError

Vectorize.target_registry.ondemand["dpex"] = lambda: DpexVectorize


numba_version = tuple(map(int, numba.__version__.split(".")[:3]))
if numba_version < (0, 56, 4):
logging.warning(
"numba_dpex needs numba 0.56.4, using "
f"numba={numba_version} may cause unexpected behavior"
)


dpctl_version = tuple(map(int, dpctl.__version__.split(".")[:2]))
if dpctl_version < (0, 14):
logging.warning(
"numba_dpex needs dpctl 0.14 or greater, using "
f"dpctl={dpctl_version} may cause unexpected behavior"
)

from numba import prange # noqa E402

import numba_dpex.core.dpjit_dispatcher # noqa E402
import numba_dpex.core.offload_dispatcher # noqa E402

# Initialize the _dpexrt_python extension
import numba_dpex.core.runtime
import numba_dpex.core.targets.dpjit_target
import numba_dpex.core.runtime # noqa E402
import numba_dpex.core.targets.dpjit_target # noqa E402

# Re-export types itself
import numba_dpex.core.types as types
from numba_dpex.core.kernel_interface.utils import *
import numba_dpex.core.types as types # noqa E402
from numba_dpex import config # noqa E402
from numba_dpex.core.kernel_interface.indexers import ( # noqa E402
NdRange,
Range,
)

# Re-export all type names
from numba_dpex.core.types import *
from numba_dpex.retarget import offload_to_sycl_device

from . import config
from numba_dpex.core.types import * # noqa E402
from numba_dpex.dpnp_iface import dpnpimpl # noqa E402
from numba_dpex.retarget import offload_to_sycl_device # noqa E402

if config.HAS_NON_HOST_DEVICE:
from .device_init import *
# Re export
from .core.targets import dpjit_target, kernel_target
from .decorators import dpjit, func, kernel

# We are importing dpnp stub module to make Numba recognize the
# module when we rename Numpy functions.
from .dpnp_iface.stubs import dpnp
from .ocl.stubs import (
GLOBAL_MEM_FENCE,
LOCAL_MEM_FENCE,
atomic,
barrier,
get_global_id,
get_global_size,
get_group_id,
get_local_id,
get_local_size,
get_num_groups,
get_work_dim,
local,
mem_fence,
private,
sub_group_barrier,
)

DEFAULT_LOCAL_SIZE = []
load_dpctl_sycl_interface()
del load_dpctl_sycl_interface
else:
raise ImportError("No non-host SYCL device found to execute kernels.")


from ._version import get_versions
from numba_dpex._version import get_versions # noqa E402

__version__ = get_versions()["version"]
del get_versions

__all__ = ["offload_to_sycl_device"] + types.__all__
__all__ = types.__all__ + ["offload_to_sycl_device"] + ["Range", "NdRange"]
Loading

0 comments on commit e3323ee

Please sign in to comment.