Archived
qwen35_fp8: a prefill step of one sequence in two pieces, block boundaries on the second lane
At two ranks a prefill step of at least 1024 rows is cut into two pieces of about half (pipe_rows: rounded up to 64, both in the whole step's band). Every block runs a piece at a time on lane 0; the work between two blocks runs a piece at a time on lane 1: the block's all-reduce at `overlap` 1 (the narrow lane rows), then the next block's plain norm, and after a feed-forward that keeps its add, the add, the DFlash2 taps and the final norm. The fused all-reduce + norm is not used there: it holds its blocks while waiting on the link and slowed the GEMM beside it by a third (measured: no gain at all with it). - GdnFP8, AttnGatedFP8: takes_pieces(); the dense attention gets a two-piece path (each piece its own rows, positions, slots and query bounds, seeing the cache up to its own end), and the delta net's piece path takes the caller's normed input (ArPieces::in_ready) and passes each piece its own context length (positions + r0), so a prompt's first chunk works. - MlpFP8: slice() split into body() and tail(), and an overlap all-reduce (issue_ar). - NormQuantFP8::step_plain(). - M-RoPE batches (the vision tower loaded) take it when no token's components differ: plane 0 of rope_pos is then every token's position. - RADIANCE_QWEN35_PIPE=0 turns it off; a wide prefill step that runs serially says why, once. Bit for bit the serial step: Qwen3.8-27B KL recordings (k6_v4, wht6) compare equal with the pipeline on and off, and greedy answers to three long requests (680-41k tokens, speculation 3 with the DFlash2 taps) are identical. 41k-token prefill on two R9700s: 9.00 -> 8.41 s with the TN crossover of the next commit (-6.6 %). arch_test: the two-rank pin moves; new tests pin the serial build under RADIANCE_QWEN35_PIPE=0 and the pieces, lanes and overlap of a wide step. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0f4c1afc38
commit
d39e0511e7
6 files changed
+459
-5
No files matched your search
@@ -139,6 +139,13 @@ struct GdnFP8 {
|
||||
* trailing add, which would read the delta before the reduction. */
|
||||
void step(RadCtx* c, const RadBatch* batch, bool own_ar = true,
|
||||
ArPieces* pieces = nullptr) const;
|
||||
/* Whether step() with `own_ar` false runs the whole block a piece at a time over `pieces`
|
||||
* (its piece path), asked by a caller that must know before it commits to a schedule. */
|
||||
bool takes_pieces(const RadBatch* batch, const ArPieces* pieces) const {
|
||||
return pieces && pieces->cu && pieces->cuts(batch->n_tok) &&
|
||||
batch->n_tok <= 2 * pieces->rows && (ext_in || pieces->in_ready) && !op_add &&
|
||||
batch->n_seq == 1 && batch->phase == RAD_PHASE_PREFILL;
|
||||
}
|
||||
/* Whether a step of T rows issues the all-reduce itself, asked by a caller before taking it
|
||||
* over; and that all-reduce over rows [r0, r0 + rows) of the output. */
|
||||
bool issues_ar(int64_t T) const { return op_ar && !ar_taken(g, T, ar_out, ar_out_take); }
|
||||
@@ -389,10 +396,10 @@ inline void GdnFP8::step(RadCtx* c, const RadBatch* batch, bool own_ar,
|
||||
* piece the chunk a span of 1 makes (the projection over its rows; the convolution, solve and
|
||||
* scan over its bounds, with the state handed on through the cache; the gated norm, quantiser
|
||||
* and out projection), so the first piece's reduction runs beside all of the second piece's
|
||||
* work. The second piece reads the history the first left in the convolution slot: a spanned
|
||||
* step is past the prompt's first interval, so its context length is never zero. */
|
||||
if (!own_ar && pieces && pieces->cu && pieces->cuts(T) && T <= 2 * pieces->rows && ext_in &&
|
||||
!op_add && S == 1 && batch->phase == RAD_PHASE_PREFILL) {
|
||||
* work. The second piece reads the history the first left in the convolution slot, so each
|
||||
* piece passes its own context length, its first row's position: the step's would tell the
|
||||
* second piece of a prompt's first chunk that it has none. */
|
||||
if (!own_ar && takes_pieces(batch, pieces)) {
|
||||
const int64_t in_w = conv_dim + v_dim;
|
||||
for (int64_t p = 0; p < 2; ++p) {
|
||||
const int64_t r0 = p * pieces->rows;
|
||||
@@ -405,7 +412,7 @@ inline void GdnFP8::step(RadCtx* c, const RadBatch* batch, bool own_ar,
|
||||
bcol(w.in.x, 0, conv_dim, T), RAD_W(w_conv), RAD_NONE, RAD_W(w_a_log),
|
||||
RAD_W(w_dt_bias), kv_cache(kv_conv, layer), praw(cu, RAD_I32, 2),
|
||||
bcol(w.ab, 0, H, T), bcol(w.ab, H, H, T),
|
||||
praw(cv_idx, RAD_I32, 1), praw(batch->ctx_lens, RAD_I32, 1),
|
||||
praw(cv_idx, RAD_I32, 1), praw(batch->positions + r0, RAD_I32, 1),
|
||||
brows(w.q, T), brows(w.k, T), brows(w.v, T),
|
||||
brows(w.gdec, T), brows(w.beta, T));
|
||||
RAD_ISSUE_N(c, op_kkt, n,
|
||||
|
||||
Reference in new issue
Block a user