[mxfp8] fix exp2f_rcp to handle special case of unbiased exponent of 127#4117
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4117
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit a1b96e4 with merge base eb64bfb ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
can we have a test? |
@vkuzo @slayton58 correct me if i'm wrong but i don't think this bug is reachable from our pytorch code? to reach a biased scale of 254 we need a very large value with exponent bits of 254, and we only can pass bf16 or fp32 (same dynamic range, so let's use fp32). the max fp32 value is (2 - (2**-23)) * (2**127) which has exponent 254. However, when using RCEIL scaling (only path that uses tl;dr We can't create large enough test inputs for the kernel to hit this path since they aren't representable in fp32 or bf16. |
|
@vkuzo @slayton58 ok i determined we can pass |
Sounds about right - even looking at MXFP4 we'd still only hit 252, which is still < 254. I think we'd need a format where |
d83ab42 to
3b08044
Compare
3b08044 to
a1b96e4
Compare
Copying updated
exp2f_rcpfrom here to properly handle case of unbiased exponent of 127.Build test
USE_CPP=1 pip install --no-build-isolation -e ~/ao -v