[SYCL][TableGen] Emit dynamic table variables as inline#22594
Open
wenju-he wants to merge 2 commits into
Open
Conversation
DynamicTableEmitter generates a plain (non-inline) global map variable in a header that is #included from multiple translation units. When those TUs end up in different shared libraries loaded into the same process, this violates the One Definition Rule: two strong definitions of DeviceConfigFile::TargetTable get double destructed at exit, causing "double free or corruption" crashes. 0bb7221 introduced non-inline global. It became a bug on 2026-04-08 with a8dff34 which moved DeviceConfigFile.hpp usage into a second shared library, libLLVMSYCLPostLink.so, creating the second strong definition. It surfaced as a visible crash on 2026-06-12 with b09acde, which added fp8 unittest that links against sycl-jit -> pulling in both libclangDriver.so and libLLVMSYCLPostLink.so in the same process when BUILD_SHARED_LIBS=ON. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
YuriPlyakhin
approved these changes
Jul 17, 2026
YuriPlyakhin
left a comment
Contributor
There was a problem hiding this comment.
Could you please update the CHECK lines in llvm/test/TableGen/dynamic-tables.td to add inline?
Otherwise, LGTM.
Contributor
Author
done, thanks for the suggestion |
Contributor
Author
|
@intel/llvm-gatekeepers please merge, thanks |
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.
DynamicTableEmitter generates a plain (non-inline) global map variable in a header that is #included from multiple translation units. When those TUs end up in different shared libraries loaded into the same process, this violates the One Definition Rule: two strong definitions of DeviceConfigFile::TargetTable get double destructed at exit, causing "double free or corruption" crashes.
0bb7221 introduced non-inline global. It became a bug on 2026-04-08 with a8dff34 which moved DeviceConfigFile.hpp usage into a second shared library, libLLVMSYCLPostLink.so, creating the second strong definition.
It surfaced as a visible crash on 2026-06-12 with b09acde, which added fp8 unittest that links against sycl-jit -> pulling in both libclangDriver.so and libLLVMSYCLPostLink.so in the same process when BUILD_SHARED_LIBS=ON.
Fix many check-sycl fails in shared lib build, e.g.
SYCL-Unit :: ur/./UrTests-Non_Preview_Tests/failed_to_discover_tests_from_gtest
SYCL-Unit-Preview :: ur/Preview/./UrTests-Preview_Tests/failed_to_discover_tests_from_gtest
CMPLRLLVM-76620, CMPLRLLVM-76699