From: Peter Maydell <peter.maydell@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org
Subject: Re: [PULL 3/4] target/arm: Handle denormals correctly for FMOPA (widening)
Date: Fri, 2 Aug 2024 09:43:35 +0100 [thread overview]
Message-ID: <CAFEAcA9GN5XNQOEUOfEVZEMR5T8st67Qmo9TXcdzH63JAtZsLQ@mail.gmail.com> (raw)
In-Reply-To: <162f8e89-1f1d-465d-a787-8abd565ce0e3@tls.msk.ru>
On Fri, 2 Aug 2024 at 08:45, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> 01.08.2024 17:23, Peter Maydell wrote:
> > The FMOPA (widening) SME instruction takes pairs of half-precision
> > floating point values, widens them to single-precision, does a
> > two-way dot product and accumulates the results into a
> > single-precision destination. We don't quite correctly handle the
> > FPCR bits FZ and FZ16 which control flushing of denormal inputs and
> > outputs. This is because at the moment we pass a single float_status
> > value to the helper function, which then uses that configuration for
> > all the fp operations it does. However, because the inputs to this
> > operation are float16 and the outputs are float32 we need to use the
> > fp_status_f16 for the float16 input widening but the normal fp_status
> > for everything else. Otherwise we will apply the flushing control
> > FPCR.FZ16 to the 32-bit output rather than the FPCR.FZ control, and
> > incorrectly flush a denormal output to zero when we should not (or
> > vice-versa).
> >
> > (In commit 207d30b5fdb5b we tried to fix the FZ handling but
> > didn't get it right, switching from "use FPCR.FZ for everything" to
> > "use FPCR.FZ16 for everything".)
> >
> > Pass the CPU env to the sme_fmopa_h helper instead of an fp_status
> > pointer, and have the helper pass an extra fp_status into the
> > f16_dotadd() function so that we can use the right status for the
> > right parts of this operation.
> >
> > Cc: qemu-stable@nongnu.org
> > Fixes: 207d30b5fdb5 ("target/arm: Use FPST_F16 for SME FMOPA (widening)")
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2373
>
> I know it's too late already, but it looks like this Fixes needs to be:
> Fixes: 3916841ac75 ("target/arm: Implement FMOPA, FMOPS (widening)")
It's fixing a mistake in 207d30b5fdb5, which is in turn fixing
a mistake in 3916841ac75 (but didn't quite get it right).
-- PMM
next prev parent reply other threads:[~2024-08-02 8:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 14:23 [PULL 0/4] target-arm queue Peter Maydell
2024-08-01 14:23 ` [PULL 1/4] hw/arm/mps2-tz.c: fix RX/TX interrupts order Peter Maydell
2024-08-01 14:23 ` [PULL 2/4] accel/kvm/kvm-all: Fixes the missing break in vCPU unpark logic Peter Maydell
2024-08-01 14:23 ` [PULL 3/4] target/arm: Handle denormals correctly for FMOPA (widening) Peter Maydell
2024-08-02 7:45 ` Michael Tokarev
2024-08-02 8:43 ` Peter Maydell [this message]
2024-08-01 14:23 ` [PULL 4/4] target/xtensa: Correct assert condition in handle_interrupt() Peter Maydell
2024-08-02 0:41 ` [PULL 0/4] target-arm queue Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA9GN5XNQOEUOfEVZEMR5T8st67Qmo9TXcdzH63JAtZsLQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).