This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/arch/common/rad_prefill_pipe.h
T
mici81andClaude Opus 5.5 ad01fcaf19 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>
2026-10-24 11:10:08 +02:00

43 lines
2.1 KiB
C++

#pragma once
// RADIANCE_PREFILL_PIPELINE: whether an architecture with a pipelined prefill (a prefill step of one
// sequence in two pieces, the collectives between blocks on the second lane, beside the other piece's
// compute) uses it.
//
// auto (or unset) at two ranks, where it was measured (Qwen3.8-27B 41k prefill -6.6 %,
// TranslateGemma-27B 6k -4.7 % at a 2048 chunk, bit for bit the serial step);
// on (1, true) also at three, four and eight ranks: libr4d has the narrow `overlap` two-shot
// all-reduce there (the wide rows' entry points at a launch that leaves the CUs to
// compute), but the step has not been measured on such hardware;
// off (0, false) never.
//
// Any other rank count has no narrow row, and a wide all-reduce beside the GEMMs ate the whole gain at
// two (it slows the GEMM 1.45-2.1x), so those stay serial. Past two ranks only the two-shot band is
// narrow: a piece small enough for the one-shot band (at most 524288 elements, e.g. 512 rows of a model
// 1024 wide) still gets the wide one-shot; and eight ranks have no lossy wire, so `on` there pipelines
// on the exact wire only.
#include "rad_arch.h"
#include <cstdlib>
#include <cstring>
namespace rad::arch {
inline bool prefill_pipeline(RadBuilder* b, int world, const char* who) {
const char* e = std::getenv("RADIANCE_PREFILL_PIPELINE");
auto is = [&](const char* v) { return e && !std::strcmp(e, v); };
const bool on = is("on") || is("1") || is("true"), off = is("off") || is("0") || is("false");
if (e && *e && !on && !off && !is("auto"))
rad_note(b, "%s: RADIANCE_PREFILL_PIPELINE=%s is not auto, on or off; taken as auto", who, e);
if (off || world < 2) return false;
if (world == 2) return true;
if (on && (world == 3 || world == 4 || world == 8)) {
rad_note(b, "%s: RADIANCE_PREFILL_PIPELINE=on allows the pipelined prefill at %d ranks, not "
"yet measured on such hardware (it still needs what the architecture checks)",
who, world);
return true;
}
return false;
}
} // namespace rad::arch