Skip to content

Conversation

@david-cortes-intel
Copy link
Contributor

Description

Sycl queues on GPU are managed through global objects, but since the introduction of array API, some operations might be offloaded to other libraries that raise the GIL during their operations, and might thus lead to conflicts if sklearnex objects are used in parallel through python threads instead of being in separate processes.

This PR fixes potential thread racing issues by making the queues thread-local, with a helper class as suggested by @ahuber21 .


Checklist:

Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
@david-cortes-intel david-cortes-intel added bug Something isn't working Array API labels Dec 10, 2025
@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@david-cortes-intel david-cortes-intel changed the title FIX: Make global queue objects thread-local [Do NOT merge yet] FIX: Make global queue objects thread-local Dec 10, 2025
@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
onedal/utils/_sycl_queue_manager.py 82.35% 3 Missing ⚠️
Flag Coverage Δ
azure 80.56% <83.33%> (+0.01%) ⬆️
github 82.24% <83.33%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sklearnex/_device_offload.py 84.61% <100.00%> (ø)
onedal/utils/_sycl_queue_manager.py 81.81% <82.35%> (+0.99%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@david-cortes-intel
Copy link
Contributor Author

/intelci: run

@david-cortes-intel
Copy link
Contributor Author

CI error on CPU appears to happen elsewhere too, likely not related to the changes here.

@david-cortes-intel david-cortes-intel changed the title [Do NOT merge yet] FIX: Make global queue objects thread-local FIX: Make global queue objects thread-local Dec 12, 2025
@david-cortes-intel david-cortes-intel marked this pull request as ready for review December 12, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Array API bug Something isn't working

1 participant