Skip to content

DeepSeek-V4.1 EXL3 Metal follow-up to #2373: exact tiled decode, fused chains, prefill chunking, last-row and Sinkhorn fixes - #3382

Open
BlivionIaG wants to merge 145 commits into
ashhart:mainfrom
BlivionIaG:pr/dsv41-exl3-metal-optimizations
Open

BlivionIaG wants to merge 145 commits into
ashhart:mainfrom
BlivionIaG:pr/dsv41-exl3-metal-optimizations

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Draft, stacked on #2373 (head bec140d545). The gate is agreed in #3385 with two conditions (below); #2373 is being rebuilt as a series against main, so this is the reference draft until that series is visible. Nothing here is claimed as release qualification.

What this changes

Before: the DeepSeek-V4.1 EXL3 Metal lane in #2373 decodes at about 40 tok/s on an M5 Ultra, fails the 128-token full-model numerical band (band ratio 1.855 against the 1.10 limit), and expands the wrong row in the fused boundary for a multi-row last-row window. After: exact tiled half-FMA decode bodies, fused attention and expert chains, batched decode attention, memory-sized prompt chunks that yield to live decoders, suffix-cone prefill, matching-suffix proposals ahead of paid trained ones, a Sinkhorn reduction order that matches the unfused split, and the last-row fix. The band ratio is 0.967; decode is about 52 tok/s and a cold 64k prompt takes 27 s instead of 57 s. One lane, one checkpoint family, Metal only.

