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

Fix eigen::numext::signbit for MXFloat types (fp6/fp4) #202

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

sergey-kozub
Copy link
Contributor

The default Eigen implementation checks the highest bit (7) to determine if a number is signed.
For less-than-8-bit types, this is incorrect - so add the template specialization for these types.

Note that "eigen::numext::signbit" returns all-zero-bits for an unsigned input, and all-one-bits for signed input.
For 8-bit types, this is 0x00 for unsigned and 0xFF for signed.

Note: this was previously not picked up by the tests, as this project doesn't use the "eigen::numext::signbit" function, but other projects do (e.g. OpenXLA).

@copybara-service copybara-service bot merged commit 620f804 into jax-ml:main Sep 17, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants