Skip to content

Avoid warnings from Unified Runtime Level Zero adapter - #2306

Open
ndgrigorian wants to merge 2 commits into
masterfrom
work-around-custom-devices-level-zero
Open

ndgrigorian wants to merge 2 commits into
masterfrom
work-around-custom-devices-level-zero

Conversation

@ndgrigorian

@ndgrigorian ndgrigorian commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator

This PR makes SyclPlatform.get_devices (DPCTLPlatform_GetDevices) return no devices for device_type="custom" on non-OpenCL platforms, without querying the SYCL runtime.

Only OpenCL supports custom devices. Other backends may warn when asked for them: the Unified Runtime Level Zero adapter has no case for UR_DEVICE_TYPE_CUSTOM, so each call prints <UR_LOG_CALLBACK>[WARNING]: Unknown device type twice to stderr while returning no devices. The warning comes from libsycl's logger callback, so it cannot be silenced with UR_LOG_LEVEL_ZERO. OpenCL platforms still forward the request to the runtime.

A test checks that get_devices(device_type="custom") on non-OpenCL platforms returns no devices and prints nothing to stdout or stderr; it fails without this change. The get_devices docstring and the C-API header now note that only OpenCL supports custom devices, and the docstring lists the "automatic" and "custom" values.

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

🤖 Generated with Claude Code

@ndgrigorian
ndgrigorian force-pushed the work-around-custom-devices-level-zero branch from 3892501 to 8954fa2 Compare April 29, 2026 22:42
@github-actions

Copy link
Copy Markdown

@coveralls

coveralls commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 74.813% (-0.08%) from 74.893% — work-around-custom-devices-level-zero into master

BTy == DPCTLSyclBackendType::DPCTL_LEVEL_ZERO)
{
// avoid ugly warnings from unified runtime
return wrap<vecTy>(DevicesVectorPtr);

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.

Any way to cover that in the test?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it isn't obvious how to capture the UR warnings. It might be possible by some gymnastics capturing all stdout, but, then it only applies for Level Zero. I can test a few things first though

@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

only opencl supports custom devices; other backends may warn when
asked for them. add a test that no output is printed, and document
the behavior

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