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
@@ -290,6 +290,10 @@ struct ArPieces {
|
||||
* chunk a span of 1 makes, the state carried through the cache) and hand off the first
|
||||
* piece's reduction before the second piece's projection. Null for any other step. */
|
||||
const int32_t* cu = nullptr;
|
||||
/* The caller normed each piece's input itself (qwen35_fp8's pipelined prefill, on the second
|
||||
* lane behind the previous block's piece), so a block with its own norm takes the piece path
|
||||
* as one with an external input does and skips that norm. */
|
||||
bool in_ready = false;
|
||||
bool cuts(int64_t T) const { return done && rows > 0 && T > rows; }
|
||||
void hand(int64_t r0, int64_t n) { done(u, r0, n); ++handed; }
|
||||
};
|
||||
@@ -389,6 +393,9 @@ struct NormQuantFP8 {
|
||||
}
|
||||
/* Asked by the preceding block before issuing its own collective. */
|
||||
bool takes_ar(int64_t T) const { return pick(T) != op; }
|
||||
/* The plain op whatever the wire, for a caller that issued the preceding all-reduce itself
|
||||
* (qwen35_fp8's pipelined prefill, which runs it narrow beside compute). */
|
||||
void step_plain(RadCtx* c, int64_t T, int64_t r0 = 0, int64_t rows = 0) const;
|
||||
};
|
||||
|
||||
inline int NormQuantFP8::declare(RadBuilder* b, const Geom& g, rad_weight gain, rad_buf x,
|
||||
@@ -470,6 +477,15 @@ inline int NormQuantFP8::declare(RadBuilder* b, const Geom& g, rad_weight gain,
|
||||
* `brows`). Slicing lets a block run in passes (the routed feed-forward). Each slice must land in
|
||||
* the same bucket-table band as the whole (core/runtime/ctx.h), or a different kernel with a
|
||||
* different summation order would run. */
|
||||
inline void NormQuantFP8::step_plain(RadCtx* c, int64_t T, int64_t r0, int64_t rows) const {
|
||||
if (rows <= 0) rows = T - r0;
|
||||
RAD_ISSUE_N(c, op, rows, brow_slice(src, r0, rows, n),
|
||||
res ? brow_slice(res, r0, rows, n) : RAD_NONE, RAD_W(w),
|
||||
brow_slice(a.q, r0, rows, n),
|
||||
brow_slice(a.s, r0, rows, n / RAD_FP8_BLOCK),
|
||||
brow_slice(a.x, r0, rows, n));
|
||||
}
|
||||
|
||||
inline void NormQuantFP8::step(RadCtx* c, int64_t T, int64_t r0, int64_t rows) const {
|
||||
if (rows <= 0) rows = T - r0;
|
||||
RAD_ISSUE_N(c, pick(rows), rows, brow_slice(src, r0, rows, n),
|
||||
|
||||
Reference in new issue
Block a user