Version 0.61.0rc1 (25 November 2024)
Table of Contents
This is a major Numba release. Numba now supports Python 3.13 as
well as NumPy 2.1. The minimum supported Python and NumPy versions
have been bumped to 3.10 and 1.24 respectively. The built-in CUDA
target numba.cuda
is now deprecated and numba-cuda
is the
preferred place to get CUDA support from this release onwards.
LLVM 15 is now supported via llmlite 0.44.0 as the default LLVM version.
Please find a summary of all noteworthy items below.
Highlights
Add initial implementation for a new type system
This adds a new type system that will allow Numba to differentiate between Python and NumPy scalars.
This has been achieved as follows:
Retain Numba’s old type system as default.
Add a config flag
USE_LEGACY_TYPE_SYSTEM
set to1
(on) by default. Switching it to0
(off) will activate new type system.Within the new type system, Python and NumPy scalars will be treated and returned separately as different entities through JIT compiled functions.
(PR-#9662)
Python 3.13 support
Support for Python 3.13 is added. Note that this does not include support for free-threading.
(PR-#9682)
Dropped support for Python 3.9
This release drops official support for Python 3.9. Numba now supports Python 3.10 and later.
(PR-#9726)
New Features
Schedule guvectorize’d functions over dask.distributed
Functions decorated with @guvectorize
can now be scheduled over distributed
Dask clusters.
(PR-#9495)
Added compile-time code coverage
Support for emitting compile-time coverage data is added.
This feature is automatically activated when running Python under coverage
.
It collects data during the compiler’s lowering phase, showing source lines
compiled into LLVM-IR, excluding dead-code eliminated lines.
(PR-#9508)
Improvements
First-class function improvements
Passing a jit function as a parameter to another jit function that accepts it as
a FunctionType
has two new improvements.
First, the compiler can now inline a jit function that is passed as a non-local variable (like a global variable) to another jit function. Previously, the interpreter had to introspect the function address for first-class function calls, which prevented inlining. With this improvement, the compiler can statically determine the referenced jit function and link in the corresponding LLVM module for optimization, bypassing the need for the GIL entirely.
Second, jit functions used as first-class functions can now raise exceptions.
Before this improvement, they were subject to the same restrictions as
@cfunc
decorated functions, where any exceptions raised were ignored.
(PR-#9077)
Allow caching of Numba functions within Zip files
This change enables Numba functions imported from a file within a Zip archive to be cached, by recognizing a Zip file and using a user-wide cache directory for the cache. Previously, Numba would fail.
For context, Zip archives are a supported-but-less-common way to distribute Python packages, and heavily used in PySpark.
(PR-#9630)
Improvements in how Pass Manager objects are created for optimizations
Move creation of ModulePassManager
object to _optimize_final_module
function, preventing the usage of the same pass manager object for
compiling multiple Python functions. This would allow for better control
while optimizing unrelated modules and possibly under different settings
(degree of vectorization, optimization level, etc.).
(PR-#9670)
Fixed typed.List __repr__()
to display ellipsis appropriately
typed.List __repr__()
has been fixed to display the list elements
without appending the ellipsis at the end, up until a maximum of 1000 elements.
Previously, the list repr
would append the ellipsis at the end of the list
regardless of the number of elements in the list.
(PR-#9693)
NumPy Support
Added support for np.setdiff1d()
, np.setxor1d()
, and np.in1d()
functions, as well as argument assume_unique
in np.intersect1d()
Support is added for: numpy.setdiff1d()
, np.setxor1d()
, np.in1d()
, and np.isin()
; and the argument assume_unique
in np.intersect1d()
.
For np.in1d()
, and np.isin()
, the keyword kind
is not supported, and the behaviour reflects that of NumPy prior to version 1.24.
This is equivalent to setting kind="sort"
in NumPy 1.24 and later.
(PR-#9338)
Bug Fixes
memcpy
static buffer content into newly allocated buffer
Fix a bug where the static buffer used to store typecode representation is not
copied to the new allocated buffer as part of a realloc
operation.
(PR-#9119)
Fix parfor hoisting
Traverse blocks in the right order so that getattrs will precede calls so that the object of the getattr can be marked as multiply defined.
(PR-#9397)
Fix ParallelAccelerator hoisting logic bug
A bug in the hoisting logic of the ParallelAccelerator is fixed. The bug caused invalid hoisting of operations that depended on non-hoistable operations, leading to incorrect execution. With this fix, the hoisting logic now correctly identifies and handles dependencies on non-hoistable operations, ensuring that operations are hoisted and executed correctly.
(PR-#9586)
Fix calls to numpy.random
distributions with size=()
Calling any of the numpy.random
distributions with size=()
is
now supported; previously it used to raise a TypingError
while
being supported by NumPy.
(PR-#9636)
Fix incorrect return type of numpy.sum
on boolean arrays
Calling numpy.sum
with axis
parameter on boolean arrays incorrectly
returns bool type, while it should return int type. Consequently,
calling numpy.count_nonzero
on boolean arrays also incorrectly returns
bool type. This is now fixed.
(PR-#9705)
Fixed numerical error and infinite loop bug in numpy.random.Generator.binomial
A bug impacting the correctness of numerical results is fixed alongside an issue which led to executing an infinite loop under specific circumstances most easily triggered by the aforementioned correctness bug.
(PR-#9747)
Fix 0.60.0 objectmode fallback regression due to bug in label renaming
A regression in objectmode fallback introduced in Numba 0.60 is fixed. The issue relates to the “label renaming” code mutating the IR directly opposed to constructing new terminator nodes, the mutations would impact copies of the IR as present in objectmode fallback.
(PR-#9755)
Fix Python reference leaks in unboxing of numpy.random.Generator
instances
Some Python reference leaks in the unboxing of numpy.random.Generator
instances have been fixed. Note that it was actually the referenced
numpy.random.BitGenerator
that was leaking on unboxing, but it is rare to
use these objects themselves as arguments.
(PR-#9756)
Fix excessive memory use/poor memory behaviour in the dispatcher for non-fingerprintable types
In the case of repeated dispatch on non-fingerprintable types, the dispatcher now uses memory in proportion to the number of unique types seen opposed to in proportion to the number of types in total.
(PR-#9757)
Fix miscompile in branch pruning of SSA form IR
A miscompile occurring when a binop expression with constant arguments is used as a predicate in SSA form IR is now fixed.
(PR-#9758)
Fix regression in type-inference for star-arg arguments
A regression, that occurred between versions 0.59.0 and 0.60.0, in the type-inference associated with star-arg arguments has been fixed. The cause of the regression was the code for star-args handling in type-inference not being updated following the switch to use new-style error handling by default.
(PR-#9799)
Changes
Removal of experimental RVSDG frontend
The experimental RVSDG frontend has been removed from the main Numba codebase. This strategic decision allows for more focused and independent development of the RVSDG frontend as a reusable component. Future development and updates will be available at https://github.com/numba/numba-rvsdg and other new repositories as they are developed.
(PR-#9738)
POWER Support Update
The Numba maintainers have not been actively testing or building packages for the POWER architecture for some time. The code will be retained to ensure compatibility with Linux distributions that may still support Power8, but POWER support is now downgraded to unofficial status.
(PR-#9763)
Disabling sys.monitoring
support by default
The sys.monitoring
support is disabled by default due to compatibility issues
with native code. In Python 3.12, the implementation and documentation lacks
clarity on native code support, which led to tools making incorrect assumptions
about Python frames and code objects. While Python 3.13 improves this situation,
many tools have not yet adapted to these changes. Consequently, tools may crash
when monitoring Numba-compiled functions. To address this, Numba disables
sys.monitoring
by default. Users can opt-in by setting the environment
variable NUMBA_ENABLE_SYS_MONITORING
.
(PR-#9780)
Deprecations
Pull-Requests:
PR #9076: Add shape context to slicing errors (kklocker guilhermeleobas)
PR #9077: Enable inlining of first-class function when it is statically known to be a dispatcher (sklam)
PR #9119: memcpy static buffer content into newly allocated buffer (guilhermeleobas)
PR #9295: Improve reorderable ufunc support (guilhermeleobas)
PR #9297: Add axis support to np.take (guilhermeleobas)
PR #9338: Add np.in1d, np.isin, np.setxor1d, np.setdiff1d, extend np.intersect1d. (synapticarbors jaredjeya)
PR #9397: Reorder block traversal order for correct hoisting. (DrTodd13)
PR #9495: Schedule guvectorize’d functions over dask.distributed (crusaderky)
PR #9508: Add compile-time coverage for compiled code (sklam)
PR #9543: Prevent setting an undeclared attribute in Flags. (sklam)
PR #9575: initialize 0.61.0dev0 : bump llvmlite to next dev version (esc)
PR #9583: Remove resolve_argument_type() from typing context (gmarkall)
PR #9593: Explicitly state that del is unsupported (gmarkall)
PR #9613: Move a couple of CUDA-specific items into the CUDA target (gmarkall)
PR #9617: Cherry-Pick: Merge pull request #9568 from esc/fix_parfors_test_sigabrt (esc)
PR #9629: Add CUDA target implementation to sysinfo and module (gmarkall)
PR #9630: Allow numba functions within zip files to be cached (max-sixty)
PR #9636: Fix #8975: TypingError raised when calling any of the np.random distributions with size being an empty tuple (NSchiffmacher)
PR #9643: Fix pythonapi wrapper for some PyTuple API (sklam)
PR #9662: Type system implementation #1: Added initial implementation for a new type system using redundancies. (kc611)
PR #9666: Trigger towncrier workflow when label changes (sklam)
PR #9670: Move creation of mpm to optimize_final_module (yashssh)
PR #9686: Type system implementation #1: Added initial implementation for a new type system using redundancies. (kc611)
PR #9693: Fix #9677. Fixed list repr in ipython environments (kc611 alok-m)
PR #9705: Fix sum_expand return_type missing cast to integer for bool arrays (luyiming)
PR #9715: Replace uses of pprint.pformat for _lazy_pformat in logging (srilman)
PR #9718: Replace find_topo_order with an iterative implementation (njriasan)
PR #9719: add supported np.trapezoid (holymonson)
PR #9727: Revert Junit XML PR that may be causing buildfarm issue related to multiprocessing.Pool error (sklam)
PR #9739: Update the minimum supported NumPy to 1.24 (kc611)
PR #9747: Fix two bugs in Generator.binomial(). (stuartarchibald)
PR #9755: Fix issue with IR mutation in label renaming. (stuartarchibald)
PR #9756: Fix PyRef leaks in unboxing of np.random.Generator (stuartarchibald)
PR #9757: Fix some memory leaks/poor memory behaviour (stuartarchibald)
PR #9758: Fix miscompile in branch pruning of SSA form IR. (stuartarchibald)
PR #9772: Emit warnings when missing authors are dectected in gitlog2changelog (kc611)
PR #9773: Remove old-style captured errors for 0.61 (gmarkall)
PR #9774: Test on gpuCI with supported NumPy and Python versions (gmarkall)
PR #9799: Fix regression in exception handling against 0.60. (stuartarchibald)