Version 0.61.0rc1 (25 November 2024)

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 to 1 (on) by default. Switching it to 0 (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)

Update the minimum supported NumPy version to 1.24

This release updates the minimum supported version of NumPy to 1.24.

(PR-#9739)

Added Support for NumPy 2.1

This release adds support for NumPy 2.1 (excluding the NEP-050 semantics).

(PR-#9741)

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)

Add axis support to np.take

Add support for axis keyword in np.take.

(PR-#9297)

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)

Use of dead branch pruning improved

Dead-branch pruning use is improved to support cases when the predicate expression is dependent on a variable that later changes type.

(PR-#9711)

find_topo_sort reliabililty improvement

Improves the reliability of the find_topo_sort function for complex CFGs (typically through generated code) by replacing the recursive post order traversal with an iterative one. This removes a risk of hitting the Python recursion limit.

(PR-#9718)

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)

Support for np.trapezoid

Add support for NumPy 2.0 new function numpy.trapezoid.

(PR-#9719)

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

Built-in CUDA target deprecation

The CUDA target built in to Numba (under numba.cuda) is deprecated in favour of further development in the NVIDIA numba-cuda package. Backward compatibility is maintained between numba-cuda and numba.cuda, and no user code changes are needed.

(PR-#9768)

Removal of NUMBA_CAPTURED_ERRORS

The NUMBA_CAPTURED_ERRORS environment variable and CAPTURED_ERRORS configuration variable have been removed, as per the deprecation schedule.

(PR-#9773)

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 #9600: Update release checklist post 0.60.0rc1 (esc)

  • PR #9613: Move a couple of CUDA-specific items into the CUDA target (gmarkall)

  • PR #9614: Backport #9596 into main (gmarkall kc611)

  • PR #9617: Cherry-Pick: Merge pull request #9568 from esc/fix_parfors_test_sigabrt (esc)

  • PR #9619: remove rc1 suffix from checklist (esc)

  • PR #9621: Misc/changelog 0.60.0 for main (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 #9631: Move Azure to use macos-12 (gmarkall)

  • 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 #9663: Fixes for LLVM 15 (gmarkall)

  • PR #9666: Trigger towncrier workflow when label changes (sklam)

  • PR #9670: Move creation of mpm to optimize_final_module (yashssh)

  • PR #9675: Fix compiler error on RTD (sklam)

  • PR #9682: Python 3.13 support (sklam)

  • PR #9683: Fix C99 I not working with NumPy 2.0.1 (sklam)

  • PR #9686: Type system implementation #1: Added initial implementation for a new type system using redundancies. (kc611)

  • PR #9691: Fix #9678. parfor issue with build_map (sklam)

  • PR #9693: Fix #9677. Fixed list repr in ipython environments (kc611 alok-m)

  • PR #9701: update flake8 version in pre-commit config (esc)

  • PR #9705: Fix sum_expand return_type missing cast to integer for bool arrays (luyiming)

  • PR #9709: activate compilers for linux-aarch64 (esc)

  • PR #9711: Add dead-branch-prune pass after SSA pass (sklam)

  • 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 #9726: Remove Python 3.9 support (kc611)

  • PR #9727: Revert Junit XML PR that may be causing buildfarm issue related to multiprocessing.Pool error (sklam)

  • PR #9738: Revert RVSDG frontend. (sklam)

  • PR #9739: Update the minimum supported NumPy to 1.24 (kc611)

  • PR #9741: Add Support for NumPy 2.1 (kc611)

  • PR #9743: Fixed GHA versions in towncrier script (kc611)

  • PR #9746: Move Azure to use macos-13 (gmarkall)

  • 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 #9761: Add CI for py313 (sklam)

  • PR #9763: Update docs regarding power8 support. (sklam)

  • PR #9768: Deprecation of built-in CUDA target (gmarkall)

  • 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 #9780: Default to turn off sys.monitoring (sklam)

  • PR #9799: Fix regression in exception handling against 0.60. (stuartarchibald)