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

+6 -2
View File
@@ -185,8 +185,12 @@ void BatchBuilder::size_set(Set& s, const std::vector<KVGroupInfo>& groups) {
s.groups[gi].block_size = e.block_size;
int64_t mb = 1;
if (e.paged) {
int64_t span = (e.kind == RAD_KV_WINDOW && e.window > 0 && e.window < max_ctx_)
? e.window : max_ctx_;
/* A WINDOW row holds the window behind the step's first query AND the step's own
* tokens (KVManager::ensure keeps both), so it is sized for a whole chunk past the
* window -- plus the speculative lookahead, which a verify row carries on top. */
const int64_t wspan = e.window + max_tok_ + 2 * ((int64_t)std::max(cfg_.n_spec, 0) + 1);
int64_t span = (e.kind == RAD_KV_WINDOW && e.window > 0 && wspan < max_ctx_)
? wspan : max_ctx_;
mb = (span + e.block_size - 1) / e.block_size + 1;
}
s.groups[gi].max_blocks = mb;