oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
211 stars 90 forks source link

The level zero laoder should look into LIBRARY_PATH to find shared objects #143

Closed ForceFaction closed 5 months ago

ForceFaction commented 5 months ago

This only applies to linux (since i only use linux).

I'm using a linux distro (Guix similar to Nix OS) which has non-standard paths for everything, which is why it releis on environment varibales to properly point programs to the correct files. Now after compiling level-zero and the compute-runtime strace shows the following:

openat(AT_FDCWD, "/gnu/store/16zls6rxxma08js8f3rkgmrg99r7qrqr-gcc-11.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../libze_intel_gpu.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libze_intel_gpu.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libze_intel_gpu.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

So the loader only searches incorrect paths. Since LIBRARY_PATH is set such that it contains the searched libze_intel_gpu.so it should be honored. I found in the code that there is ZE_ENABLE_ALT_DRIVERS which indeed could be used instead, but a comment in the code says it is only for debugging purposes, so i guess it might change or vanish without notice.

bmyates commented 5 months ago

Have you tried LD_LIBRARY_PATH That should work

ForceFaction commented 5 months ago

LD_LIBRARY_PATH is not honored either. The reason seems simple to me: it isn't ld.so that's trying to lookup that shared object the level zero loader itself looks for it.

nevermind i'm just stupid.