Skip to content

[HLSL] half overloads and typedefs are supported when 16-bit types are not enabled #81049

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

Closed
llvm-beanz opened this issue Feb 7, 2024 · 0 comments · Fixed by #81782
Closed
Assignees
Labels
HLSL HLSL Language Support

Comments

@llvm-beanz
Copy link
Collaborator

llvm-beanz commented Feb 7, 2024

In HLSL when 16-bit types are not enabled, half overloads are all supported. DXC currently treats half as a distinct type from float in all contexts even if they are both 32-bit float types. This behavior can be preserved in Clang.

Acceptance Criteria

Clean up the existing test cases to allow half overloads and typedefs to be resolved without any additional flags required.

@llvm-beanz llvm-beanz converted this from a draft issue Feb 7, 2024
@llvm-beanz llvm-beanz self-assigned this Feb 7, 2024
@llvm-beanz llvm-beanz added the HLSL HLSL Language Support label Feb 7, 2024
llvm-beanz added a commit to llvm-beanz/llvm-project that referenced this issue Feb 7, 2024
This addresses feedback from @rjmcall. The main updates are:
* Added asserts and todos about handling constrained intrinsics.
* Fixed sufflevector code generation (and updated tests)
* Fixed shadowed promotion casts. Writing a test for this revealed
another issue.
* Added Element conversion to conversion rank checking, and added test
to verify promotion is preferred over conversion.
* Added HLSL integral promotion check.

There are still at least two outstanding bugs that are exposed by this
change which I've added an XFAIL'd test for (llvm#81047 & llvm#81049).

HLSL's promotion rules are not well written down, but specifically in
overload resolution integer and floating point values can implicitly
cast to larger types and the smallest of the larger types is the best
match.
@llvm-beanz llvm-beanz removed their assignment Feb 7, 2024
@llvm-beanz llvm-beanz changed the title [HLSL] half should alias float when 16-bit types are not enabled [HLSL] half overloads and typedefs are supported when 16-bit types are not enabled Feb 13, 2024
@llvm-beanz llvm-beanz self-assigned this Feb 13, 2024
llvm-beanz added a commit to llvm-beanz/llvm-project that referenced this issue Feb 14, 2024
We previously made an implmenetation error when adding `half` overloads
for HLSL library functionalitly. The `half` type is always defined in
HLSL and `half` intrinsics should not be conditionally included.

When native 16-bit types are disabled `half` is a unique 32-bit float
type with lesser promotion rank than `float`.

Fixes llvm#81049
llvm-beanz added a commit that referenced this issue Feb 15, 2024
We previously made an implmenetation error when adding `half` overloads
for HLSL library functionalitly. The `half` type is always defined in
HLSL and `half` intrinsics should not be conditionally included.

When native 16-bit types are disabled `half` is a unique 32-bit float
type with lesser promotion rank than `float`.

Fixes #81049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant