radiance 1.2.2

- Static YaRN for the Qwen rotary paths (#37): a container whose config names YaRN gets it in
  attention, the QSA index keys and a DFlash2 drafter; one reader for every rotary type, and a
  LLaMA container whose type is not served (llama3, longrope, dynamic) is refused by name.
- --rope-scaling yarn:FACTOR[:ORIG] (#38) writes YaRN over a container's own rotary keys at load,
  no reconvert; the persisted prefix cache's fingerprint carries the resolved rotary.
- An uneven world's cheaper rank (#36) pages the common token count and gives the rest of its
  VRAM to its experts; a plan and pool that disagree refuse to start.
- MoE prefill (#35): wide gather, parallel scan and run-map prefix, 256-column down tile, early
  weight loads -- by rule, bit-identical.
- MoE decode (#34): the sorted operand's own down kernel, its column tiles by routed rows.
- --draft-window fixed|adaptive (#24): a per-sequence draft window priced by measured step time,
  one head depth per step over the batch; fixed stays the default. New metric
  radiance:draft_position_accepted_total and Grafana panels.
- Out-of-tree plugin builds compile to the tree's device code from any build directory.
This commit is contained in:
Deadcode committed 2026-10-07 12:37:53 +02:00
1 parent 6fa7707dff
commit ac79f4dc8a
63 files changed
+2744 -8759

No files matched your search

+54
View File
@@ -306,6 +306,8 @@ extern "C" void* rad_buf_ptr (RadCtx* c, rad_buf b) { (void)c; return (void
#include "../arch/qwen35_bf16/qwen35_bf16.cpp"
/* And the production architecture, for its sizing declare (RadBuildCtx::shape_probe). */
#include "../arch/qwen4exp_fp8/qwen4exp_fp8.cpp"
/* And the LLaMA family, for how it reads its rotary scaling. */
#include "../arch/llama_fp8/llama_fp8.cpp"
/* The PLE block on its own: no architecture in this file declares it, and what its step() hands
* the two windowed ops is a contract of its own (rad_block_ple.h). */
#include <arch/rad_block_ple.h>
@@ -578,6 +580,58 @@ TEST(qwen35_bf16_yarn_reaches_every_text_rotary_op) {
CHECK_EQ(qwen35_bf16::declare(&invalid, &meta, &ctx), RAD_E_INVAL);
}
/* THE LLAMA FAMILY READS ITS ROTARY SCALING THROUGH THE SAME READER. A Llama 3.1 checkpoint says
* `rope_type: llama3` with a factor of 8; read as a bare factor that is a linear position divide
* by 8 and fluent nonsense, so it is refused by name at declare. Linear stays linear and YaRN
* reaches the rope op. */
TEST(llama_reads_its_rotary_scaling_by_type) {
(void)&llama_fp8::step; /* included for its declare; nothing here runs a step */
(void)&llama_fp8::probe;
auto declare = [](const char* type, const char* factor, RadBuilder* b) {
const char* keys[] = {"rope_scaling.rope_type", "rope_scaling.factor",
"rope_scaling.original_max_position_embeddings"};
const char* vals[] = {type, factor, "8192"};
RadModelMeta m{};
m.arch_id = "llama"; m.name = "test-llama"; m.quant = "fp8_e4m3";
m.n_layers = 2; m.n_embd = 1024; m.n_head = 8; m.n_head_kv = 2; m.head_dim = 128;
m.n_ff = 2048; m.n_vocab = 32000; m.n_ctx_train = 8192;
m.rms_eps = 1e-5f; m.rope_theta = 5e5f; m.rope_scale = 1.0f;
m.n_kv = type ? 3 : 0; m.kv_key = keys; m.kv_val = vals;
RadBuildCtx c = build_ctx();
return llama_fp8::declare(b, &m, &c);
};
for (const char* refused : {"llama3", "longrope", "dynamic"}) {
RadBuilder b;
CHECK_EQ(declare(refused, "8", &b), RAD_E_UNSUPPORTED);
}
{
RadBuilder b;
CHECK_OK(declare("linear", "2", &b));
CHECK(count_op(b, "rope") > 0);
for (const auto& op : b.ops) if (op.op == "rope") {
CHECK_EQ(pflt(&op, "scale"), 2.0);
CHECK(!param(&op, "yarn_factor"));
}
}
{
RadBuilder b;
CHECK_OK(declare("yarn", "4", &b));
CHECK(count_op(b, "rope") > 0);
for (const auto& op : b.ops) if (op.op == "rope") {
CHECK_EQ(pflt(&op, "scale"), 1.0);
CHECK_EQ(pflt(&op, "yarn_factor"), 4.0);
}
}
{
RadBuilder b;
CHECK_OK(declare(nullptr, "", &b));
for (const auto& op : b.ops) if (op.op == "rope") {
CHECK_EQ(pflt(&op, "scale"), 1.0);
CHECK(!param(&op, "yarn_factor"));
}
}
}
TEST(the_alternation_puts_full_attention_at_3_and_7) {
RadBuilder b;
RadModelMeta meta = qwen35_meta();