All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] Add OCP FP8/FP4 and RISC-V Zvfofp8min/Zvfofp4min extension support
@ 2026-01-08 15:16 Max Chou
  2026-01-08 15:16 ` [PATCH 01/18] target/riscv: rvv: Fix NOP_UU_B vs2 width Max Chou
                   ` (18 more replies)
  0 siblings, 19 replies; 33+ messages in thread
From: Max Chou @ 2026-01-08 15:16 UTC (permalink / raw)
  To: qemu-devel, qemu-riscv
  Cc: Palmer Dabbelt, Alistair Francis, Aurelien Jarno, Peter Maydell,
	Alex Bennée, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
	Max Chou

This patchset adds support for the OCP (Open Compute Project) 8-bit and
4-bit floating-point formats, along with the RISC-V Zvfofp8min and
Zvfofp4min vector extensions that provide conversion operations for
these formats.

OCP Floating-Point Formats
* The OCP FP8 specification defines two 8-bit floating-point formats:
  - E4M3: 4-bit exponent, 3-bit mantissa
    * No infinity representation; only 0x7f and 0xff are NaN
  - E5M2: 5-bit exponent, 2-bit mantissa
    * IEEE-like format with infinity representation
    * Multiple NaN encodings supported
* The OCP FP4 specification defines the E2M1 format:
  - E2M1: 2-bit exponent, 1-bit mantissa
    * No NaN representation

RISC-V ISA Extensions
* Zvfofp8min (Version 0.2.1):
  The Zvfofp8min extension provides minimal vector conversion support
  for OFP8 formats. It requires the Zve32f extension and leverages the
  altfmt field in the VTYPE CSR (introduced by Zvfbfa) to select between
  E4M3 (altfmt=0) and E5M2 (altfmt=1) formats.
  - Canonical NaN for both E4M3 and E5M2 is 0x7f
  - All NaNs are treated as quiet NaNs
  Instructions added/extended:
  - vfwcvtbf16.f.f.v: OFP8 to BF16 widening conversion
  - vfncvtbf16.f.f.w: BF16 to OFP8 narrowing conversion
  - vfncvtbf16.sat.f.f.w: BF16 to OFP8 with saturation (new)
  - vfncvt.f.f.q: FP32 to OFP8 quad-narrowing conversion (new)
  - vfncvt.sat.f.f.q: FP32 to OFP8 with saturation (new)

* Zvfofp4min (Version 0.1):
  The Zvfofp4min extension provides minimal vector conversion support
  for the OFP4 E2M1 format. It requires the Zve32f extension.
  Instructions added:
  - vfext.vf2: OFP4 E2M1 to OFP8 E4M3 widening conversion

Modifications
* Softfloat library:
  - New float8_e4m3 and float8_e5m2 types with NaN checking functions
  - New float4_e2m1 type for OFP4 support
  - Conversion functions: bfloat16/float32 <-> float8_e4m3/float8_e5m2
  - Conversion function: float4_e2m1 -> float8_e4m3
  - Implementation-defined behavior flags in float_status:
    * ocp_fp8e5m2_no_signal_nan: Treat all E5M2 NaNs as quiet
    * ocp_fp8_same_canonical_nan: Use 0x7f as canonical NaN for all OFP8
* RISC-V target:
  - CPU configuration properties for Zvfofp8min and Zvfofp4min
  - Extension implied rules (Zvfofp8min requires Zve32f and Zvfbfa)
  - Vector helper functions for OFP8/OFP4 conversion instructions
  - Disassembler support for new instructions

References
* OCP FP8 specification:
  https://www.opencompute.org/documents/ocp-8-bit-floating-point-specification-ofp8-revision-1-0-2023-12-01-pdf-1
* Zvfofp8min specification (v0.2.1 commit e1e20a7):
  https://github.com/aswaterman/riscv-misc/blob/main/isa/zvfofp8min.adoc
* Zvfofp4min specification (v0.1 commit e1e20a7):
  https://github.com/aswaterman/riscv-misc/blob/main/isa/zvfofp4min.adoc

PS: This series depends on the Zvfbfa extension patchset which introduces:
  - The altfmt field in VTYPE CSR
  - BF16 vector operations infrastructure
  - vfwcvtbf16.f.f.v and vfncvtbf16.f.f.w base instructions

Based-on: 20260108132631.9429-1-max.chou@sifive.com

