Skip to content

[UR] Make the device sanitizer layer a shared library - #22950

Open
pbalcer wants to merge 1 commit into
intel:syclfrom
pbalcer:shared-sanitizer-layer
Open

[UR] Make the device sanitizer layer a shared library#22950
pbalcer wants to merge 1 commit into
intel:syclfrom
pbalcer:shared-sanitizer-layer

Conversation

@pbalcer

@pbalcer pbalcer commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

The loader can be statically linked into more than one library of a process. Its state is hidden, so the linker cannot merge those copies, and the sanitizers ended up with two independent states over one device. Both reserved device shadow memory, and the second reservation failed with UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY.

Move the sanitizer layer into libur_sanitizer_layer.so, loaded on demand from the same locations an adapter is loaded from, so all loader instances of a process share one instance of it. Every loader still initializes the layer with its own ddi table; the layer reference counts those and hooks up the extra tables via context_t::interceptDdiTable instead of setting up a second state.

Assisted-by: Claude

The loader can be statically linked into more than one library of a
process - an OpenMP offload application using SYCL interop loads both
libomptarget and libsycl, each with its own copy of libur_loader.a. The
layer state is hidden, so the linker cannot merge those copies, and the
sanitizers ended up with two independent states over one device. Both
reserved device shadow memory, and the second reservation failed with
UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY.

Move the sanitizer layer into libur_sanitizer_layer.so, loaded on demand
from the same locations an adapter is loaded from, so all loader
instances of a process share one instance of it. Every loader still
initializes the layer with its own ddi table; the layer reference counts
those and hooks up the extra tables via context_t::interceptDdiTable
instead of setting up a second state.

The library exports nothing but urLoaderLayerGetInterface, which also
makes the ld -r/objcopy pre-link that hid the LLVM symbolizer symbols
inside the static loader unnecessary - they are now private to this
library by construction. Enabling a layer whose library cannot be loaded
now fails urLoaderInit rather than silently running unsanitized.

The generic half of this lives in ur_loader::SharedLayer so that other
layers can be moved out of the loader the same way.
@pbalcer
pbalcer requested review from a team as code owners August 16, 2026 13:23
@pbalcer
pbalcer requested a review from sergey-semenov August 16, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants