Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HLSL] Type trait for layout compatibility #100614

Closed
llvm-beanz opened this issue Jul 25, 2024 · 4 comments · Fixed by #102227
Closed

[HLSL] Type trait for layout compatibility #100614

llvm-beanz opened this issue Jul 25, 2024 · 4 comments · Fixed by #102227
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@llvm-beanz
Copy link
Collaborator

We need to define a type trait for layout compatibility. HLSL allows explicit casting between types if they have the same member layouts. We should expose this as a type trait builtin so that we can use it from source as well.

Related: #75676

@llvm-beanz llvm-beanz converted this from a draft issue Jul 25, 2024
@llvm-beanz llvm-beanz added the HLSL HLSL Language Support label Jul 25, 2024
@llvm-beanz
Copy link
Collaborator Author

I just reviewed and confirmed that the existing __is_layout_compatible added in #81506 covers exactly what we need here, so there is no work to be done on this for HLSL.

@llvm-beanz llvm-beanz closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
@llvm-beanz llvm-beanz reopened this Aug 2, 2024
@llvm-beanz
Copy link
Collaborator Author

Wait... Nvm... The C++ version of this does not support flattening the way that HLSL requires, so there is more work to do... yay.

@llvm-beanz llvm-beanz moved this from Done to Planning in HLSL Support Aug 5, 2024
@llvm-beanz llvm-beanz moved this from Planning to Ready in HLSL Support Aug 5, 2024
@llvm-beanz llvm-beanz self-assigned this Aug 5, 2024
@llvm-beanz
Copy link
Collaborator Author

Spec PR: microsoft/hlsl-specs#298

llvm-beanz added a commit to llvm-beanz/llvm-project that referenced this issue Aug 6, 2024
HLSL tends to rely pretty aggressively on scalarization occuring in the
complier, which allows for some relaxed language behaviors when types
are fully sclarized to equivalent scalar representations.

This change adds a new queryable trait builtin for scalarized layout
compatability.

Resolves llvm#100614
@llvm-beanz llvm-beanz moved this from Ready to Active in HLSL Support Aug 12, 2024
@github-project-automation github-project-automation bot moved this from Active to Done in HLSL Support Aug 26, 2024
@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Aug 26, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 26, 2024

@llvm/issue-subscribers-clang-frontend

Author: Chris B (llvm-beanz)

We need to define a type trait for layout compatibility. HLSL allows explicit casting between types if they have the same member layouts. We should expose this as a type trait builtin so that we can use it from source as well.

Related: #75676

5c4lar pushed a commit to 5c4lar/llvm-project that referenced this issue Aug 29, 2024
HLSL tends to rely pretty aggressively on scalarization occuring in the
complier, which allows for some relaxed language behaviors when types
are fully sclarized to equivalent scalar representations.

This change adds a new queryable trait builtin for scalarized layout
compatability.

Resolves llvm#100614

---------

Co-authored-by: Aaron Ballman <[email protected]>
dmpolukhin pushed a commit to dmpolukhin/llvm-project that referenced this issue Sep 2, 2024
HLSL tends to rely pretty aggressively on scalarization occuring in the
complier, which allows for some relaxed language behaviors when types
are fully sclarized to equivalent scalar representations.

This change adds a new queryable trait builtin for scalarized layout
compatability.

Resolves llvm#100614

---------

Co-authored-by: Aaron Ballman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants