Skip to content

Fix SM100 split kv when num_sm_parts == 1 - #42

Open
cjackal wants to merge 1 commit into
vllm-project:mainfrom
cjackal:mistral-large-4
Open

cjackal wants to merge 1 commit into
vllm-project:mainfrom
cjackal:mistral-large-4

Conversation

@cjackal

@cjackal cjackal commented Nov 2, 2026

Copy link
Copy Markdown

Fix a OOM when running Mistral Large 4 on SM100 devices. (On SM100, FlashMLA is the default kernel for Mistral Large 4)

This PR is effectively the same fix as #19 in the sense that we do not allocate o_accum and lse_accum (on SM100), which is reverted by #20.

Due to how this fixes the OOM, this fix only works for fp8 kv cache (AFAICT nvfp4 would take the split path). Also this PR does not fix SM90 regression from #20, it should be fixes by #29 instead.

Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
@cjackal

cjackal commented Nov 3, 2026

Copy link
Copy Markdown
Author

With num_batched_tokens=16k, peak extra memory measured with this PR is 1028.00MiB, compared to 4.0GiB on main.

drakosha added a commit to drakosha/FlashMLA that referenced this pull request Nov 3, 2026
vllm-project#19 allocated the split-KV accumulators only when the scheduler has more
than one partition. The V4.1 sync (vllm-project#20) brought back the upstream
interface, which allocates them whenever split-KV scheduling is enabled,
and on SM90 that is always. With a single partition no request is split:
the SM90 kernel writes `out` / `lse` directly and the combine has nothing
to merge, so the (b + num_sm_parts) x s_q x h_q x d_v fp32 buffers are
never read. In vLLM's mixed-batch layout (b=1, s_q=num_tokens) they grow
to 8 GiB at 32k tokens and reintroduce the runtime OOM of
vllm-project/vllm#53413 (vllm-project/vllm#59305).

Skip the accumulators and the combine launch on SM90 when there is a
single partition, and bring back the workspace test from vllm-project#19 for SM90.
SM100 is left to vllm-project#42: its kernels in the new tree build the o_accum tensor
map and offset its pointers unconditionally, so there split-KV has to be
turned off before scheduling instead.

Signed-off-by: Mikhail Kostryukov <mike@triptrack.net>
Co-Authored-By: Claude Opus 5.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.

1 participant