Skip to content

RuntimeError: UR error with XPU #149953

@idkSeth

Description

@idkSeth

🐛 Describe the bug

Tried with the current stable version torch 2.6.0+xpu and latest nightly torch 2.8.0.dev20250321+xpu.

I get RuntimeError: UR error whenever I try to use XPU for various tasks.

Minimal code to reproduce:

import torch
t = torch.tensor([0], device="xpu")
t.to(torch.float16)

Error:

Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    t.to(torch.float16)
    ~~~~^^^^^^^^^^^^^^^
RuntimeError: UR error

Setting oneAPI env variables before results in the following error when importing torch:


ImportError: /opt/intel/oneapi/compiler/2025.1/lib/libur_loader.so.0: version `LIBUR_LOADER_0.10' not found (required by /media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../libsycl.so.8)

torch.xpu.is_available() returns True

I have tried the solutions suggested in #147226 and #144143 by updating conda, removing libstdc++.so.6 and updating libstdcxx.

Output of SYCL_UR_TRACE=1 python -c "import torch; print(torch.xpu.is_available())" with the latest nightly version:

<LOADER>[INFO]: loaded adapter 0x0x41a2cd60 (libur_adapter_level_zero.so.0)
<LOADER>[INFO]: loaded adapter 0x0x42206580 (libur_adapter_opencl.so.0)
<LOADER>[INFO]: failed to load adapter 'libur_adapter_cuda.so.0' with error: libur_adapter_cuda.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_cuda.so.0' with error: /media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_cuda.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter 'libur_adapter_hip.so.0' with error: libur_adapter_hip.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_hip.so.0' with error: /media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_hip.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter 'libur_adapter_native_cpu.so.0' with error: libur_adapter_native_cpu.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_native_cpu.so.0' with error: /media/seth/Main/conda_pytorch/lib/python3.12/site-packages/torch/lib/../../../../../lib/libur_adapter_native_cpu.so.0: cannot open shared object file: No such file or directory
True

With torch 2.6.0+xpu

[W326 00:19:55.428225956 OperatorEntry.cpp:154] Warning: Warning only once for all operators,  other operators may also be overridden.
  Overriding a previously registered kernel for the same operator and the same dispatch key
  operator: aten::_validate_compressed_sparse_indices(bool is_crow, Tensor compressed_idx, Tensor plain_idx, int cdim, int dim, int nnz) -> ()
    registered at /pytorch/build/aten/src/ATen/RegisterSchema.cpp:6
  dispatch key: XPU
  previous kernel: registered at /pytorch/build/aten/src/ATen/RegisterCPU.cpp:30477
       new kernel: registered at /build/intel-pytorch-extension/build/Release/csrc/gpu/csrc/aten/generated/ATen/RegisterXPU.cpp:468 (function operator())
<LOADER>[INFO]: loaded adapter 0x0x43f2940 (libur_adapter_level_zero.so.0)
<LOADER>[INFO]: loaded adapter 0x0x12190180 (libur_adapter_opencl.so.0)
<LOADER>[INFO]: failed to load adapter 'libur_adapter_cuda.so.0' with error: libur_adapter_cuda.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_cuda.so.0' with error: /media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_cuda.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter 'libur_adapter_hip.so.0' with error: libur_adapter_hip.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_hip.so.0' with error: /media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_hip.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter 'libur_adapter_native_cpu.so.0' with error: libur_adapter_native_cpu.so.0: cannot open shared object file: No such file or directory
<LOADER>[INFO]: failed to load adapter '/media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_native_cpu.so.0' with error: /media/seth/Second/conda_intel-pytorch/lib/python3.13/site-packages/torch/lib/../../../../../lib/libur_adapter_native_cpu.so.0: cannot open shared object file: No such file or directory
True

Versions

Attached are the outputs from both versions of torch installed without setting oneAPI env variables.

latest_nightly.txt
stable.txt

cc @seemethere @malfet @osalpekar @atalman @gujinghui @EikanWang @fengyuan14 @guangyey

Metadata

Metadata

Assignees

Labels

module: binariesAnything related to official binaries that we release to usersmodule: xpuIntel XPU related issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions