Repository navigation
Conversation
|
Independent device run at The exact head merges cleanly with main Igor Lessio - AIFLOW LABS |
|
Thanks @gilby. The 8-bit/64 Since you opened this, the GLM DFlash2 registrations landed on main, which conflicts with this branch in
|
b5de18d to
5b956b8
Compare
5b956b8 to
5701393
Compare
Allow 8-bit group-64 kv_b_proj weights alongside native 4/64 experts on single-Mac loads without widening or QSplit, adding glm_kvb_q8 kernels (glm_absorb_8b and glm_unabsorb_8b), 8-bit glm_absorb_nax support for TP=1 and TP=2, kernel contract records/gates/controls, and parity unit tests. Refs ashhart#3152
5701393 to
63c5dbd
Compare
|
The current zig build tf-kernel-contract test-kernel-contract -Dcpu=apple_m1 \
-Doptimize=ReleaseSafe -j2 --summary all
./zig-out/bin/tf-kernel-contract --only 'glm kvb8'This covers the absorption and unabsorption kernel contracts on the current trial tree. The release-checkpoint timing and any combined MoE comparison remain separate. Igor Lessio - AIFLOW LABS |
What this changes
Adds Metal runtime support for intact 8-bit group-64
kv_b_projweights alongside native 4-bit/64 routed experts on single-Mac GLM-5.3-Flash loads without widening or QSplit (GLM-5.3-Flash-oQ4e-m5u256-hq).Allows
kv_b_projat8-bit/64-group inzig/src/families/glm/affine.zig(kvb8) alongside native4/64experts.Adds single-pass
glm_absorb_8bandglm_unabsorb_8bdecode/verify kernels inzig/kernels/metal/glm_kvb_q8.metaland wires dispatch inzig/src/families/glm/kernels.zigandzig/src/families/glm/forward.zig.Extends
zig/kernels/metal/glm_absorb_nax.metal(andzig/src/families/glm/prompt.zig) to read8-bit/64-groupkv_b_projfor prompt prefill (TP=1andTP=2).Registers
glm kvb8launches, planted controls, limits (zig/src/core/contract/glm_kvb_q8_records.zig), and unit parity tests (zig/src/families/glm/kvb_q8_test.zig,zig/src/families/glm/weights_test.zig).Issue: Refs GLM-5.3-Flash on Metal: decode and prompt speed on M5 Ultra, token-exact (baseline, items and gate) #3152
Stacked on:
main(4c616e63d57204cd8395dc3af9b572d9ec49626b)atc overlap --base origin/main --json:15changed files;6clean overlaps against open PRs,4older conflicting PRs (#1835,#2239,#2273,#2634),5unknown.Checks on this head
b5de18d0c72c92bf68a96cc46e07a7fb547fa2dcpython3 tools/zig/lean_check.py, on the base and on this head:168on base (4c616e63d),168on head (b5de18d0c7),0new findings (python3 tools/pr_check.py --base origin/mainexits0).main(4c616e63d):tensorfold-native serve GLM-5.3-Flash-oQ4e-m5u256-hqexits1(UnsupportedWidth:error: glm: model.language_model.layers.3.self_attn.kv_b_proj is 8-bit in groups of 64, a width the kv_b kernels do not read).8/64 intact kv_b_proj alongside 4/64 routed experts plans without QSplitfails onmain(4c616e63d) before the change and passes after.zig fmt --check build.zig zig— passed (0exit)git diff --check— passed (0exit)families.glm.*unit tests —All 186 tests passed.zig build test-kernel-contract test-golden test-glm-scheduling-host test-glm-prefill-widths-host check-glm-restore-host— passed (test-golden322/335&69/69,0unexpected differences)./zig-out/bin/tf-kernel-contract --no-gates --only "glm kvb8" --offline ...— passed (PASS limits: 2 selected registered Metal launches against M1-M5, 0 problems;PASS offline glm kvb8 glm_absorb_8b: 512 threads; M1 pipelines take 512, M2 512 (recorded 0, 0);PASS offline glm kvb8 glm_unabsorb_8b: 512 threads; M1 pipelines take 512, M2 512 (recorded 0, 0); both limit controls red)./zig-out/bin/tf-kernel-contract --only "glm kvb8"on Apple M5 Ultra (applegpu_g17,therm=0) — exited0(details below)--offlinelimits); CUDA/ROCm paths (Metal-only change).Receipt
Full scrubbed receipts (pre-fix refusal, contract log,
bench_concurrent.py,bench_openai.py,bench_cache.py): https://gist.github.com/gilby/374894a27bbab2284886828b8741777dmain(4c616e63d), same Apple M5 Ultra (256 GB) andTensorFold/GLM-5.3-Flash-MLX-4bit-MTPcheckpoint (tools/bench_openai.py --tokens 256 --reps 3 --temperatures 0,1.0,--prompt-cache-gib 0,therm=0,12/12replytoken_sha256s bit-identical):main(4c616e63d)S1(b5de18d0c7)fibonacci-raw T=0.0gpu-chat-no-think T=0.0fibonacci-raw T=1.0gpu-chat-no-think T=1.0Enabled checkpoint (
GLM-5.3-Flash-oQ4e-m5u256-hq— refused onmainwithUnsupportedWidth) on Apple M5 Ultra (256 GB),--prompt-cache-gib 0 --profile stable,therm=0:bench_concurrent.py --alone --serial --tokens 256 --reps 3 --temperatures 0,1.0 --levels 1,3(0unequal /0failed across every cell):code T=0.0 N=1:94.8,N=3:156.8(steady 163.0)chat T=0.0 N=1:78.5,N=3:124.0(steady 130.3)code T=1.0 N=1:91.7,N=3:119.7(steady 124.5)chat T=1.0 N=1:74.7,N=3:111.1(steady 115.7)bench_openai.py:fibonacci-raw T=0.094.64,gpu-chat-no-think T=0.078.47,fibonacci-raw T=1.086.67,gpu-chat-no-think T=1.076.21.bench_cache.py --require-cold:2kTTFTs[0.997, 0.994, 0.996](0.996smedian,qualified: true),8kTTFTs[3.881, 3.879, 3.880](3.880smedian,qualified: true).Boxes it reaches:
glm5_nexton Metal (kv_b_projin8-bit/64-group alongside native4-bit/64-group routed experts; 4-bitkv_b_projpath unchanged).New switch? Default, accepted values, profile row: None.
Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision:
b5de18d0c72c92bf68a96cc46e07a7fb547fa2dcatopmain4c616e63d57204cd8395dc3af9b572d9ec49626b0.17.0(-Dcpu=apple_m1), macOS Metalapplegpu_g17, 256 GB unified memory, tensor units true)GLM-5.3-Flash-oQ4e-m5u256-hq(intact8-bit/64-groupkv_b_proj+4-bit/64-group experts) andTensorFold/GLM-5.3-Flash-MLX-4bit-MTPPaths and platforms the change reaches, which I ran and which I could not:
oQ4e-m5u256-hqandMLX-4bit-MTP), unit parity tests, host/golden tests, Metal contract + M1/M2 offline limits.TP=2multi-Mac hardware, live M1/M2/M3/M4 silicon, CUDA/ROCm (Metal-only change).Exactness, from
tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false:bench_concurrent.py --alone --serialonGLM-5.3-Flash-oQ4e-m5u256-hq:0unequal and0failed across allalone(concurrent == alone) andserial(drafted == "draft": false) checks.bench_openai.pyonMLX-4bit-MTP:12/12replytoken_sha256s bit-identical tomain.Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): Yes — same Apple M5 Ultra (256 GB);
oQ4e-m5u256-hqfails to load onmain(UnsupportedWidthlog in Gist), andMLX-4bit-MTPzero-regression receipts are in Gist.Decode speed before and after: see
MLX-4bit-MTPparity table above; enablesoQ4e-m5u256-hq(94.64tok/sfibonacci-raw T=0.0).Prompt speed before and after:
oQ4e-m5u256-hqcold TTFT0.996sat2K,3.880sat8K(fails to load onmain).Licence of any new weights or drafter, or "n/a": n/a.
Kernel contract, only when a GPU kernel is new or changed
glm_absorb_8b+glm_unabsorb_8b(zig/kernels/metal/glm_kvb_q8.metal) — adds intact8-bit/64-group support alongsideglm_absorb/glm_unabsorb(glm_absorb_nax.metal8-bit path verified by synthetic unit parity tests inkvb_q8_test.zig).zig/src/core/contract/glm_kvb_q8_records.zig,zig/src/core/contract/registry_joins.zig,zig/tests/contract/metal_glm_kvb_q8.zig,zig/tests/contract/metal_limits.zig, andzig/tests/contract/metal_main.zig.control: glm kvb8 glm_absorb_8b writes into input(FAIL repeat)control: glm kvb8 glm_absorb_8b drops tail cols(FAIL shapes)control: glm kvb8 glm_unabsorb_8b writes into input(FAIL repeat)control: glm kvb8 glm_unabsorb_8b drops tail rows(FAIL shapes)tf_row_projection_q4_f32(2 limit problems),36 KiB tf_ctl_big_tg(8 limit problems);2 selected registered Metal launches against M1-M5, 0 problemsSUMMARYline and exit status:applegpu_g17, tensor units true):SUMMARY 2 kernels: 2 pass gates 1-4, 0 fail, 0 known findings; 4 controls: 4 red as planted, 0 missed; 0 limit problems; gates 108 ms, limits 12 ms(exit0)--offline;metal_limits.zigchecks M1–M5 limits with0 problems); NVIDIA/AMD untouched (Metal-only change).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled