HelloSun commited on
Commit
b26cee8
·
verified ·
1 Parent(s): 616131c

HANDOFF: start Q4_1 optimization on this machine (baseline + plan)

Browse files
Files changed (1) hide show
  1. HANDOFF.md +73 -0
HANDOFF.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HANDOFF — flint Q4_1 CPU optimization (this machine)
2
+
3
+ Updated: 2026-10-31 (UTC+1) — periodic checkpoint (uploaded every ~5 min while working).
4
+
5
+ ## Read this first
6
+
7
+ This is the live handoff for continuing the Q4_1 optimization of
8
+ `HelloSun/flint_cpu_opt`. The static docs are `README.md`,
9
+ `benchmarks/q41-summary.md` (Q4_1) and `benchmarks/summary.md` (Q4_K_XL).
10
+
11
+ ## Machine (the one this work targets)
12
+
13
+ - Intel Xeon Platinum 8559C, 2 sockets, 192 logical CPUs online.
14
+ - **cgroup limit: 16 CPUs** (`cpu.max = 1600000/100000`), `nproc` = 16.
15
+ - 2 TiB RAM host; memory guard: agent-started processes must stay < 80 GiB RSS.
16
+ - Flags: AVX512-F/BW/VL/DQ, AVX512-VNNI, AVX512-FP16, AMX-INT8/AMX-BF16, F16C.
17
+ - Same CPU model as the numbers in `machine.txt` (16 threads), but the host is
18
+ shared, so single runs vary ~±8 %.
19
+ - Repo base: llama.cpp `de5122d879d00d2895c36be7e0cee94105aeeabd` with
20
+ `patches/flint-cpu-opt.patch` applied in `llama.cpp/`.
21
+
22
+ ## Current model/server
23
+
24
+ - Model: `flint-int4-q4_1.gguf` (24.2 GiB, every weight Q4_1; token_embd +
25
+ router F32), downloaded from `RecursiveSI/flint-int4-gguf`.
26
+ - `llama-server` running on `127.0.0.1:20000`, alias `flint-q4_1`,
27
+ `-t 16 -fa on --jinja -c 32768` (started by `build.sh`).
28
+ - pi coding agent is configured to use it (`pi-local`).
29
+
30
+ ## Current Q4_1 kernel state (already in the patch)
31
+
32
+ 1. `ggml_vec_dot_q4_1_q8_1` (decode): AVX512-VNNI, 2 blocks per ymm, 4
33
+ blocks/iteration, prefetch `GGML_Q41_PF` (default 192 blocks, T1 hint).
34
+ 2. Tiled VNNI GEMM for Q4_1 prefill: per-32-block f32 `sd`/`sm`, `Q41`
35
+ template flag, Q8_1 activations.
36
+ 3. Reported on 8559C/16t: pp256 266, pp2048 297, tg128 55.7 t/s; stock
37
+ 183/189/48.3. KLD inside stock's own noise floor.
38
+
39
+ ## Plan / next steps
40
+
41
+ - [x] Read existing docs and machine context.
42
+ - [ ] Build `llama-bench` + `llama-cli` (only `llama-server` was built).
43
+ - [ ] Baseline on **this** machine: interleaved A/B, `taskset -c 0-15`,
44
+ `-t 16 -fa on -b 1024 -ub 1024`, Q4_1 file.
45
+ - [ ] Sweep `GGML_Q41_PF` (e.g. 128/192/256/320) and thread counts on the
46
+ real model (not only microbench).
47
+ - [ ] Try one decode-side improvement (memory-bound path) and/or an AMX
48
+ prefill variant; keep only if it beats noise.
49
+ - [ ] A/B compare, record raw CSV/log under `benchmarks/`.
50
+ - [ ] Update `README.md` + `benchmarks/q41-summary.md` only with measured,
51
+ reproducible numbers.
52
+ - [ ] Restart `llama-server` with the final best settings.
53
+
54
+ ## How to reproduce
55
+
56
+ ```bash
57
+ cd /root/flint_cpu_opt
58
+ cmake --build llama.cpp/build -j16 --target llama-bench llama-cli
59
+ taskset -c 0-15 llama.cpp/build/bin/llama-bench -m flint-int4-q4_1.gguf \
60
+ -t 16 -fa on -lm mlock -b 1024 -ub 1024 -p 256,2048 -n 128
61
+ ```
62
+
63
+ ## Notes / gotchas
64
+
65
+ - Do **not** run 100 parallel Tor/open code probes here; memory guard kills
66
+ processes over 80 GiB / single child over 64 GiB.
67
+ - The llama-server is serving pi; stop it before a clean benchmark, restart
68
+ afterwards (`bash build.sh` reuses an already-running server).
69
+ - Host is shared: use medians of >= 3 interleaved rounds; differences under
70
+ ~8 % are not a win.
71
+ - Kernel changes must keep integer dot products exact; only f32 accumulation
72
+ order may change. Check `benchmarks/graph_accuracy_test.cpp` and KLD if a
73
+ numeric path changes.