Skip to content

[SYCL][UR] Improve diagnostics for missing platforms in sycl-ls - #23542

Open
inteltdelisle wants to merge 2 commits into
intel:syclfrom
inteltdelisle:unified-runtime/verbose_sycl_ls
Open

inteltdelisle wants to merge 2 commits into
intel:syclfrom
inteltdelisle:unified-runtime/verbose_sycl_ls

Conversation

@inteltdelisle

@inteltdelisle inteltdelisle commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

When a backend's platforms or devices fail to show up in sycl-ls, users currently get little indication of where in the stack things went wrong. This change adds some logging and guidance to help narrow it down:

  • UR loader: log each adapter that is loaded (statically or dynamically) and the total number of adapters loaded.
  • UR adapters (CUDA, HIP, Level Zero, OpenCL, Native CPU, Offload): log the number of platforms each adapter initializes at INFO level. The Level Zero message is raised from DEBUG to INFO for consistency.
  • OpenCL adapter: log a message when clGetPlatformIDs fails or returns no platforms, and when a platform reports CL_DEVICE_NOT_FOUND.
  • sycl-ls --verbose: print backend-specific hints at the end of the output (clinfo, nvidia-smi, rocminfo/amd-smi, ZE_ENABLE_LOADER_DEBUG_TRACE, strace).

The new messages can be seen with UR_LOG_LOADER / UR_LOG_ set to "level:info;output:stdout" (or similar).

This doesn't fully resolve the issue, since sycl-ls still can't tell users why a backend is missing, but it should make the cause much easier to find.

Refs: #22313

When a backend's platforms or devices fail to show up in sycl-ls, users
currently get little indication of where in the stack things went wrong.
This change adds some logging and guidance to help narrow it down:

* UR loader: log each adapter that is loaded (statically or dynamically)
  and the total number of adapters loaded.
* UR adapters (CUDA, HIP, Level Zero, OpenCL, Native CPU, Offload): log
  the number of platforms each adapter initializes at INFO level. The
  Level Zero message is raised from DEBUG to INFO for consistency.
* OpenCL adapter: log an error when clGetPlatformIDs fails or returns no
  platforms, and when a platform reports CL_DEVICE_NOT_FOUND.
* sycl-ls --verbose: print backend-specific hints at the end of the
  output (clinfo, nvidia-smi, rocminfo/amd-smi,
  ZE_ENABLE_LOADER_DEBUG_TRACE, /dev/dri/renderD* permissions, strace),
  and say which UR logger messages point to a configuration problem.

The new messages can be seen with UR_LOG_LOADER / UR_LOG_<ADAPTER>
set to "level:info;output:stdout" (or similar).

This doesn't fully resolve the issue, since sycl-ls still can't tell
users *why* a backend is missing, but it should make the cause much
easier to find.

Refs: intel#22313

Signed-off-by: Delisle, Thierry <thierry.delisle@intel.com>
Comment thread unified-runtime/source/adapters/level_zero/common/adapter.cpp Outdated

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

CUDA/HIP/NativeCPU/OpenCL LGTM

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

The description says more than the code does. It says:

  • OpenCL adapter logs an error when clGetPlatformIDs fails and for CL_DEVICE_NOT_FOUND,
  • sycl-ls prints a hint about permissions on /dev/dri/renderD*,
  • sycl-ls explains which UR logger messages point to a configuration problem.

I cannot find any of these in the code. The OpenCL adapter adds only one INFO message ("CL No platforms found").
Please update the description (and the commit message) to match the code, or add the missing parts.

Comment thread sycl/tools/sycl-ls/sycl-ls.cpp Outdated
cl_uint NumPlatforms = 0;
cl_int Result = ocl::clGetPlatformIDs_ptr(0, nullptr, &NumPlatforms);
if (Result != CL_SUCCESS || NumPlatforms == 0) {
UR_LOG(INFO, "CL No platforms found (Result = {})", Result);

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.

Nit: the new messages use different styles:

  • CUDA Initialized {} platforms
  • HIP Initialized {} platforms
  • LZ Initialized {} platforms
  • CL Initialized {} platforms
  • CL No platforms found (Result = {})
  • NATIVE_CPU: 1 platform available
  • OFFLOAD: {} platforms available

Could you use one style for all of them? For example:
<Adapter name>: found {} platforms.
Also "OpenCL" is easier to understand than "CL".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

UR_ASSERT(pNumPlatforms || phPlatforms, UR_RESULT_ERROR_INVALID_VALUE);

if (pNumPlatforms) {
UR_LOG(INFO, "NATIVE_CPU: 1 platform available");

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.

Nit: this is inside urPlatformGet(), which is called many times.
So this message is printed again and again. The other adapters print it only once,
during initialization. Could you move it there, or keep it but know it will repeat?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm missing something, I don't believe this particular adapter has initialization code. So I moved the log into a static initilization.

ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) {

if (pNumPlatforms) {
UR_LOG(INFO, "OFFLOAD: {} platforms available", Adapter->Platforms.size());

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.

Nit: this is inside urPlatformGet(), which is called many times.
So this message is printed again and again. The other adapters print it only once,
during initialization. Could you move it there, or keep it but know it will repeat?

Comment thread sycl/tools/sycl-ls/sycl-ls.cpp
@inteltdelisle

Copy link
Copy Markdown
Contributor Author

The description says more than the code does. It says:

  • OpenCL adapter logs an error when clGetPlatformIDs fails and for CL_DEVICE_NOT_FOUND,
  • sycl-ls prints a hint about permissions on /dev/dri/renderD*,
  • sycl-ls explains which UR logger messages point to a configuration problem.

I cannot find any of these in the code. The OpenCL adapter adds only one INFO message ("CL No platforms found"). Please update the description (and the commit message) to match the code, or add the missing parts.

Updated the description:

  • OpenCL logs a message, I forgot I downgraded this to info.
  • I believe the code already checked for /dev/dri/renderD* in checkRenderGroupPermission.
  • The hints at the end used to point to existing logger messages, but I felt they could go out of sync too easily.

Signed-off-by: Delisle, Thierry <thierry.delisle@intel.com>

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.

3 participants