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

Add floating-point pack/unpack proposal #6191

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

fairywreath
Copy link
Contributor

Related to #6175. Adds a proposal to define floating-point pack/unpack intrinsics.

Comment on lines 78 to 80
### Built-in packed Datatypes
Unlike HLSL's implementation with introduces new packed datatypes, `uint8_t4_packed` and `int8_t4_packed`, unsigned 32-bit integers are used directly
and no new pakced datatypes are introduced.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong preference here and would really appreciate any suggestions or input. If new datatypes are to be introduced we would add something like half2_unorm_packed, half2_snorm_packed, half2_packed, then another full set for the 8-bit variants.

@fairywreath fairywreath changed the title Add float-point pack/unpack proposal Add floating-point pack/unpack proposal Jan 27, 2025
csyonghe
csyonghe previously approved these changes Jan 27, 2025
Copy link
Collaborator

@csyonghe csyonghe left a comment

Choose a reason for hiding this comment

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

Looks good to me. Are these functions named the same way after the corresponding HLSL intrinsic? Or should we name them using Slang's naming convention?

half2 unpack_snorm_f16f16(uint packedVal);

float2 unpack_half_f16f32(uint packedVal);
half4 unpack_half_f16f16(uint packedVal);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be half2 here. this should be exactly the same as bitcast<half2>, right?

@fairywreath
Copy link
Contributor Author

Looks good to me. Are these functions named the same way after the corresponding HLSL intrinsic? Or should we name them using Slang's naming convention?

The proposal currently names them based on HLSL's intrinsics - I believe using Slang's naming convention is better. I will change them and will also add new intrinsics for the integer pack/unpack functions that follows Slang's naming convention in addition to the hlsl intrinsics.

@fairywreath fairywreath marked this pull request as draft January 31, 2025 02:41
@fairywreath fairywreath marked this pull request as ready for review January 31, 2025 02:47
@fairywreath fairywreath requested a review from csyonghe January 31, 2025 02:47
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.

2 participants