Skip to content

Fix GIL for fft extensions - #3040

Open
abagusetty wants to merge 6 commits into
IntelPython:masterfrom
abagusetty:fix/gil-release-fft
Open

Fix GIL for fft extensions#3040
abagusetty wants to merge 6 commits into
IntelPython:masterfrom
abagusetty:fix/gil-release-fft

Conversation

@abagusetty

Copy link
Copy Markdown
Contributor
  • 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?

@intel-python-devops

Copy link
Copy Markdown

Can one of the admins verify this patch?

@antonwolfy antonwolfy added this to the 0.21.0 release milestone Aug 24, 2026
@abagusetty

Copy link
Copy Markdown
Contributor Author

Apologies for not covering this in the earlier PRs. This was caught by an application and resulted in this separate PR

@antonwolfy

Copy link
Copy Markdown
Contributor

Apologies for not covering this in the earlier PRs. This was caught by an application and resulted in this separate PR

It's absolutely fine. Thank you pushing the fix.

abagusetty and others added 2 commits August 25, 2026 06:36
usm_ndarray::get_data() goes through the Cython api function
UsmNDArray_GetData, which calls into the Python C-API. Calling it after
py::gil_scoped_release aborts the interpreter with

    Fatal Python error: PyThreadState_Get: the function must be called
    with the GIL held [...] the GIL is released

which crashed every test worker that reached an out-of-place transform.
Read both pointers before the release, matching in_place.tpp.

The GIL test used SyclQueue.wait() as its reference, but by the time it
ran the queue was already drained, so the reference measured no ticks at
all. Compare against a nogil time.sleep() of the same duration instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.482% (+0.005%) from 78.477% — abagusetty:fix/gil-release-fft into IntelPython:master

@abagusetty

Copy link
Copy Markdown
Contributor Author

not sure if the CI is stuck or something

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @abagusetty. The change is very helpful.
The only small nit below.

Comment thread dpnp/backend/extensions/fft/out_of_place.tpp
Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com>
Comment thread dpnp/backend/extensions/fft/out_of_place.tpp Outdated
abagusetty and others added 2 commits August 25, 2026 14:23
Co-authored-by: ndgrigorian <46709016+ndgrigorian@users.noreply.github.com>
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