llvm
8c64b646 - [SYCL] Skip free-function kernel global-info updates after runtime teardown (#22946)

Commit
51 days ago
[SYCL] Skip free-function kernel global-info updates after runtime teardown (#22946) 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).
Author
Parents
Loading