Archived
libxe2: m2xfp4 codes stored tiled at load -- the verify GEMM's step one block load, gate_up 240 -> 222 us
Where N % 16 == 0 and K % 128 == 0 the layout hook asks for "xe2.m2.tiled16": a 16-column tile's 128-column step is 1 KiB, dword w of its columns side by side, the ESIMD kernel's [word][lane] registers as they lie (four block loads in place of four d32x4 gathers). M = 1 goes to the same kernel when tiled. Every m2 reader in libxe2 (exact, SIMT GEMV, jm and SIMT DPAS forms, prefill decode) reads the tiled form; unrelayout inverts it for the oracle. rad-kbench against libref: 70 checked, 70 passed (worst rel_l2 1.2e-3). M = 8: gate_up 240 -> 222, down 140 -> 119, N=1024 50 -> 25 us. Greedy output identical (8 prompts x 64 tokens); 512-token decode 31.8 -> 33.3 tok/s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
2a764d2d38
commit
68d510b1f4
4 files changed
+107
-37
No files matched your search
@@ -101,4 +101,13 @@ int gemm_m2_unrelayout(const RadParam* p, int n_p, int operand, const RadEncodin
|
||||
const int* sel, const void* src, int64_t src_bytes, const RadTensor* planes,
|
||||
int n);
|
||||
|
||||
/* The m2xfp4 codes tiled (xe2_gemm_m2.cpp's layout, tag "xe2.m2.tiled16"), where N % 16 == 0 and
|
||||
* K % 128 == 0: a 16-column tile's 128-column step is 1 KiB, dword w (codes 8w .. 8w + 7) of its
|
||||
* columns side by side -- the [word][lane] registers of the verify GEMM, one block load. m2t_off is
|
||||
* byte b (codes 2b, 2b + 1) of column n's row; the meta rows follow the codes as before. */
|
||||
inline bool m2_tiled(int64_t N, int64_t K) { return N % 16 == 0 && K % 128 == 0; }
|
||||
inline int64_t m2t_off(int64_t n, int64_t b, int64_t K) {
|
||||
return ((((n >> 4) * (K / 128) + (b >> 6)) * 16 + ((b >> 2) & 15)) * 64) + (n & 15) * 4 + (b & 3);
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
Reference in new issue
Block a user