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

Use a better error bound for fp16 tests of the rsum microkernel. #6431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

Use a better error bound for fp16 tests of the rsum microkernel.

// We don't use the usual hard bound $\gamma_n = \frac{nu}{1 - nu}$ since
// for `fp16` $nu > 1$ already for $n > 2000$, rendering the bound
// meaningless.
const float fp16_u =
Copy link
Contributor

Choose a reason for hiding this comment

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

make 1 line

const float fp16_u =
4.88281e-4; // Half of the ULP, max relative rounding error.
const float n = batch_size() - 1;
const float gamma_n = std::expm1(5.0f * std::sqrt(n) * fp16_u +
Copy link
Contributor

Choose a reason for hiding this comment

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

this is really complicated/obscure and different than all other testers, making it hard to maintain.
is rsum fp16 different than other testers?
assuming this is better, can we apply it to float and all other testers?
does it need to change for bf16 or qs8 comparisons?
it looks slow... did you benchmark?

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.

None yet

2 participants