Skip to content

Enable free threading support - #255

Merged
ndgrigorian merged 10 commits into
IntelPython:mainfrom
vchamarthi:feat/free-threaded-python
Sep 2, 2026
Merged

Enable free threading support#255
ndgrigorian merged 10 commits into
IntelPython:mainfrom
vchamarthi:feat/free-threaded-python

Conversation

@vchamarthi

Copy link
Copy Markdown
Contributor

Adds free-threaded (GIL-disabled) CPython 3.14t support to mkl_umath by declaring both the Cython extension and the hand-written _ufuncs C extension as free-threading compatible, aligning build tooling requirements, and expanding CI/conda packaging to cover both CPython 3.14 (GIL) and 3.14t (free-threaded) variants.

Changes:

  • Mark mkl_umath/src/_patch_numpy.pyx as freethreading_compatible for Cython, and declare Py_MOD_GIL_NOT_USED in the _ufuncs C extension (ufuncsmodule.c) so importing either module no longer re-enables the GIL.
  • Pin Cython to >=3.1.0 across build/packaging (pyproject.toml, both conda recipes, AGENTS.md, README.md).
  • Update conda recipes to require cython >=3.1.0 and remove python-gil pins.
  • Extend conda/pip CI matrices to build/test CPython 3.14 cp314 and cp314t variants and adjust cache/artifact naming accordingly.
  • Add concurrency tests covering multi-threaded ufunc execution and patch/restore state, plus a regression guard asserting the GIL stays disabled on import.

Comment thread mkl_umath/tests/test_freethreading.py Outdated
@antonwolfy antonwolfy added this to the 0.6.0 release milestone Aug 31, 2026

@ndgrigorian ndgrigorian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndgrigorian

Copy link
Copy Markdown
Collaborator

@antonwolfy
if no more comments, I will go ahead and merge this

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndgrigorian
ndgrigorian merged commit 84070fe into IntelPython:main Sep 2, 2026
116 of 126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants