[SYCL] Lookup versioned OpenCL adapter library as fallback #20254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a cherry-pick of #20229
Problem
SYCL RT loads
libur_adapter_opencl.so
(
llvm/sycl/include/sycl/detail/os_util.hpp
Line 129 in 0ff1a5c
libur_adapter_opencl.so.0
(
llvm/unified-runtime/source/loader/ur_manifests.hpp
Line 35 in 0031df1
dlopen()
withRTLD_NOLOAD
flag, which causesdlopen()
to fail if this library wasn’t loaded before.Now, in our Linux compiler packages,
libur_adapter_opencl.so
andlibur_adapter_opencl.so.0
are symlinked so they are the same file, that’s why call todlopen()
in SYCL RT succeeds. However, the problem happens with DPCPP PyPi package, which doesn’t support symlinked files, so call to dlopen() fails because these are two different files.Proposed solution
Lookup
libur_adapter_opencl.so.0
as fallback.Other potential solutions
libur_adapter_opencl.so.0
always? Because that causes SYCL unit tests, which rely on mocked OpenCL adapter to fail. In unit tests, we actually want SYCL RT to loadlibur_adapter_opencl.so
(mocked) and UR to loadlibur_adapter_opencl.so.0
, both of which are different files.RTLD_NOLOAD
flag? When using PyPi package, that can cause SYCL RT and UR to load two OpenCL adapters libraries. I'm not an expert on loaders, but that might lead to more bugs if, for example, OpenCL adapter functions that SYCL RT calls have side effects.