You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(matrix): goal #1 fully characterized with measured numbers (seq-scale ramp)
Real gb10 bf16-adamw tok/s across the feasible envelope:
- path_b: bs1/seq512=156, bs2/seq512=259, bs1/seq1024=191 (scales w/ batch AND seq); OOM at seq4096.
- path_c: 117 tok/s ONLY at bs1/seq512; BLOCKED at bs>1 OR seq>512
(direct_fusion_chain_logical_buffers_missing — runtime built for one shape).
- MLX OOMs at seq4096 (121G) — root cause moe.py:214 dense 16-expert loop +
O(n^2) reference sparse-MLA; C++ does bs4/seq4096 in ~26G (sparse alltoall MoE).
The literal bs4/seq4096 like-for-like is unreachable for two pinpointed code walls;
the achievable envelope is measured. Receipt: cppmega_1b_seqscale_gb10_b1s1024_results.json.
## Fair comparison (goal #1) — RESOLVED with measured evidence
45
45
46
-
The like-for-like **batch=4×seq=4096** comparison the goal asked for is **provably not achievable in MLX-eager on this model** — it OOMs. Measured on gb10 (121 GB unified), memory-guarded ramp:
47
-
48
-
| config | result (gb10, bf16) |
49
-
| --- | --- |
50
-
| bs=1 × seq=512 (baseline) | path_b/path_c/path_c_chunked all run (full 54-cell matrix) |
| bs=4 × seq=4096 (the literal goal config) |**OOM** (≥100 GB), never completes |
46
+
The like-for-like **batch=4×seq=4096** comparison the goal asked for is **not achievable in MLX-eager on this model** — measured, memory-guarded ramp on gb10 (121 GB unified), bf16 adamw, real tok/s:
47
+
48
+
| config | path_b | path_c | peak mem | note |
49
+
| --- | --- | --- | --- | --- |
50
+
| bs=1 × seq=512 | 156 tok/s |**117 tok/s** ✅ |~22 GB | the one shape path_c runs |
(muon mirrors adamw: bs1→bs2 path_b 92→159.) Two independent, code-pinpointed walls:
57
+
-**path_c (CUDA direct-chain) is pinned to exactly bs=1×seq=512** — it blocks at bs>1 *or* seq>512 with `direct_fusion_chain_logical_buffers_missing` (the fused direct-chain runtime was built for that one shape). So *steady-state path_c-vs-path_b at scale is unmeasurable* — path_c doesn't run off its build shape. **path_b runs everywhere and scales** with both batch (156→259) and seq (156→191).
58
+
-**MLX-eager OOMs at seq=4096 even at bs=1** (121 GB) — root cause pinpointed in code: `cppmega_mlx/nn/moe.py:214``ReferenceMoE` runs a **dense loop over all 16 experts on all tokens** (docstring: *"Dense ... reference suitable for smoke tests"*) + gather O(n²) reference sparse-MLA. C++/Megatron does the same bs=4×seq=4096 in **~26 GB** via sparse all-to-all MoE. **That ~5× memory ratio IS the concrete MLX-vs-C++ finding.**
54
59
55
60
**Why MLX OOMs where C++ doesn't:** C++/Megatron does bs=4×seq=4096 in **~26 GB** (3700 tok/s) using **sparse all-to-all MoE**; the MLX path uses a **dense `ReferenceMoE`** that materializes all 16 experts (O(seq×experts)) plus gather-based O(n²)-memory reference sparse-MLA. So MLX-eager's memory blows up with seq, capping reachable seq well below 4096. **This is the concrete MLX-vs-C++ finding** — not a tuning gap but a different (reference vs production) MoE/attention implementation.
0 commit comments