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

Explicitly enforce int4 bit representation with ignored high bits. #119

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Oct 27, 2023

Explicitly enforce int4 bit representation with ignored high bits.

The previous implementation using a bit-field leaves the exact
representation implementation-defined, with some platforms storing
bit-fields packed left-to-right, others right-to-left, and the
masked bits unspecified. This complicates serialization and
vectorized conversions.

With this change, we now explicitly store the value in the lower
4 bits, and leave the upper 4 bits unspecified. The type is
constructed in such a way that correctness is preserved
regardless of the upper bit values.

@copybara-service copybara-service bot force-pushed the test_577312207 branch 3 times, most recently from 257f47b to 74bac1c Compare October 27, 2023 23:00
@copybara-service copybara-service bot changed the title Explicitly enforce int4 bit representation and sign-extension. Explicitly enforce int4 bit representation with ignored high bits. Nov 1, 2023
@copybara-service copybara-service bot force-pushed the test_577312207 branch 3 times, most recently from b6940e5 to 20b73dc Compare November 2, 2023 04:27
The previous implementation using a bit-field leaves the exact
representation implementation-defined, with some platforms storing
bit-fields packed left-to-right, others right-to-left, and the
masked bits unspecified.  This complicates serialization and
vectorized conversions.

With this change, we now explicitly store the value in the lower
4 bits, and leave the upper 4 bits unspecified.  The type is
constructed in such a way that correctness is preserved
regardless of the upper bit values.

PiperOrigin-RevId: 578735344
@copybara-service copybara-service bot merged commit e844eee into main Nov 2, 2023
1 check passed
@copybara-service copybara-service bot deleted the test_577312207 branch November 2, 2023 04:46
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.

1 participant