Merge Gemma 4 31B: PRs #74, #75, #81 and #86 (sfjes, keptn42), with fixes

The gemma4_bf16 architecture (sliding and global attention, the proportional RoPE ladder, the
assistant head as a drafter that reads the trunk's cache, the vision tower), its w4a8 decode
junctions, the h512/gqa8 and h256/gqa2 attention kernels, compressed-tensors int4 import, multi-EOS
from generation_config, the call/reasoning reply format, a window group that keeps the keys a
prefill chunk still reads, and window snapshots in checkpoint slots so a prefix hit on a
sliding-window trunk resumes.

Fixes on top: the investigation switches and diagnostic blocks out of the served paths; int4 import
through the checkpoint import framework; attention_k_eq_v from the config; the fused junctions only
where every reader takes their pair; a shared-KV head binds no group of its own; the compose file
without HSA_ENABLE_IPC_MODE_LEGACY (TP2 fails with it on ROCm 10.1); a checkpoint carries a window
only where a hit resumes from it; the README says the linked container is keptn42's calibrated GPTQ
build and what the in-tree recipe gives.
This commit is contained in:
Deadcode committed 2026-10-12 20:46:37 +02:00
84 files changed
+10292 -230

No files matched your search

+9
View File
@@ -320,6 +320,9 @@ struct KVGroupInfo {
int64_t bytes_per_state = 0; /* linear/conv: per sequence */
std::vector<int> layers;
bool zero = false; /* rad_kv_group_zero: declared for position, nothing carved */
/* Bound only at meta.n_layers and above: the drafter's own cache, which no trunk layer reads.
* Set at declare (Builder::finish_kv_groups). */
bool drafter = false;
};
/* A RAD_KV_CONV GROUP'S WINDOW, IN ENTRIES: conv_width - 1 of history and one more for every
@@ -362,6 +365,12 @@ public:
* RadDrafterDecl::name points into the plugin's own storage. */
RadDrafterDecl drafter{};
std::string drafter_name;
/* A SERIAL HEAD WITH NO CACHE OF ITS OWN (rad_drafter_shared_kv): it reads the trunk's K and V
* and writes none, so the driver owes it no history and runs every round at the committed
* position. `drafter_pos_offset` is where those rows sit for the rotary, 0 or 1 past it. Both
* are false and 0 for every drafter that did not ask, which is every one that predates it. */
bool drafter_shared_kv = false;
int32_t drafter_pos_offset = 0;
/* THE MEDIA ENCODER THIS PLUGIN DECLARED (rad_declare_encoder). `modalities == 0` when it
* declared none, which is every text-only program and every deployment that asked for no