[SYCL] Fix ODR violation causing SpecializationConstant test segfaults - #22817
Open
ldorau wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Please review @intel/llvm-reviewers-runtime @KseniyaTikhomirova |
ldorau
force-pushed
the
SYCL_Fix_ODR_violation_causing_SpecializationConstant_test_segfaults
branch
2 times, most recently
from
July 30, 2026 10:40
e7a264f to
2f67928
Compare
SpecializationConstant.cpp declared its own global class TestKernel and specialized detail::KernelInfo<TestKernel> with getName()="SpecializationConstant_TestKernel". However, unittests/helpers/TestKernel.hpp (included by other tests linked into the same binary, e.g. via TestKernel/KernelID/IsCompatible tests) also declares a global class TestKernel with a different KernelInfo<TestKernel> specialization (getName()="TestKernel"). This is an ODR violation: two different definitions of the same template specialization in the same program. The linker silently picks one definition, so SpecializationConstant.cpp's get_kernel_id<TestKernel>() could resolve to the wrong kernel ID, causing device_image_impl to look up a mock device image with empty property sets and segfault when dereferencing the (empty) spec constant blob. Fix by renaming the test-local class to SpecConstTestKernel, which no longer collides with the shared TestKernel class. It was found in the local build. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
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.
SpecializationConstant.cpp declared its own global class TestKernel
and specialized detail::KernelInfo with
getName()="SpecializationConstant_TestKernel". However,
unittests/helpers/TestKernel.hpp (included by other tests linked into
the same binary, e.g. via TestKernel/KernelID/IsCompatible tests) also
declares a global class TestKernel with a different KernelInfo
specialization (getName()="TestKernel").
This is an ODR violation: two different definitions of the same
template specialization in the same program. The linker silently
picks one definition, so SpecializationConstant.cpp's
get_kernel_id() could resolve to the wrong kernel ID,
causing device_image_impl to look up a mock device image with empty
property sets and segfault when dereferencing the (empty) spec
constant blob.
Fix by renaming the test-local class to SpecConstTestKernel, which no
longer collides with the shared TestKernel class.
It was found in the local build.