Skip to content

Update 16-bit exp tests to use smaller values #312

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

Merged
merged 2 commits into from
Aug 8, 2025

Conversation

llvm-beanz
Copy link
Collaborator

@llvm-beanz llvm-beanz commented Aug 5, 2025

The exp function computes e^x, and has wider precision drift for higher values of x due to compounding floating point rounding errors. For FP32, values under 100 tend to be pretty reliable, but for FP16 you really need values under 10 to have reliable precision.

This updates the tests to use 2 as the test value instead of 10, making the test reliable across our test suite.

For fp16 exp(10) is a quite large number to represent in fp16, so it is
possible (maybe even likely) that the precision loss is massively
increased causing the problems resulting in the XFAILs. Trying this with
a smaller value to see if it fixes the issue.
@llvm-beanz llvm-beanz requested a review from spall August 5, 2025 14:56
@llvm-beanz llvm-beanz changed the title Checking to see if exp16 is reliable at smaller values Update 16-bit exp tests to use smaller values Aug 5, 2025
@@ -25,7 +25,7 @@ Buffers:
- Name: In
Format: Float16
Stride: 8
Data: [ 0x7e00, 0xfc00, 0x8001, 0x8000, 0x0000, 0x0001, 0x7c00, 0xbc00, 0x4900, 0x7e00, 0x7e00, 0x7e00,]
Data: [ 0x7e00, 0xfc00, 0x8001, 0x8000, 0x0000, 0x0001, 0x7c00, 0xbc00, 0x4000, 0x7e00, 0x7e00, 0x7e00,]
# NaN, -Inf, -denorm, -0, 0, denorm, Inf, -1, 10,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also update the comment here.

@@ -34,7 +34,7 @@ Buffers:
- Name: ExpectedOut # The result we expect
Format: Float16
Stride: 8
Data: [ 0x7e00, 0x0000, 0x3c00, 0x3c00, 0x3c00, 0x3c00, 0x7c00, 0x35e3, 0x7561, 0x7e00, 0x7e00, 0x7e00,]
Data: [ 0x7e00, 0x0000, 0x3c00, 0x3c00, 0x3c00, 0x3c00, 0x7c00, 0x35e3, 0x4764, 0x7e00, 0x7e00, 0x7e00,]
# NaN, 0, 1, 1, 1, 1, Inf, 0.367879441, 22026.46579,
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here.

@llvm-beanz llvm-beanz merged commit 06240b2 into llvm:main Aug 8, 2025
8 of 9 checks passed
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.

4 participants