Archived
M2XFP4 (MXFP4v2): quantiser, gfx1201 WMMA kernels, host rows, df2 wiring, .rad packer (Import::ParoM2), stability fixes (counters-in-scratch x3, aql publish fences), kbench rows, runbook (REMAINING.md)
This commit is contained in:
1 parent
9eaf10da6e
commit
ea0908596b
60 files changed
+4619
-193
No files matched your search
@@ -69,9 +69,22 @@ struct Scales {
|
||||
int64_t group; /* K elements per scale */
|
||||
int64_t rblk; /* operand rows per scale row; 1 unless the grid is block-scaled */
|
||||
bool e8m0; /* the scale stream is OCP e8m0 exponent bytes, not floats */
|
||||
/* M2XFP4 (libquant's `m2xfp4`, lq_m2xfp.cpp): `group` is 8, so `g` names a subgroup. The
|
||||
* E8M0 byte is one per four subgroups and the meta plane's two-bit field refines it, the
|
||||
* scale of subgroup g being e8m0(scale[g >> 2]) . (1 + k/4) with k the field's value -- the
|
||||
* quantiser's own decode, which this states where it folds the product. */
|
||||
const uint8_t* m2_meta = nullptr; /* [rows][K/32] meta bytes, canonical rows */
|
||||
int64_t m2_mrs = 0; /* bytes between meta rows */
|
||||
bool m2 = false;
|
||||
|
||||
/* The scale of group `g` of `row`. */
|
||||
inline float grp(int64_t row, int64_t g) const {
|
||||
if (m2) {
|
||||
const int64_t gi = g >> 2;
|
||||
const int64_t i = (rblk > 1 ? row / rblk : row) * rs + gi * cs;
|
||||
const int k = (m2_meta[row * m2_mrs + gi] >> (2 * (g & 3))) & 3;
|
||||
return e8m0_to_f32(((const uint8_t*)p)[i]) * (1.0f + 0.25f * (float)k);
|
||||
}
|
||||
int64_t i = (rblk > 1 ? row / rblk : row) * rs + g * cs;
|
||||
return e8m0 ? e8m0_to_f32(((const uint8_t*)p)[i]) : ld_dt(dt, p, i);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user