M5 Max专用Splash引擎优化版:并发提速1.5倍
Splash fork optimised for M5 Max: ~1.5× faster (1.25× single request)
本地部署M系列芯片的同学必看,这篇给出了具体的内核调优参数和工程取舍细节,直接照做就能榨干硬件性能。
I’ve spent the last couple of days with Opus 5.5 working on a fork of Inco’s excellent and already blazingly fast Splash engine to optimise it for M5 Max chips. Taking liberties and referring to it as Splish.
过去几天我一直在 Opus 5.5 上工作,基于 Inco 出色且已极其快速的 Splash 引擎进行分支开发,旨在针对 M5 Max 芯片对其进行优化。我擅自改动并将其命名为 Splish。
Roughly the opposite direction to u/Erp4759’s great M1 port (Splash on M1, part 2).
这与 u/Erp4759 出色的 M1 移植版(Splash on M1,第 2 部分)的方向大致相反。
Charts (stock Splash vs Splish):
图表(原版 Splash 与 Splish 对比):
https://raw.githubusercontent.com/publicExcess/splish/m5/docs/m5/charts/png/single-request.png
https://raw.githubusercontent.com/publicExcess/splish/m5/docs/m5/charts/png/concurrency.png
Results
结果
Against Splash 1.1.0 as shipped, on the same Mac with the same models, Splish is:
在与搭载相同模型的同款 Mac 上,与随附的 Splash 1.1.0 相比,Splish 的表现如下:
- ~1.25× faster at a single request (+11% to +35%)
- Up to 1.5× faster at 2–4 requests
- Quality is unchanged on everything I measured
- In real world use, going from about 45-51 tok/s to 56 - 64 tok/s in short story prompts in Deepseek Harness.
- 单请求速度提升约 1.25 倍(+11% 至 +35%)
- 在 2–4 个请求下,速度最高提升 1.5 倍
- 在我测量的所有项目中,质量保持不变
- 在实际使用中,在 Deepseek Harness 的短篇故事提示中,吞吐量从大约 45-51 tok/s 提升至 56 - 64 tok/s。
All figures are for 4-bit models on a 40-core M5 Max unless stated otherwise.
除非另有说明,所有数据均基于 40 核 M5 Max 上的 4-bit 模型。
What worked
有效的措施
1. Kernel choices measured specifically for the 40-core M5 Max, using Splash’s own tuner.
1. 专门针对 40 核 M5 Max 测量的内核选择,使用 Splash 自带的调优器。
The tuner is in Splash’s source code but isn’t included in the packaged app. This was the biggest single-request win: Swift-1.5 went from 74.7 → 89.8 tok/s (+20%).
该调优器包含在 Splash 的源代码中,但未包含在打包的应用程序中。这是单请求性能提升最大的部分:Swift-1.5 从 74.7 → 89.8 tok/s(+20%)。
2. Loading those choices from a file (SPLASH_KERNEL_CHOICES).
2. 从文件加载这些选择(SPLASH_KERNEL_CHOICES)。
No speedup by itself, but it means anyone can retune without rebuilding.
这本身不会带来加速,但意味着任何人都可以重新调优而无需重新构建。
3. New verify kernels for the M5’s tensor units.
3. 为 M5 的张量单元提供新的验证内核。
These use lighter barriers and compute row sums once per projection:
这些内核使用更轻量的屏障,并在每次投影时仅计算一次行和:
- +5% at 1 request
- +10–19% at 2–4 requests
- 1 个请求时提升 5%
- 2–4 个请求时提升 10–19%
4. Extending the same kernels to more projections.
4. 将相同的内核扩展到更多投影。
A further 1–3% at 3–4 requests.
在 3–4 个请求时进一步提升 1–3%。
Together, #3 and #4 make a decode step at 2 / 3 / 4 requests:
综上所述,#3 和 #4 使得在 2 / 3 / 4 个请求下的解码步骤:
1.32× / 1.49× / 1.36× faster than tuned Splash.
比调优后的 Splash 快 1.32 倍 / 1.49 倍 / 1.36 倍。
5. Tuned Qwen3.6-35B-A3B with the new kernels.
5. 使用新内核调优 Qwen3.6-35B-A3B。
Speedups at 1–4 requests:
1–4 个请求时的加速比:
+5% / +18% / +22% / +18%
6. An attention tweak for the 27B shape.
6. 针对 27B 形状的一种注意力机制调整。
Attention is 2–3% faster and prompt processing 3–4% faster. Too small to show up in the overall numbers.
注意力机制速度提升 2–3%,提示词处理速度提升 3–4%。幅度太小,在整体数据中体现不出来。
7. GGUF (Q8_0, Q4_K_M, Q6_K): faster input loads in the decode kernel.
7. GGUF (Q8_0, Q4_K_M, Q6_K):解码内核中的输入加载更快。
+2–14% per kernel and about +2% per step. Output is bit-identical.
每个内核提升 2–14%,每一步约提升 2%。输出位级完全一致。
8. A copy rule for coding agents, borrowed from TensorFold.
8. 借鉴自 TensorFold 的编码智能体复制规则。
When the model is rewriting text it has already seen, the drafts copy it verbatim.
当模型重写其已见过的文本时,草稿会逐字复制。
Whole-file edits get +24% to +42%, while everything else stays within ±3%, and output is exact.
整个文件的编辑获得 +24% 到 +42% 的提升,而其他所有情况保持在 ±3% 以内,且输出精确无误。
I’m exploring a complementary approach for a future version.
我正在探索一种用于未来版本的互补方法。
The README also lists everything that didn’t work for me, which is probably useful if anyone wants to avoid going down the same rabbit holes.
README 还列出了所有对我无效的方案,如果任何人想避免陷入同样的死胡同,这应该很有用。
There’s lots more I’d like to test, but thought this was a nice start.
我还有很多想要测试的内容,但认为这是一个不错的开端。
The tuned settings are for a 40-core M5 Max. Other M5 chips fall back to Splash’s defaults unless overridden. An auto-tuner is coming.
这些调优设置适用于 40 核 M5 Max。其他 M5 芯片除非被覆盖,否则回退到 Splash 的默认值。自动调优器即将推出。
If you run it, python3 dev/m5/report.py prints a performance report.
如果你运行它,python3 dev/m5/report.py 会打印一份性能报告。
Results from other machines are very welcome, especially if you find cases where it’s slower.
非常欢迎来自其他机器的结果,特别是如果你发现其中变慢的情况。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力