It is one pull request because its parts cannot be qualified apart. I built the three-slice stack and ran it: the decode-bodies slice and the lane-scheduling slice each fail one-row fused wq_a+wkv matches the two separate projections on M4 (it also fails at #2373's head; its fix is in the numerical commit), and the contract registrations for the new chain, native-row and attention-row kernels land with that commit, so neither earlier slice could pass the kernel contract (--only exl3 reports 0 kernels at both). The commits below keep their order and their own messages; I have not pushed that stack.

Review guide

GitHub shows this pull request against main, so its file list includes #2373's 243 files. This delta alone is 124 files, 11,113 lines added and 820 removed (about 4,600 lines of Zig source, 1,500 of Metal, 4,500 of tests, 1,700 of receipts): bec140d545...a99384be17, or git log --reverse bec140d545..a99384be17.

Read it in these groups; sizes are changed lines per commit.

1. Decode arithmetic and fused chains (the speed)

  • f84866800b Metal EXL3: accelerate exact decode with tiled half-FMA bodies (Metal 463, source 108, tests 6)
  • 54c9114187 Metal EXL3: fuse exact attention and expert projection chains (source 1688, Metal 483, tests 6)
  • a298334537 Metal EXL3: qualify pipelines and reject invalid NAX tile widths (source 150)

2. Lane scheduling: batched attention, suffix-cone prefill, prompt chunks, Engram staging

  • 86e69be6c2 DeepSeek EXL3 Metal: batch decode attention and yield between prompt chunks (source 565, Metal 290, tests 225, tools 4)
  • 49605ca481 DeepSeek EXL3 Metal: retain exact suffix-cone prefill per prompt (source 783, tests 56, Metal 5)
  • c4d5e484f3 DeepSeek EXL3 Metal: overlap Engram staging and bound head scratch (source 209, Metal 134)
  • 0d3a3034da DeepSeek EXL3 Metal: size prefill chunks by memory and live decoders (source 78, tests 22)

3. Corrections found by the qualification (read last: they touch what 1 and 2 add)

  • e37bb2b418 Metal EXL3: integrate validated controls and preserve backend chunk hints (tests 150, source 91)
  • 59535dad91 Metal EXL3: keep failed-open allocation cleanup single-owned (source 4)
  • 0870c860f4 Metal EXL3: make cone verification independent and fail closed (source 27)
  • e070123319 Metal EXL3: retain generic indexed widths and align small dense reductions (Metal 48, source 44)
  • 128cfe743a Metal EXL3: size shared-down check scratch for every encoded stage (source 2)
  • 6aa834fdb4 Qualify EXL3 Metal projections and correct batched merge strides (tests 928, receipts 443, tools 92, source 58, docs 24)
  • efdf7a464e Metal EXL3: fix last-row expansion, Sinkhorn reduction order and lookup-first proposals (tests 3130, receipts 1066, source 680, Metal 42, docs 32)

4. Settings: what is registered and what was removed

  • e9e06ee0b1 Metal EXL3: read the drafter switch through the registry in the lane host log (source 4)
  • dd80dd7164 Metal EXL3: drop the per-fusion kill switches (source 82, docs 2)
  • a80eddd9a6 DeepSeek EXL3 Metal: keep tile groups, chunked prefill and Engram lookahead fixed (source 34, docs 3)

5. Documentation, CHANGELOG and receipts (no code)

  • 9be9ce5322 Document the EXL3 Metal optimization follow-up and qualification scope (docs 67)
  • 26592f0ed3 Record the final qualification of the EXL3 Metal follow-up source tree (receipts 45)
  • 3d56a5f39e CHANGELOG: name the follow-up pull request (docs 2)
  • a4320a20b4 CHANGELOG: name the follow-up pull request on the bullet's first line (docs 4)
  • d83fdf4549 Record the final qualification, cold prompt speed and decode of the EXL3 Metal follow-up (receipts 60)
  • 581d738626 Record the settings sweep, resumed, 128k, M4 and local CI results of the EXL3 Metal follow-up (receipts 114)
  • a99384be17 Record the eight-stream comparison against the parent (receipts 16)

The largest commit, efdf7a464e, carries three small fixes (last-row expansion, Sinkhorn reduction order, lookup-first proposals) and their regressions: 3,130 of its changed lines are tests and 1,066 receipts. The production change in it is about 680 lines of source and 42 of Metal.

What to check, in order: (1) every new kernel is registered with the contract and has a planted control (zig/tests/contract); (2) the exact bodies keep the unfused arithmetic, so same-engine hashes match (receipts README, "Final qualification"); (3) every token still goes through the lane rounds (zig/src/families/deepseek_v41/model*.zig, backend*.zig); (4) settings are read through platform/environment.zig only (docs/environment.md, "DeepSeek EXL3 Metal controls").

Checks on this head

  • Head commit: 5d1f3d6418 (four folded commits d62498c304, a6730a4c04, 61cd8d8a97, c56e962f4f on top of 69f93351a7, plus a merge of main 4c79cfe346). The qualified code tree is the one of a80eddd9a6; 581d738626, a99384be17 and this fold add the receipts README, the committed numbers and the three follow-ups' fixes and tests.
  • Lean checker, python3 tools/zig/lean_check.py, base 4c79cfe346 against this head: 165 problems on the base, 164 on this head, 0 new. pr_check --base 4c79cfe346 --pr 3382: 0 errors, 0 warnings (330 changed files). zig fmt --check build.zig zig and git diff --check: clean. No Zig file this delta adds or edits passes 600 lines.
  • Earlier, on a80eddd9a6 (before the folded commits and the main merge): tests, M5 Ultra, zig build test test-golden dev-tools native tf-dsv41-run test-deepseek-v41-lifetime -Dcpu=apple_m1 -Doptimize=ReleaseSafe: 977/977 steps, exit 0, 11392 of 11503 tests passed, 111 skipped. M4 Pro, the same command with tf-kernel-contract: 979/979 steps, exit 0, 11874 of 11984 passed, 110 skipped. zig build test-cuda-host: 345/345 steps, 131 tests, on both. Counts exclude cached work.
  • Tests, M4 Pro, zig build metal-kernel-contract-limits test-metal-launch-map-host test-deepseek-v41 -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j3: 50/52 steps, exit 1. The launch map reports 1270 registered launches, 2 controls, 0 missing, and its 8 tests pass; test-deepseek-v41 has 74 tests: 70 pass, 4 skip. zig build test-exl3-gpu -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j3: 41 tests, 40 pass, 1 skip, exit 0. Counts exclude cached work. The one limit problem is inherited: flashnext penalties fz_penalize_rows has no launch source, and main fails the same step with an uncaught UnknownLaunch after PASS limits: 1093 selected registered Metal launches … 0 problems.
  • New tests: the register-only bound pin and the two-to-four-row dense bit test fail when their assertions are broken (2 of 41 red as planted) and pass restored; the concurrent-encoder test is reached and fails by name when its skip is turned into an error, but on this M4 Pro it skips (Metal without tensor units, below generation 17), so TF_DSV41_CONCURRENT=1 reply equality is not re-established on this machine.
  • CI: none reported on this draft (a fork pull request needs a maintainer to start its workflow; the queued runs are backlogged). Device-free steps were run locally earlier on a80eddd9a6 as below, and nothing in this fold touches them except the build-file lines listed under Stacked on.
  • Not run: M1, M2, M3; CUDA, HIP (Metal-only change); the native window; a comparison against mlx_lm; the full unfiltered kernel contract (it aborts in metal_lfm3_attention_sums.zig:39, an integer overflow in a file this delta does not touch).

Receipt

  • Main against branch: main has no DeepSeek-V4.1 EXL3 lane, so the baseline is DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373's head. Tables below.
  • Boxes it reaches: Metal on Apple Silicon, the deepseek_v41 EXL3 lane only. Other families, CUDA, HIP and the shared lane code are not changed by behavior.
  • New switches (registered in platform/environment.zig, documented in docs/environment.md with their accepted forms and defaults): TF_DSV41_EXL3_FMA_TILES (0, 1, 2, 4; default 2), TF_DSV41_BATCH_MAX (1-8; default 4), TF_DSV41_BATCH_ATTN (0/1; default 1), TF_DSV41_CONE (0-2; default 2), TF_DSV41_CONE_PARK (0-3; default 3), and TF_DSV41_MTP_DRAFTS (default 0; DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373 already read it, this registers it). Each has a production caller and a measured benefit: with the others at their defaults, turning it off or down cost 4% to 65% in some cell (TILES=0 -15%, BATCH_MAX=1 -33% with four short streams, BATCH_ATTN=0 -7%, CONE=0 -38% on four long prompts and +65% cold TTFT, CONE_PARK=0 -5%, the weakest). Three more settings I had added (TF_DSV41_EXL3_FMA_TILE_GROUPS, TF_DSV41_PREFILL_INTERLEAVE, TF_DSV41_ENGRAM_LOOKAHEAD) showed no slower arm in the same sweep and are gone, and the nine TF_DSV41_NO_FUSE_* switches are gone because a fusion is taken when its shape and pipeline checks admit it. The sweep table is in the receipt README.
  • Environment: this head's code tree, Zig 0.17.0, Xcode 27.1 (Metal compiler 32023.921), macOS 27.0 (26A428), M5 Ultra (64 GPU cores, 256 GiB; the M4 Pro, 48 GiB, ran the kernel contract and the device-free checks), checkpoint deepseek-ai/DeepSeek-V4.1-Flash-1017 at 1bae0e1088993b9b82de08f59de5be5a34e42170 as an EAQ v1 EXL3 2.9 bpw pack with the original Engram shards.
  • Paths and platforms: default path and the trained-MTP, lookup, shared-lane and unload/reload callers on M5 Ultra; kernel contract on M5 Ultra and M4 Pro. Not run: M1, M2, M3.
  • Exactness: bench_concurrent.py --alone --serial, 64 tokens, three repetitions, temperatures 0 and 1.0 at 1 and 4 streams, short and long prompts: all cells equal to their solo run in both builds (0 unequal), and the same in all 13 non-default settings arms. Served checks on this tree: 33 plain, drafted and shared responses with equal full hashes, 41 completed responses, a cancelled 8192-token request, two unload/reload cycles. Resumed against fresh: the first request is cold, the next three reuse the cache (8064 of 8192 and 32640 of 32768 tokens), and every reply has the cold run's hash (a 2048-token prompt is below the reuse size). Tokens differ from DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373's build in long greedy decodes (256 tokens, both public prompts) because the parent's arithmetic did not match its own reference; 16-token cold replies are token-equal at 2k, 8k, 32k, 64k and 128k.
  • Main against this branch, posted before asking for a run: tables below, same machine and checkpoint, 4096 workspace rows and prefill step 4096 in both arms (the parent's default workspace refuses admission at 32k with four lanes).
  • Decode speed before and after, bench_openai.py --tokens 256 --reps 3 --temperatures 0: 40.23 tok/s (code) and 40.22 (chat) for the parent against 52.37 and 52.35 for this head.
  • Prompt speed before and after, bench_cache.py --require-cold, --prompt-cache-gib 0, context 70000, one lane, exact token arrays, one request per size (128k: context 131072, 131008 tokens, parent measured once on the sweep tree's run):
Cold prompt tokens Parent TTFT This head TTFT
2048 1.98 s 1.81 s
8192 6.86 s 3.94 s
32768 28.06 s 13.79 s
65536 57.39 s 27.16 s
131008 119.7 s 56.1 s

The 2048 row follows the decode run on the same server, as the parent's did; a cold first request on a fresh server measures 3.48 s.

  • Served throughput, bench_concurrent.py, 64 tokens (bench_exl3_compare.py refuses the pair because tokens differ, so this is an observation):
Cell Parent tok/s This tree tok/s
short, 1 stream 40.6 52.5
short, 4 streams, aggregate / steady 43.5 / 61.0 59.0 / 93.9
long, 1 stream 38.5 49.1
long, 4 streams, aggregate / steady 6.1 / 58.1 11.1 / 88.4
  • Fidelity: the unchanged 128-token teacher-forced comparison against the independent CPU references: band ratio 0.967 (parent 1.855; clear at 1.05, limit 1.10), mean KL 0.0422, worst-row KL 0.833, five teacher argmax differences. Strict one-, two- and four-row profiles give identical grouped and ungrouped logits and read 0 bytes with 0 page-ins in a first run and two warm reruns. The gate measures cache temperature; a warm pass does not prove every Engram page is resident.
  • Licence: n/a (no new weights or drafter).
  • Raw logs and the drivers are in the receipt directory and its README; tools/bench_cache.py, bench_openai.py and bench_concurrent.py are the committed tools.
Kernel contract
  • Kernels registered with the contract, and the kernel each one replaces: exl3-metal (tf_exl3_matmul, fourteen tf_exl3_matmul_decode_fma* bodies, tf_exl3_matmul_prefill_nax31); exl3-chain (tf_exl3_qkv_epilogue, swiglu_prerotate, rotate_out_in, rms_rotate_in, rotate_out_rope, rope_rotate_in, gateup_swiglu_prerotate, down_combine), each replacing the unfused launch sequence it fuses and checked against it (exl3_chain_unfused.zig); dsv41-native-rows (dsv41_rope_rows, dsv41_kv_glue_rows, dsv41_publish_rows) and dsv41-native-attention (dsv41_dense_kv_rows, dsv41_sparse_nax_rows), replacing the per-slot path; tf_hc_boundary_mix. Records are in zig/src/core/contract/*_records.zig and limits.zig.
  • A planted control for each new kernel, and each one fails as planted: yes, no missed controls in any run below.
  • Metal, M5 Ultra, this tree, tf-kernel-contract --only dsv41 --rotary-accuracy rotary.json --offline, exit 1: SUMMARY 102 kernels: 102 pass gates 1-4, 0 fail, 0 known findings; 237 controls: 237 red as planted, 0 missed; 6 limit problems; gates 109600 ms, limits 117497 ms. The six limit problems (xp_quant, fp4pack, fp4rt, hcmix, hcpost, joinpost: offline M1/M2 builds) are identical at DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373's head, whose run reports 89 kernels: 89 pass ... 6 limit problems.
  • Metal, M5 Ultra, --only exl3, exit 0: SUMMARY 296 kernels: 296 pass gates 1-4, 0 fail, 0 known findings; 1186 controls: 1186 red as planted, 0 missed; 0 limit problems; gates 191983 ms, limits 20033 ms.
  • Metal, M4 Pro (no tensor units), --only dsv41, exit 1: SUMMARY 94 kernels: 94 pass gates 1-4, 0 fail, 0 known findings; 203 controls: 203 red as planted, 0 missed; 6 limit problems; gates 154729 ms, limits 208012 ms; --only exl3, exit 0: SUMMARY 35 kernels: 35 pass gates 1-4, 0 fail, 0 known findings; 142 controls: 142 red as planted, 0 missed; 0 limit problems; gates 31328 ms, limits 34502 ms.
  • Chips I could not run: M1, M2, M3 (offline M1/M2 limits only). CUDA and HIP are not touched.

Gate agreed in #3385

The five parts, with where each is met on this tree (one M5 Ultra; the kernel contract also on an M4 Pro):

Part Result
Same-engine exactness Solo, serial and concurrent hashes equal at 1 and 4 streams (all 13 non-default settings arms exact); drafted equals "draft": false (33 responses, equal full hashes); resumed equals fresh at 8192 and 32768 tokens; 1 cancellation and 2 unload/reload cycles left the next request valid (41 served responses)
Fidelity 128-token teacher-forced band ratio 0.967 (limit 1.10, parent 1.855), mean KL 0.0422, worst-row KL 0.833, five argmax differences with margins in the receipt README; strict 1-, 2- and 4-row profiles with identical grouped and ungrouped logits
Residency 0 execution-time disk bytes and 0 page-ins on the profile commands, three runs each at 1, 2 and 4 rows; the cold first run is reported on its own (below)
Kernel contract M5 Ultra --only dsv41 102 pass, 237 controls red as planted, 6 limit problems (the same 6 at the parent); --only exl3 296 pass, 1186 controls, 0 limit problems. M4 Pro 94 and 35 pass, 203 and 142 controls. Each new kernel has a planted control
Performance Parent against this tree on the same machine and checkpoint (tables above): no column is lower. Per column, speed against the parent: cold 2048 +9.4%, 8192 +74%, 32768 +104%, 65536 +111%; decode short 1 stream +29%, short 4 streams +36%, long 1 stream +28%, long 4 streams +82%. Mean +59%, worst column cold 2048 at +9.4% (1.98 s to 1.81 s). The parent's cold 2048 figure follows its decode run on the same server, as this tree's does; a cold first request on a fresh server measures 3.48 s here and was not measured for the parent

The two conditions: each slice must be green on its own with its contract registrations and planted controls, which this single draft does not meet by itself (the slices cannot be separated while the registrations sit in one commit); and the token gates are the ones above, since #2373 is not on main. The slices will be built on the series that replaces #2373.

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. Author and committer of every outgoing commit are public noreply identities (BlivionIaG on this delta; DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373's commits keep their authors).
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false (33 responses with equal full hashes), a resumed prompt equals a fresh one (8192 and 32768 tokens), and concurrent equals solo (above).
  • No precision traded for speed, judged against the gate agreed in Gate proposal: DeepSeek-V4.1 EXL3 Metal follow-up to #2373 (exact decode, fused chains, Sinkhorn order, prefill chunks) #3385: the 128-token teacher-forced band is 0.967 at the unchanged 1.10 limit (the parent's draft head is 1.855), every teacher argmax difference and margin is recorded, and same-engine exactness holds (gate section above). The bits change against DeepSeek-V4.1-Flash on Metal: the EXL3 2.9 bpw lane #2373's draft head, which is not on main. The fused Sinkhorn now uses the unfused split's FP32 row and column reduction order (1728 coefficients bit-identical to it); the other changed sums and their per-column FP64 fixtures are in the receipt README. The maintainers run their own device check.
  • Decode and prompt processing are no slower than the parent at one stream and the widest admitted: on one M5 Ultra the final tree is faster at 1, 4 and 8 streams (short prompts 52.5, 59.0 and 56.1 against 40.6, 43.5 and 41.7 tok/s; four long prompts 11.1 against 6.2 and eight 8.8 against 5.4) and in cold prefill to 128k (56.1 s against 119.7 s); --drafter greedy and sampled no-slowdown against plain is in the served checks (95.2 against 52.5 tok/s greedy, 94.3 against 52.2 sampled). One machine only; the maintainers' hardware run is still to come.

Commits in this delta

  • f848668 Metal EXL3: accelerate exact decode with tiled half-FMA bodies
  • 54c9114 Metal EXL3: fuse exact attention and expert projection chains
  • a298334 Metal EXL3: qualify pipelines and reject invalid NAX tile widths
  • 86e69be DeepSeek EXL3 Metal: batch decode attention and yield between prompt chunks
  • 49605ca DeepSeek EXL3 Metal: retain exact suffix-cone prefill per prompt
  • c4d5e48 DeepSeek EXL3 Metal: overlap Engram staging and bound head scratch
  • 0d3a303 DeepSeek EXL3 Metal: size prefill chunks by memory and live decoders
  • e37bb2b Metal EXL3: integrate validated controls and preserve backend chunk hints
  • 59535da Metal EXL3: keep failed-open allocation cleanup single-owned
  • 0870c86 Metal EXL3: make cone verification independent and fail closed
  • e070123 Metal EXL3: retain generic indexed widths and align small dense reductions
  • 128cfe7 Metal EXL3: size shared-down check scratch for every encoded stage
  • 6aa834f Qualify EXL3 Metal projections and correct batched merge strides
  • efdf7a4 Metal EXL3: fix last-row expansion, Sinkhorn reduction order and lookup-first proposals
  • e9e06ee Metal EXL3: read the drafter switch through the registry in the lane host log
  • dd80dd7 Metal EXL3: drop the per-fusion kill switches
  • a80eddd DeepSeek EXL3 Metal: keep tile groups, chunked prefill and Engram lookahead fixed
  • 9be9ce5 Document the EXL3 Metal optimization follow-up and qualification scope
  • 26592f0 Record the final qualification of the EXL3 Metal follow-up source tree
  • 3d56a5f CHANGELOG: name the follow-up pull request
  • a4320a2 CHANGELOG: name the follow-up pull request on the bullet's first line
  • d83fdf4 Record the final qualification, cold prompt speed and decode of the EXL3 Metal follow-up
  • 581d738 Record the settings sweep, resumed, 128k, M4 and local CI results of the EXL3 Metal follow-up
  • a99384b Record the eight-stream comparison against the parent
  • d62498c EXL3 Metal: the register-only body serves a window's whole fused gate+up call
  • a6730a4 changelog: DeepSeek V4.1 four-draft windows decode as plain decode again
  • 61cd8d8 test(exl3): the dense bodies keep every one-row bit at two to four rows
  • c56e962 fix(dsv41): the concurrent decode encoder orders the sparse scan and its merge
  • 5d1f3d6 Merge upstream/main into pr/dsv41-exl3-metal-optimizations

Copy rule and authorship

The projection kernels and Metal drafter that #2373's review traced to mlx-serve are #2373's code; its 87 commits (84 EugeneClaw, 3 Eugine) are kept unchanged in this branch's history. This PR adds 39 commits by BlivionIaG on top (42, 46 and 49 beyond #2373 in #3734, #3735 and #3736). A text comparison against the public mlx-serve, mlx-stream and turboexl3 histories finds no copied text (longest common run 3 normalized lines) but does not show independent design. Independence of #2373's code is not claimed here; this stack's own commits are proposed as separate improvements on top of it.

…kernels, streamed Engram, drafted decode, retained prompt cache
The glm_dsa exes take the tokenizer module from the engines import table
(the file was compiled twice, once per module). The reference suite calls
encodeDiagnostic with prof and segs. The four prof clocks guard Windows,
where std.c.clock_gettime does not compile; those builds read 0 from an
instrument that never runs there.
bench/ (the round scripts and the two patch diffs), tf_ids_tmp and its
tf-ids target, and the r519 bf16 experiment with its fixture leave the
diff. The repo-wide *.log ignore line goes (upstream keeps its own).
glue_tmp.metal was load-bearing, so it is glue_rows.metal now, with the
records file, the contract tests and every comment following. No kernel
text changed.
Dead code under the copy rule: no lane file dispatches tf_gather_qmm_*; zig/tests/mlx_gather.zig and the tf-mlx-gather entry existed only to time the reference. Removes core/mlx/ (mlx_steel.h + gather.metal), the core_mlx_steel embed, the test and its build entry. Gates: fmt, native, test-deepseek-v41, dev-tools.
…switches

The diff adds comment blocks that carry experiment labels and measured numbers; this pass keeps the technical statements and drops the history. Core is family-neutral again: the round-trip profiler and its clock leave lanes/engine.zig, the resumed-tail switch moves to prompt_cache.Rules (set by the DSV4.1 lane host), and the family metal-mirror shell check hangs off test-deepseek-v41 instead of zig build native. Gates: zig fmt --check, native, test-deepseek-v41, dev-tools.
Every file in the branch is under 600 lines: lanes/engine (pipelined round), core/prompt_cache (marks), server/cli (scalar helpers), weights (source helpers, int8 sidecar), backend (policy, run), and the index Metal sources (scalar + tensor-unit). Moves are function-for-function, with in-struct aliases for the methods; no arithmetic moved. Gates: zig fmt --check, test-native, test-deepseek-v41, dev-tools.
…he release

R1's first half. TF_DSV41_Q_RMS, TF_DSV41_MTP_Q_RMS and TF_DSV41_Q_RMS_DEBUG and their ones/dump buffers are gone; the release has no per-head query RMS (it normalizes qr before wq_b, which is the shipped path). The provenance comments in model.zig/attention.zig now state the release's order (wq_a -> q_norm -> wq_b -> rope; wkv -> kv_norm -> rope; sparse attention; inverse rope; wo_a groups -> wo_b) and the DSpark block forms, with no sibling-engine citations. No default-path arithmetic moved: every removed arm defaulted off. Gates: zig fmt --check, native, test-deepseek-v41, dev-tools.
…ement

The top-1/KL receipt the review asks for needs a divergence term over the whole next-token
distribution, not only argmax and NRMS. `qualify.zig` already runs the independent CPU teacher
(FP32 or FP64 over the release pack's weights) against the GPU decode; this adds KL(teacher ||
engine) per row, its mean and worst, in f64 with a max-subtracted softmax. The fields are added
with defaults, so existing oracle JSON readers keep working. Gates: zig fmt --check,
test-deepseek-v41-reference.
…MM moves lane-side

core/affine_mm.metal and prefill/gemm_nax.metal are byte-identical to upstream's
(sha a91a3539 / 16a1d78a). The router gate's fp32-destination GEMM is the lane's
own copy under deepseek_v41/gate_gemm.metal, registered in the metal sources and
loaded by ops.zig; the gate bench reads the lane source and the contract records
keep their names.

The unused int8/weighted-GLU affine delta (only a flag-gated FP64 ground-truth
test) is removed with its header and test. It was dead in the lane and carried a
whole-file port attribution, so re-homing it would not clear the copy rule.

Gates: zig fmt --check 0; check_dsv41_metal_mirrors 86/86; zig build native 0;
test-deepseek-v41 0; dev-tools 0.
The drafter's conditioning, noise-token rows and Markov head chain cite the
release's Transformer.forward_spec / DSparkBlock.forward_embed / forward_head
(inference/model.py, revision 314113f8) instead of the sibling engine. The
remaining port language is gone. Comments only: no non-comment line changed.

Gates: zig fmt --check 0; zig build native 0; test-deepseek-v41 0; dev-tools 0.
…y leaves the comments

The EXL3 files no longer name another engine or a round. The funnel/dig forms,
the register-only decode, the pair and the multi-row dense body are described by
their arithmetic and their own shapes; the model-facing order cites the release
(inference/model.py, revision 314113f8). Comments only: no non-comment line
changed.

Gates: zig fmt --check 0; zig build native 0; test-deepseek-v41 0; dev-tools 0.
…ured numbers

The five files the earlier pass skipped (attention, model, the EXL3
projection Zig glue, and both EXL3 Metal files) now carry the same
comment rule as the rest of the diff: no ROUND-/R- labels, no handoff
or other-engine references, no measured figures. Comment text only;
git diff -U0 over the five shows no non-comment line changed, so the
kernels and the host glue are bit-identical by construction.
…duplicated code go

hc_boundary.metal's header no longer claims a whole-file port: it cites
Block.hc_mixes, hc_pre and hc_post in the release's inference/model.py at
revision 314113f8, and the duplicated mix-product and two-stage reduction
code is one pair of helpers. The arithmetic, the thread mapping and the
lagged collapse are unchanged, so the kernels stay bit-identical; the mHC
GPU tests pass.

The remaining comparator/MLX/Bob references in the diff are reworded to
describe the form by its arithmetic or removed. The other files here change
comments and bench output strings only; no engine path changes.
… walk

The prompt tile no longer carries an inline decode job: TfExl3DigJob holds the
resident pack slice, the k/n strides, the width/codebook and the live tile
extents, built once from the call args and the route. TfExl3DigWindows holds
the lane's eight-state cursor (slot, word offset, shift, word distance) and is
shared by the default tensor-unit prefill body, the grouped table body and the
scalar prefill twin (the named TfExl3ScalarWindow fields replace the packed map
word). The arithmetic, the k order and the MMA order are unchanged, so the
kernels are bit-identical by construction; the shared prefill and grouped-tile
GPU tests in test-deepseek-v41 pass, and the prefill spot rows report zero
parity mismatches.

The model-facing order cites the release (inference/model.py, revision
314113f8); the trellis arithmetic and the cursor are our own pack format.

Gates: zig fmt --check 0; zig build native 0; test-deepseek-v41 0;
dev-tools -Doptimize=Debug 0.
…nd row walk

The register-only routed decode and its paired form no longer rebuild the
pack slice and the lane cursor inline. TfExl3DecodeJob names the trellis,
k/n strides, width and codebook for one row (the dense call takes its own
trellis, the routed call the expert's descriptor); TfExl3RowWalk names the
lane's first word, bit offset, shift/mask and the next two words. The pair
body uses the same two structs, so the duplicated setup is one place.

The arithmetic, the k order, the product order and the reduction tree are
unchanged: the shared prefill, grouped-tile and resumable-window GPU tests
in test-deepseek-v41 pass, and the single-row/pair bodies are the same code
with named fields. The release is cited for the MTP/draft projection shapes
(inference/model.py, revision 314113f8); the pack layout and the row walk
are our own.

This is the register-only single-row and pair pass. The funnel, wide and
multi-row dense bodies still carry their inline setup; they are named as
remaining R3 work in the record.

Gates: zig fmt --check 0; zig build native 0; test-deepseek-v41 0;
dev-tools -Doptimize=Debug 0.
…walk

The tensor-unit decode's three remaining bodies no longer rebuild the pack slice and the lane
cursor inline. The multi-row routed decode, the 128-column dense decode and the column walk build
TfExl3DecodeJob (the expert descriptor or the call's own trellis, the k/n strides, width and
codebook); the eight-state cursor is the shared TfExl3DigWindows walk, now with the tile's column
stride and the ring's next words, so the funnel, two-word and general paths take rel/off/sh/at
from it. The single-row and pair register bodies keep TfExl3RowWalk.

The arithmetic, k order, MMA order, product order and reduction tree are unchanged: the walk is
the same map arithmetic with named fields, and the cursor was checked for halves 4, 6, 8 and 16 on
every lane. The file compiles standalone with the default, funnel, two-word, compact and table
defines. The body comments also lose the last task label, the probe measurement and the orphan
possessives the earlier attribution strip left behind.

Gates on the tree: zig fmt --check 0; metal compile 0 (default plus the named defines);
zig build native 0; test-deepseek-v41 0 (the csa2 diagnostic and failed-command line are the same
on the base 1530351); dev-tools 0; test-exl3 0.
The copy-rule comment pass left orphan possessives ("are 's"), a task label and a
measurement in the rewrite-set files. This restores the sentences: the EXL3 glue
describes the single-tile body, the backend notes drop their round numbers and the
one measurement, and the docs drop the round cross-references. Comment and prose
only; no non-comment line changed in the Zig sources.
…h order is kept and proved byte-identical

The file started from BobClawblaw/TensorFold deepseek-v41-main 72a552e. It is now written from the release's Block.hc_mixes, hc_split_sinkhorn_kernel, hc_pre and hc_post (inference/model.py and inference/kernel.py at 314113f8): the mix projection over the flattened stream, the Sinkhorn split, the lagged collapse, the norm and the post expansion.

The two launches and the reduction order are unchanged by design. The split cannot read the 24 mix totals until the first launch finishes and Metal has no grid-wide barrier; the one-threadgroup fold was built and measured 2.4x slower at the decode's row counts. The reduction order is the canon's.

A byte-for-byte A/B against the previous kernel over rows 1, 2, 5 and 17 and every expand/mixes combination (16 cases) is identical in every output buffer, so no reply can move. The harness and its log are in the plan record, scratch/hc-ab-20261106/. Metal compile and the fast gates pass.
The attention encode is now the release's decomposition (inference/model.py,
revision 314113f8): the query's low-rank pair and its norm, _window_kv's norm,
rope and fp8 pack, _compress_kv/_compress_topk_idxs' compressor and pick,
sparse_attn over the two sources, and the grouped wo_a/wo_b close. The stage
context carries the views the stages hand forward, so each stage reads as the
release's step instead of one inline block.

The dispatch order, the fused forms' arithmetic, the k order, the split counts
and every A/B arm are unchanged: the bodies moved, they were not retyped. The
trellis arithmetic, the ring layout and the scan remain this lane's pack
format.

Gates: fmt 0; metal-mirrors 86/86; native 0; test-deepseek-v41 0; test-exl3 0;
dev-tools 0; umbrella test 0 (COMBINE GATE 45056/0); reference 0.
…stages

The drafter's block attention is now the release's DSparkAttention.forward
(inference/model.py, revision 314113f8): the draft query's low-rank pair and
norm, the draft key's norm and rope, the packed window, the scan over the main
model's window rows, and the grouped wo_a/wo_b close, with the draft rows'
publish last. The stage context carries the encoder and the views the stages
hand forward, so each stage reads as the release's step.

The dispatch order, every rope/scale/mask arm, the debug dumps and the prof
splits are unchanged; the bodies moved, they were not retyped. The pack
arithmetic, the ring layout and the scan remain this lane's pack format.

Gates: fmt 0; metal-mirrors 86/86; native 0; test-deepseek-v41 0; test-exl3 0;
dev-tools 0; umbrella test 0; reference 0.
…tal engine

The shared host tests and the Linux cross-compile reach model.zig and load.zig, so keep main's neutral owners there and move the Metal model and loader to model_metal.zig and load_metal.zig. Guard F_NOCACHE to macOS and drop the token-map CLI's optional unwraps.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Thanks @ashhart. Refreshed as asked, this one first and then the three on top of it (each by merging main; no history rewritten). main is b192eaa298, which is an ancestor of all four heads.

PR head
#3382 (this) b79e344ff8
#3734 4507efacb1
#3735 22a53a6763
#3736 30c904fc84

What you listed.

  • prompt_cache.zig: builds on main's split. The inline reserve is gone; the calls use prompt_cache_reserve.reserve and endpointFor, and Lookup returns main's fitted marks together with snap_at. marksRewind lives in prompt_cache_marks.zig with main's new salt argument; find keeps main's e.salt != s.salt check before our off-grid tail guards.
  • lanes/config.zig: main's copy_guard beside our shared_plain. lanes/engine.zig: main's copy-timing call kept. deepseek_v41/draft/lanes.zig is identical to main (strict environment reads, plain_streams).
  • server/cli.zig: main's typed --learn-dir and Unix-socket flags, with our Engram directory flags and the fields moved into cli_args.zig as on main.
  • kernels/metal/core/affine_mm.metal and sources.zig: main's header and comment text; affine_mm ++ affine_mm_glu and affine_nonfinite from main beside our core_exl3_projection_i8.

One structural change you should know about. The first refresh failed the Linux test-host-a job: test-dsv41-shared and test-dsv41-engram-alloc reached metal/kernel_sources and F_NOCACHE, because our deepseek_v41/model.zig and load.zig carried the Metal engine. They are now byte-identical to main's neutral files; the Metal engine is in model_metal.zig and load_metal.zig (the same text, one import renamed), the importers point at them, and the F_NOCACHE call is guarded to macOS. Linux cross-compile of the shared, engram-alloc, token-map and device-host steps was red and is green.

Checks on b79e344ff8 (macOS arm64, Zig 0.17.0, -Dcpu=apple_m1): git diff --check and zig fmt --check clean; lean 165 base / 164 head, 0 new; test-dsv41-shared 113 of 114 (1 skipped), test-deepseek-v41 74 of 74, test-dsv41-device-host, test-dsv41-engram-alloc, dev-tools pass. Full zig build test test-golden on the head before the last two small commits: 3043 of 3084 tests (38 skipped, 3 failed) and 1256 of 1263 steps; all five failing steps also fail on pristine main: vision_config x2, persistence identity, metal-kernel-contract-limits (fz_penalize_rows: no source) and the native _memcpy link check.

Receipt on the hardware (M5 Ultra, macOS, zig build native -Dcpu=apple_m1, the DeepSeek-V4.1-Flash EXL3 pack used for this PR's earlier receipts, --parallel 4, prompt cache off, greedy):

main does not serve DeepSeek-V4.1 checkpoints at all yet ("no TensorFold release serves deepseek_v41 checkpoints"), so there is no before/after against main; the before/after for #3734, #3735 and #3736 is against this head.

Not run: tools/bench_concurrent.py and tools/prefill_cold.py (64k prompts), CUDA, other Mac chips than the M5 Ultra.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Follow-up after the first refresh: the Linux zig-b job then failed compile-proposal-metal-host (zig/src/core/frags.zig: file exists in modules 'core' and 'affine_mm'), because the proposal host gets both the shared core module and the encoder's affine_mm module, which owns frags. The proposal host now takes a small core facade (zig/proposal_core.zig) that exposes only proposal_rows, so no file is in two modules. Red then green: test-host-ci-linux-compile's 30 compile steps on x86_64-linux-gnu fail 131 of 133 before and pass 133 of 133 after; macOS dev-tools test-deepseek-v41 test-dsv41-shared 317 of 317 steps.

Heads now (each contains main at 1c9688ca26): #3382 69f93351a7, #3734 6ca5fa425c, #3735 4030c23138, #3736 2cf7738706. The CI jobs of the earlier head passed apart from that one; the new runs are green so far (one job each still pending when I posted). The hardware receipt above is for b79e344ff8; the changes since are the merges of main and the build-graph facade, which does not touch the engine sources.

…+up call

A five-token window's fused gate+up call names seventy descriptors (two blocks of the backbone's six
picks plus the merged shared expert's two, a token), and the register-only bodies stopped at
`moe_split_rows`, which is the split reduction's bound: the window's later rows changed to the
tensor-unit compact body inside one window. A body is a rounding order, so those rows no longer
carried the one-row bits and a four-draft window decoded differently from plain decode.

The bodies now serve any call up to 112 descriptors, the eight-token window's fused count, so a decode
window and a prompt chunk of the same token count run the body a one-row decode runs. One- to
three-draft windows name fifty-six descriptors and below and keep their bodies; the only other calls
past sixty-four descriptors are prompt chunks of five to seven tokens, which now match a one-token
decode of the same rows.

The host test pins the arithmetic: the fused call is fourteen descriptors a token, five tokens pass the
split reduction's bound, and eight tokens stay inside the body's bound.
Measured on the eight reference prompts, solo and four-at-once, and on the ten code prompts: the
four-draft window's hashes now equal plain decode's (7 of 8 and 5 of 10 differed before), the 5-row
round's event p50 is 61.2 ms, and the default config's hashes and timings are unchanged.
The multi-row dense bodies switch at two rows and at four; a GPU test compares each window's rows against one-row dispatches of the same matrix for both codebooks, so a body that is not row-invariant fails here instead of in a reply.
…its merge

Concurrent dispatch mode put the attention scan ahead of the dense-table
pass that fills it and the split merge ahead of the scan that writes its
partials: TF_DSV41_CONCURRENT=1 moved the reply. Both dependencies now
have an explicit barrier, and a GPU test runs the chain on a concurrent
encoder against the serial one.
@BlivionIaG BlivionIaG changed the title Draft: DeepSeek-V4.1 EXL3 Metal follow-up to #2373: exact tiled decode, fused chains, prefill chunking, last-row and Sinkhorn fixes DeepSeek-V4.1 EXL3 Metal follow-up to #2373: exact tiled decode, fused chains, prefill chunking, last-row and Sinkhorn fixes Nov 24, 2026
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Folded the three follow-ups from the fork as four commits on this branch, then merged main (9fa8863bcf) so the head is mergeable again. What each one does:

  • d62498c304 + a6730a4c04: the register-only EXL3 decode body now serves a whole window's fused gate+up call (the bound is the eight-token window's 112 descriptors, not the split reduction's 64), so a four-draft window keeps the one-row rounding order instead of switching bodies mid-window. On the eight reference prompts solo and four-at-once and the ten code prompts, the four-draft window's hashes equal plain decode's (7 of 8 and 5 of 10 differed before); the 5-row round's event p50 falls from about 104 ms to 61 ms; the default config's hashes and timings are unchanged.
  • 61cd8d8a97: a GPU test proves the dense multi-row bodies keep every one-row bit at two, three and four rows, for both codebooks, so a non-row-invariant body fails there instead of in a reply.
  • c56e962f4f: concurrent dispatch (TF_DSV41_CONCURRENT=1) put the attention sparse scan ahead of the dense-table pass that fills it and the split merge ahead of the scan that writes its partials. Both dependencies now have explicit barriers, and a GPU test runs the chain on a concurrent encoder against the serial one; TF_DSV41_CONCURRENT=1 no longer changes the reply.

Checks on 5d1f3d6418, M4 Pro, Zig 0.17.0, zig build metal-kernel-contract-limits test-metal-launch-map-host test-deepseek-v41 -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j3: launch map 1270 launches, 2 controls, 0 missing, 8/8 tests; test-deepseek-v41 70/74 pass, 4 skip; test-exl3-gpu 40/41 pass, 1 skip. Two tests fail as planted when their assertion is broken, and pass restored. The concurrent-encoder test skips on this M4 Pro (no Metal 4 tensor units), so TF_DSV41_CONCURRENT=1 equality here rests on the earlier M5-class measurement. metal-kernel-contract-limits reports one inherited limit problem (flashnext penalties fz_penalize_rows has no launch source); main fails the same step with an uncaught UnknownLaunch. Lean 164 against 165 on main, 0 new; pr_check 0 errors, 0 warnings; fmt and git diff --check clean.

@BlivionIaG
BlivionIaG marked this pull request as ready for review November 24, 2026 10:43
The resolution had dropped the engine's import and pointed hy4_flash's
config at the file instead, which failed the hy4 flash host test: its
config reached the readers by path while the engine declared them as a
module. Keep main's side byte for byte.
The readers live in config_number.zig, which the metal graphs declare as
a module for hy4_flash's config. The family's config still reached the
file by path, so a graph with both owned it twice. Import it by name and
declare the module on the roots that compile the family's config
themselves.
…lings

The core modules re-exported the file while main's inkling2 opener
imports it directly, so a graph with both owned it twice. Read it by path
from the family and drop the two re-exports.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

CI on 31b2116506 failed zig-b and zig-windows: my merge of main had edited main's config_number module registrations (metal_targets.zig, hy4_cuda.zig, hy4_flash.zig) to avoid a module clash with this branch's tensorfold.zig export, and the hy4_flash host graph then failed with import of file outside module path. Fixed on bab2613de8: main's three build files and hy4_flash sources are restored byte for byte, and the clash is resolved on this PR's side only (build(dsv41): the family reads checkpoint_metal by path, and the checkpoint numbers are the module every graph declares; fix(merge): main's config_number module stays on the metal graphs). test-hy4-flash-host and compile-inkling2-native-host pass on an M4 Pro, pr_check reports 0 errors and 0 warnings, and lean is 164 vs 164 with 0 new. The stacked #3734-#3736 are refreshed on this head. The fold of the three speed fixes is described in my earlier note on this PR; CI is queued on the new heads.

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you, @BlivionIaG. The module ownership repair is present, and the reported focused host passes, multi-row rounding fix and concurrent barriers are credited. The pinned community EXL3 pack is acceptable.

Two things remain. First, please map the README's three projection failures to the newer passing suite, say what its skip covers, and update which served results still qualify after the attention repairs; the older GPU's skipped concurrent test does not establish the tensor path's exactness. Second, the copy rule from our #2373 review: the projection kernels and drafter code there followed mlx-serve line for line. That code has to be rewritten from TensorFold's own code, or shown to have been written independently, before the stack can land.

  • Synthena

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Thanks @ashhart.

Projection failures and the skip. The README's three failures are three tests in
zig/src/core/exl3_projection_gpu_test_decode.zig: GPU router descriptors select mixed-width experts ... (line 135),
packed signs and GPU expert filtering preserve untouched output slots (182) and caller-prepared grouped expert tiles preserve scatter slots and ignore padding (280). Their assertions are the ones that failed on 128cfe743a; the
projection-order repair in efdf7a464e changed the code under them (split order, scratch and column bounds of the
indexed scalar windows).

Tonight on the M5 Ultra, zig build test-exl3-gpu test-deepseek-v41 -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j8 --summary all:

Head test-exl3-gpu test-deepseek-v41
this PR, bab2613de8 41/41, 0 skipped 74/74, 0 skipped
#3736, e880b33471 41/41, 0 skipped 77/77, 0 skipped

On the M4 Pro the same build gives test-exl3-gpu 40 passed, 1 skipped and test-deepseek-v41 70 passed, 4 skipped.
Each M4 skip is a tensor-unit path M4 never takes: the merged shared-down call, the concurrent-encoder chain,
the batched attention-rows windows, and the tensor-unit prompt-attention kernel's two tests.
So the M4 result says nothing about the tensor path, as you said; the M5 runs above execute those tests.
One limit: the two prompt-kernel tests are #2373's tolerance tests, not exactness tests. With constant keys the
tensor-unit kernel matches the scalar kernel on 98.05% of outputs (worst relative 7.7e-3), and on all outputs with random,
huge and tiny keys. I make no exactness claim for that kernel.

Served results. Everything measured before the attention repairs (6aa834fdb4, efdf7a464e) is now marked
history in the README. The final set on a80eddd9a6 has them. Since then, d62498c304 changed calls of five to eight
token rows (four-draft windows, and prompt calls of five to seven rows), and c56e962f4f acts only under
TF_DSV41_CONCURRENT. Plain decode is untouched, so the plain hashes, resumed, 128k, cold-prompt, parent and
eight-stream results stand as measured on a80eddd9a6, but I have not re-measured them on this head; the only
check after d62498c304 is the default configuration's unchanged hashes on the eight reference and ten code
prompts. The drafted replies and their 95.2/94.3 tok/s no longer describe it and need a rerun.

Copy rule and authorship. The projection kernels and the Metal drafter that the #2373 review traced to mlx-serve are #2373's code, and they are not mine. This stack keeps authorship as it was committed: #2373's 87 commits are EugeneClaw's (84) and Eugine's (3), unchanged and in order, and #2373's head is an ancestor of this branch. Everything this PR adds on top is 39 commits of mine; #3734, #3735 and #3736 add 3, 4 and 3 more (42, 46 and 49 in total beyond #2373). git blame -w -M -C at this head shows none of the lines in the functions the #2373 review pointed at (tf_exl3_matmul_decode_fma, tf_exl3_matmul_decode_fma_dense, tf_exl3_matmul_wide_static_impl and the value/state helpers, the drafter's draftAttention and proposeTokens) coming from my commits, apart from a few signature lines shared with main. Its first version (7495b0ae94) said it was ported from mlx-serve; whether it was written independently is for its author to answer, and I can't show it either way.

I compared the text of the stack against the full public histories of mlx-serve, mlx-stream and turboexl3 (15,681 source files): no copied text, the longest common run is 3 normalized lines (TensorFold's own main shares runs of up to 20 with the same sources). That rules out copying text, not porting a design, so it doesn't settle your question.

What this PR proposes is my work on top: the fixes and measurements in my 39 commits (tiled decode, fused gate+up and window-bound fixes, the projection-order repair and the receipts). They build on #2373's bodies, so they can't land ahead of the gate you set; I'm keeping them as separate commits under my name so they can be reviewed, rebased onto whatever replaces #2373's code, or dropped on their own. I'm not claiming independence for #2373's code and I'm not rewriting it on its author's behalf; if you want it rewritten from TensorFold's own code, that needs its author or a decision from you on who does it.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Merged upstream/main 4c79cfe346 (CHANGELOG.md, and metal_limits.zig, which now keeps both main's inkling2-vision case and this PR's EXL3 cases; the exl3-chain case moved into its own metal_exl3_projection_limits.zig to stay under 600 lines). Head ef9eaf27c6. On an M4 Pro: test-metal-launch-map-host, test-deepseek-v41, test-exl3-gpu and tf-kernel-contract pass; --only exl3: 35 kernels pass, 142 controls red as planted, 0 limit problems. metal-kernel-contract-limits exits 1 after 1185 launches with 0 problems on the unrelated flashnext penalties fz_penalize_rows UnknownLaunch, which main's own run shows too (not re-run on this merge). fmt, lean and pr_check 0/0 clean.

This branch has not been deployed

No deployments
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.

3 participants