[SYCL] Skip free-function kernel global-info updates after runtime teardown - #22946
Open
koparasy wants to merge 2 commits into
Open
[SYCL] Skip free-function kernel global-info updates after runtime teardown#22946koparasy wants to merge 2 commits into
koparasy wants to merge 2 commits into
Conversation
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.
This is a SYCL runtime bug. Likely introduced by intel/llvm PR #20422 .
For each TU containing a SYCL free-function kernel, the compiler emits a static GlobalMapUpdater object in the integration header. Before #20422 it had only a constructor (registers kernel names). #20422 added a destructor that calls
sycl::detail::free_function_info_map::remove(...) → ProgramManager::unRegisterKernelGlobalInfo, which mutates state owned by libsycl'sGlobalHandlersingleton.The crash is a cross-shared-object static-destruction-order problem:
GlobalMapUpdater updater lives in liboneccl_v1.so with no destructor priority.
libsycl tears down its GlobalHandler (and the ProgramManager map) in shutdown_late(), run from attribute((destructor(110))) in
libsycl.so.Destructor priority only orders teardown within a single shared object. It does not order an independent .so (liboneccl) against libsycl. When libsycl is torn down before oneCCL's updater destructor runs, that destructor calls into an already-freed/unloaded libsycl → SIGBUS.
This triggers merely by linking libccl.so with a free-function kernel present; no oneCCL API call is needed, because updater is a static object whose destructor runs at process exit regardless.
On the workaround
unRegisterKernelGlobalInfo/getInstanceshould be robust to a torn-down runtime, and/or the map cleanup should be skipped at process termination (it's only meaningful for a true mid-process dlclose).