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

[QST] Avoiding fp16 errors during GEMM from CUTE example #1188

Closed
SamKG opened this issue Nov 14, 2023 · 2 comments
Closed

[QST] Avoiding fp16 errors during GEMM from CUTE example #1188

SamKG opened this issue Nov 14, 2023 · 2 comments
Labels
CuTe CuTe Functionality question Question

Comments

@SamKG
Copy link

SamKG commented Nov 14, 2023

What is your question?
In the CUTE GEMM Example, the accumulation buffer is fp16. However, I noticed a rather annoying downstream effect: due to rounding errors, the accumulation will silently ignore small deltas if the exponent is large (e.g. 2048 + 1 = 2048, due to precision issues).

I have two (related) questions:

  1. Is there a way to error or warn if the accumulator is silently dropping bits?
  2. Is there a way (aside from setting to fp32 or bf16) to avoid this issue?
@hwu36
Copy link
Collaborator

hwu36 commented Nov 15, 2023

if this is an issue to you, it means fp16 is not enough for you. you need to use fp32 accumulation.

in fp16 math, 2048 + 1 = 2048. wikipedia explains it in detail.

@mnicely mnicely added the CuTe CuTe Functionality label Dec 6, 2023
@mnicely
Copy link
Collaborator

mnicely commented Dec 6, 2023

I believe this has been resolved. Feel free to reopen if you disagree.

@mnicely mnicely closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CuTe CuTe Functionality question Question
Projects
None yet
Development

No branches or pull requests

3 participants