compat.sycl-runtime: a SYCL artifact can reach its runtime - #354
Merged
Conversation
An mcpp binary on Linux runs under mcpp's own loader, so a soname that is not on its runtime search path is not found at all. A program whose device half was compiled by the `xim:dpcpp` payload links `-lsycl`, which the rule package satisfies at link time from the payload's own directory, and then fails mcpp's runtime closure check: libsycl.so.9 not found on the search path this artifact will actually use. Its PT_INTERP is a private loader, so the host's /usr/lib is NOT consulted This is the same shape compat.cuda-driver and compat.vulkan-runtime have, for the same class of library: one a program reaches through the loader rather than through a header. It declares the payload as an install-time edge, reads the directory back, and links the versioned sonames into a package-owned farm that `runtime.library_dirs` puts on the artifact's search path. Three things it does that the CUDA adapter does not, each measured rather than assumed: EVERY VERSIONED SONAME, NOT JUST libsycl. SYCL's device support is a chain of dlopens -- `libsycl.so.9` loads `libur_loader.so.0`, which loads one `libur_adapter_*.so.0` per back end, and those need `libumf.so.1`. The loader finds an adapter beside ITSELF, and `$ORIGIN` is the symlink's directory rather than the target's, so a farm holding `libsycl.so.9` alone loads and then enumerates nothing -- the failure that reads as "this machine has no GPU". THE C++ RUNTIME IS FARMED, WHICH compat.cudart DELIBERATELY DOES NOT DO. Its comment says libstdc++ is already loaded on the executable's own behalf by the time the component asks, and for a CUDA program that is true. It is not true here: `libsycl.so.9` needs libstdc++ itself and an mcpp artifact links libc++, so unless the consumer named libstdc++ on its own link line nothing has loaded it and the farm's RUNPATH is the only place the loader looks. Measured, before the fix: `FAIL libsycl.so.9: libstdc++.so.6: cannot open shared object file`. Farming it is safe for the reason farming libc would not be -- there is exactly one libstdc++ in this ecosystem and a consumer that also links it resolves the same file under the same soname. THE STUB SEARCH STARTS FROM THE PAYLOAD, NOT FROM THE ENVIRONMENT. This package installs into a PROJECT-LOCAL store while its payload resolves from the shared registry, and $HOME may be remapped, so `install_dir`'s grandparent holds this package alone. With the environment-derived roots alone the search found nothing and the program died on `libdl.so.2` with a farm that otherwise looked complete. The payload's own directory cannot be wrong: glibc is its sibling by construction. Verified by a new workspace member, `tests/examples/sycl-runtime`, which asserts what this package is responsible for and not what the machine answers: the runtime loads by soname and carries `__sycl_register_lib`, and so do `libur_loader.so.0` and `libumf.so.1` -- the leaf that separates "the farm has libsycl" from "the farm has the chain". Which devices exist is the machine's answer and is not asserted.
…ine had it CI reported what this machine could not: `libur_loader.so.0` needs `libz.so.1`, the payload does not carry it, and the farm's RUNPATH is the only place the loader looks. On a machine with zlib installed for unrelated reasons the omission was invisible; on a fresh runner every library in the chain failed on it. `xim:zlib` is declared and farmed, and the stub search now tries `lib/` as well as `lib64/` because zlib ships under the former.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An mcpp binary on Linux runs under mcpp's own loader, so a soname that is not
on its runtime search path is not found at all. A program whose device half was
compiled by the
xim:dpcpppayload links-lsycl, which the rule packagesatisfies at link time from the payload's own directory, and then fails mcpp's
runtime closure check:
libsycl.so.9 not found on the search path this artifact will actually use.
Its PT_INTERP is a private loader, so the host's /usr/lib is NOT consulted
This is the same shape compat.cuda-driver and compat.vulkan-runtime have, for
the same class of library: one a program reaches through the loader rather than
through a header. It declares the payload as an install-time edge, reads the
directory back, and links the versioned sonames into a package-owned farm that
runtime.library_dirsputs on the artifact's search path.Three things it does that the CUDA adapter does not, each measured rather than
assumed:
EVERY VERSIONED SONAME, NOT JUST libsycl. SYCL's device support is a chain of
dlopens --
libsycl.so.9loadslibur_loader.so.0, which loads onelibur_adapter_*.so.0per back end, and those needlibumf.so.1. The loaderfinds an adapter beside ITSELF, and
$ORIGINis the symlink's directory ratherthan the target's, so a farm holding
libsycl.so.9alone loads and thenenumerates nothing -- the failure that reads as "this machine has no GPU".
THE C++ RUNTIME IS FARMED, WHICH compat.cudart DELIBERATELY DOES NOT DO. Its
comment says libstdc++ is already loaded on the executable's own behalf by the
time the component asks, and for a CUDA program that is true. It is not true
here:
libsycl.so.9needs libstdc++ itself and an mcpp artifact links libc++,so unless the consumer named libstdc++ on its own link line nothing has loaded
it and the farm's RUNPATH is the only place the loader looks. Measured, before
the fix:
FAIL libsycl.so.9: libstdc++.so.6: cannot open shared object file.Farming it is safe for the reason farming libc would not be -- there is exactly
one libstdc++ in this ecosystem and a consumer that also links it resolves the
same file under the same soname.
THE STUB SEARCH STARTS FROM THE PAYLOAD, NOT FROM THE ENVIRONMENT. This package
installs into a PROJECT-LOCAL store while its payload resolves from the shared
registry, and $HOME may be remapped, so
install_dir's grandparent holds thispackage alone. With the environment-derived roots alone the search found
nothing and the program died on
libdl.so.2with a farm that otherwise lookedcomplete. The payload's own directory cannot be wrong: glibc is its sibling by
construction.
Verified by a new workspace member,
tests/examples/sycl-runtime, whichasserts what this package is responsible for and not what the machine answers:
the runtime loads by soname and carries
__sycl_register_lib, and so dolibur_loader.so.0andlibumf.so.1-- the leaf that separates "the farm haslibsycl" from "the farm has the chain". Which devices exist is the machine's
answer and is not asserted.