Skip to content

Implement filter selector strings without the DPC++ extension - #2420

Open
ndgrigorian wants to merge 6 commits into
masterfrom
implement-custom-filter-string
Open

ndgrigorian wants to merge 6 commits into
masterfrom
implement-custom-filter-string

Conversation

@ndgrigorian

@ndgrigorian ndgrigorian commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

This PR proposes a dpctl implementation of filter selector strings, as sycl::ext::oneapi::filter_selector is deprecated in DPC++ 2026.2. dpctl_filter_selector now parses filter strings and matches devices itself, keeping the syntax of the extension and ranking matches by default_selector_v

Device numbers are resolved when the selector is created, so DPCTLDeviceSelector_Score gives correct results for numbered filters, and a list of filters such as "0,1" now selects devices 0 and 1 (the extension selected devices 0 and 2)

This PR also adds custom as a device type in filter strings, so that SyclDevice(d.filter_string) == d holds for custom devices, and makes SyclDevice.filter_string and SyclDevice.get_filter_string raise ValueError for backends and device types that can not be expressed in a filter string, instead of returning a string containing unknown

  • 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?

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

@coveralls

coveralls commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 75.768% (+0.6%) from 75.173% — implement-custom-filter-string into master

ndgrigorian added a commit that referenced this pull request Nov 5, 2026
@ndgrigorian
ndgrigorian force-pushed the implement-custom-filter-string branch from bd44ff9 to 24037ba Compare November 5, 2026 00:50
ndgrigorian added a commit that referenced this pull request Nov 5, 2026
@ndgrigorian
ndgrigorian force-pushed the implement-custom-filter-string branch from 24037ba to d737a4e Compare November 5, 2026 17:33

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

One comment on the tests below:

ndgrigorian added a commit that referenced this pull request Nov 6, 2026
@ndgrigorian
ndgrigorian force-pushed the implement-custom-filter-string branch from d737a4e to 08612c3 Compare November 6, 2026 19:57

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

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

LGTM
Thank you @ndgrigorian!

zcorio added a commit to zcorio/scikit-learn-intelex that referenced this pull request Nov 30, 2026
…om DPCTL

Implement SYCL filter selector strings with the SYCL 2020 callable
device selector API, adapted from IntelPython/dpctl#2420, instead of
the deprecated sycl::ext::oneapi::filter_selector extension, which
fails the build with -Werror on newer ICX.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Zachary Corio <zachary.corio@intel.com>
@david-cortes-intel

Copy link
Copy Markdown
Contributor

Copy-pastying a comment from the bot in sklearnex PR uxlfoundation/scikit-learn-intelex#3574 that copies this:
https://github.com/uxlfoundation/scikit-learn-intelex/pull/3574/changes#r4748571369

On a CPU-only system, gpu:0,: can create a CPU queue. The parser drops the nonexistent gpu:0 term but keeps : as a filter with no constraints.

I haven't verified whether the comment is right or not.

david-cortes-intel pushed a commit to uxlfoundation/scikit-learn-intelex that referenced this pull request Dec 1, 2026
…sing from DPCTL (#3574)

* Replace deprecated sycl filter_selector with filter string parsing from DPCTL

Implement SYCL filter selector strings with the SYCL 2020 callable
device selector API, adapted from IntelPython/dpctl#2420, instead of
the deprecated sycl::ext::oneapi::filter_selector extension, which
fails the build with -Werror on newer ICX.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Zachary Corio <zachary.corio@intel.com>

* Include charconv only in the data-parallel build, where it is available and used

The filter selector code using these headers is compiled only under
ONEDAL_DATA_PARALLEL; unconditional includes broke the host backend
build with GCC versions that lack charconv.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Zachary Corio <zachary.corio@intel.com>

* Parse device numbers without std::from_chars

The CI toolchain's libstdc++ predates charconv, so neither GCC nor ICX
(which uses the system libstdc++ on Linux) can include it. A manual
digit loop with an overflow guard has the same semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Zachary Corio <zachary.corio@intel.com>

---------

Signed-off-by: Zachary Corio <zachary.corio@intel.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ndgrigorian added a commit that referenced this pull request Dec 2, 2026
@ndgrigorian
ndgrigorian force-pushed the implement-custom-filter-string branch from 3582824 to a332822 Compare December 2, 2026 08:28
@ndgrigorian

Copy link
Copy Markdown
Collaborator Author

I haven't verified whether the comment is right or not.

It was correct but DPC++ did the same. I adjusted it to no longer work.

DPC++ 2026.2 deprecates sycl::ext::oneapi::filter_selector.
dpctl_filter_selector now parses filter strings and matches devices
itself, keeping the extension's syntax and default_selector_v ranking.

Device numbers are resolved once at construction, counted the same way
as SyclDevice.filter_string. The selector is now stateless, so
DPCTLDeviceSelector_Score gives correct results for numbered filters,
and overlapping filters such as "0,1" select devices 0 and 1.
SyclDevice.filter_string and get_filter_string used to return "unknown"
for backends and device types without a filter string spelling.
The filter selector accepts "custom", and filter_string of a custom
device is "backend:custom:N".
Catches selectors whose scores depend on earlier calls, even with one device.
A filter made only of ":" separators, such as ":" or "gpu:0,:", matched
any device, so a missing gpu:0 fell back to whatever else was available.
Such filters are now malformed.
@ndgrigorian
ndgrigorian force-pushed the implement-custom-filter-string branch from a332822 to 15bc7de Compare December 2, 2026 22:14

This branch has not been deployed

No deployments
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.

4 participants