[eldritch] attention: support DCP in SM120 FlashInfer sparse MLA - #60
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ee71d9d to
56fb5d8
Compare
28ca429
into
codex/eldritch-enlightenment-release-20260627
|
Hi, @voipmonitor I'm trying to enable DCP (DCP size = 8) by following the deployment guide in the My configuration is:
However, the engine hangs during the If I disable DCP (or set the DCP size to 1), everything works normally. Is there any recommended configuration or best practice for enabling DCP with DeepSeek V4 Flash when using TP=8? My goal is to achieve high-concurrency serving. Thanks! oh,by the way, could you please update the discord invite link in rtx6kpro |
Summary
This is a cleaned-up SM120 FlashInfer sparse-MLA DCP patch for the Eldritch release branch (
codex/eldritch-enlightenment-release-20260627). It makesFLASHINFER_MLA_SPARSE_SM120usable with--decode-context-parallel-size > 1without carrying the unrelated B12X hybrid/debug experiments from earlier overlays.The PR touches only the FlashInfer sparse MLA path plus one generic warmup shape guard needed for DCP production launches:
seq_lensto the FlashInfer SM120 launcher;max_num_seqs > 1launches do not autotune invalid zero-local-KV DCP shapes.No B12X binding, arena, workspace, or kernel path is changed here. The B12X sparse MLA implementation was used only as the behavioral reference for DCP index conversion and LSE return semantics.
Why
Before this change,
FLASHINFER_MLA_SPARSE_SM120was effectively DCP1-only. Under DCP, the common MLA attention layer requires each backend to return decode softmax LSE so the partial results from DCP ranks can be merged correctly. The SM120 FlashInfer backend returned(out, None), so DCP serving had to useB12X_MLA_SPARSEeven when the SM120 FlashInfer sparse decode kernel was faster.The SM120 FlashInfer launcher already supports returning LSE. The missing pieces were the vLLM-side DCP index mapping, valid-count plumbing, head/LSE buffer sizing after DCP query gather, and per-device scratch allocation that is visible during memory profiling.
A second issue showed up only in production-style launches.
run_mixed_prefill_decode_warmup()used a two-token synthetic decode prompt. With DCP sparse decode, that prompt can occupy only the first cache block and leave later DCP ranks with an empty local KV range. The warmup then autotunes an invalid DCP shape and can corrupt startup. The fix mirrors the existing DCP warmup constraint: span at least one KV block per DCP rank for the synthetic decode request.Implementation Notes
The global-to-local DCP mapping reuses
triton_convert_dcp_global_index_to_local_index, keeping the sparse top-k contract aligned with the existing DCP-capable sparse MLA implementation.The SM120 path sizes output and LSE buffers from the runtime query head count (
q.shape[1]) rather than the constructor's localnum_heads, because DCP decode can present a query tensor whose head dimension has already been gathered across DCP ranks.The FlashInfer scratch buffer is still caller scratch for the FlashInfer launcher, but it is keyed by CUDA device and allocated during backend initialization. This avoids cross-device tensor reuse and avoids first-decode lazy allocation after vLLM has already sized KV cache.
Validation
Validated on 8x RTX PRO 6000 / SM120 with GLM-5.2 NVFP4, TP8/DCP2 and TP8/DCP4, MTP off,
--attention-backend FLASHINFER_MLA_SPARSE_SM120,--moe-backend b12x,--kv-cache-dtype fp8, V2 runner.Static checks:
Debug/smoke validation, TP8/DCP4,
max_num_seqs=1, graph cap 4:Production-start validation, TP8/DCP2,
max_num_seqs=32, graph cap 4:Application startup complete;1,357,696 tokens;0, generation-only throughput around67.4 tok/s.Observed startup/log checks:
Using V2 Model RunnerUsing AttentionBackendEnum.FLASHINFER_MLA_SPARSE_SM120 backendUsing 'B12X' NvFp4 MoE backend['B12X_PCIE_ONESHOT', 'PYNCCL']for decode-sized tensors; DCP/EP groups remain PyNCCL.The stored B12X DCP4/no-MTP reference for the same GLM recipe is about
62.3 tok/s, so the SM120 path is consistently faster on the coding smoke while preserving coherent output.Scope / Limitations
This validates the
ag_rsDCP flow used on our PCIe SM120 machines. I did not claima2acoverage here.The path assumes the same sparse MLA prerequisites already required by the backend: packed
fp8_ds_mlaKV cache layout, a FlashInfer build with the SM120 sparse MLA decode API, and a global top-k sparse indexer contract that can be mapped to local DCP KV slots.