Repository navigation
Add FP4 Indexer for DeepSeek V4 - #26209
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements an experimental FP4 C4 indexer for DeepSeek V4, including Triton kernels for quantization and storage, memory pool adjustments for reduced token sizes, and integration into the attention forward pass. Feedback suggests optimizing the hot path by caching server configuration flags and refining type hints to replace "Any" with a more specific Union type for the query tensor.
liz-badada
force-pushed
the
FP4-indexer
branch
2 times, most recently
from
May 24, 2026 14:02
98d41f4 to
cc7e3c1
Compare
liz-badada
marked this pull request as ready for review
May 24, 2026 14:36
liz-badada
requested review from
BBuf,
DarkSharpness,
Fridge003,
HaiShaw,
HydraQYH,
Qiaolin-Yu,
Ying1123,
celve,
hanming-lu,
hebiao064,
hnyls2002,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann,
yizhang2077 and
yuan-luo
as code owners
May 24, 2026 14:36
Collaborator
Author
|
/tag-and-rerun-ci |
Collaborator
Author
|
/rerun-failed-ci |
Collaborator
Author
|
/rerun-failed-ci |
1 similar comment
Collaborator
Author
|
/rerun-failed-ci |
Collaborator
Author
|
/rerun-failed-ci |
Fridge003
approved these changes
Jun 2, 2026
mqhc2020
pushed a commit
to mqhc2020/sglang
that referenced
this pull request
Jun 2, 2026
Co-authored-by: Jinyan Chen <[email protected]>
5 tasks done
This was referenced Jun 2, 2026
hanming-lu
pushed a commit
that referenced
this pull request
Jun 3, 2026
Co-authored-by: Jinyan Chen <[email protected]>
vincentzed
added a commit
to vincentzed/sglang
that referenced
this pull request
Jul 8, 2026
…gl-project#26209) Add --enable-dsa-fp4-indexer (default off): store the DSA lightning-indexer K cache as MXFP4 (E2M1 elements + packed UE8M0/32 scales, 68 B/token/layer) instead of FP8 (128 B key + 4 B fp32 scale = 132 B/token/layer), a ~48% cut of the indexer KV footprint, and route the indexer top-k logits through DeepGEMM's FP4 MQA kernels. This is a plumbing port of the DeepSeek-V4 FP4 indexer (sgl-project#26209) to the shared DSA path; it reuses the existing V4 kernels unmodified: - Store: quantize_fp4_indexer_tensor / store_fp4_index_k_cache (dsv4/fp4_indexer.py Triton kernels; bit-identical to DeepGEMM's per_token_cast_to_fp4(use_ue8m0=True, gran_k=32, use_packed_ue8m0=True)). - Decode/verify top-k: deep_gemm.fp8_fp4_paged_mqa_logits over the 68 B paged layout. - Prefill top-k: deep_gemm.fp8_fp4_mqa_logits over the gathered FP4 pair (the index_buf_accessor gathers are parametrized on a new pool.index_k_bytes_per_token instead of the hardcoded 128 B width). - Q side is quantized with the same Triton FP4 quantizer after the eager RoPE(+Hadamard) split path, so both RoPE conventions (NeoX V3.2 / interleaved GLM-5.x) are handled; the per-token q_scale folding into the head-gate weights is dropped because the FP4 kernels consume q_sf directly. Constraints / guards (fail loudly, never degrade silently): - SM100+ only; DeepGEMM build must expose the FP4 MQA-logits kernels. - DeepGEMM paged-MQA backend only (no cutedsl/aiter FP4 path). - Indexer fusion is disabled under the flag (the fused kernels quantize/store the FP8 132 B layout). - Incompatible with --enable-hisparse, DSA prefill-CP, and piecewise/breakable CUDA graph (explicit errors). - Flag off: FP8 path byte-identical (132 B sizing and kernels unchanged). MXFP4 only: the DeepGEMM sm100 MQA-logits kernel hardcodes E2M1+UE8M0; there is no NVFP4/E4M3-scale mode.
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
Co-authored-by: Jinyan Chen <[email protected]>
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modifications
--enable-deepseek-v4-fp4-indexer.Accuracy
GSM8K
GPQA
Speed Tests and Profiling
Kernel-Level
SM100, B=256, H=64, D=128, NextN=1, block_kv=64.
E2E Fixed Long-Context
DeepSeek-V4-Flash, SM100, TP=4, flashinfer_mxfp4, fixed input ids, input_len=8192, output_len=1024, concurrency=256,
--disable-radix-cache, 2 repeats.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #26712479836
Latest PR Test (Extra): 🚫 Run #26794563741