code wiki / _hdl_build / nx_nofloat_mxfp4.nx
nx_nofloat_mxfp4.nx
buildroot/runtime/_hdl_build/nx_nofloat_mxfp4.nx
about
nx_nofloat_mxfp4.nx -- SOVEREIGN no-float MXFP4 dequant (K3 F406 gap; operator 2026-07-19 "beyond SOTA").
OCP Microscaling Formats (MX) Spec v1.0: a block = 32 elements, each E2M1 (4-bit float: sign(1) + 3-bit
magnitude field) sharing ONE E8M0 scale byte (8-bit unsigned exponent, value = 2^(e-127), 0xFF = NaN).
E2M1 magnitude set (3-bit field 0..7) = {0, 0.5, 1, 1.5, 2, 3, 4, 6}. Dequant is PURE INTEGER (a Q16
magnitude lookup + a power-of-2 shift by (e-127) + sign) -- no float touches the weights, deterministic,
the exact no-float treatment we gave Q6_K/Q5_0. Kimi K3 uses MXFP4 weights / MXFP8 activations; this
closes the weight-format half. Grounded: OCP MX v1.0; arXiv 2310.10537 (Microscaling Data Formats).
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_nofloat_mxfp4_gate.nx
structs
| none |
consts
| 11 | const MX_BIAS: i64 = 127 // E8M0 exponent bias |
| 12 | const MX_NAN: i64 = 255 // 0xFF E8M0 scale = NaN/uninitialised |
| 13 | const MX_BLK: i64 = 32 // elements per MX block |
| 14 | const MX_Q: i64 = 65536 // Q16 one |
functions
| 17 | func mx_mag_q16(idx: i64) -> i64 called by 1: mx_e2m1 |
| 28 | func mx_e2m1(nib: i64, e: i64) -> i64 |
| 40 | func mx_block(buf: *u8, boff: i64, soff: i64, out: *i64) -> i64 |