From: Weiwei Li <liweiwei@iscas.ac.cn>
To: qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Cc: palmer@dabbelt.com, alistair.francis@wdc.com,
bin.meng@windriver.com, dbarboza@ventanamicro.com,
zhiwei_liu@linux.alibaba.com, wangjunqiang@iscas.ac.cn,
lazyparser@gmail.com, Weiwei Li <liweiwei@iscas.ac.cn>
Subject: [RFC 1/5] target/riscv: Add properties for BF16 extensions
Date: Wed, 12 Apr 2023 10:33:16 +0800 [thread overview]
Message-ID: <20230412023320.50706-2-liweiwei@iscas.ac.cn> (raw)
In-Reply-To: <20230412023320.50706-1-liweiwei@iscas.ac.cn>
Add ext_zfbfmin/zvfbfmin/zvfbfwma properties.
Add require check for BF16 extensions.
Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
---
target/riscv/cpu.c | 13 +++++++++++++
target/riscv/cpu.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1e97473af2..c19bbb41fb 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -874,6 +874,12 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
return;
}
+ if ((cpu->cfg.ext_zfbfmin | cpu->cfg.ext_zvfbfmin |
+ cpu->cfg.ext_zvfbfwma) && !cpu->cfg.ext_f) {
+ error_setg(errp, "BF16 extensions require F extension");
+ return;
+ }
+
if (cpu->cfg.ext_d && !cpu->cfg.ext_f) {
error_setg(errp, "D extension requires F extension");
return;
@@ -918,6 +924,13 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
return;
}
+ if ((cpu->cfg.ext_zvfbfmin | cpu->cfg.ext_zvfbfwma) &&
+ !cpu->cfg.ext_zve32f) {
+ error_setg(errp, "Zvfbfmin/Zvfbfwma extensions require Zve32f "
+ "extension");
+ return;
+ }
+
/* Set the ISA extensions, checks should have happened above */
if (cpu->cfg.ext_zhinx) {
cpu->cfg.ext_zhinxmin = true;
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 638e47c75a..6c99a82624 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -462,6 +462,7 @@ struct RISCVCPUConfig {
bool ext_svpbmt;
bool ext_zdinx;
bool ext_zawrs;
+ bool ext_zfbfmin;
bool ext_zfh;
bool ext_zfhmin;
bool ext_zfinx;
@@ -471,6 +472,8 @@ struct RISCVCPUConfig {
bool ext_zve64f;
bool ext_zve64d;
bool ext_zmmul;
+ bool ext_zvfbfmin;
+ bool ext_zvfbfwma;
bool ext_zvfh;
bool ext_zvfhmin;
bool ext_smaia;
--
2.25.1
next prev parent reply other threads:[~2023-04-12 2:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 2:33 [RFC 0/5] target/riscv: Add support for BF16 extensions Weiwei Li
2023-04-12 2:33 ` Weiwei Li [this message]
2023-04-12 20:24 ` [RFC 1/5] target/riscv: Add properties " Daniel Henrique Barboza
2023-04-12 2:33 ` [RFC 2/5] target/riscv: Add support for Zfbfmin extension Weiwei Li
2023-04-12 10:20 ` Richard Henderson
2023-04-12 2:33 ` [RFC 3/5] target/riscv: Add support for Zvfbfmin extension Weiwei Li
2023-04-12 10:21 ` Richard Henderson
2023-04-12 2:33 ` [RFC 4/5] target/riscv: Add support for Zvfbfwma extension Weiwei Li
2023-04-12 10:22 ` Richard Henderson
2023-04-12 2:33 ` [RFC 5/5] target/riscv: Expose properties for BF16 extensions Weiwei Li
2023-04-12 20:24 ` Daniel Henrique Barboza
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=20230412023320.50706-2-liweiwei@iscas.ac.cn \
--to=liweiwei@iscas.ac.cn \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=lazyparser@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=wangjunqiang@iscas.ac.cn \
--cc=zhiwei_liu@linux.alibaba.com \
/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).