Archived
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:
1 parent
cbc299417e
commit
2721f7c951
8 files changed
+63
-25
No files matched your search
@@ -942,20 +942,24 @@ extern "C" int r4d_rad_relayout_mxfp4(const RadParam* p, int n_p, int operand,
|
||||
/* gemm_nt_q_gated_mx's weights are gemm_nt_q's mxfp4a8 planes in the same stored forms, but its
|
||||
* `b_ref` is operand 4, where gemm_nt_q has `y`: mapped to gemm_nt_q's index, so both ops ask for
|
||||
* the reference plane in one form and the loader stores it once. */
|
||||
static int mx_gated_operand(int operand) { return operand == 4 ? Q_BREF : operand; }
|
||||
static int mx_gated_operand(int operand) {
|
||||
return operand == Q_B || operand == Q_BSCALE ? operand : operand == 4 ? Q_BREF : -1;
|
||||
}
|
||||
|
||||
extern "C" int r4d_rad_layout_mxfp4_gated(const RadParam* p, int n_p, int operand,
|
||||
const RadEncoding* enc, const int* sel,
|
||||
const RadTensor* pl, int n, RadLayout* out) {
|
||||
return r4d_rad_layout_mxfp4(p, n_p, mx_gated_operand(operand), enc, sel, pl, n, out);
|
||||
const int o = mx_gated_operand(operand);
|
||||
return o < 0 ? RAD_E_UNSUPPORTED : r4d_rad_layout_mxfp4(p, n_p, o, enc, sel, pl, n, out);
|
||||
}
|
||||
|
||||
extern "C" int r4d_rad_relayout_mxfp4_gated(const RadParam* p, int n_p, int operand,
|
||||
const RadEncoding* enc, const int* sel,
|
||||
const RadTensor* pl, int n, void* dst,
|
||||
int64_t dst_bytes) {
|
||||
return r4d_rad_relayout_mxfp4(p, n_p, mx_gated_operand(operand), enc, sel, pl, n, dst,
|
||||
dst_bytes);
|
||||
const int o = mx_gated_operand(operand);
|
||||
return o < 0 ? RAD_E_UNSUPPORTED
|
||||
: r4d_rad_relayout_mxfp4(p, n_p, o, enc, sel, pl, n, dst, dst_bytes);
|
||||
}
|
||||
|
||||
/* ---- the MoE experts. The weight is staged through LDS, so it is not permuted: the int4 plane is
|
||||
|
||||
Reference in new issue
Block a user