feat(kv): add Q4_0 KV cache mode with FWHT-256 Walsh-Hadamard rotation

- Implement Q4_0 KV quantization and dequantization kernels with scale/offset
- Implement fast Walsh-Hadamard transform (FWHT-256) rotation for outlier suppression
- Add Q4_0 attention decode support in qsa_decode_attn
- Add kv_q4_parity parity test verifying CPU vs CUDA numerical accuracy
- Support --kv q4_0 in generate CLI and runtime layer allocation
- Update .gitignore for build and repository hygiene
This commit is contained in:
code-martin committed 2026-09-27 11:29:08 +03:00
1 parent 8f279d82a0
commit 7f21e2b401
17 files changed
+943 -86

No files matched your search

+3 -2
View File
@@ -722,11 +722,12 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: invalid --ple-io/--ple-row-cache/--ple-inflight/--ple-delay-us\n");
return 2;
}
if (o.kv != "fp16" && o.kv != "int8") {
std::fprintf(stderr, "strata generate: --kv must be fp16 or int8\n");
if (o.kv != "fp16" && o.kv != "int8" && o.kv != "q4_0" && o.kv != "q4") {
std::fprintf(stderr, "strata generate: --kv must be fp16, int8, or q4_0\n");
return 2;
}
strata::core::qsa_set_kv_int8(o.kv == "int8");
strata::core::qsa_set_kv_q4(o.kv == "q4_0" || o.kv == "q4");
if (o.kv_resident < 0) {
std::fprintf(stderr, "strata generate: --kv-resident must be >= 0\n");
return 2;