Skip to content

[SYCL] Skip free-function kernel global-info updates after runtime teardown - #22946

Open
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:fix-ffk-globalmap-shutdown-mlsl4642
Open

[SYCL] Skip free-function kernel global-info updates after runtime teardown#22946
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:fix-ffk-globalmap-shutdown-mlsl4642

Conversation

@koparasy

Copy link
Copy Markdown
Contributor

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's GlobalHandler singleton.

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/getInstance should 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).

@koparasy
koparasy requested a review from a team as a code owner August 14, 2026 20:49
@koparasy
koparasy requested a review from dm-vodopyanov August 14, 2026 20:49
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.

1 participant