[lworld+fp16] RFR: 8329817: Augment prototype Float16 class [v5]
Jatin Bhateja
jbhateja at openjdk.org
Fri Jun 14 05:26:27 UTC 2024
On Wed, 12 Jun 2024 22:38:19 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> > Hi @jddarcy , Apart from few minor comments, patch looks good to me, there is a build error due to malformed javadoc comment.
> > Kindly fix and integrate.
>
> Thanks; let me take a pass at writing at least some basic regression tests before pushing.
>
> @jatin-bhateja , do you know if promoting the three operands of a Float16 fma to double, doing the operation in double, and rounding to Float16 is sufficient to correctly implement a Float16 fma? I haven't worked through all the cases yet and I'm not certain they're cannot be double-rounding issues. (If double rounding turns out to be a problem, I was thinking it would be possible to see if (a*b + c) was exact in double, and if, not add in a sticky bit to make sure the rounding occurs properly, but I haven't developed the details yet.)
Hi @jddarcy , As per specification of [Math.fma(float, float, float)](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/Math.java#L2494) internal computation of constituent operation (mul and add) should be done at infinite precision and only final result should be rounded, we are now upcasting float16 to double but it will not prevent rounding happening for mul and add.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1117#issuecomment-2167234350
More information about the valhalla-dev
mailing list