qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] target/arm: Implement FEAT_EBF16
@ 2024-07-30 16:02 Peter Maydell
  2024-07-30 16:02 ` [PATCH 1/8] target/arm: Allow setting the FPCR.EBF bit for FEAT_EBF16 Peter Maydell
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Peter Maydell @ 2024-07-30 16:02 UTC (permalink / raw)
  To: qemu-arm, qemu-devel

This patchset implements the optional FEAT_EBF16 architectural feature.
This feature only does one thing: it adds a new bit FPCR.EBF to the
floating point control register, so that the guest can enable a
slightly different set of semantics for the bfloat16 dot-product
instructions (BFDOT, BFMMLA, BFMOPA, BFMOPS; also BFVDOT when we
eventually implement SME2). When the bit is set:
 * they honour FPCR.RMode to set the rounding mode
 * they honour the FPCR bits controlling flushing of denormals
 * they can generate default NaN and infinity as intermediate
   sum-of-products
 * the intermediate rounding handling changes

In the Arm ARM these changes only affect the pseudocode BFDotAdd
function, which in QEMU we implement in bfdotadd().

A lot of this series is plumbing -- we need the CPU env pointer
now in the helper functions which call bfdotadd(), so we need
to pass it through from the generated code. Once we have it,
we can refactor the callsites in a manner suggested by RTH,
so that we have bfdotadd() specialized for EBF=0 and bfdotadd_ebf()
specialized for EBF=1. This lets us hoist the setup out of the
inner loop:
   float_status fpst, fpst_odd;
   if (is_ebf(env, &fpst, &fpst_odd)) {
       for (...) {
           x = bfdotadd_ebf(..., &fpst, &fpst_odd);
       }
   } else {
       for (...) {
           x = bfdotadd(..., &fpst);
       }
   }

The implementation itself requires a fused paired-multiply-and-add;
we use the same trick we already have in f16_dotadd() to implement
this.

Not intended for 9.1, obviously, but I figured since I'd written
and tested it I might as well send it out to the list.

Based-on: <20240730155819.2958924-1-peter.maydell@linaro.org>
("target/arm: Handle denormals correctly for FMOPA (widening)")
both for textual reasons and because that patch introduces the
do_outprod_env() utility function we use here.

thanks
-- PMM

Peter Maydell (8):
  target/arm: Allow setting the FPCR.EBF bit for FEAT_EBF16
  target/arm: Pass env pointer through to sme_bfmopa helper
  target/arm: Pass env pointer through to gvec_bfdot helper
  target/arm: Pass env pointer through to gvec_bfdot_idx helper
  target/arm: Pass env pointer through to gvec_bfmmla helper
  target/arm: Prepare bfdotadd() callers for FEAT_EBF support
  target/arm: Implement FPCR.EBF=1 semantics for bfdotadd()
  target/arm: Enable FEAT_EBF16 in the "max" CPU

 docs/system/arm/emulation.rst   |   1 +
 target/arm/cpu-features.h       |   5 +
 target/arm/cpu.h                |   1 +
 target/arm/helper.h             |  12 +-
 target/arm/tcg/helper-sme.h     |   4 +-
 target/arm/tcg/vec_internal.h   |  37 +++++-
 target/arm/tcg/cpu64.c          |   4 +-
 target/arm/tcg/sme_helper.c     |  78 ++++++++----
 target/arm/tcg/translate-a64.c  |  40 ++++++-
 target/arm/tcg/translate-neon.c |  43 ++++++-
 target/arm/tcg/translate-sme.c  |   3 +-
 target/arm/tcg/translate-sve.c  |  25 +++-
 target/arm/tcg/vec_helper.c     | 202 +++++++++++++++++++++++++-------
 target/arm/vfp_helper.c         |   8 +-
 14 files changed, 371 insertions(+), 92 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-07-31 12:33 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 16:02 [PATCH 0/8] target/arm: Implement FEAT_EBF16 Peter Maydell
2024-07-30 16:02 ` [PATCH 1/8] target/arm: Allow setting the FPCR.EBF bit for FEAT_EBF16 Peter Maydell
2024-07-31  1:30   ` Richard Henderson
2024-07-30 16:03 ` [PATCH 2/8] target/arm: Pass env pointer through to sme_bfmopa helper Peter Maydell
2024-07-31  1:32   ` Richard Henderson
2024-07-30 16:03 ` [PATCH 3/8] target/arm: Pass env pointer through to gvec_bfdot helper Peter Maydell
2024-07-31  1:36   ` Richard Henderson
2024-07-31 12:31     ` Peter Maydell
2024-07-30 16:03 ` [PATCH 4/8] target/arm: Pass env pointer through to gvec_bfdot_idx helper Peter Maydell
2024-07-31  1:37   ` Richard Henderson
2024-07-30 16:03 ` [PATCH 5/8] target/arm: Pass env pointer through to gvec_bfmmla helper Peter Maydell
2024-07-31  1:38   ` Richard Henderson
2024-07-30 16:03 ` [PATCH 6/8] target/arm: Prepare bfdotadd() callers for FEAT_EBF support Peter Maydell
2024-07-31  1:43   ` Richard Henderson
2024-07-31  1:48   ` Richard Henderson
2024-07-31 12:32     ` Peter Maydell
2024-07-30 16:03 ` [PATCH 7/8] target/arm: Implement FPCR.EBF=1 semantics for bfdotadd() Peter Maydell
2024-07-31  1:50   ` Richard Henderson
2024-07-30 16:03 ` [PATCH 8/8] target/arm: Enable FEAT_EBF16 in the "max" CPU Peter Maydell
2024-07-31  1:51   ` Richard Henderson

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).