[lworld+fp16] RFR: 8308363: Initial compiler support for FP16 scalar operations. [v7]

Jatin Bhateja jbhateja at openjdk.org
Tue Sep 19 16:41:34 UTC 2023


On Mon, 18 Sep 2023 22:27:48 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>>> Very good work in general. I only have couple of comments in the code, please take a look. Also there might be some further optimization opportunities for the path that comes from Op_ConvF2HF -> ReinterpretS2HF. ConvF2HF is doing the conversion from xmm to xmm register and then moves the xmm to gpr. ReinterpretS2HF then moves from gpr back to xmm. This unnecessary movement from xmm->gpr and from gpr->xmm could be optimized out.
>> 
>> Yes, but this can only be done if we factor out xmm -> gpr movement out of ConvF2HF,  its inputs is a IEEE 754 binary32 bit floating point value and output is a binary16 bit value help in a GPR. It will not be proper to remove ConvF2HF + ReinterpretS2HF by a direct ideal transformation currently.
>
>> > Very good work in general. I only have couple of comments in the code, please take a look. Also there might be some further optimization opportunities for the path that comes from Op_ConvF2HF -> ReinterpretS2HF. ConvF2HF is doing the conversion from xmm to xmm register and then moves the xmm to gpr. ReinterpretS2HF then moves from gpr back to xmm. This unnecessary movement from xmm->gpr and from gpr->xmm could be optimized out.
>> 
>> Yes, but this can only be done if we factor out xmm -> gpr movement out of ConvF2HF, its inputs is a IEEE 754 binary32 bit floating point value and output is a binary16 bit value help in a GPR. It will not be proper to remove ConvF2HF + ReinterpretS2HF by a direct ideal transformation currently.
> 
> One path is having an instruct with match rule for this, something like below I think:
> match(Set dst (ReinterprestS2HF(ConvF2HF src)));

Hi @sviswa7 , @XiaohongGong , All your comments have been addressed. I am committing this patch

Best Regards

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/848#issuecomment-1726057093



More information about the valhalla-dev mailing list