Skip to content

cuda: keep the raw MMQ MoE tier off streamed routed experts - #747

Open
pmasala wants to merge 1 commit into
antirez:mainfrom
pmasala:fix/cuda-mmq-streaming-oom
Open

cuda: keep the raw MMQ MoE tier off streamed routed experts#747
pmasala wants to merge 1 commit into
antirez:mainfrom
pmasala:fix/cuda-mmq-streaming-oom

Conversation

@pmasala

@pmasala pmasala commented Aug 8, 2026

Copy link
Copy Markdown

Fixes #732.

The tier needs a pointer to the whole routed tensor of a layer. Under
--ssd-streaming that tensor is not resident, so resolving it makes the fallback
cache build it: 528 MiB gate, 528 up, 1792 down, per routed layer. It tries to
cache 32.06 GiB, the alloc fails on a 12 GB card, and any real prompt then dies
with an illegal memory access.

The guard is !g_ssd_streaming_mode. The aligned IQ2 variant above already has
it, and the MXFP4 tier below also declines under streaming, so only the raw
variant was missing it. Failures here already fall back to the sorted-pairs
path.

Outside streaming nothing changes: the flag is set in one place, from the CLI
toggle, and the tier is prefill-only. The dense MMQ tiers stay on, which is
where the win is: prefill 9.14 / 16.08 / 17.61 t/s at 512 / 1024 / 2048 tokens,
and 21.40 t/s at 2048 with #734, about 2.1x the DS4_CUDA_MMQ=0 baseline.

Tested only on 12 GB: RTX 3500 Ada (sm_89), CUDA 13.0, WSL2, DeepSeek-V4-Flash
IQ2_XXS 80.8 GB. Bigger cards should show the same bug with a milder symptom.

The tier resolves a pointer to the whole routed tensor of the layer, which under
SSD streaming is not resident and makes the fallback cache materialise hundreds of
MiB per layer, failing outright on a card without the room. Add the
!g_ssd_streaming_mode guard that the aligned variant of the same tier already
carries; the dense MMQ tiers keep working, and that is where its prefill win is.

Closes antirez#732

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

CUDA --ssd-streaming: MMQ prefill tier OOMs on a 12 GB card (main b030961)

2 participants