Skip to content

feat(cache): support FlashStates prefill context parallelism - #1808

Merged
AlpinDale merged 1 commit into
feat/flashstates-context-parallelfrom
feat/flashstates-prefill-parallel
Nov 13, 2026
Merged

AlpinDale merged 1 commit into
feat/flashstates-context-parallelfrom
feat/flashstates-prefill-parallel

Conversation

@AlpinDale

@AlpinDale AlpinDale commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds prefill context parallelism (PCP) support for the CUDA GLM-5.3-Flash and Kimi-K3 hybrid paths, including FlashStates checkpoint export and restoration.

PCP splits prefill tokens across ranks. The recurrent layers gather those inputs into global token order and run recurrence on every PCP rank. This leaves each rank with the state needed for subsequent decoding and checkpoint restoration.

KV storage and recurrent state are replicated across PCP ranks. This implementation does not reduce their per-rank memory footprint.

Example for GLM on 2 GPUs:

sonar serve nvidia/GLM-5.3-Flash-NVFP4 \
  --tensor-parallel-size 1 \
  --prefill-context-parallel-size 2 \
  --language-model-only \
  --enforce-eager \
  --max-model-len 32768 \
  --enable-prefix-caching \
  --mamba-frontier-checkpoint \
  --mamba-prefill-export \
  --prefix-cache-eviction gds \
  --prefill-cost-coefficients 1.862e-5 3.33e-6 \
  --prefix-cache-leaf-last

Performance

Measured GLM-5.3-Flash-NVFP4 on B300 with 6,145 input tokens, 64 output tokens and concurrency 1. Both configurations used TP 1 / DCP 1. Results are medians of three warmed runs.

Both configurations used a 16 GiB KV-cache budget per GPU, a maximum of four sequences and 2,048 batched tokens.

Configuration GPUs TTFT Decode output tok/s
PCP 1 1 0.452 s 11.96
PCP 2 2 0.488 s 9.03

Limitations

  • Requires --language-model-only and --enforce-eager. CUDA graphs are rejected for hybrid PCP.
  • GLM's FlashInfer sparse attention backend supports PCP or DCP separately, not both simultaneously.
  • Gathering recurrence inputs and replicating recurrence adds communication and computation overhead.

Signed-off-by: AlpinDale <alpindale@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:31:54.201331Z a4736eb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AlpinDale
AlpinDale added this pull request to stack #1810 November 13, 2026 16:50
@AlpinDale
AlpinDale merged commit 33a0078 into main Nov 13, 2026
2 checks passed
@AlpinDale
AlpinDale deleted the feat/flashstates-prefill-parallel branch November 22, 2026 11:26
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