review notes of the pipelined prefill past two ranks; selftest timings warm the clocks first

Independent review of fa118d8 / 14fb72c: no defect. Notes taken:

- RADIANCE_PREFILL_PIPELINE takes 1 / true as on and 0 / false as off (the old per-arch switches
  took 0 for off; such a value must not leave the pipeline on); the header says that past two
  ranks only the two-shot band is narrow and that eight ranks pipeline on the exact wire only; the
  note says the switch allows the pipeline (gemma3 may still turn it off); "rad_arch.h" as the other
  common headers include it; comment lines rewrapped.
- plugin_test resolves the all-reduce at `overlap` 1 against the real libr4d: the two-shot band
  takes the lane row at three, four and eight ranks, exact and ti8; the one-shot band keeps the wide
  row. arch_test: every spelling of the switch, off at two ranks in all three; no three-rank arch
  case (neither test model's heads split three ways, nor do the real models' KV heads).
- r4d_selftest: gemv_wide's two column tiles at four row tiles and on the per-row scale.
- r4d_selftest: every timed pass is preceded by an untimed one. A fresh process otherwise times its
  first pass while the clocks ramp up from idle (up to 1.5x slow, +-30 % between runs); two builds
  of the same machine code read 13 % apart until both warmed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-24 11:10:08 +02:00
1 parent 284feda3a6
commit ad01fcaf19
5 files changed
+80 -29

No files matched your search

+32 -12
View File
@@ -9299,15 +9299,19 @@ TEST(qwen35_a_wide_prefill_runs_in_two_pieces_with_its_boundaries_on_the_second_
}
}
/* Past two ranks the pipelined prefill is opt-in (RADIANCE_PREFILL_PIPELINE=on): unset, the step is
* serial; asked, a 2048-row step of one sequence runs in two pieces with every collective on the
* second lane, the layers' all-reduces a piece at a time at `overlap` 1 (libr4d's narrow lane rows),
* the embedding's whole, on every rank. At four and eight ranks. */
static void four_rank_pipe_case(int world, bool gemma) {
/* Past two ranks the pipelined prefill is opt-in (RADIANCE_PREFILL_PIPELINE=on, or 1, or true): unset,
* auto or an unknown value, the step is serial; asked, a 2048-row step of one sequence runs in two
* pieces with every collective on the second lane, the layers' all-reduces a piece at a time at
* `overlap` 1 (libr4d's narrow lane rows), the embedding's whole, on every rank. At four and eight
* ranks: neither test model's heads split three ways (nor do Qwen3.8's 4 or TranslateGemma's 16 KV
* heads); plugin_test checks that the three-rank lane rows resolve. */
static void n_rank_pipe_case(int world, bool gemma) {
const char* env = "RADIANCE_PREFILL_PIPELINE";
for (int ask : { 0, 1 })
const char* vals[] = { nullptr, "auto", "maybe", "on", "1", "true" };
for (const char* val : vals)
for (int rank = 0; rank < world; ++rank) {
if (ask) setenv(env, "on", 1);
const int ask = val && (!strcmp(val, "on") || !strcmp(val, "1") || !strcmp(val, "true"));
if (val) setenv(env, val, 1);
RadBuilder b;
RadBuildCtx ctx = spec_ctx(rank, world, 7);
ctx.max_tok = 2048;
@@ -9316,7 +9320,7 @@ static void four_rank_pipe_case(int world, bool gemma) {
const int rc = stderr_of_rc([&] {
return gemma ? gemma3::declare(&b, mk.meta(), &ctx) : qwen35_fp8::declare(&b, mk.meta(), &ctx);
});
if (ask) unsetenv(env);
if (val) unsetenv(env);
REQUIRE_EQ(rc, RAD_OK);
const bool on = gemma ? gemma3::g_model[rank].pipe_on : qwen35_fp8::g_model[rank].pipe_on;
const int64_t L = gemma ? (int64_t)gemma3::g_model[rank].layers.size()
@@ -9344,10 +9348,26 @@ static void four_rank_pipe_case(int world, bool gemma) {
CHECK(!c.joins.empty());
}
}
TEST(qwen35_four_ranks_pipeline_only_when_asked) { four_rank_pipe_case(4, false); }
TEST(gemma3_four_ranks_pipeline_only_when_asked) { four_rank_pipe_case(4, true); }
TEST(qwen35_eight_ranks_pipeline_only_when_asked) { four_rank_pipe_case(8, false); }
TEST(gemma3_eight_ranks_pipeline_only_when_asked) { four_rank_pipe_case(8, true); }
TEST(qwen35_four_ranks_pipeline_only_when_asked) { n_rank_pipe_case(4, false); }
TEST(gemma3_four_ranks_pipeline_only_when_asked) { n_rank_pipe_case(4, true); }
TEST(qwen35_eight_ranks_pipeline_only_when_asked) { n_rank_pipe_case(8, false); }
TEST(gemma3_eight_ranks_pipeline_only_when_asked) { n_rank_pipe_case(8, true); }
/* At two ranks "off", "0" and "false" all run the pipelined prefill's step serially (the old switches
* took 0 for off; such a value must not leave it on). */
TEST(two_ranks_pipeline_off_in_every_spelling) {
MetaKV mk = with_dflash2(q35fp8_meta());
for (const char* v : { "off", "0", "false" }) {
setenv("RADIANCE_PREFILL_PIPELINE", v, 1);
RadBuilder b;
RadBuildCtx ctx = spec_ctx(0, 2, 7);
ctx.max_tok = 2048;
const int rc = stderr_of_rc([&] { return qwen35_fp8::declare(&b, mk.meta(), &ctx); });
unsetenv("RADIANCE_PREFILL_PIPELINE");
REQUIRE_EQ(rc, RAD_OK);
CHECK(!qwen35_fp8::g_model[0].pipe_on);
}
}
/* Under a span a Flash-Next prefill of two intervals runs a pass at a time. At every world its
* connection reads take a pass each and the indexer scores its pass-tall plane in windows, the MTP