Fix exp2f_rcp to properly handle nan and 0xFE cases#2647
Conversation
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
|
/te-ci |
Greptile OverviewGreptile SummaryThis PR updates the The main blocking issues are unrelated to the new math cases: both files still rely on Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant K as Kernel/Device code
participant P as ptx.cuh::exp2f_rcp
participant F as __int_as_float
participant T as Host tests
participant H as test_common.h::exp2f_rcp
K->>P: exp2f_rcp(biased_exp: e8m0_t)
alt biased_exp == 0xFF (NaN)
P->>F: __int_as_float(0x7fffffff)
F-->>P: qNaN float
else biased_exp == 0xFE
P->>F: __int_as_float(0x00400000)
F-->>P: 2^-127 (subnormal)
else other
P->>F: __int_as_float((254 - biased_exp) << 23)
F-->>P: 2^(127 - biased_exp)
end
P-->>K: float reciprocal
T->>H: exp2f_rcp(biased_exp: fp8e8m0)
alt biased_exp == 0xFF
H-->>T: reinterpret bits 0x7fffffff (qNaN)
else biased_exp == 0xFE
H-->>T: reinterpret bits 0x00400000 (2^-127)
else other
H-->>T: reinterpret bits (254 - biased_exp) << 23
end
|
Additional Comments (2)
|
Description
Fix the implementation of
exp2f_rcpFixes #2408
Type of change
Changes
Please list the changes introduced in this PR:
Our previous implementation of
exp2f_rcpis not accurate. After some discussion we decide toChecklist: