[common] Fix UE8M0 code 0 (2^-127) and code 255 (NaN) expansion in ptx::exp2f - #3262
[common] Fix UE8M0 code 0 (2^-127) and code 255 (NaN) expansion in ptx::exp2f#3262xiuhu17 wants to merge 1 commit into
Conversation
Greptile SummaryCorrects UE8M0 extreme-code expansion and adds regression coverage.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "Fix UE8M0 code 0 and 255 expansion in pt..." | Re-trigger Greptile |
|
@ptrendx Anyone from your team can help review this? |
|
/te-ci |
|
@xiuhu17 Please sign your commit - please refer to https://github.com/NVIDIA/TransformerEngine/blob/main/CONTRIBUTING.rst#sign-your-work Thanks! |
UE8M0 code 0 is 2^-127 and code 255 is NaN, but the exponent-field shift produced +0.0 and +Inf, so MXFP8 software dequantize zeroed every 1x32 block whose scale byte was 0. Mirror the special cases already present in exp2f_rcp and add a dequantize test with planted extreme scale codes. Signed-off-by: zhihaow6 <zhihaow6@illinois.edu>
Fixed, thanks for reminding |
|
Hi @ptrendx, would you like to run the ci for this one? Thanks! |
|
Actually, for this test to run you need to add it to the qa/L0_pytorch_unittest/test.sh |
Got it, my bad |
Hi @ptrendx, I think this one may already be covered. qa/L0_pytorch_unittest/test.sh:36 runs the whole directory rather than individual files:
|
Description
ptx::exp2f(e8m0_t)builds the scale by shifting the biased exponent into the fp32 exponent field. Two UE8M0 codes cannot be built that way:0is2^-127— an fp32 subnormal (0x00400000), so the shift yields+0.0. MXFP8 software dequantize (dequantize_mxfp8.cuh,group_dequantize_mxfp8.cuh) then zeroes every 1x32 block whose scale byte is 0.255is NaN — the shift yields+Inf.exp2f_rcpnext to it already special-cases both; this applies the same handling toexp2f.Repro:
Type of change
Checklist: