MXFP4 gated fold: review fixes and docs

The parts of the series' review rounds that concern the fold, carried over when the series was
split:

- gemm_mxfp4a8_gated_gemv: operand dtypes checked, the activation scale grid read as the gemm_nt_q
  rows read it (mx_ascale_grid), row pitches checked against the widths; the arrival counters are
  zeroed before any launch reads them (the memset is on the null stream, which the engine's
  streams need not wait for).
- The layout hooks refuse an operand the gated row does not have; the GeGLU chain refuses
  out_bf16 (its bf16 plane is a temporary there).
- r4d_selftest: the reference plane through the gemv row's own hook must be the same bytes; the
  small gated cases at K 256.
- libr4d/README.md and docs/TOOLS.md: the row, and --perfmxd's fold timing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-25 09:59:53 +01:00
1 parent cbc299417e
commit 2721f7c951
8 files changed
+63 -25

No files matched your search

+3
View File
@@ -531,6 +531,9 @@ extern "C" int r4d_fuse_gemm_nt_q_gated_mx(const RadParam* p, int n_p, uint64_t
if (!dt || std::strcmp(dt, "mxfp4a8")) return RAD_E_UNSUPPORTED;
const bool gelu = act_is(p, n_p, "silu", "gelu_tanh");
if (!gelu && !act_is(p, n_p, "silu", "silu")) return RAD_E_UNSUPPORTED;
/* The GeGLU chain leaves its bf16 plane in a temporary, so a caller asking for out_bf16 there
* has no chain (the shim refuses the operand too). */
if (gelu && RAD_FUSE_HAS(present, 7)) return RAD_E_UNSUPPORTED;
if (step == 0) {
Step s(out, "gemm_nt_q");