Commit 75e9e73
authored
[SYCL] Lookup versioned OpenCL adapter library as fallback (#20229)
**Problem**
SYCL RT loads `libur_adapter_opencl.so`
(https://github.com/intel/llvm/blob/0ff1a5c2b4e4bc56799ec2dd17a89c3c57608890/sycl/include/sycl/detail/os_util.hpp#L129)
while UR loads `libur_adapter_opencl.so.0`
(https://github.com/intel/llvm/blob/0031df16e41bd0665e85af635b7bfd4e187ce7cd/unified-runtime/source/loader/ur_manifests.hpp#L35).
Note that SYCL RT calls `dlopen()` with `RTLD_NOLOAD` flag, which causes
`dlopen()` to fail if this library wasn’t loaded before.
Now, in our Linux compiler packages, `libur_adapter_opencl.so` and
`libur_adapter_opencl.so.0` are symlinked so they are the same file,
that’s why call to `dlopen()` 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**
1. Why not just load `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 load `libur_adapter_opencl.so`
(mocked) and UR to load `libur_adapter_opencl.so.0`, both of which are
different files.
2. Why not remove `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.1 parent c355a3d commit 75e9e73
File tree
2 files changed
+54
-34
lines changed- sycl
- include/sycl/detail
- source/detail
2 files changed
+54
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
110 | | - | |
111 | 110 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 111 | + | |
| 112 | + | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
122 | 123 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
127 | 138 | | |
128 | 139 | | |
129 | | - | |
| 140 | + | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 294 | + | |
298 | 295 | | |
299 | | - | |
| 296 | + | |
300 | 297 | | |
301 | | - | |
302 | | - | |
| 298 | + | |
| 299 | + | |
303 | 300 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
310 | 306 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
318 | 316 | | |
319 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
320 | 329 | | |
321 | 330 | | |
322 | 331 | | |
323 | | - | |
324 | 332 | | |
325 | 333 | | |
326 | 334 | | |
| |||
0 commit comments