perf(deepseek-v4): skip redundant all-pooled indexer scoring - #2563
Conversation
|
I reviewed and benchmarked #2559, #2562, and #2563 together since they merge cleanly as a set, so I am posting the same summary on all three. Setup: M3 Ultra 512 GB, DeepSeek-V4-Flash-0731 oQ4e (4-bit top level with mxfp4 experts, so all three changes are active), MTP off, single request, cold prefill with cached_tokens=0 verified on every run, one run per point, current main vs main plus all three PRs, using the built-in throughput benchmark (tg128). With the prompt cache disabled, which gives 2048-token prefill steps matching the #2558 methodology:
tg was unchanged everywhere, which is expected for prefill-only changes. This independently reproduces the #2558 ablation on a different checkpoint, so the numbers hold up well. One finding on my side rather than yours: with the default server config the paged SSD cache aligns the rotating block size to 512, which clamps prefill to 512-token chunks, and in that regime these gains mostly disappear (the MoE route count stays below the MXFP4 crossover and the ratio-128 win shrinks with the chunk). Raising the DeepSeek V4 block alignment to 2048 with the cache still enabled recovers the full numbers above (549.5 / 558.7 / 524.2 / 461.6 pp tok/s). I will handle that follow-up separately so default-config users actually see the improvement. Merging all three. |
Summary
index_topk.PoolingCacheadvances exactly as before.index_topk.Correctness
The regression test uses the existing full indexer as the reference for a non-aligned ratio-4 prefill: 10 input tokens produce two pooled rows and a two-token remainder.
It verifies that:
PoolingCache.stateexactly match the reference path;Performance evidence
Issue #2558 attributes approximately 0.4% marginal throughput improvement to this slice in its controlled leave-one-out testing.
That result is scoped to:
DeepSeek-V4-Flash-0731at revision7872f01b1d1fe23eabc4c98b48bffcef5a386062;a1465f4b5ee68dbd173c138dd65718bd06957439b66e99069e91f50364bf81f1;This is an M3 Ultra result, not an unconditional cross-chip performance claim.
Evidence package:
https://github.com/DiscoStew6082/omlx/tree/06b515b0fd3543341b346e74cf0d3a13da2d6c06/benchmarks/evidence/deepseek_v4_flash_prefill_m3_ultra
Validation
tests/test_deepseek_v4_patch.py: 92 passedtests/test_deepseek_v4_dspark.py: 64 passed, 11 skippedgit diff --checkpassedRefs #2558