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

Update conversion ranks for minimum precision types #206

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

llvm-beanz
Copy link
Collaborator

@llvm-beanz llvm-beanz commented Apr 19, 2024

This just updates the conversion rank for minimum precision types which are now represented in the Basic.types section.

I've iterated on this a few times and reduced it down to just the min16{int|uint|float} types because those are the only types DXC actually supports. Using any of the other types produces a warning and they get treated as the corresponding min16 type.

The promotion orders are as follows:

min16int < int16_t < int32_t < int64_t
min16uint < uint16_t < uint32_t < uint64_t
min16float < half < float < double

This just updates the conversion rank for minimum precision types which
are now represented in the Basic.types section.

TL;DR:

min10int < min12int < min16int < int16_t < int32_t < int64_t
min10uint < min12uint < min16uint < uint16_t < uint32_t < uint64_t
min10float < min12float < min16float < half < float < double
Copy link
Collaborator

@coopp coopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rank of this review shall have a minimum precision value of 'Approved'.

There is not a 10, 12, and 16 for each type. Float has 10 and 16, int
has 12 and 16, and uint has only 16.
llvm-beanz added a commit to llvm-beanz/llvm-project that referenced this pull request Apr 26, 2024
This PR fixes bugs in HLSL floating conversions. HLSL always has
`half`, `float` and `double` types, which promote in the order:

`half`->`float`->`double`

and convert in the order:

`double`->`float`->`half`

As with other conversions in C++, promotions are preferred over
conversions.

We do have floating conversions documented in the draft language
specification (https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf
[Conv.rank.float]) although the exact language is still in flux
(microsoft/hlsl-specs#206).

Resolves llvm#81047
@llvm-beanz llvm-beanz merged commit e38d22f into microsoft:main Apr 26, 2024
3 checks passed
llvm-beanz added a commit to llvm/llvm-project that referenced this pull request May 2, 2024
This PR fixes bugs in HLSL floating conversions. HLSL always has `half`,
`float` and `double` types, which promote in the order:

`half`->`float`->`double`

and convert in the order:

`double`->`float`->`half`

As with other conversions in C++, promotions are preferred over
conversions.

We do have floating conversions documented in the draft language
specification (https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf
[Conv.rank.float]) although the exact language is still in flux
(microsoft/hlsl-specs#206).

Resolves #81047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants