Archived
qwen35_fp8: read the delta net's out-projection beside its decode recurrent update
At decode heights the recurrent update runs one workgroup per (sequence, head) and leaves the card's memory mostly idle. Each delta-net layer now reads its out-projection (the whole weight, 7.9 MB a rank in MXFP4) into the on-die cache there, on the second lane behind a join from lane 0, as prefetch_beside does beside the all-reduces. Up to four decode sequences and 32 rows; no read on a step that carries a prompt's rows, at one rank, or where the deployment turns weight prefetch off (RadBuildCtx::weight_prefetch_off: nothing is declared). Qwen3.8-27B MXFP4 + DFlash2 at tp 2 on 2x R9700, production flags, 1k context, hwgrid ms/step, median of five interleaved rounds, none -> whole projection: x1 19.40 -> 19.10 (-1.5 %), x2 20.93 -> 20.78 (-0.7 %), x4 24.26 -> 24.17 (-0.4 %), every round faster at each of the three; x8 25.22 -> 25.48 (+1.0 %, four rounds of five slower) -- hence the four-sequence ceiling; x16 (64 rows, no read) and 90k x4 unchanged. 4 MB reads as the whole. Against this main (one round): x1 19.40 -> 19.15, other cells within noise. Greedy output identical to the build without the read (300/300 tokens on two prompts, |dlogprob| 0). arch_test: qwen35_fp8_reads_the_delta_net_out_projection_beside_its_decode_update; the qwen35_fp8 step pins move (prg_pins.py). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
49ca5ff9c6
commit
a64c75eb34
3 files changed
+76
-3
No files matched your search
@@ -127,6 +127,11 @@ struct GdnFP8 {
|
||||
* the widest decode window the fold serves. */
|
||||
rad_op op_cr = 0;
|
||||
int64_t cr_rows = 0;
|
||||
/* Set by the architecture after declare: a `prefetch` of the out-projection's leading bytes
|
||||
* (decl_prefetch, rad_arch.h), issued on the second lane beside the decode recurrent update on
|
||||
* steps of up to pf_out_rows rows and pf_out_seqs sequences. 0 where none is declared. */
|
||||
rad_op op_pf_out = 0;
|
||||
int64_t pf_out_rows = 0, pf_out_seqs = 0;
|
||||
rad_op op_ar = 0, op_add = 0;
|
||||
/* The next block absorbs this block's closing all-reduce (see rad_block_attn_gated_fp8.h). */
|
||||
bool ar_out = false;
|
||||
@@ -481,6 +486,14 @@ inline void GdnFP8::step(RadCtx* c, const RadBatch* batch, bool own_ar,
|
||||
const int64_t PT = T - DT;
|
||||
const int64_t in_w = conv_dim + v_dim; /* w.in.x's declared row width */
|
||||
|
||||
/* The recurrent update at decode heights runs one workgroup per (sequence, head) and leaves the
|
||||
* card's memory mostly idle, so the out-projection's weight is read into the on-die cache
|
||||
* beside it, on the second lane behind a join from lane 0 (as prefetch_beside). */
|
||||
if (op_pf_out && D > 0 && D <= pf_out_seqs && P == 0 && T <= pf_out_rows) {
|
||||
if (rad_lane_join(c, 0, 1) == RAD_OK && rad_lane(c, 1) == RAD_OK)
|
||||
RAD_ISSUE(c, op_pf_out, RAD_W(out.w));
|
||||
rad_lane(c, 0);
|
||||
}
|
||||
if (D > 0 && op_cr && qd <= cr_rows) {
|
||||
RAD_ISSUE_N(c, op_cr, qd,
|
||||
bcol(w.in.x, 0, conv_dim, DT), RAD_W(w_conv), RAD_NONE, kv_cache(kv_conv, layer),
|
||||
|
||||
@@ -114,6 +114,16 @@ using MtpHead = MtpFP8;
|
||||
* wash. The drafter's reads (Dflash2::Config::prefetch) take the same size. */
|
||||
constexpr int64_t kPrefetchBytes = (int64_t)12 << 20;
|
||||
constexpr int64_t kPrefetchStepRows = 32;
|
||||
/* The delta net's out-projection read into the on-die cache beside its decode recurrent update
|
||||
* (GdnFP8::op_pf_out): the update runs one workgroup per (sequence, head) and leaves the memory mostly
|
||||
* idle, so the whole projection (7.9 MB a rank in MXFP4; the read stops at the weight's end) is read
|
||||
* there. Qwen3.8-27B MXFP4 + DFlash2 at tp 2, production flags, 1k context, hwgrid ms/step, median of
|
||||
* five interleaved rounds, none -> whole: x1 19.40 -> 19.10, x2 20.93 -> 20.78, x4 24.26 -> 24.17
|
||||
* (every round faster), x8 25.22 -> 25.48 (four rounds of five slower: eight sequences' state traffic
|
||||
* fills the memory and the read competes with it), so up to four sequences. 4 MB read as the whole
|
||||
* (x1 19.24 / 19.10 against 19.20 / 19.06); 90k x4 and x16 (64 rows, no read) unchanged. */
|
||||
constexpr int64_t kGdnOutPrefetchBytes = (int64_t)8 << 20;
|
||||
constexpr int64_t kGdnOutPrefetchSeqs = 4;
|
||||
|
||||
struct Layer {
|
||||
int full = 0;
|
||||
@@ -1091,6 +1101,11 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
|
||||
Layer& lay = m.layers[(size_t)l];
|
||||
lay.pf_gu_w = lay.mlp.gate_up.w;
|
||||
lay.op_pf_gu = decl_prefetch(b, lay.pf_gu_w, kPrefetchBytes);
|
||||
if (!lay.full) {
|
||||
lay.gdn.op_pf_out = decl_prefetch(b, lay.gdn.out.w, kGdnOutPrefetchBytes);
|
||||
lay.gdn.pf_out_rows = kPrefetchStepRows;
|
||||
lay.gdn.pf_out_seqs = kGdnOutPrefetchSeqs;
|
||||
}
|
||||
if (l + 1 < m.n_main) {
|
||||
const Layer& nx = m.layers[(size_t)l + 1];
|
||||
lay.pf_next_w = nx.full ? nx.attn.qg.w : nx.gdn.in.w;
|
||||
|
||||
Reference in new issue
Block a user