[SYCL][LIT] Check POD-ness for types crossing ABI boundary#21229
Open
uditagarwal97 wants to merge 3 commits intosyclfrom
Open
[SYCL][LIT] Check POD-ness for types crossing ABI boundary#21229uditagarwal97 wants to merge 3 commits intosyclfrom
uditagarwal97 wants to merge 3 commits intosyclfrom
Conversation
uditagarwal97
commented
Feb 5, 2026
| std::cout << "Standard layout: " << std::is_standard_layout_v<T> << "\n"; | ||
| } | ||
|
|
||
| int main() { |
Contributor
Author
There was a problem hiding this comment.
This test is not exhaustive and I only considered types for which we already have abi layout tests.
uditagarwal97
commented
Feb 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a LIT test to verify type traits (POD-ness, trivial copyability, standard layout) of SYCL types that cross ABI boundaries, ensuring these properties remain stable to prevent ABI breakage and undefined behavior.
Changes:
- Added comprehensive type trait verification test for 18 SYCL types commonly used across ABI boundaries
- Implemented test infrastructure using FileCheck to validate type properties remain consistent
Contributor
Author
|
I think I'd have to split this test for Linux and Windows... Some types are standard_layout for |
againull
reviewed
Feb 6, 2026
Comment on lines
+22
to
+27
| std::cout << "Trivially copyable: " | ||
| << std::is_trivially_copyable_v<T> << "\n"; | ||
| std::cout << "Trivially default constructible: " | ||
| << std::is_trivially_default_constructible_v<T> << "\n"; | ||
| std::cout << "Standard layout: " << std::is_standard_layout_v<T> << "\n"; | ||
| } |
Contributor
There was a problem hiding this comment.
I think we should change cout/FileCheck to static_assert checks, i.e. something like:
template <typename T, bool IsTriviallyCopyable,
bool IsTriviallyDefaultConstructible,
bool IsStandardLayout>
void check_type_traits() {
static_assert(std::is_trivially_copyable_v<T> == IsTriviallyCopyable,
"Trivially copyable trait changed");
...
It will also allow to easier differentiate between msvc/gcc if any differences:
#ifdef ..
check_type_traits<some_type, false, false, false>(); // MSVC
#else
check_type_traits<some_type, false, false, true>(); // GCC
#endif
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.
Added test to check POD-ness of SYCL types when crossing ABI boundaries. POD-ness if changed outside the ABI breaking window, can break the ABI and cause undefined behavior.