RISC-V MAC Mnemonics
RISC-V MAC Mnemonics: OCP MX, FP8, and FP4
This document summarizes the identified RISC-V instructions for Multiply-Accumulate (MAC) operations utilizing OCP Microscaling Formats (MX) for FP8 and FP4.
1. OCP-MX-V (Custom Scalar Extension)
The OCP-MX-V extension provides a set of custom R-type instructions (Opcode 0x0b) for bit-serial MAC operations, optimized for integration with the SERV core.
Mnemonic |
Opcode |
funct3 |
Description |
|---|---|---|---|
|
0x0b |
0x0 |
Set format/rounding mode from |
|
0x0b |
0x1 |
Load Shared Scale A ( |
|
0x0b |
0x2 |
Stream 4+4 packed elements for MAC from |
|
0x0b |
0x3 |
Read 32-bit accumulator into |
Register Bit-Mapping (MX.SETFMT)
rs1[2:0]:format_ars1[4:3]:round_moders1[5]:overflow_wrap
2. PULP Snitch (Small-Float / Xff8 Extension)
The Snitch core from the PULP platform utilizes a custom “Small-Float” extension for efficient 8-bit floating-point arithmetic.
Mnemonic |
Opcode |
funct3 |
Description |
|---|---|---|---|
|
0x5b |
0x4 |
Vector dot-product of FP8 elements (Sum of Products). |
|
0x5b |
0x5 |
Vector multiply-accumulate for FP8 elements. |
|
0x5b |
0x6 |
Vector fused multiply-add for FP8 elements. |
Architectural Integration
Extension: Part of the
Xpulpf/Xff8ISA extension.Register File: Operates on the 32-bit (or 64-bit) floating-point registers, treating them as vectors of 4 (or 8) FP8 elements.
3. ZvfofpXmin (Minimal Vector OCP Floating-Point)
ZvfofpXmin is a proposed minimal vector extension for OCP MX support, integrating the MAC unit into the RISC-V Vector pipeline.
Mnemonic |
Type |
Description |
|---|---|---|
|
Vector-Vector |
Vector dot product of two OCP MX blocks. |
Architectural Integration
CSRs: Uses
vmxfmt(0x800) for format configuration.State: Respects standard RVV 1.0 CSRs (
vstart,vl,vtype,vxsat).
4. Zvf8mmai (Vector FP8 Matrix-Multiply-Accumulate)
Zvf8mmai is an inferred extension for vector-based 8-bit floating-point matrix operations.
Mnemonic |
Description |
|---|---|
|
Vector matrix-multiply-accumulate for FP8 formats (E4M3/E5M2). |
5. Zf8 (Scalar FP8 Support)
Zf8 refers to scalar support for 8-bit floating-point formats, providing base conversion and arithmetic instructions.
Mnemonic |
Description |
|---|---|
|
Convert FP8 to Single-Precision (FP32). |
|
Convert Single-Precision (FP32) to FP8. |
|
Scalar FP8 addition (rare in minimal implementations). |
6. Summary of OCP MX Formats (Element IDs)
These IDs are used in MX.SETFMT and vmxfmt.
ID |
Format |
Type |
Bits |
|---|---|---|---|
|
E4M3 |
MXFP8 |
8 |
|
E5M2 |
MXFP8 |
8 |
|
E3M2 |
MXFP6 |
6 |
|
E2M3 |
MXFP6 |
6 |
|
E2M1 |
MXFP4 |
4 |
|
INT8 |
MXINT8 |
8 |
|
INT8_SYM |
MXINT8 |
8 |
References
integration/SERV_INTEGRATION_CONCEPT.mdintegration/CSR_RVV_CONCEPT_AND_ROADMAP.mdresearch/ZVFOFPXMIN_GAP.mdintegration/RISCV/OCP-MICROSCALING-FORMATS-MX-V1-0-SPEC.PDFintegration/RISCV/2510.14557V1.PDF