perf(glm5next): gather full C4 cache for DCP prefill - #517
Conversation
|
Warning Review limit reachedNext included review available in 48 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
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. Comment |
|
@coderabbitai review |
|
Pure-prefill DCP batches pack each rank-local CKV shard, gather the full cache in rank-major order, remap global C4 selections, and execute B12X extend attention with local query heads and global causal lengths. Decode, speculative verification, CUDA-graph capture, and ineligible batches retain the ordinary DCP attention path. The implementation excludes indexer query splitting and cross-layer asynchronous prefetch. Those mechanisms have independent topology and ownership contracts and are not required for synchronous full-CKV prefill. (cherry picked from commit d98b9b2) Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com> Co-authored-by: opencode <opencode@anthropic.ai> (cherry picked from commit ddfa3d558079fbba8d5b874e1c1c269ec0506ce2) Signed-off-by: Martin Vit <martin@voipmonitor.org>
Co-authored-by: OpenAI Codex <noreply@openai.com> (cherry picked from commit d71b3ca) (cherry picked from commit 208f574034cfc38076e9b69007b78fad64a7927f) (cherry picked from commit 6bfb5fc7c9fb78c12bd88dcd361c3b1e881dd45f) Signed-off-by: Martin Vit <martin@voipmonitor.org>
Co-Authored-By: Claude opus <noreply@anthropic.com> (cherry picked from commit ea338d7) (cherry picked from commit 0cb13562a9763fc349c2d3761bea315aa0d00e4d) (cherry picked from commit c17abaeb08b4b7893a396585c19ea6845afbbd94) Signed-off-by: Martin Vit <martin@voipmonitor.org>
Hybrid cache alignment applies the resolved page size to loaded attention implementations before device-memory profiling. B12X rebuilds its plans from that immutable geometry and reserves every workspace execution slot, so the KV-cache budget includes full-CKV gather storage. KV-cache binding validates the finalized page size and fails closed when full-CKV gathering reaches binding without pre-profile finalization. The 64-to-2304-token page transition and multi-slot workspace reservation have regression coverage. Validation: uvx ruff check and format on changed files; 11 targeted pytest cases passed in the source-compatible runtime image. (cherry picked from commit 65fc70fe002c5318b4ea9ccf998353368fe2cb4a) (cherry picked from commit 87b9d1195a133a9aa328f989c63549fbb34b1031) Signed-off-by: Martin Vit <martin@voipmonitor.org>
Co-authored-by: OpenAI Codex <noreply@openai.com> (cherry picked from commit 68eb9de) (cherry picked from commit 710fe52ba4373f2e7b52efdfc821b7726b302b00)
Selector-state fixture stubs expose prefill, decode-token, and speculative-decode fields required by the sparse-MLA metadata builder. The bare builder disables full-CKV eligibility so selector-state staging tests remain isolated from DCP cache-gather behavior. (cherry picked from commit 702004ec703c2f36237b160fa2cb9c2cb01754aa)
Enable the synchronous full-cache gather only when B12X metadata reports zero decode tokens. This excludes ordinary and speculative decode without depending on a metadata field that the sparse MLA builder does not define, including during CUDA graph memory profiling. (cherry picked from commit eeae70219b9f86889108afa734f6de1bbd42d99e) Signed-off-by: Martin Vit <martin@voipmonitor.org>
089ce1e to
db0f144
Compare
675ff25 to
92d807a
Compare
|
@coderabbitai review |
|
5035715
into
fix/b12x-memory-profiling-warmup-lifetime
Purpose
Give GLM5Next B12X C4 prefill a global compressed-key/value view under decode
context parallelism. Each rank normally selects candidates from only its local
KV shard, which reduces selector quality and leaves most C4 candidates
invisible during prefill.
Resulting behavior
When
VLLM_B12X_MLA_CKV_GATHER=1, an eligible pure-prefill batch:Eligibility requires
num_decode_tokens == 0. Decode and MTP verificationbatches cannot enter this path. The implementation uses one synchronous
workspace slot and does not introduce side-stream prefetch.
Cache page geometry is finalized before memory profiling. B12X plans, packed
capacity, gather workspace, persistent-pool reservation, and cache binding use
the same immutable physical page size. Full-CKV prefill executes eagerly;
CUDA-graph profiling uses ordinary DCP attention, while decode and eligible
serving paths retain PIECEWISE and FULL graphs.
The environment-variable source default is disabled. No B12X source or kernel
is changed.
Review-stack boundary
This pull request is based on #516, which supplies startup-only B12X profiling
warmup safety. Pull request #516 is based on #515, which supplies CUDA-graph
profiling resource lifetime. The lower review stack also contains #531 and
#532, which reuse immutable B12X C4 plans and parallelize packed C4 pool writes.
The head tree for this pull request is
265353fc996f5a788aaac069f58f9484e3d7be41.The diff in this pull request contains only the GLM5Next synchronous full-CKV
operation contract, immutable page geometry, cache-binding lifecycle, and
associated tests.
Duplicate-work check
Searches covered GLM5Next, B12X, DCP, CKV gathering, and CKV prefetch in both
local-inference-lab/vllmandvllm-project/vllm.routing, DFlash cache ownership, and depth-1 side-stream prefetch. It also
permits workspace sizing before the hybrid physical page is finalized. This
pull request isolates the depth-0 pure-prefill contract and fixes page
geometry before memory profiling.
dev/gilded-gnosis. Its main commit is not an ancestor ofdev/gilded-gnosisordev/infernal-invocation, and it is used only as adesign reference here.
dev/gilded-gnosis; it does not providethe Jovian runtime path.
this implementation.
Verified review findings from #488
Luke Alonso's #488 review notes were checked against
e72447af820d4f996b33710cc0232a3144460722and minimal reproducers:sequences, interleave 4, and a 524,288-token CKV limit. Binding the
2,304-token hybrid page requires 131,328 records, leaving a depth-1 lane
608,256 bytes short. This implementation finalizes the page before memory
profiling and rejects post-allocation geometry changes.
VLLM_B12X_MLA_SPEC_EXTEND_AS_DECODEdefaults to disabled even though arouting test passes an enabled flag directly. Full-CKV eligibility therefore
derives from the batch's decode-token count and excludes MTP verification.
synchronous gathering and allocates approximately 1.2 GiB for the second
lane. This implementation remains synchronous. Side-stream prefetch requires
independent profiling and qualification.
Source provenance
Substantially transferred commits retain their Git authors:
[gg-rebased] perf(dcp): split prefill queries and gather selected CKV #120 commit
d98b9b245c1430e02090e06edc4a836018f1e727.selection, and GLM5Next packed page-tail fixtures.
fixtures, and decode-token eligibility.
Validation
Hardware and model conditions: four NVIDIA RTX PRO 6000 Blackwell Workstation
Edition GPUs, physical device IDs 4, 5, 6, and 7; TP4; DCP4; FP8 target KV;
max_num_batched_tokens=4096; GLM-5.3-Flash-NVFP4 revision520de24eabf507659eaef7c70f14fd584527facc; composed vLLM head3609a3db498698314bdc44920cad9f2d25796eb9; and B12X head0a73e97fe4dd67500999b0152d8a3c41ba238715.Correctness:
ordinary DCP and perf(glm5next): complete B12X CKV support for DCP and MTP #488 depth 0: 256 tokens, chunked 32,768 tokens, two
concurrent 32,768-token requests, and two 32,768-token requests sharing a
30,720-token prefix.
DCP and 0.0041269148 against perf(glm5next): complete B12X CKV support for DCP and MTP #488 depth 0.
with no implementation failure.
git diff --check: passed.Performance used
llm-decode-bench0.4.30, concurrency 1, its 32k standaloneprefill workload with 32,320 measured prompt tokens, one output token, unique
cold-prefix requests, and a 30-second client measurement window:
The adjacent median gain is 9.63%. The measured gain applies to non-speculative
serving at the declared 4,096-token scheduler batch limit; it is not a claim
for a different batch limit or speculative mode.
An earlier source-isolation qualification compared this implementation with
#488 depth 0 under the same model, B12X revision, hardware, and 4,096-token
scheduler batch limit. Their median difference was 0.15%, which establishes
performance parity with #488 depth 0 rather than a speedup over #488.
AI assistance disclosure
OpenAI Codex assisted with source analysis, implementation, tests, runtime
qualification, and pull-request preparation. A human maintainer must review
every changed line and understand and defend the behavior before merge.