Archived
ParoQuant int5/int4: the review fixes of PR 1 carried to the 5-/4-bit path
* givens_rotate and givens_quant_act_i8g take the same checked `pairs` relayout as givens_quant_act_fp8. * gemm_w4a8i8/w5a8i8_tiled: one re-tile slab for every part, as gemm_mxfp4a8_tiled (they share its scratch hook, which is one slab now). * LinearFP8::decl_gemm_q: the one gemm_nt_q declaration, pb1/pb2 only with parts, for the MXFP4, the skinny 5-/4-bit and the int8 prefill GEMMs.
This commit is contained in:
1 parent
6091039926
commit
3491aca6fe
3 files changed
+33
-44
No files matched your search
@@ -239,7 +239,7 @@ static void wpa8i8_launch(long at, long ascale, long wq, long whi, long wsz, lon
|
||||
}
|
||||
|
||||
// ============================================================== the plugin ABI entry points
|
||||
// The row-major int8 activation is re-tiled into the op's scratch (one slab a part), then the GEMM
|
||||
// The row-major int8 activation is re-tiled into the op's scratch (one slab, the parts in turn), then the GEMM
|
||||
// reads it from there -- mxfp4a8_tiled's arrangement exactly, including a partitioned weight as
|
||||
// one launch per part over windows of the planes.
|
||||
template <int BITS>
|
||||
@@ -258,11 +258,11 @@ static int wpa8i8_dispatch(const RadArgs* a, RadStream s) {
|
||||
if (rc != RAD_OK) return rc;
|
||||
if (as_group != 128) return R4D_NO(RAD_E_SHAPE); // one scale a (row, 128): the slab
|
||||
const long long slab = r4d_mxfp4a8_tile_a_bytes((int)g.M, (int)g.K);
|
||||
if (!a->scratch || a->scratch_bytes < slab * mp.n) return R4D_NO(RAD_E_INVAL);
|
||||
if (!a->scratch || a->scratch_bytes < slab) return R4D_NO(RAD_E_INVAL);
|
||||
const long long kb = g.K / 128;
|
||||
const long at = (long)(uintptr_t)a->scratch;
|
||||
for (int p = 0; p < mp.n; ++p) {
|
||||
const long long n0 = mp.n0[p], np = mp.n1[p] - mp.n0[p];
|
||||
const long at = (long)(uintptr_t)a->scratch + (long)(p * slab);
|
||||
R4D_TRY("gemm_wpa8i8_tiled",
|
||||
r4d_mxfp4a8_tile_a(r4d_addr(g.a) + p * g.K, at, (int)g.M, (int)g.K, (long)(uintptr_t)s,
|
||||
(int)(mp.lda ? mp.lda : g.K));
|
||||
|
||||
+6
-4
@@ -5254,8 +5254,9 @@ static const RadKernelInfo kKernels[] = {
|
||||
"scales",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
|
||||
ROW(cHadQuantActFp8), NOTUNE,
|
||||
nullptr, nullptr, r4d_rad_givens_quant_act_i8g, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, r4d_rad_givens_quant_act_i8g_describe },
|
||||
nullptr, nullptr, r4d_rad_givens_quant_act_i8g, nullptr, r4d_rad_layout_givens_pairs,
|
||||
r4d_rad_relayout_givens_pairs, nullptr, r4d_rad_unrelayout_givens_pairs, nullptr,
|
||||
r4d_rad_givens_quant_act_i8g_describe },
|
||||
|
||||
{ "givens_rotate", "givens_rotate", "quant",
|
||||
"the channel scale and ParoQuant's Givens rotations, once for each rotated part, to f16",
|
||||
@@ -5264,8 +5265,9 @@ static const RadKernelInfo kKernels[] = {
|
||||
"f32 channel scales",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
|
||||
ROW(cHadQuantActFp8), NOTUNE,
|
||||
nullptr, nullptr, r4d_rad_givens_rotate, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, r4d_rad_givens_rotate_describe },
|
||||
nullptr, nullptr, r4d_rad_givens_rotate, nullptr, r4d_rad_layout_givens_pairs,
|
||||
r4d_rad_relayout_givens_pairs, nullptr, r4d_rad_unrelayout_givens_pairs, nullptr,
|
||||
r4d_rad_givens_rotate_describe },
|
||||
|
||||
{ "quant_act_i8g", "quant_act_i8g", "quant",
|
||||
"per-(row, 128-column) symmetric int8 quantisation of a bf16 activation",
|
||||
|
||||
Reference in new issue
Block a user