qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fpu/softfloat: a question on BFloat 16 support on QEMU


From: LIU Zhiwei
Subject: Re: fpu/softfloat: a question on BFloat 16 support on QEMU
Date: Tue, 9 Jun 2020 11:09:07 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0



On 2020/6/9 3:34, Richard Henderson wrote:
On 6/8/20 5:53 AM, LIU Zhiwei wrote:
Hi Richard,

I am doing bfloat16 support on QEMU.

Once I tried to reuse float32 interface, but I couldn't properly process
rounding in some insns like fadd.

What's your opinion about it? Should I expand the fpu/softfloat?
Yes, we need to expand fpu/softfloat.

You'll want something like

static const FloatFmt bfloat16_params = {
     FLOAT_PARAMS(8, 7)
};

(This would be the Arm and x86 definition, anyway; hopefully risc-v is the 
same.)
Yes. It's the same for me.
And then add all of the other interface functions that you need to use that
parameter.

FWIW, it appears that Arm only requires:

   float32_to_bfloat16
   bfloat16_mul
   bfloat16_add

and I could even get away with only float32_to_bfloat16, since technically
Arm's BFAdd and BFMul psuedo-code are implemented in terms of single-precision
arithmetic, followed by a round-to-odd into BFloat16.
Some different here.

It's directly implemented in half-precision unit. So I'm afraid I have to implement as many as interfaces like float16.

Best Regards,
Zhiwei



r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]