Max Chou (18):
  target/riscv: rvv: Fix NOP_UU_B vs2 width
  fpu/softfloat: Add OCP(Open Compute Project) OFP8 data type
  fpu/softfloat: Add convert operations(bf16, fp32) for OFP8 data types
  fpu/softfloat: Add OCP(Open Compute Project) OFP4 data type
  fpu/softfloat: Add OCP FP4 E2M1 to OCP FP8 E4M3 convert operation
  target/riscv: Add cfg properity for Zvfofp8min extension
  target/riscv: Add implied rules for Zvfofp8min extension
  target/riscv: rvv: Make vfwcvtbf16.f.f.v support OFP8 to BF16
    conversion for Zvfofp8min extension
  target/riscv: rvv: Make vfncvtbf16.f.f.w support BF16 to OFP8
    conversion for Zvfofp8min extension
  target/riscv: rvv: Add vfncvtbf16.sat.f.f.w instruction for Zvfofp8min
    extension
  target/riscv: rvv: Add vfncvt.f.f.q and vfncvt.sat.f.f.q instructions
    for Zvfofp8min extension
  target/riscv: Expose Zvfofp8min properity
  disas/riscv: Add support of Zvfofp8min extension
  target/riscv: Add cfg properity for Zvfofp4min extension
  target/riscv: Add implied rules for Zvfofp4min extension
  target/riscv: rvv: Add vfext.vf2 instruction for Zvfofp4min extension
  target/riscv: Expose Zvfofp4min properity
  disas/riscv: Add support of Zvfofp4min extension

 disas/riscv.c                              |  12 +
 fpu/softfloat-parts.c.inc                  |  77 +++++-
 fpu/softfloat-specialize.c.inc             |  57 ++++-
 fpu/softfloat.c                            | 274 +++++++++++++++++++++
 include/fpu/softfloat-helpers.h            |  20 ++
 include/fpu/softfloat-types.h              |  28 +++
 include/fpu/softfloat.h                    | 124 ++++++++++
 target/riscv/cpu.c                         |  35 ++-
 target/riscv/cpu_cfg_fields.h.inc          |   2 +
 target/riscv/helper.h                      |  15 ++
 target/riscv/insn32.decode                 |   8 +
 target/riscv/insn_trans/trans_rvbf16.c.inc |  32 ++-
 target/riscv/insn_trans/trans_rvofp4.c.inc |  54 ++++
 target/riscv/insn_trans/trans_rvofp8.c.inc | 115 +++++++++
 target/riscv/insn_trans/trans_rvv.c.inc    |  39 +++
 target/riscv/tcg/tcg-cpu.c                 |  15 ++
 target/riscv/translate.c                   |   2 +
 target/riscv/vector_helper.c               | 131 +++++++++-
 18 files changed, 1022 insertions(+), 18 deletions(-)
 create mode 100644 target/riscv/insn_trans/trans_rvofp4.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvofp8.c.inc

-- 
2.43.7



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

end of thread, other threads:[~2026-01-15  9:24 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 15:16 [PATCH 00/18] Add OCP FP8/FP4 and RISC-V Zvfofp8min/Zvfofp4min extension support Max Chou
2026-01-08 15:16 ` [PATCH 01/18] target/riscv: rvv: Fix NOP_UU_B vs2 width Max Chou
2026-01-08 15:16 ` [PATCH 02/18] fpu/softfloat: Add OCP(Open Compute Project) OFP8 data type Max Chou
2026-01-09  7:29   ` Chao Liu
2026-01-15  7:46     ` Max Chou
2026-01-10  2:57   ` Richard Henderson
2026-01-14 11:54     ` Max Chou
2026-01-08 15:16 ` [PATCH 03/18] fpu/softfloat: Add convert operations(bf16, fp32) for OFP8 data types Max Chou
2026-01-10  3:20   ` Richard Henderson
2026-01-15  9:13     ` Max Chou
2026-01-08 15:16 ` [PATCH 04/18] fpu/softfloat: Add OCP(Open Compute Project) OFP4 data type Max Chou
2026-01-09  6:08   ` Chao Liu
2026-01-08 15:16 ` [PATCH 05/18] fpu/softfloat: Add OCP FP4 E2M1 to OCP FP8 E4M3 convert operation Max Chou
2026-01-08 15:16 ` [PATCH 06/18] target/riscv: Add cfg properity for Zvfofp8min extension Max Chou
2026-01-09  7:05   ` Chao Liu
2026-01-15  9:18     ` Max Chou
2026-01-08 15:16 ` [PATCH 07/18] target/riscv: Add implied rules " Max Chou
2026-01-08 15:16 ` [PATCH 08/18] target/riscv: rvv: Make vfwcvtbf16.f.f.v support OFP8 to BF16 conversion " Max Chou
2026-01-08 15:16 ` [PATCH 09/18] target/riscv: rvv: Make vfncvtbf16.f.f.w support BF16 to OFP8 " Max Chou
2026-01-08 15:16 ` [PATCH 10/18] target/riscv: rvv: Add vfncvtbf16.sat.f.f.w instruction " Max Chou
2026-01-08 15:16 ` [PATCH 11/18] target/riscv: rvv: Add vfncvt.f.f.q and vfncvt.sat.f.f.q instructions " Max Chou
2026-01-09  6:37   ` Chao Liu
2026-01-15  9:24     ` Max Chou
2026-01-08 15:16 ` [PATCH 12/18] target/riscv: Expose Zvfofp8min properity Max Chou
2026-01-08 15:16 ` [PATCH 13/18] disas/riscv: Add support of Zvfofp8min extension Max Chou
2026-01-08 15:16 ` [PATCH 14/18] target/riscv: Add cfg properity for Zvfofp4min extension Max Chou
2026-01-09  6:59   ` Chao Liu
2026-01-15  9:22     ` Max Chou
2026-01-08 15:16 ` [PATCH 15/18] target/riscv: Add implied rules " Max Chou
2026-01-08 15:16 ` [PATCH 16/18] target/riscv: rvv: Add vfext.vf2 instruction " Max Chou
2026-01-08 15:16 ` [PATCH 17/18] target/riscv: Expose Zvfofp4min properity Max Chou
2026-01-08 15:16 ` [PATCH 18/18] disas/riscv: Add support of Zvfofp4min extension Max Chou
2026-01-09  7:12 ` [PATCH 00/18] Add OCP FP8/FP4 and RISC-V Zvfofp8min/Zvfofp4min extension support Chao Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.