Skip to content

docs(serving): measured verdict — gather is fit-not-speed; CUDA decode -24% - #2150

Merged
joelteply merged 1 commit into
canaryfrom
docs/gather-measured-verdict
Aug 4, 2026
Merged

docs(serving): measured verdict — gather is fit-not-speed; CUDA decode -24%#2150
joelteply merged 1 commit into
canaryfrom
docs/gather-measured-verdict

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Honest A/B both backends, the locality explanation, the overhead-vs-bandwidth rule, and the co-location synthesis.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…DA decode is 24% SLOWER

Correctness closed both backends; speed is split and the CUDA half is negative.
5090 V4-Flash: copy 3.10 tok/s @1875 MiB vs gather 2.36 tok/s @51 MiB — 97%
fewer bytes, 24% slower. M5 Metal: copy 12.23 vs gather 49.09 — 4.0x faster.

Same mechanism, opposite outcomes, one explanation: the copy path consolidates
scattered slots into a contiguous staging tensor ONCE and the matmul then reads
it densely many times. Gather removes the transfer but scatters every read
across a multi-GB pool, killing L2 and row-buffer locality in the hottest
kernel. On the 5090 the copy was ~1-2 ms of a ~320 ms token — never the
bottleneck. On the M5 it was 384 small per-expert copies at ~6 GB/s — overhead
-bound, which is what removing them actually won.

Rule recorded: gather wins where the copy is OVERHEAD-bound, loses where it is
BANDWIDTH-efficient. Opt-in stays opt-in; measure both arms per backend.

Also records what the mechanism is genuinely for (working sets over VRAM, NVMe
tiers, and grid share where 'copy' means a network hop) and the synthesis that
could recover both: co-occurrence-driven slot co-location (#228/#229) makes
gathered reads dense again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply enabled auto-merge (squash) August 4, 2026 04:31
@joelteply
joelteply merged commit 3703b4e into canary Aug 4, 2026
2 checks passed
@joelteply
joelteply deleted the docs/gather-measured-verdict branch August 4, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant