Skip to content

DOC: array API - document support of torch XPU and dpnp - #34021

Merged
betatim merged 6 commits into
scikit-learn:mainfrom
cakedev0:doc/dpnp_xpu_support
May 19, 2026
Merged

betatim merged 6 commits into
scikit-learn:mainfrom
cakedev0:doc/dpnp_xpu_support

Conversation

@cakedev0

Copy link
Copy Markdown
Member

Reference Issues/PRs

Follow-up from #32460 and some fixes.

Also, Pytorch 2.12 was released a few days ago, fixing some issues that were making XPU-float64 tests fail. From the release blog:

This was first implemented for CUDA by Michael Lazos (Meta) (PR #174912), then extended to XPU by Guangye Yu (Intel) (PR #176163), fixing several numerical correctness issues on Intel GPUs.

What does this implement/fix? Explain your changes.

Update the doc to include support of torch XPU and dpnp.

AI usage disclosure:

Used to write the first draft of this PR.

@cakedev0
cakedev0 marked this pull request as ready for review May 15, 2026 10:37
@cakedev0

Copy link
Copy Markdown
Member Author

cc @ogrisel

@ogrisel ogrisel moved this to In Progress in Array API May 15, 2026

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is good for now. If the support of tested libraries and hardware grows bigger in the future, we might consider refactoring this doc to show a table of official library/device/dtype combinations that are officially supported with links to installation instructions and custom CI infra.

Comment thread doc/modules/array_api.rst Resolved

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For information:

Comment thread doc/modules/array_api.rst
GPU tests are manually triggered by maintainers. Intel GPU testing for PyTorch
XPU and dpnp is run on a dedicated self-hosted runner:
`probabl-ai/scikit-learn-intel-workflow
<https://github.com/probabl-ai/scikit-learn-intel-workflow>`_.

@ogrisel ogrisel May 15, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This CI runner is a dedicated laptop with an integrated Intel GPU that sits on my personal office desk for now. We want to keep it isolated from the main scikit-learn CI to limit security impacts: in particular it's not possible to trigger it on usual pull request but only via manual trigger by a limited list of authorized GitHub accounts. We can grant access to trigger the CI to scikit-learn maintainers on request.

On the longer term, we plan to move this runner to a dedicated server available with Probabl and/or Intel supporting the hosting fees.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the long term would we be able to trigger it via a label like the CUDA CI? And if yes, should we move to a label that triggers both? With a name that won't need changing when we add the third kind of CI. Maybe something like "Accelerator CI", "Special CI"?

@cakedev0 cakedev0 May 22, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

using this comment to ping everyone I gave access to the scikit-learn intel CI repo, more context in this thread, this PR and in the repo's readme

In the long term would we be able to trigger it via a label like the CUDA CI?

Yes I think so. Once we are confortable having a CI workflow running on self-hosted runners in the scikit-learn repo I guess.
In the meantime, I added you @betatim, @virchan, @lucyleeow and @OmarManzoor as collaborators on the scikit-learn intel CI repo so you can all trigger the workflow when needed.
Members of probabl have access too (cc @StefanieSenger, @jeremiedbb).

And if yes, should we move to a label that triggers both?

Why not, "Accelerator CI" SGTM.

@ogrisel

ogrisel commented May 15, 2026 •

Copy link
Copy Markdown
Member

@virchan virchan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks, @cakedev0!

@ogrisel, could we merge this?

@betatim

betatim commented May 18, 2026

Copy link
Copy Markdown
Member

I'm not a huge fan of filling our docs with essentially copy&paste's of the same "how to use this with $array-producing-library" - the whole point of array API is that it is the same, except for the type of the input arrays. Having it replicated several times takes up a lot of space and adds "noise" because to the not-so-attentive-reader it all looks the same.

We do need an easy to find list of array libraries we support. We have it in a "note" which I only spotted after scrolling to the end of the page and back up (even though I know it exists somewhere ...). Having that as a table close to the top is probably the way to solve this problem/todo item. Then following that table with the current "Enabling array API support" and a "Example usage" with code. Which library to use in the example? I don't know. My suggestion would be PyTorch because it is probably what most human readers use and with a small side sentence we can say "Change device=<foo> to use one of the other supported device ." - So we get a code example that hopefully many people can actually use and we can mention all the devices that are supported.

In the table we can have columns: name, supported, install instructions, notes

The "supported" column could be redundant but maybe it is useful to indicate that a library is supported but with caveats. The caveats appear as a link to a section with caveats about that library in the "notes" column. The "install instructions" should be a link to instructions hosted by the library

WDYT about this?

Ideally we could do this before the release, hopefully the above is enough of a prompt for our AI friends to generate a first draft

@cakedev0

Copy link
Copy Markdown
Member Author

@betatim would you agree on merging the PR as it is and opening an issue about revamping the array API doc?

I prefer to avoid mixing a "refactor" and "feature" in the same PR.

@ogrisel

ogrisel commented May 19, 2026

Copy link
Copy Markdown
Member

Personally I am fine with a two stage process. A first PR that adds the new material (this one). And a second one dedicated to the content structure refactoring to improve readability and reduce verbosity/redundancy.

@betatim

betatim commented May 19, 2026

Copy link
Copy Markdown
Member

If we all agree to do the two steps then it is fine with me. Adding one more section like we do in this PR is probably still fine, but it feels like we are approaching the point where we can't keep adding.

I wonder a little bit how much more/not more work it would be to do it all in one step, but I can also see bike shedding over how to do the refactor :D

@betatim
betatim merged commit 4c88acc into scikit-learn:main May 19, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Array API May 19, 2026
@jeremiedbb jeremiedbb mentioned this pull request Jun 1, 2026
16 tasks done
jeremiedbb pushed a commit that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants