Skip to content

Remove python-gil requirement and enable free-threaded Python#2250

Merged
ndgrigorian merged 34 commits into
masterfrom
feature/enable-free-threaded-python
Jun 18, 2026
Merged

Remove python-gil requirement and enable free-threaded Python#2250
ndgrigorian merged 34 commits into
masterfrom
feature/enable-free-threaded-python

Conversation

@ndgrigorian

@ndgrigorian ndgrigorian commented Feb 17, 2026

Copy link
Copy Markdown
Collaborator

This PR removes the required python-gil dependency from the dpctl conda package workflow and enables free-threaded Python in extension modules

Adjustments are made to the SequentialOrderManager class such that the class is safe in free-threaded, including mutexes in the C++ class as a fall-back in case of (not recommended) simultaneous access to its members and methods

SequentialOrderManager now maintains thread-local storage for individual queue-to-manager-maps, such that each thread has its own manager per queue.

Queue and device caching, meanwhile, are global, to create a concept of default queues and devices that allows operations in extensions like dpnp (which rely on queues being the same for compute follows data) to operate on data passed between threads without copy.

In the futue, per-thread-queues and devices may prove more efficient, in which case, extensions will be asked to be made more robust (checking that context and device are the same, not using queue as a shortcut).

This PR builds on top of work already done removing the tensor submodule, which is pending migration to dpnp

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@ndgrigorian ndgrigorian changed the base branch from master to feature/uncouple-tensor-from-dpctl February 17, 2026 01:29
@ndgrigorian ndgrigorian force-pushed the feature/uncouple-tensor-from-dpctl branch from dcac1f6 to e450664 Compare February 17, 2026 02:08
@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch from 085aece to 5dda977 Compare February 17, 2026 03:12
@github-actions

github-actions Bot commented Feb 17, 2026

Copy link
Copy Markdown

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch 4 times, most recently from 82e9a5e to a1d36ce Compare February 17, 2026 12:06
@ndgrigorian ndgrigorian marked this pull request as ready for review February 18, 2026 04:00
@ndgrigorian

Copy link
Copy Markdown
Collaborator Author

@antonwolfy @vlad-perevezentsev
won't be merged until after tensor submodule move, but take a look when you have time

@ndgrigorian ndgrigorian force-pushed the feature/uncouple-tensor-from-dpctl branch 2 times, most recently from 6a5046b to 7d8bbc8 Compare April 7, 2026 18:36
@ndgrigorian ndgrigorian force-pushed the feature/uncouple-tensor-from-dpctl branch 2 times, most recently from b610ee3 to dd74214 Compare April 13, 2026 16:47
Base automatically changed from feature/uncouple-tensor-from-dpctl to master April 13, 2026 20:20
@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch from 1b70ce6 to 1bc9c3d Compare April 15, 2026 04:18
@coveralls

coveralls commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 75.677% (+0.05%) from 75.632% — feature/enable-free-threaded-python into master

@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch 5 times, most recently from 732f37d to df6f452 Compare April 21, 2026 06:39
Comment thread dpctl/utils/src/sequential_order_keeper.hpp Outdated
Comment thread dpctl/apis/include/dpctl4pybind11.hpp Outdated
Comment thread dpctl/_sycl_queue.pxd Outdated
Comment thread dpctl/_sycl_queue_manager.pyx
Comment thread dpctl/tests/test_sycl_queue_manager.py

@vlad-perevezentsev vlad-perevezentsev 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.

No more comments from my side
LGTM
Thank you @ndgrigorian

Comment thread pyproject.toml Outdated
@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch from e536e7b to 61e7697 Compare June 17, 2026 00:05
@ndgrigorian ndgrigorian force-pushed the feature/enable-free-threaded-python branch from e25bea2 to bd96827 Compare June 18, 2026 04:03
antonwolfy
antonwolfy previously approved these changes Jun 18, 2026

@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.

Thank you @ndgrigorian, LGTM!
I left a couple minor nits more:

Comment thread pyproject.toml Outdated
Comment thread conda-recipe/meta.yaml Outdated
@ndgrigorian ndgrigorian merged commit eedcd2c into master Jun 18, 2026
76 of 81 checks passed
@ndgrigorian ndgrigorian deleted the feature/enable-free-threaded-python branch June 18, 2026 14:51
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.

5 participants