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

+8 -1
View File
@@ -56,6 +56,12 @@ struct SrcTensor {
* the K columns one row of its scale tensor covers. 0 for any other tensor. */
int32_t gptq_bits = 0;
int64_t gptq_group = 0;
/* CT-INT4 (compressed-tensors' pack-quantized int4, symmetric): `data` is X.weight_packed's
* int32 words [N, K / 8], eight codes a word along K from the low bits up, stored unsigned with
* the zero point 8. The tensor this describes is the logical [N, K] code matrix, `rad_dtype`
* RAD_I4; `ct_group` is the K columns one scale of X.weight_scale [N, K / group] covers. 0 for
* any other tensor. */
int64_t ct_group = 0;
int64_t numel() const {
int64_t n = 1;
@@ -132,7 +138,7 @@ public:
* this does not read stays None, with the reason in import_refusal(). */
/* Its quantization_config keys are then renamed `imported_quantization_config.*`: they
* describe the tool, not a served format, and a plugin reads the latter there. */
enum class Import { None, Gptq, QuarkMx };
enum class Import { None, Gptq, QuarkMx, CtInt4 };
Import imports() const { return import_; }
const std::string& import_refusal() const { return import_why_; }
@@ -164,6 +170,7 @@ private:
int64_t fp8_br_ = 128, fp8_bc_ = 128;
Import import_ = Import::None;
std::string import_why_;
int64_t ct_group_ = 0; /* CtInt4: the group every weight's config states */
/* import_piece's answers by name, so a weight resolved twice reads one pair of views. */
std::unordered_map<std::string, std::pair<const SrcTensor*, const SrcTensor*>> imported_;
};