Skip to content

inkling2 metal: uniform tensor-unit dense projections across all widths 1..512 (ROWS1 + contract-off) - #4595

Closed
gilby wants to merge 41 commits into
ashhart:lead/inkling2-minifrom
gilby:inkling2-lead-dense-units
Closed

gilby wants to merge 41 commits into
ashhart:lead/inkling2-minifrom
gilby:inkling2-lead-dense-units

Conversation

@gilby

@gilby gilby commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Unifies Inkling 2 Mini Metal dense projections onto width-invariant tensor-unit kernels across 1..512 rows, cutting M5 Ultra 8.7K cold TTFT from 5.73s to 4.57s and raising c=16 decode to 522 tok/s with 0 seam drift.

What this changes

  • Before: forward_layers.zig branched between sp_matvec / dense_fuse at rows <= 32 and tf_dsv41_mv_mma_bf16 above 32, causing chunk-width variance across dense() dispatches, extra c=16 and prefill dense matmul overhead on M5 tensor units, and contraction rounding variance without fp contract(off).

  • After: adds dense_units.metal / dense_units.zig (tf_ink2_dense_units_{1,16,32,64} and 6-way fused tf_ink2_dense6_units_{1,16,32,64}) using #pragma METAL fp contract(off), an explicit ROWS1 rows == 1 fast path (tf_ink2_dense_units_1 / tf_ink2_dense6_units_1), and uniform 8-way K-split ink2_mma + ordered ink2_part_sum across every width 1..512 (so prompt chunks of 64..512 produce bit-identical row-0 sums).

  • Issue: Refs Inkling 2 Mini Metal V3 (#4387): exact prefill, decode launch/fusion, GQA KV reuse, and DSpark speedups #4652

  • Stacked on: inkling2 metal: fuse router at rows > 32, bfloat4 conv_dynamic, loop RMS hoist, 2D bank_and_reset, and 32-row logits_all cap #4594 (c741dcddb9, inkling2-lead-prefill-exact), adding afddcc0b27 and 7c509dd706.

  • atc overlap --json: Ran against origin/lead/inkling2-mini (complete: false, 69 changed files across local stacked worktrees); changes stay scoped to dense_units Metal kernels, wrappers, forward_layers.zig, model.zig, and contracts.

Checks on this head

  • Head commit: 7c509dd706
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 167 vs 167, 0 new findings (14 changed files via python3 tools/pr_check.py --base c741dcddb9 --pr 4595: 0 error(s), 1 advisory CHANGELOG.md warning).
  • Tests run:
    • zig fmt --check build.zig zig: exit 0; git diff --check c741dcddb9..7c509dd706: exit 0.
    • zig build -Dcpu=apple_m1 test-metal-launch-map-host test-inkling2-controls-host test-inkling2-metal-host test-inkling2-host compile-inkling2-native-host: test-metal-launch-map-host 8/8 (1232 launches, 0 missing); test-inkling2-controls-host 20/20; test-inkling2-metal-host 83/87 (4 skipped without model env); test-inkling2-host 44/48 (4 skipped); compile-inkling2-native-host exit 0.
    • Full real-checkpoint integration verification (merging 7c509dd706 onto lead/inkling2-mini + #4607 head-major snapshot.zig/serving_test.zig alignment): test-inkling2-metal-host 88/88 passed (0 failed, 0 skipped) on Apple M5 Ultra, Apple M5 Pro, and Apple M3 Ultra.
    • Independent M5 Max CPU float64 verification (results4595.txt): 281/281 metric rows (0 nonfinite/extra mismatches; every non-near-zero element across 1..512 <= 1 BF16 ULP), 18/18 ROWS1/multi-row seam parity checks bit_identical=YES.
  • CI: Verified across local M5 Max + remote M5 Ultra, M5 Pro, and M3 Ultra; workflow CI pending push.
  • Not run, and why: Non-Metal backends untouched.

Receipt

  • Main against branch: On M5 Ultra vs inkling2 metal: fuse router at rows > 32, bfloat4 conv_dynamic, loop RMS hoist, 2D bank_and_reset, and 32-row logits_all cap #4594, cold 8,704-token completion client TTFT drops 5.733s -> 4.573s first / 4.472s repeated (5.694s -> 4.446s server), while c=16 plain concurrency rises 428.2 -> 522.2 agg / 587.0 steady tok/s (code) and 418.0 -> 507.2 agg / 581.7 steady tok/s (chat). On M5 Pro, cold 2,571-token TTFT drops 5.794s -> 4.443s first / 4.243s repeated (5.461s -> 3.947s server).
  • Boxes it reaches: Apple Silicon Metal (dense_units runs on tensor-unit M5 chips; M3 Ultra continues on exact non-NAX path with unchanged outputs).
  • New switch? Default, accepted values, profile row: n/a.
  • Environment: TensorFold 7c509dd706 over inkling2 metal: fuse router at rows > 32, bfloat4 conv_dynamic, loop RMS hoist, 2D bank_and_reset, and 32-row logits_all cap #4594 (c741dcddb9), Zig 0.17.0, Apple Metal / macOS 27.0, Apple M5 Ultra / M5 Pro / M5 Max / M3 Ultra, checkpoint thinkingmachines/Inkling-2-Mini@ed40e7da.
  • Paths and platforms the change reaches: Inkling 2 Mini Metal dense & dense6 projections across widths 1..512 and prefill chunk invariance on M5; M3 Ultra verified unaffected. CUDA/HIP untouched.
  • Exactness (tools/bench_concurrent.py --alone --serial & bench_cache.py):
  • Main against this branch (same machine and checkpoint):
    • Apple M5 Ultra plain (c=1/4/16, 256 tok, T=0.0): code 49.2 / 182.0 (186.0 steady) / 522.2 (587.0 steady) tok/s; chat 49.2 / 182.5 (188.1 steady) / 507.2 (581.7 steady) tok/s; 8,704-tok ttft_s=4.573s first / 4.472s repeated (4.446s server).
    • Apple M5 Pro plain (c=1/4, 128 tok, T=0.0): code 29.4 / 103.3 (112.2 steady) tok/s; chat 29.4 / 101.1 (110.9 steady) tok/s; 2,571-tok ttft_s=4.443s first / 4.243s repeated (3.947s server).
    • Apple M3 Ultra plain (c=1/4, 128 tok, T=0.0): code 40.0 / 98.5 (105.6 steady) tok/s; chat 39.6 / 96.4 (102.9 steady) tok/s; 2,571-tok ttft_s=6.367s first / 6.330s repeated.
  • Decode speed before and after (bench_concurrent.py): M5 Ultra c=16 plain rises 428.2 -> 522.2 agg (587.0 steady) tok/s (code) and 418.0 -> 507.2 agg (581.7 steady) tok/s (chat).
  • Prompt speed before and after (bench_cache.py --require-cold): M5 Ultra 8,704-tok cold client ttft_s 5.733s -> 4.573s (4.446s server); M5 Pro 2,571-tok cold client ttft_s 5.794s -> 4.443s (3.947s server).
  • Licence of any new weights or drafter: n/a.
Independent FP64 Reference Error Tables (Decode & Prompt, Apple M5 Max vs CPU double)

Part II — PR #4595 (inkling2-lead-dense-units, 7c509dd706 vs origin/lead/inkling2-mini 3e0e9bcb83 & #4594 c741dcddb9)

#4595 replaces width-dependent BF16 matmul paths (sp_matvec_{1..32} in origin/lead/inkling2-mini, and rows<=32 sp_matvec_{next_pow2}/dense_fuse + rows>32 tf_dsv41_mv_mma_bf16 in #4594) with uniform 8-way K-split ink2_mma (16x32x16) + ordered ink2_part_sum and #pragma METAL fp contract(off) (units.metal + dense_units.metal) across ALL widths 1..512 (_1 ROWS1 fast path at rows=1, plus _16 / _32 / _64 bands for 2..16, 17..32, 33..512) for both individual dense projections (dense_units) and 6-way fused dense6_units (8600x2304). All 18 / 18 seam parity checks (ROWS1 vs _16 at r=1, and row 0 across r=8..512 vs both ROWS1 and _16 r=1) passed bit_identical=YES.

E. Decode (rows = 1, 8, 16, 17, 32)

Note: On Decode (rows <= 32), #4594 uses sp_matvec_{next_pow2} (single projections, bit-identical to base sp_matvec) / tf_ink2_mv6_{next_pow2} (dense_fuse.metal at c741dcddb9), while #4595 uses ROWS1 (tf_ink2_dense_units_1 / tf_ink2_dense6_units_1) on rows = 1 (bit-identical to _16) and _16/_32 bands on rows = 2..32.

E1. Individual Dense Projections (dense_units vs sp_matvec)

| Projection | Rows | Path | ref RMS | max |abs err| | RMSE | mean |abs err| | max ULP (bf16) | % 0-ULP | Worst Col max |abs| | Worst Col RMSE | Worst Col ULP | Near-Zero Witness |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Q/Gate (3072x2304) | 1 | base / #4594 (sp_matvec) | 1.015e+00 | 7.791306e-03 | 1.722161e-03 | 1.151230e-03 | 0 | 100.0000% | 7.791306e-03 @c2761 | 7.791306e-03 @c2761 | 0 @c0 | — |
| Q/Gate (3072x2304) | 1 | #4595 (dense_units) | 1.015e+00 | 7.791306e-03 | 1.722161e-03 | 1.151230e-03 | 1 (0 sig) | 99.9674% | 7.791306e-03 @c2761 | 7.791306e-03 @c2761 | 1 @c1705 | r0,c1705: got=5.684e-04, ref=5.704e-04 |
| Q/Gate (3072x2304) | 8 | base / #4594 (sp_matvec) | 1.004e+00 | 7.809879e-03 | 1.669403e-03 | 1.131546e-03 | 1 | 99.9878% | 7.809879e-03 @c2011 | 4.232762e-03 @c2587 | 1 @c560 | — |
| Q/Gate (3072x2304) | 8 | #4595 (dense_units) | 1.004e+00 | 7.809879e-03 | 1.669403e-03 | 1.131546e-03 | 1 | 99.9797% | 7.809879e-03 @c2011 | 4.232762e-03 @c2587 | 1 @c90 | — |
| Q/Gate (3072x2304) | 16 | base / #4594 (sp_matvec) | 1.006e+00 | 1.050471e-02 | 1.673030e-03 | 1.132946e-03 | 1 | 99.9919% | 1.050471e-02 @c2827 | 3.382177e-03 @c2754 | 1 @c560 | — |
| Q/Gate (3072x2304) | 16 | #4595 (dense_units) | 1.006e+00 | 1.050471e-02 | 1.673030e-03 | 1.132946e-03 | 1 | 99.9837% | 1.050471e-02 @c2827 | 3.382177e-03 @c2754 | 1 @c90 | — |
| Q/Gate (3072x2304) | 17 | base / #4594 (sp_matvec) | 1.007e+00 | 1.050471e-02 | 1.677080e-03 | 1.135299e-03 | 1 | 99.9904% | 1.050471e-02 @c2827 | 3.345200e-03 @c2754 | 1 @c560 | — |
| Q/Gate (3072x2304) | 17 | #4595 (dense_units) | 1.007e+00 | 1.050471e-02 | 1.677080e-03 | 1.135299e-03 | 1 | 99.9847% | 1.050471e-02 @c2827 | 3.345200e-03 @c2754 | 1 @c90 | — |
| Q/Gate (3072x2304) | 32 | base / #4594 (sp_matvec) | 1.005e+00 | 1.341564e-02 | 1.671534e-03 | 1.131830e-03 | 1 | 99.9919% | 1.341564e-02 @C2007 | 2.939875e-03 @c2303 | 1 @c560 | — |
| Q/Gate (3072x2304) | 32 | #4595 (dense_units) | 1.005e+00 | 1.341564e-02 | 1.671534e-03 | 1.131830e-03 | 1 | 99.9827% | 1.341564e-02 @C2007 | 2.939875e-03 @c2303 | 1 @c90 | — |
| K/V (1024x2304) | 1 | base / #4594 (sp_matvec) | 1.018e+00 | 7.787879e-03 | 1.636223e-03 | 1.106453e-03 | 0 | 100.0000% | 7.787879e-03 @c654 | 7.787879e-03 @c654 | 0 @c0 | — |
| K/V (1024x2304) | 1 | #4595 (dense_units) | 1.018e+00 | 7.787879e-03 | 1.636223e-03 | 1.106453e-03 | 0 | 100.0000% | 7.787879e-03 @c654 | 7.787879e-03 @c654 | 0 @c0 | — |
| K/V (1024x2304) | 8 | base / #4594 (sp_matvec) | 9.989e-01 | 7.806678e-03 | 1.651221e-03 | 1.114117e-03 | 0 | 100.0000% | 7.806678e-03 @C330 | 3.923153e-03 @C4 | 0 @c0 | — |
| K/V (1024x2304) | 8 | #4595 (dense_units) | 9.989e-01 | 7.806678e-03 | 1.651221e-03 | 1.114117e-03 | 1 | 99.9878% | 7.806678e-03 @C330 | 3.923153e-03 @C4 | 1 @c882 | — |
| K/V (1024x2304) | 16 | base / #4594 (sp_matvec) | 9.977e-01 | 7.806678e-03 | 1.651064e-03 | 1.113947e-03 | 1 | 99.9939% | 7.806678e-03 @C330 | 3.284462e-03 @C519 | 1 @C892 | — |
| K/V (1024x2304) | 16 | #4595 (dense_units) | 9.977e-01 | 7.806678e-03 | 1.651064e-03 | 1.113947e-03 | 1 | 99.9878% | 7.806678e-03 @C330 | 3.284462e-03 @C519 | 1 @c882 | — |
| K/V (1024x2304) | 17 | base / #4594 (sp_matvec) | 9.979e-01 | 7.806678e-03 | 1.656242e-03 | 1.116715e-03 | 1 | 99.9943% | 7.806678e-03 @C330 | 3.187381e-03 @C519 | 1 @C892 | — |
| K/V (1024x2304) | 17 | #4595 (dense_units) | 9.979e-01 | 7.806678e-03 | 1.656242e-03 | 1.116715e-03 | 1 | 99.9885% | 7.806678e-03 @C330 | 3.187381e-03 @C519 | 1 @c882 | — |
| K/V (1024x2304) | 32 | base / #4594 (sp_matvec) | 9.972e-01 | 1.144834e-02 | 1.658485e-03 | 1.120172e-03 | 1 | 99.9939% | 1.144834e-02 @c456 | 2.857589e-03 @C519 | 1 @c335 | — |
| K/V (1024x2304) | 32 | #4595 (dense_units) | 9.972e-01 | 1.144834e-02 | 1.658485e-03 | 1.120172e-03 | 1 | 99.9908% | 1.144834e-02 @c456 | 2.857589e-03 @C519 | 1 @c335 | — |
| Rel (384x2304) | 1 | base / #4594 (sp_matvec) | 1.005e+00 | 5.780723e-03 | 1.456041e-03 | 1.028794e-03 | 0 | 100.0000% | 5.780723e-03 @C380 | 5.780723e-03 @C380 | 0 @c0 | — |
| Rel (384x2304) | 1 | #4595 (dense_units) | 1.005e+00 | 5.780723e-03 | 1.456041e-03 | 1.028794e-03 | 0 | 100.0000% | 5.780723e-03 @C380 | 5.780723e-03 @C380 | 0 @c0 | — |
| Rel (384x2304) | 8 | base / #4594 (sp_matvec) | 1.023e+00 | 7.793652e-03 | 1.652371e-03 | 1.114311e-03 | 1 | 99.9674% | 7.793652e-03 @c364 | 4.066712e-03 @C153 | 1 @C148 | — |
| Rel (384x2304) | 8 | #4595 (dense_units) | 1.023e+00 | 7.793652e-03 | 1.652371e-03 | 1.114311e-03 | 1 | 99.9674% | 7.793652e-03 @c364 | 4.066712e-03 @C153 | 1 @c17 | — |
| Rel (384x2304) | 16 | base / #4594 (sp_matvec) | 1.020e+00 | 7.793652e-03 | 1.661458e-03 | 1.121546e-03 | 1 | 99.9674% | 7.793652e-03 @c364 | 3.096100e-03 @C153 | 1 @c118 | — |
| Rel (384x2304) | 16 | #4595 (dense_units) | 1.020e+00 | 7.793652e-03 | 1.661458e-03 | 1.121546e-03 | 1 | 99.9837% | 7.793652e-03 @c364 | 3.096100e-03 @C153 | 1 @c17 | — |
| Rel (384x2304) | 17 | base / #4594 (sp_matvec) | 1.016e+00 | 7.793652e-03 | 1.665981e-03 | 1.125446e-03 | 1 | 99.9694% | 7.793652e-03 @c364 | 3.039383e-03 @C153 | 1 @c118 | — |
| Rel (384x2304) | 17 | #4595 (dense_units) | 1.016e+00 | 7.793652e-03 | 1.665981e-03 | 1.125446e-03 | 1 | 99.9847% | 7.793652e-03 @c364 | 3.039383e-03 @C153 | 1 @c17 | — |
| Rel (384x2304) | 32 | base / #4594 (sp_matvec) | 1.002e+00 | 7.793652e-03 | 1.658842e-03 | 1.119871e-03 | 1 | 99.9756% | 7.793652e-03 @c364 | 2.551813e-03 @C280 | 1 @C5 | — |
| Rel (384x2304) | 32 | #4595 (dense_units) | 1.002e+00 | 7.793652e-03 | 1.658842e-03 | 1.119871e-03 | 1 | 99.9919% | 7.793652e-03 @c364 | 2.551813e-03 @C280 | 1 @c17 | — |
| Sink (24x2304) | 1 | base / #4594 (sp_matvec) | 1.177e+00 | 7.571654e-03 | 2.526341e-03 | 1.628667e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 7.571654e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 1 | #4595 (dense_units) | 1.177e+00 | 7.571654e-03 | 2.526341e-03 | 1.628667e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 7.571654e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 8 | base / #4594 (sp_matvec) | 1.001e+00 | 7.571654e-03 | 1.667749e-03 | 1.099071e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 3.056401e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 8 | #4595 (dense_units) | 1.001e+00 | 7.571654e-03 | 1.667749e-03 | 1.099071e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 3.056401e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 16 | base / #4594 (sp_matvec) | 9.947e-01 | 7.571654e-03 | 1.581782e-03 | 1.060904e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 2.441039e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 16 | #4595 (dense_units) | 9.947e-01 | 7.571654e-03 | 1.581782e-03 | 1.060904e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 2.441039e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 17 | base / #4594 (sp_matvec) | 1.009e+00 | 7.571654e-03 | 1.582698e-03 | 1.072027e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 2.369906e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 17 | #4595 (dense_units) | 1.009e+00 | 7.571654e-03 | 1.582698e-03 | 1.072027e-03 | 0 | 100.0000% | 7.571654e-03 @c3 | 2.369906e-03 @c3 | 0 @c0 | — |
| Sink (24x2304) | 32 | base / #4594 (sp_matvec) | 9.800e-01 | 7.703438e-03 | 1.612499e-03 | 1.065725e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.059357e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 32 | #4595 (dense_units) | 9.800e-01 | 7.703438e-03 | 1.612499e-03 | 1.065725e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.059357e-03 @c9 | 0 @c0 | — |
| Wo (2304x3072) | 1 | base / #4594 (sp_matvec) | 1.001e+00 | 7.811960e-03 | 1.665837e-03 | 1.115871e-03 | 0 | 100.0000% | 7.811960e-03 @c846 | 7.811960e-03 @c846 | 0 @c0 | — |
| Wo (2304x3072) | 1 | #4595 (dense_units) | 1.001e+00 | 7.811960e-03 | 1.665837e-03 | 1.115871e-03 | 0 | 100.0000% | 7.811960e-03 @c846 | 7.811960e-03 @c846 | 0 @c0 | — |
| Wo (2304x3072) | 8 | base / #4594 (sp_matvec) | 1.007e+00 | 7.811960e-03 | 1.661896e-03 | 1.120693e-03 | 1 | 99.9891% | 7.811960e-03 @c846 | 4.039757e-03 @c305 | 1 @c552 | — |
| Wo (2304x3072) | 8 | #4595 (dense_units) | 1.007e+00 | 7.811960e-03 | 1.661896e-03 | 1.120693e-03 | 1 | 99.9783% | 7.811960e-03 @c846 | 4.039757e-03 @c305 | 1 @c552 | — |
| Wo (2304x3072) | 16 | base / #4594 (sp_matvec) | 1.000e+00 | 1.443046e-02 | 1.655178e-03 | 1.118137e-03 | 1 | 99.9837% | 1.443046e-02 @C749 | 4.728608e-03 @C749 | 1 @C333 | — |
| Wo (2304x3072) | 16 | #4595 (dense_units) | 1.000e+00 | 1.443046e-02 | 1.655178e-03 | 1.118137e-03 | 1 | 99.9729% | 1.443046e-02 @C749 | 4.728608e-03 @C749 | 1 @C121 | — |
| Wo (2304x3072) | 17 | base / #4594 (sp_matvec) | 1.001e+00 | 1.443046e-02 | 1.656763e-03 | 1.119189e-03 | 1 | 99.9847% | 1.443046e-02 @C749 | 4.592901e-03 @C749 | 1 @C333 | — |
| Wo (2304x3072) | 17 | #4595 (dense_units) | 1.001e+00 | 1.443046e-02 | 1.656763e-03 | 1.119189e-03 | 1 | 99.9745% | 1.443046e-02 @C749 | 4.592901e-03 @C749 | 1 @C121 | — |
| Wo (2304x3072) | 32 | base / #4594 (sp_matvec) | 1.001e+00 | 1.443046e-02 | 1.662173e-03 | 1.125578e-03 | 1 | 99.9851% | 1.443046e-02 @C749 | 3.480283e-03 @C749 | 1 @C333 | — |
| Wo (2304x3072) | 32 | #4595 (dense_units) | 1.001e+00 | 1.443046e-02 | 1.662173e-03 | 1.125578e-03 | 1 | 99.9797% | 1.443046e-02 @C749 | 3.480283e-03 @C749 | 1 @C121 | — |

E2. Fused 6-Projection dense6 (8600x2304, Decode rows = 1, 8, 17, 32)

| Projection | Rows | Path | ref RMS | max |abs err| | RMSE | mean |abs err| | max ULP (bf16) | % 0-ULP | Worst Col max |abs| | Worst Col RMSE | Worst Col ULP | Near-Zero Witness |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| dense6 (8600x2304) | 1 | base (sp_matvec) | 1.022e+00 | 1.356221e-02 | 1.722630e-03 | 1.154745e-03 | 0 | 100.0000% | 1.356221e-02 @c3947 | 1.356221e-02 @c3947 | 0 @c0 | — |
| dense6 (8600x2304) | 1 | #4594 (dense_fuse) | 1.022e+00 | 1.356221e-02 | 1.722630e-03 | 1.154745e-03 | 1 | 99.9767% | 1.356221e-02 @c3947 | 1.356221e-02 @c3947 | 1 @c1833 | — |
| dense6 (8600x2304) | 1 | #4595 (dense6_units) | 1.022e+00 | 1.356221e-02 | 1.722630e-03 | 1.154745e-03 | 1 | 99.9767% | 1.356221e-02 @c3947 | 1.356221e-02 @c3947 | 1 @c1833 | — |
| dense6 (8600x2304) | 8 | base (sp_matvec) | 1.006e+00 | 1.388819e-02 | 1.679293e-03 | 1.134563e-03 | 1 | 99.9913% | 1.388819e-02 @C797 | 5.353285e-03 @C797 | 1 @C106 | — |
| dense6 (8600x2304) | 8 | #4594 (dense_fuse) | 1.006e+00 | 1.388819e-02 | 1.679293e-03 | 1.134563e-03 | 1 | 99.9840% | 1.388819e-02 @C797 | 5.353285e-03 @C797 | 1 @c1565 | — |
| dense6 (8600x2304) | 8 | #4595 (dense6_units) | 1.006e+00 | 1.388819e-02 | 1.679293e-03 | 1.134563e-03 | 1 | 99.9782% | 1.388819e-02 @C797 | 5.353285e-03 @C797 | 1 @C616 | — |
| dense6 (8600x2304) | 17 | base (sp_matvec) | 1.000e+00 | 1.418646e-02 | 1.668253e-03 | 1.127063e-03 | 5 (1 sig) | 99.9891% | 1.418646e-02 @c362 | 4.035872e-03 @C797 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 17 | #4594 (dense_fuse) | 1.000e+00 | 1.418646e-02 | 1.668253e-03 | 1.127063e-03 | 3 (1 sig) | 99.9850% | 1.418646e-02 @c362 | 4.035872e-03 @C797 | 3 @c6293 | r15,c6293: got=-3.785e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 17 | #4595 (dense6_units) | 1.000e+00 | 1.418646e-02 | 1.668253e-03 | 1.127063e-03 | 2 (1 sig) | 99.9781% | 1.418646e-02 @c362 | 4.035872e-03 @C797 | 2 @C4401 | r16,c4401: got=-1.395e-05, ref=-1.383e-05 |
| dense6 (8600x2304) | 32 | base (sp_matvec) | 1.001e+00 | 1.451653e-02 | 1.668989e-03 | 1.127499e-03 | 5 (1 sig) | 99.9913% | 1.451653e-02 @C749 | 3.186272e-03 @c362 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 32 | #4594 (dense_fuse) | 1.001e+00 | 1.451653e-02 | 1.668989e-03 | 1.127499e-03 | 3 (1 sig) | 99.9869% | 1.451653e-02 @C749 | 3.186272e-03 @c362 | 3 @c6293 | r15,c6293: got=-3.785e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 32 | #4595 (dense6_units) | 1.001e+00 | 1.451653e-02 | 1.668989e-03 | 1.127499e-03 | 2 (1 sig) | 99.9800% | 1.451653e-02 @C749 | 3.186272e-03 @c362 | 2 @C4401 | r16,c4401: got=-1.395e-05, ref=-1.383e-05 |

F. Prompt (rows = 33, 64, 65, 128, 131, 512)

F1. Individual Dense Projections (#4595 dense_units vs #4594 mv_mma vs base sp_matvec)

| Projection | Rows | Path | ref RMS | max |abs err| | RMSE | mean |abs err| | max ULP (bf16) | % 0-ULP | Worst Col max |abs| | Worst Col RMSE | Worst Col ULP | Near-Zero Witness |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Q/Gate (3072x2304) | 33 | base (sp_matvec) | 1.005e+00 | 1.341564e-02 | 1.672447e-03 | 1.132652e-03 | 1 | 99.9921% | 1.341564e-02 @C2007 | 2.940283e-03 @c2303 | 1 @c560 | — |
| Q/Gate (3072x2304) | 33 | #4594 (mv_mma) | 1.005e+00 | 1.341564e-02 | 1.672447e-03 | 1.132652e-03 | 1 | 99.9911% | 1.341564e-02 @C2007 | 2.940283e-03 @c2303 | 1 @c833 | — |
| Q/Gate (3072x2304) | 33 | #4595 (dense_units) | 1.005e+00 | 1.341564e-02 | 1.672447e-03 | 1.132652e-03 | 1 | 99.9832% | 1.341564e-02 @C2007 | 2.940283e-03 @c2303 | 1 @c90 | — |
| Q/Gate (3072x2304) | 64 | base (sp_matvec) | 1.000e+00 | 1.341564e-02 | 1.663518e-03 | 1.125193e-03 | 1 | 99.9898% | 1.341564e-02 @C2007 | 2.597431e-03 @c828 | 1 @C81 | — |
| Q/Gate (3072x2304) | 64 | #4594 (mv_mma) | 1.000e+00 | 1.341564e-02 | 1.663518e-03 | 1.125193e-03 | 1 | 99.9878% | 1.341564e-02 @C2007 | 2.597431e-03 @c828 | 1 @c155 | — |
| Q/Gate (3072x2304) | 64 | #4595 (dense_units) | 1.000e+00 | 1.341564e-02 | 1.663518e-03 | 1.125193e-03 | 1 | 99.9832% | 1.341564e-02 @C2007 | 2.597431e-03 @c828 | 1 @c90 | — |
| Q/Gate (3072x2304) | 65 | base (sp_matvec) | 1.000e+00 | 1.341564e-02 | 1.663009e-03 | 1.124715e-03 | 1 | 99.9900% | 1.341564e-02 @C2007 | 2.610561e-03 @c828 | 1 @C81 | — |
| Q/Gate (3072x2304) | 65 | #4594 (mv_mma) | 1.000e+00 | 1.341564e-02 | 1.663009e-03 | 1.124715e-03 | 1 | 99.9880% | 1.341564e-02 @C2007 | 2.610561e-03 @c828 | 1 @c155 | — |
| Q/Gate (3072x2304) | 65 | #4595 (dense_units) | 1.000e+00 | 1.341564e-02 | 1.663009e-03 | 1.124715e-03 | 1 | 99.9835% | 1.341564e-02 @C2007 | 2.610561e-03 @c828 | 1 @c90 | — |
| Q/Gate (3072x2304) | 128 | base (sp_matvec) | 9.991e-01 | 1.341564e-02 | 1.661274e-03 | 1.124241e-03 | 1 | 99.9901% | 1.341564e-02 @C2007 | 2.415618e-03 @c828 | 1 @C81 | — |
| Q/Gate (3072x2304) | 128 | #4594 (mv_mma) | 9.991e-01 | 1.341564e-02 | 1.661274e-03 | 1.124241e-03 | 1 | 99.9888% | 1.341564e-02 @C2007 | 2.415618e-03 @c828 | 1 @c155 | — |
| Q/Gate (3072x2304) | 128 | #4595 (dense_units) | 9.991e-01 | 1.341564e-02 | 1.661274e-03 | 1.124241e-03 | 3 (1 sig) | 99.9875% | 1.341564e-02 @C2007 | 2.415618e-03 @c828 | 3 @c2883 | r107,c2883: got=1.049e-05, ref=1.033e-05 |
| Q/Gate (3072x2304) | 131 | base (sp_matvec) | 9.985e-01 | 1.341564e-02 | 1.659821e-03 | 1.123401e-03 | 3 (1 sig) | 99.9901% | 1.341564e-02 @C2007 | 2.399038e-03 @c828 | 3 @c1502 | r130,c1502: got=2.936e-06, ref=2.987e-06 |
| Q/Gate (3072x2304) | 131 | #4594 (mv_mma) | 9.985e-01 | 1.341564e-02 | 1.659821e-03 | 1.123401e-03 | 3 (1 sig) | 99.9886% | 1.341564e-02 @C2007 | 2.399038e-03 @c828 | 3 @c1502 | r130,c1502: got=2.936e-06, ref=2.987e-06 |
| Q/Gate (3072x2304) | 131 | #4595 (dense_units) | 9.985e-01 | 1.341564e-02 | 1.659821e-03 | 1.123401e-03 | 6 (1 sig) | 99.9871% | 1.341564e-02 @C2007 | 2.399038e-03 @c828 | 6 @c1502 | r130,c1502: got=3.070e-06, ref=2.987e-06 |
| Q/Gate (3072x2304) | 512 | base (sp_matvec) | 1.001e+00 | 1.557235e-02 | 1.664004e-03 | 1.125161e-03 | 85 (1 sig) | 99.9900% | 1.557235e-02 @c925 | 2.032556e-03 @c2369 | 85 @c456 | r196,c456: got=-1.788e-07, ref=-2.771e-07 |
| Q/Gate (3072x2304) | 512 | #4594 (mv_mma) | 1.001e+00 | 1.557235e-02 | 1.664004e-03 | 1.125161e-03 | 15 (1 sig) | 99.9900% | 1.557235e-02 @c925 | 2.032556e-03 @c2369 | 15 @c72 | r430,c72: got=-1.520e-06, ref=-1.633e-06 |
| Q/Gate (3072x2304) | 512 | #4595 (dense_units) | 1.001e+00 | 1.557235e-02 | 1.664004e-03 | 1.125161e-03 | 117 (1 sig) | 99.9869% | 1.557235e-02 @c925 | 2.032556e-03 @c2369 | 117 @c456 | r196,c456: got=-1.490e-07, ref=-2.771e-07 |
| K/V (1024x2304) | 33 | base (sp_matvec) | 9.985e-01 | 1.144834e-02 | 1.663189e-03 | 1.122961e-03 | 1 | 99.9941% | 1.144834e-02 @c456 | 2.829206e-03 @C519 | 1 @c335 | — |
| K/V (1024x2304) | 33 | #4594 (mv_mma) | 9.985e-01 | 1.144834e-02 | 1.663189e-03 | 1.122961e-03 | 1 | 99.9911% | 1.144834e-02 @c456 | 2.829206e-03 @C519 | 1 @c406 | — |
| K/V (1024x2304) | 33 | #4595 (dense_units) | 9.985e-01 | 1.144834e-02 | 1.663189e-03 | 1.122961e-03 | 1 | 99.9911% | 1.144834e-02 @c456 | 2.829206e-03 @C519 | 1 @c335 | — |
| K/V (1024x2304) | 64 | base (sp_matvec) | 9.974e-01 | 1.144834e-02 | 1.659998e-03 | 1.122960e-03 | 1 | 99.9924% | 1.144834e-02 @c456 | 2.517863e-03 @c828 | 1 @c220 | — |
| K/V (1024x2304) | 64 | #4594 (mv_mma) | 9.974e-01 | 1.144834e-02 | 1.659998e-03 | 1.122960e-03 | 1 | 99.9863% | 1.144834e-02 @c456 | 2.517863e-03 @c828 | 1 @c29 | — |
| K/V (1024x2304) | 64 | #4595 (dense_units) | 9.974e-01 | 1.144834e-02 | 1.659998e-03 | 1.122960e-03 | 5 (1 sig) | 99.9878% | 1.144834e-02 @c456 | 2.517863e-03 @c828 | 5 @c220 | r47,c220: got=-2.861e-06, ref=-2.934e-06 |
| K/V (1024x2304) | 65 | base (sp_matvec) | 9.977e-01 | 1.144834e-02 | 1.660765e-03 | 1.123310e-03 | 1 | 99.9925% | 1.144834e-02 @c456 | 2.498474e-03 @c828 | 1 @c220 | — |
| K/V (1024x2304) | 65 | #4594 (mv_mma) | 9.977e-01 | 1.144834e-02 | 1.660765e-03 | 1.123310e-03 | 1 | 99.9865% | 1.144834e-02 @c456 | 2.498474e-03 @c828 | 1 @c29 | — |
| K/V (1024x2304) | 65 | #4595 (dense_units) | 9.977e-01 | 1.144834e-02 | 1.660765e-03 | 1.123310e-03 | 5 (1 sig) | 99.9880% | 1.144834e-02 @c456 | 2.498474e-03 @c828 | 5 @c220 | r47,c220: got=-2.861e-06, ref=-2.934e-06 |
| K/V (1024x2304) | 128 | base (sp_matvec) | 9.963e-01 | 1.144834e-02 | 1.654818e-03 | 1.118913e-03 | 1 | 99.9924% | 1.144834e-02 @c456 | 2.277471e-03 @c603 | 1 @C4 | — |
| K/V (1024x2304) | 128 | #4594 (mv_mma) | 9.963e-01 | 1.144834e-02 | 1.654818e-03 | 1.118913e-03 | 1 | 99.9901% | 1.144834e-02 @c456 | 2.277471e-03 @c603 | 1 @C4 | — |
| K/V (1024x2304) | 128 | #4595 (dense_units) | 9.963e-01 | 1.144834e-02 | 1.654818e-03 | 1.118913e-03 | 5 (1 sig) | 99.9863% | 1.144834e-02 @c456 | 2.277471e-03 @c603 | 5 @c220 | r47,c220: got=-2.861e-06, ref=-2.934e-06 |
| K/V (1024x2304) | 131 | base (sp_matvec) | 9.964e-01 | 1.144834e-02 | 1.654159e-03 | 1.118443e-03 | 1 | 99.9925% | 1.144834e-02 @c456 | 2.271075e-03 @c603 | 1 @C4 | — |
| K/V (1024x2304) | 131 | #4594 (mv_mma) | 9.964e-01 | 1.144834e-02 | 1.654159e-03 | 1.118443e-03 | 1 | 99.9903% | 1.144834e-02 @c456 | 2.271075e-03 @c603 | 1 @C4 | — |
| K/V (1024x2304) | 131 | #4595 (dense_units) | 9.964e-01 | 1.144834e-02 | 1.654159e-03 | 1.118443e-03 | 5 (1 sig) | 99.9866% | 1.144834e-02 @c456 | 2.271075e-03 @c603 | 5 @c220 | r47,c220: got=-2.861e-06, ref=-2.934e-06 |
| K/V (1024x2304) | 512 | base (sp_matvec) | 9.999e-01 | 1.527225e-02 | 1.659833e-03 | 1.123794e-03 | 4 (1 sig) | 99.9912% | 1.527225e-02 @c451 | 1.973914e-03 @c1016 | 4 @c63 | r358,c63: got=-1.550e-06, ref=-1.518e-06 |
| K/V (1024x2304) | 512 | #4594 (mv_mma) | 9.999e-01 | 1.527225e-02 | 1.659833e-03 | 1.123794e-03 | 6 (1 sig) | 99.9908% | 1.527225e-02 @c451 | 1.973914e-03 @c1016 | 6 @c63 | r358,c63: got=-1.475e-06, ref=-1.518e-06 |
| K/V (1024x2304) | 512 | #4595 (dense_units) | 9.999e-01 | 1.527225e-02 | 1.659833e-03 | 1.123794e-03 | 16 (1 sig) | 99.9865% | 1.527225e-02 @c451 | 1.973914e-03 @c1016 | 16 @c63 | r358,c63: got=-1.401e-06, ref=-1.518e-06 |
| Rel (384x2304) | 33 | base (sp_matvec) | 1.001e+00 | 7.793652e-03 | 1.664888e-03 | 1.122399e-03 | 1 | 99.9684% | 7.793652e-03 @c364 | 2.539520e-03 @c357 | 1 @C5 | — |
| Rel (384x2304) | 33 | #4594 (mv_mma) | 1.001e+00 | 7.793652e-03 | 1.664888e-03 | 1.122399e-03 | 1 | 99.9763% | 7.793652e-03 @c364 | 2.539520e-03 @c357 | 1 @c17 | — |
| Rel (384x2304) | 33 | #4595 (dense_units) | 1.001e+00 | 7.793652e-03 | 1.664888e-03 | 1.122399e-03 | 1 | 99.9921% | 7.793652e-03 @c364 | 2.539520e-03 @c357 | 1 @c17 | — |
| Rel (384x2304) | 64 | base (sp_matvec) | 1.003e+00 | 1.312306e-02 | 1.673372e-03 | 1.124172e-03 | 1 | 99.9797% | 1.312306e-02 @c284 | 2.468123e-03 @c24 | 1 @C5 | — |
| Rel (384x2304) | 64 | #4594 (mv_mma) | 1.003e+00 | 1.312306e-02 | 1.673372e-03 | 1.124171e-03 | 1 | 99.9837% | 1.312306e-02 @c284 | 2.468123e-03 @c24 | 1 @c17 | — |
| Rel (384x2304) | 64 | #4595 (dense_units) | 1.003e+00 | 1.312306e-02 | 1.673372e-03 | 1.124171e-03 | 1 | 99.9959% | 1.312306e-02 @c284 | 2.468123e-03 @c24 | 1 @c17 | — |
| Rel (384x2304) | 65 | base (sp_matvec) | 1.002e+00 | 1.312306e-02 | 1.672307e-03 | 1.123216e-03 | 1 | 99.9800% | 1.312306e-02 @c284 | 2.456111e-03 @c24 | 1 @C5 | — |
| Rel (384x2304) | 65 | #4594 (mv_mma) | 1.002e+00 | 1.312306e-02 | 1.672307e-03 | 1.123216e-03 | 1 | 99.9840% | 1.312306e-02 @c284 | 2.456111e-03 @c24 | 1 @c17 | — |
| Rel (384x2304) | 65 | #4595 (dense_units) | 1.002e+00 | 1.312306e-02 | 1.672307e-03 | 1.123216e-03 | 1 | 99.9960% | 1.312306e-02 @c284 | 2.456111e-03 @c24 | 1 @c17 | — |
| Rel (384x2304) | 128 | base (sp_matvec) | 1.003e+00 | 1.446670e-02 | 1.667865e-03 | 1.124938e-03 | 1 | 99.9817% | 1.446670e-02 @c178 | 2.118339e-03 @C153 | 1 @C4 | — |
| Rel (384x2304) | 128 | #4594 (mv_mma) | 1.003e+00 | 1.446670e-02 | 1.667865e-03 | 1.124938e-03 | 1 | 99.9878% | 1.446670e-02 @c178 | 2.118339e-03 @C153 | 1 @c17 | — |
| Rel (384x2304) | 128 | #4595 (dense_units) | 1.003e+00 | 1.446670e-02 | 1.667865e-03 | 1.124938e-03 | 1 | 99.9919% | 1.446670e-02 @c178 | 2.118339e-03 @C153 | 1 @C4 | — |
| Rel (384x2304) | 131 | base (sp_matvec) | 1.002e+00 | 1.446670e-02 | 1.665630e-03 | 1.123715e-03 | 1 | 99.9821% | 1.446670e-02 @c178 | 2.113185e-03 @c362 | 1 @C4 | — |
| Rel (384x2304) | 131 | #4594 (mv_mma) | 1.002e+00 | 1.446670e-02 | 1.665630e-03 | 1.123715e-03 | 1 | 99.9881% | 1.446670e-02 @c178 | 2.113185e-03 @c362 | 1 @c17 | — |
| Rel (384x2304) | 131 | #4595 (dense_units) | 1.002e+00 | 1.446670e-02 | 1.665630e-03 | 1.123715e-03 | 1 | 99.9920% | 1.446670e-02 @c178 | 2.113185e-03 @c362 | 1 @C4 | — |
| Rel (384x2304) | 512 | base (sp_matvec) | 1.001e+00 | 1.495600e-02 | 1.661302e-03 | 1.124063e-03 | 1 | 99.9898% | 1.495600e-02 @c212 | 1.934769e-03 @c62 | 1 @C4 | — |
| Rel (384x2304) | 512 | #4594 (mv_mma) | 1.001e+00 | 1.495600e-02 | 1.661302e-03 | 1.124063e-03 | 1 | 99.9893% | 1.495600e-02 @c212 | 1.934769e-03 @c62 | 1 @c17 | — |
| Rel (384x2304) | 512 | #4595 (dense_units) | 1.001e+00 | 1.495600e-02 | 1.661302e-03 | 1.124063e-03 | 1 | 99.9888% | 1.495600e-02 @c212 | 1.934769e-03 @c62 | 1 @C4 | — |
| Sink (24x2304) | 33 | base (sp_matvec) | 9.798e-01 | 7.703438e-03 | 1.616607e-03 | 1.070916e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.082515e-03 @c20 | 0 @c0 | — |
| Sink (24x2304) | 33 | #4594 (mv_mma) | 9.798e-01 | 7.703438e-03 | 1.616607e-03 | 1.070916e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.082515e-03 @c20 | 0 @c0 | — |
| Sink (24x2304) | 33 | #4595 (dense_units) | 9.798e-01 | 7.703438e-03 | 1.616607e-03 | 1.070916e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.082515e-03 @c20 | 0 @c0 | — |
| Sink (24x2304) | 64 | base (sp_matvec) | 9.926e-01 | 7.703438e-03 | 1.655062e-03 | 1.101214e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.164669e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 64 | #4594 (mv_mma) | 9.926e-01 | 7.703438e-03 | 1.655062e-03 | 1.101214e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.164669e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 64 | #4595 (dense_units) | 9.926e-01 | 7.703438e-03 | 1.655062e-03 | 1.101214e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.164669e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 65 | base (sp_matvec) | 9.925e-01 | 7.703438e-03 | 1.652505e-03 | 1.100730e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.185398e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 65 | #4594 (mv_mma) | 9.925e-01 | 7.703438e-03 | 1.652505e-03 | 1.100730e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.185398e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 65 | #4595 (dense_units) | 9.925e-01 | 7.703438e-03 | 1.652505e-03 | 1.100730e-03 | 0 | 100.0000% | 7.703438e-03 @c10 | 2.185398e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 128 | base (sp_matvec) | 1.008e+00 | 7.755154e-03 | 1.655502e-03 | 1.113800e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.977560e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 128 | #4594 (mv_mma) | 1.008e+00 | 7.755154e-03 | 1.655502e-03 | 1.113800e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.977560e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 128 | #4595 (dense_units) | 1.008e+00 | 7.755154e-03 | 1.655502e-03 | 1.113800e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.977560e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 131 | base (sp_matvec) | 1.008e+00 | 7.755154e-03 | 1.665086e-03 | 1.118521e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.958910e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 131 | #4594 (mv_mma) | 1.008e+00 | 7.755154e-03 | 1.665086e-03 | 1.118521e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.958910e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 131 | #4595 (dense_units) | 1.008e+00 | 7.755154e-03 | 1.665086e-03 | 1.118521e-03 | 0 | 100.0000% | 7.755154e-03 @c21 | 1.958910e-03 @c9 | 0 @c0 | — |
| Sink (24x2304) | 512 | base (sp_matvec) | 9.966e-01 | 7.780807e-03 | 1.669896e-03 | 1.118014e-03 | 0 | 100.0000% | 7.780807e-03 @c6 | 1.789137e-03 @C5 | 0 @c0 | — |
| Sink (24x2304) | 512 | #4594 (mv_mma) | 9.966e-01 | 7.780807e-03 | 1.669896e-03 | 1.118014e-03 | 1 (0 sig) | 99.9756% | 7.780807e-03 @c6 | 1.789137e-03 @C5 | 1 @C5 | r386,c5: got=-3.128e-04, ref=-3.117e-04 |
| Sink (24x2304) | 512 | #4595 (dense_units) | 9.966e-01 | 7.780807e-03 | 1.669896e-03 | 1.118014e-03 | 1 (0 sig) | 99.9919% | 7.780807e-03 @c6 | 1.789137e-03 @C5 | 1 @C5 | r386,c5: got=-3.128e-04, ref=-3.117e-04 |
| Wo (2304x3072) | 33 | base (sp_matvec) | 1.001e+00 | 1.443046e-02 | 1.660949e-03 | 1.124929e-03 | 1 | 99.9855% | 1.443046e-02 @C749 | 3.437893e-03 @C749 | 1 @C333 | — |
| Wo (2304x3072) | 33 | #4594 (mv_mma) | 1.001e+00 | 1.443046e-02 | 1.660949e-03 | 1.124929e-03 | 1 | 99.9908% | 1.443046e-02 @C749 | 3.437893e-03 @C749 | 1 @c615 | — |
| Wo (2304x3072) | 33 | #4595 (dense_units) | 1.001e+00 | 1.443046e-02 | 1.660949e-03 | 1.124929e-03 | 1 | 99.9803% | 1.443046e-02 @C749 | 3.437893e-03 @C749 | 1 @C121 | — |
| Wo (2304x3072) | 64 | base (sp_matvec) | 1.002e+00 | 1.476524e-02 | 1.660571e-03 | 1.125542e-03 | 1 | 99.9885% | 1.476524e-02 @c639 | 2.828936e-03 @C749 | 1 @c250 | — |
| Wo (2304x3072) | 64 | #4594 (mv_mma) | 1.002e+00 | 1.476524e-02 | 1.660571e-03 | 1.125542e-03 | 1 | 99.9898% | 1.476524e-02 @c639 | 2.828936e-03 @C749 | 1 @c336 | — |
| Wo (2304x3072) | 64 | #4595 (dense_units) | 1.002e+00 | 1.476524e-02 | 1.660571e-03 | 1.125542e-03 | 3 (1 sig) | 99.9858% | 1.476524e-02 @c639 | 2.828936e-03 @C749 | 3 @c1059 | r47,c1059: got=9.775e-06, ref=9.931e-06 |
| Wo (2304x3072) | 65 | base (sp_matvec) | 1.002e+00 | 1.476524e-02 | 1.661331e-03 | 1.126109e-03 | 1 | 99.9886% | 1.476524e-02 @c639 | 2.808413e-03 @C749 | 1 @c250 | — |
| Wo (2304x3072) | 65 | #4594 (mv_mma) | 1.002e+00 | 1.476524e-02 | 1.661331e-03 | 1.126109e-03 | 1 | 99.9900% | 1.476524e-02 @c639 | 2.808413e-03 @C749 | 1 @c336 | — |
| Wo (2304x3072) | 65 | #4595 (dense_units) | 1.002e+00 | 1.476524e-02 | 1.661331e-03 | 1.126109e-03 | 3 (1 sig) | 99.9860% | 1.476524e-02 @c639 | 2.808413e-03 @C749 | 3 @c1059 | r47,c1059: got=9.775e-06, ref=9.931e-06 |
| Wo (2304x3072) | 128 | base (sp_matvec) | 9.999e-01 | 1.515730e-02 | 1.660518e-03 | 1.124228e-03 | 1 | 99.9891% | 1.515730e-02 @c2217 | 2.310001e-03 @c1667 | 1 @c250 | — |
| Wo (2304x3072) | 128 | #4594 (mv_mma) | 9.999e-01 | 1.515730e-02 | 1.660518e-03 | 1.124228e-03 | 8 (1 sig) | 99.9891% | 1.515730e-02 @c2217 | 2.310001e-03 @c1667 | 8 @c697 | r80,c697: got=-2.414e-06, ref=-2.533e-06 |
| Wo (2304x3072) | 128 | #4595 (dense_units) | 9.999e-01 | 1.515730e-02 | 1.660518e-03 | 1.124228e-03 | 3 (1 sig) | 99.9817% | 1.515730e-02 @c2217 | 2.310001e-03 @c1667 | 3 @c697 | r80,c697: got=-2.578e-06, ref=-2.533e-06 |
| Wo (2304x3072) | 131 | base (sp_matvec) | 1.000e+00 | 1.515730e-02 | 1.661117e-03 | 1.124590e-03 | 1 | 99.9887% | 1.515730e-02 @c2217 | 2.365405e-03 @c1667 | 1 @c82 | — |
| Wo (2304x3072) | 131 | #4594 (mv_mma) | 1.000e+00 | 1.515730e-02 | 1.661117e-03 | 1.124590e-03 | 8 (1 sig) | 99.9887% | 1.515730e-02 @c2217 | 2.365405e-03 @c1667 | 8 @c697 | r80,c697: got=-2.414e-06, ref=-2.533e-06 |
| Wo (2304x3072) | 131 | #4595 (dense_units) | 1.000e+00 | 1.515730e-02 | 1.661117e-03 | 1.124590e-03 | 3 (1 sig) | 99.9821% | 1.515730e-02 @c2217 | 2.365405e-03 @c1667 | 3 @c697 | r80,c697: got=-2.578e-06, ref=-2.533e-06 |
| Wo (2304x3072) | 512 | base (sp_matvec) | 9.999e-01 | 1.515730e-02 | 1.662336e-03 | 1.124004e-03 | 8 (1 sig) | 99.9898% | 1.515730e-02 @c2217 | 2.006475e-03 @c1306 | 8 @c128 | r228,c128: got=6.557e-07, ref=6.852e-07 |
| Wo (2304x3072) | 512 | #4594 (mv_mma) | 9.999e-01 | 1.515730e-02 | 1.662336e-03 | 1.124004e-03 | 8 (1 sig) | 99.9893% | 1.515730e-02 @c2217 | 2.006475e-03 @c1306 | 8 @c128 | r228,c128: got=6.557e-07, ref=6.852e-07 |
| Wo (2304x3072) | 512 | #4595 (dense_units) | 9.999e-01 | 1.515730e-02 | 1.662336e-03 | 1.124004e-03 | 40 (1 sig) | 99.9838% | 1.515730e-02 @c2217 | 2.006475e-03 @c1306 | 40 @c128 | r228,c128: got=5.364e-07, ref=6.852e-07 |

F2. Fused 6-Projection dense6 (8600x2304, Prompt rows = 64, 65, 128, 131, 512)

| Projection | Rows | Path | ref RMS | max |abs err| | RMSE | mean |abs err| | max ULP (bf16) | % 0-ULP | Worst Col max |abs| | Worst Col RMSE | Worst Col ULP | Near-Zero Witness |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| dense6 (8600x2304) | 64 | base (sp_matvec) | 9.995e-01 | 1.451653e-02 | 1.662446e-03 | 1.124275e-03 | 5 (1 sig) | 99.9895% | 1.451653e-02 @C749 | 2.709787e-03 @c362 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 64 | #4594 (mv_mma) | 9.995e-01 | 1.451653e-02 | 1.662446e-03 | 1.124275e-03 | 3 (1 sig) | 99.9880% | 1.451653e-02 @C749 | 2.709787e-03 @c362 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 64 | #4595 (dense6_units) | 9.995e-01 | 1.451653e-02 | 1.662446e-03 | 1.124275e-03 | 3 (1 sig) | 99.9829% | 1.451653e-02 @C749 | 2.709787e-03 @c362 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 65 | base (sp_matvec) | 1.000e+00 | 1.451653e-02 | 1.663255e-03 | 1.124735e-03 | 5 (1 sig) | 99.9896% | 1.451653e-02 @C749 | 2.691725e-03 @c362 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 65 | #4594 (mv_mma) | 1.000e+00 | 1.451653e-02 | 1.663255e-03 | 1.124735e-03 | 3 (1 sig) | 99.9882% | 1.451653e-02 @C749 | 2.691725e-03 @c362 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 65 | #4595 (dense6_units) | 1.000e+00 | 1.451653e-02 | 1.663255e-03 | 1.124735e-03 | 3 (1 sig) | 99.9823% | 1.451653e-02 @C749 | 2.691725e-03 @c362 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 128 | base (sp_matvec) | 1.000e+00 | 1.451653e-02 | 1.662951e-03 | 1.124264e-03 | 5 (1 sig) | 99.9892% | 1.451653e-02 @C749 | 2.346336e-03 @c7209 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 128 | #4594 (mv_mma) | 1.000e+00 | 1.451653e-02 | 1.662951e-03 | 1.124264e-03 | 3 (1 sig) | 99.9877% | 1.451653e-02 @C749 | 2.346336e-03 @c7209 | 3 @c2247 | r91,c2247: got=5.603e-06, ref=5.528e-06 |
| dense6 (8600x2304) | 128 | #4595 (dense6_units) | 1.000e+00 | 1.451653e-02 | 1.662951e-03 | 1.124264e-03 | 3 (1 sig) | 99.9838% | 1.451653e-02 @C749 | 2.346336e-03 @c7209 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 131 | base (sp_matvec) | 1.000e+00 | 1.451653e-02 | 1.663370e-03 | 1.124379e-03 | 5 (1 sig) | 99.9892% | 1.451653e-02 @C749 | 2.330879e-03 @c7209 | 5 @c6293 | r15,c6293: got=-3.755e-06, ref=-3.838e-06 |
| dense6 (8600x2304) | 131 | #4594 (mv_mma) | 1.000e+00 | 1.451653e-02 | 1.663370e-03 | 1.124379e-03 | 3 (1 sig) | 99.9878% | 1.451653e-02 @C749 | 2.330879e-03 @c7209 | 3 @c2247 | r91,c2247: got=5.603e-06, ref=5.528e-06 |
| dense6 (8600x2304) | 131 | #4595 (dense6_units) | 1.000e+00 | 1.451653e-02 | 1.663370e-03 | 1.124379e-03 | 3 (1 sig) | 99.9838% | 1.451653e-02 @C749 | 2.330879e-03 @c7209 | 3 @c5996 | r57,c5996: got=6.199e-06, ref=6.104e-06 |
| dense6 (8600x2304) | 512 | base (sp_matvec) | 9.997e-01 | 1.551900e-02 | 1.662389e-03 | 1.124315e-03 | 12744 (1 sig) | 99.9894% | 1.551900e-02 @c6498 | 1.975627e-03 @c7033 | 12744 @c5668 | r165,c5668: got=0.000e+00, ref=-5.835e-09 |
| dense6 (8600x2304) | 512 | #4594 (mv_mma) | 9.997e-01 | 1.551900e-02 | 1.662389e-03 | 1.124315e-03 | 504 (1 sig) | 99.9888% | 1.551900e-02 @c6498 | 1.975627e-03 @c7033 | 504 @c5668 | r165,c5668: got=-8.941e-08, ref=-5.835e-09 |
| dense6 (8600x2304) | 512 | #4595 (dense6_units) | 9.997e-01 | 1.551900e-02 | 1.662389e-03 | 1.124315e-03 | 440 (1 sig) | 99.9850% | 1.551900e-02 @c6498 | 1.975627e-03 @c7033 | 440 @c5668 | r165,c5668: got=-5.960e-08, ref=-5.835e-09 |

Kernel contract, only when a GPU kernel is new or changed
  • Kernels registered with the contract, and the kernel each one replaces: tf_ink2_dense_units_{1,16,32,64} and tf_ink2_dense6_units_{1,16,32,64} (dense_units.metal with #pragma METAL fp contract(off) in both units.metal and dense_units.metal), replacing sp_matvec / dense_fuse / mv_mma across widths 1..512 on M5 tensor-unit GPUs.
  • A planted control for each new kernel, and each one fails as planted: All 68/68 controls (M5) and 56/56 controls (M3) fail as planted.
  • Each backend's SUMMARY line and exit status:
    • Apple M5 Ultra: SUMMARY 68 kernels: 68 pass gates 1-4, 0 fail, 0 known findings; 68 controls: 68 red as planted, 0 missed; 0 limit problems; gates 27748 ms, limits 388 ms (exit 0)
    • Apple M5 Pro: SUMMARY 68 kernels: 68 pass gates 1-4, 0 fail, 0 known findings; 68 controls: 68 red as planted, 0 missed; 0 limit problems; gates 27498 ms, limits 9 ms (exit 0)
    • Apple M5 Max: SUMMARY 68 kernels: 68 pass gates 1-4, 0 fail, 0 known findings; 68 controls: 68 red as planted, 0 missed; 0 limit problems; gates 31845 ms, limits 30 ms (exit 0)
    • Apple M3 Ultra: SUMMARY 56 kernels: 56 pass gates 1-4, 0 fail, 0 known findings; 56 controls: 56 red as planted, 0 missed; 0 limit problems; gates 26566 ms, limits 505 ms (exit 0)
  • Chips I could not run: None.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled

ashhart and others added 30 commits November 21, 2026 16:05
Derive per-visit cache access and exact arithmetic for the 48 visits so CUDA admission and kernels have a reference before serving is enabled.
Decode stored NVFP4 and MXFP8 expert weights to BF16 and launch them beside the grouped expert/vision kernels, with exact tensor baselines and planted faults.
Launch cross-pass messages, rank-64 gates, residual steps and split QKV with FP32 reductions, BF16 rounding controls and per-launch resource records.
Run all 48 visits with per-visit cache state, prompt snapshots and exact rollback. Refuse TP, vision and DSpark loading until those engines exist.
sethforprivacy and others added 4 commits November 21, 2026 22:42
…t attention, and use mv_mma for prompt dense projections
Replace the scalar stride-2304 tf_inkling2_logits kernel with a 256-thread (8-simdgroup) batched implementation where each simdgroup computes one vocab row across up to 8 token rows, sharing coalesced bfloat4 unembed loads and preserving width-invariant FP32 reduction and BF16 softcap rounding. Update glue dispatch, contract limits record, host check, and 8x8 tile/interval contract tests.
… mask stride and firstLogprobRow

Fuse Stage-1 argmax into tf_inkling2_logits and add Stage-2 tf_inkling2_reduce_argmax with exact host tie-breaking and NaN-at-0 preservation. Enable gpu_tokens with async GPU-resident decode queueFn and skip unread f32 logits DRAM stores on pure-greedy unmasked no-logprobs batches while keeping mixed batches exact. Fix ashhart#4635 multi-row grammar mask stride from xgrammar padded vocab words, fix firstLogprobRow when called before first(), and add host tests and Metal kernel contracts.
…op/conv, and move part-0 backup into single decode CB

- Disable FP contraction in dense_fuse/units and match mv_mma 32-lane fma reduction, with rows=1..33 width-seam and --loops refusal tests.
- Split forward.zig into forward.zig, forward_layers.zig, and forward_conv.zig.
- Add native bf16 tf_inkling2_ar_bf16 and grid.z Q/K/V loop controller fusion.
- Vectorize short-conv staging/dynamic updates over grid.y segments and fuse tf_ink2_stage_conv_static.
- Remove blocking verify blit/wait stall via part-0 in-CB conv backup and 3-case part-aware rollback.
…size prompt part_o by capacity, and widen glue/loop scratch to 512
…2D bank_and_reset, and vectorized prompt_attention

- conv_dynamic: dispatch 32 threads with bfloat4 sequential dot and simd_shuffle (0 B TG)
- router: fuse route_scores and router into one 256-thread launch with 512 B TG and ascending tie-broken IDs
- loop_messages: hoist per-row RMS scale into tf_inkling2_loop_rms and cache bank values per entry (80 B TG)
- bankAndReset: flatten copyBf16 row loop and prelude reset into 2D bfloat4 launch tf_ink2_bank_and_reset
- prompt_attention: hoist loop-invariant row/head scalars and vectorize bfloat4/float4 loads and stores
@gilby
gilby force-pushed the inkling2-lead-dense-units branch from 0a88928 to 7c509dd Compare November 22, 2026 19:17
@gilby gilby changed the title inkling2 metal: uniform tensor-unit dense projections across all widths 1..512 inkling2 metal: uniform tensor-unit dense projections across all widths 1..512 (ROWS1 + contract-off) Nov 22, 2026
@c828

c828 commented Nov 22, 2026 via email

Copy link
Copy Markdown

@gilby

gilby commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Closing per #4652 policy: uniform tensor-unit dense projections regress single-stream M5 Ultra decode (-4.5% code, -2.2% chat) and alter greedy tokens against the scalar reference, while M5 prompt dense projections are already covered by #4631 (pending #4618's tensor-unit reduction-order ruling).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants