hc_read PF2: a persistent up product and mix

Each wave keeps its 16 rows of d as twenty WMMA fragments (K = 320) and the
workgroup walks a run of channel blocks, with mix_up in fragment order so a
block's B is a 40 KB copy into LDS. R4D_HC_READ_PF2 5, 6 and 7 pair it with
the 64-row, the 128-row or the wide down product. Bit-identical. On gfx1201
it is slower than the 256-row tile of value 1.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-10-06 11:22:32 +02:00
1 parent 075dfefe54
commit d7aa401568
3 files changed
+200 -23

No files matched your search

+10 -4
View File
@@ -5321,7 +5321,10 @@ static void hc_read_i8(const Plugin& pl, int64_t M, bool real_stream, int form)
static const char* const kForm[] = { "the launcher's rule", "the decode tiles' kernels",
"the wide kernels", "the PF2 kernels",
"the PF2 down product", "the PF2 up product",
"the PF2 kernels at 128 rows" };
"the PF2 kernels at 128 rows",
"the PF2 down and persistent up products",
"the PF2 128-row down and persistent up products",
"the PF2 persistent up product" };
const std::string nm = fmt("hc_read_e4m3 int8 codes at M=%lld (%s, %s)", (long long)M,
real_stream ? "a real stream" : "the null stream", kForm[form]);
if (!d_h || !d_w || !d_dn || !d_up || !d_iw || !d_x || !d_inj || !d_q || !d_qs || !d_rq || !d_rs) {
@@ -5488,11 +5491,14 @@ static void hc_prefill(const Plugin& pl, int64_t M, int iters, bool timed) {
/* PF2 keeps its two weight planes in the band's `u` buffer, M * hc * n bf16: they need
* ceil((lr + hc) / 16) * 16 + lr rows of it, so a smaller M is the wide form's alone. */
const int64_t pf2_min_m = ((lr + hc + 15) / 16) * 16 + lr;
const int f_lo = pl.pin_hc ? 1 : 0, f_hi = pl.pin_hc ? (M >= pf2_min_m ? 6 : 2) : 0;
const int f_lo = pl.pin_hc ? 1 : 0, f_hi = pl.pin_hc ? (M >= pf2_min_m ? 9 : 2) : 0;
static const char* const kForm[] = { "the launcher's rule", "the decode tiles' kernels",
"the wide kernels", "the PF2 kernels",
"the PF2 down product", "the PF2 up product",
"the PF2 kernels at 128 rows" };
"the PF2 kernels at 128 rows",
"the PF2 down and persistent up products",
"the PF2 128-row down and persistent up products",
"the PF2 persistent up product" };
std::vector<Out> outs;
for (int form = f_lo; form <= f_hi; ++form) {
if (pl.pin_hc) pl.pin_hc(form);
@@ -10504,7 +10510,7 @@ static void device_phase(const Plugin& pl) {
for (int64_t m : { 65, 2048 })
for (int form : { 1, 2 }) hc_read_i8(pl, m, true, form);
for (int64_t m : { 700, 2048 })
for (int form : { 3, 4, 5, 6 }) hc_read_i8(pl, m, true, form);
for (int form = 3; form <= 9; ++form) hc_read_i8(pl, m, true, form);
}
}