From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 0/8] target/arm: Implement FEAT_EBF16
Date: Tue, 30 Jul 2024 17:02:58 +0100 [thread overview]
Message-ID: <20240730160306.2959745-1-peter.maydell@linaro.org> (raw)
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
next reply other threads:[~2024-07-30 16:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 16:02 Peter Maydell [this message]
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
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=20240730160306.2959745-1-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--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).