Skip to content

perf(glm5next): accelerate C4 prefill - #496

Open
voipmonitor wants to merge 4 commits into
dev/jovian-judgementfrom
codex/glm53-c4-prefill-20260828
Open

perf(glm5next): accelerate C4 prefill#496
voipmonitor wants to merge 4 commits into
dev/jovian-judgementfrom
codex/glm53-c4-prefill-20260828

Conversation

@voipmonitor

Copy link
Copy Markdown

Resulting behavior

Status: implemented and qualified for GLM-5.3 C4 prefill at tensor parallel size 4 and decode-context parallel size 1.

GLM C4 decode retains the B12X paged selector. C4 prefill gathers the visible packed FP8 page-tail cache into caller-owned workspace and uses DeepGEMM to rank candidates. Host-side sequence lengths bound each request to its visible pool prefix.

Completed C4 pools are updated by independent Triton programs. Each request updates its own partial tail, while decode and speculative-decode rows retain ordered processing. The prefill path requires packed main-cache slots and consecutive positions.

Source contract

  • Base: local-inference-lab/vllm:dev/jovian-judgement at c79f35ca00e8e93e0943a0d79b85b22b18aac939.
  • Head: 70bdc4d51e571b75d7e1a7e1721a488b35aadb83.
  • The B12X paged decode ABI and cache layout are unchanged.
  • QSA page-tail tests assert 33 bytes per token independently from fixed page padding.
  • The prefill request offset is an append-only kernel argument so the shared launch tuple cannot shift positional arguments.

Validation

  • Focused GLM pooled-indexer and B12X sparse-MLA tests: 20 passed, 14 accelerator-dependent tests skipped, 9 deselected.
  • A physical SM120 oracle compared DeepGEMM and B12X ranking over 576 visible candidates at top-k 512: passed.
  • For 4,096 query rows and pool contexts from 4,096 through 32,768 tokens, the DeepGEMM prefill ranking path measured 6.5-24.1% faster than B12X prefill ranking.
  • Repository pre-commit hooks, including Ruff, mypy, SPDX, forbidden-import, and configuration checks: passed.
  • git diff --check: passed.
  • The composed TP4 runtime sustained 12,692 input tokens/s in a 32,768-token cold-prefill profile over 30 seconds.

Duplicate-work check

Related pull requests implement different execution modes:

  • local-inference-lab/vllm#488 gathers full compressed KV state for GLM decode-context-parallel prefill and overlaps DCP communication. This pull request qualifies DCP1 packed-cache gathering, DeepGEMM ranking, and parallel C4 pool updates.
  • vllm-project/vllm#41834 contains DeepSeek V4 SM120 sparse-indexer and prefill work, but it does not implement the GLM C4 page-tail gather and pool-update contract in this pull request.

Review disclosure

OpenAI Codex assisted with implementation, tests, GPU oracle validation, profiling, benchmarking, and pull-request preparation. Human review of every changed line and the packed-cache ABI is required before merge.

Gather the packed FP8 page-tail cache into caller-owned workspace for DeepGEMM prefill scoring while retaining the B12X paged kernel for decode. Preserve exact host-side prefill sequence lengths so each request gathers only its visible pool prefix.

Compatibility: the GLM cache layout and decode route are unchanged. The prefill selector uses the same DeepGEMM and vLLM top-k contract as the qualified functional runtime.

Validation: 51 GLM model tests passed on SM120; packed-cache DeepGEMM top-k matched the B12X oracle; 4096-row measurements were 6.5-24.1% faster than B12X prefill for 4096-32768 pool contexts.

Co-authored-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Martin Vit <martin@voipmonitor.org>
Assign each completed C4 pool to an independent Triton program and update each request tail separately. Decode and speculative-decode requests retain ordered row processing, while prefill requires packed main-cache slots and consecutive positions.

Validated with GLM-5.3-Flash-NVFP4 on four RTX PRO 6000 Blackwell GPUs using a 32k-token standalone-prefill benchmark and parity tests for boundary tails, state-slot isolation, and invalid dummy slots.

Signed-off-by: Martin Vit <martin@voipmonitor.org>
Assert the per-token QSA tail independently from fixed page padding and provide the decode-only metadata field required by selector-state fixtures. The tests now preserve the runtime-sized page ABI shared with B12X instead of requiring the superseded padded allocation.

Validation: 80 targeted GLM, sparse-attention, and workspace tests passed; 14 accelerator-dependent tests skipped.

Assisted-by: OpenAI Codex <codex@openai.com>

Signed-off-by: Martin Vit <martin@voipmonitor.org>
Pass the decode-request count as an append-only argument to the C4 prefill pool kernel so positional launch parameters cannot shift when the common argument tuple changes. Exercise the DeepGEMM and B12X ranking oracle with 576 visible candidates and top-k 512, including multiple packed cache pages.

Validation: the GLM pooled-indexer suite and the SM120 DeepGEMM/B12X oracle cover the supported page-tail and top-k contracts.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Martin Vit <martin@voipmonitor.org>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26077c9c-54f9-44d0-a028-f36042af503d

📥 Commits

Reviewing files that changed from the base of the PR and between c79f35c and 70bdc4d.

📒 Files selected for processing (6)
  • tests/models/test_glm5next_pooled_indexer.py
  • tests/v1/attention/test_b12x_sparse_mla_api.py
  • vllm/models/deepseek_v4/nvidia/b12x_indexer.py
  • vllm/models/glm5next/nvidia/ops/glm_kpool.py
  • vllm/models/glm5next/nvidia/pooled_indexer.py
  • vllm/v1/attention/backends/mla/b12x_mla_sparse.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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