Skip to content

[Perf] dsv41: Token-interleaved V4.1 KV caches for the FlashMLA V4.1 kernels - #45635

Closed
kpham-sgl wants to merge 1 commit into
sgl-project:mainfrom
kpham-sgl:dsv41-flashmla-v41-interleaved
Closed

kpham-sgl wants to merge 1 commit into
sgl-project:mainfrom
kpham-sgl:dsv41-flashmla-v41-interleaved

Conversation

@kpham-sgl

@kpham-sgl kpham-sgl commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The latest FlashMLA DeepSeek-V4.1 kernels read a token-interleaved KV cache (each token's data followed by its scales). Serve with them.

The kernels come from the sgl-flash-mla wheel built from sgl-project/FlashMLA's sgl branch (release workflow: #45651); this PR adds sgl-flash-mla==1.0.0 to the dependencies and leaves sgl-kernel's FlashMLA untouched for every other path.

Modifications

  • V41 / V41_FP4 pages store 528 B / 288 B per token (data then scales), unpadded; PagedKV::row, the Triton dequant, the request-window copy and kv_layout.py address the new layout.
  • MegaAttention decode and the V4.1 sparse decode call flash_mla.fused_norm_rope_attn_rope_cast.decode and flash_mla.flash_mla_with_kvcache from the wheel through sglang.kernels.ops.attention.dsv4.flashmla_v41.
  • PD layout handshake gains a ;token-interleaved suffix; HIP refuses the V4.1 layouts.
  • Tests: new test_flashmla_v41.py; mega-attention test uses the new op; V4.1 dequant tests enabled on SM100; c128 pool page expects 1056 B.

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #39741200967
Latest PR Test (Extra): ❌ Run #39741200881
Latest PR Test (AMD ROCm 10): ❌ Run #39741201256

@kpham-sgl
kpham-sgl force-pushed the dsv41-flashmla-v41-interleaved branch 6 times, most recently from 206ab41 to 6ae2775 Compare October 22, 2026 04:08
@kpham-sgl kpham-sgl changed the title [Perf] dsv41: Token-interleaved V4.1 KV caches read by FlashMLA 2e5429f [Perf] dsv41: Token-interleaved V4.1 KV caches for the FlashMLA V4.1 kernels Oct 22, 2026
@kpham-sgl
kpham-sgl force-pushed the dsv41-flashmla-v41-interleaved branch 2 times, most recently from 727fe5c to 2a87ae6 Compare October 22, 2026 07:06
Comment thread python/pyproject.toml
@@ -76,6 +76,7 @@ dependencies = [
"setproctitle",
"sgl-deep-ep==0.1.2.post1",
"sgl-deep-gemm==0.2.3",
"sgl-flash-mla==1.0.0",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder. 1.0.0 is the fork's flash_mla/VERSION, but the release workflow sets the published version from its dispatch input, and nothing is on PyPI yet. This pin must be set to whatever version the first sgl-flash-mla release gets before this PR can merge.

@kpham-sgl
kpham-sgl force-pushed the dsv41-flashmla-v41-interleaved branch from 2a87ae6 to b5b386f Compare October 22, 2026 07:32
@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

close in favor of #45893

@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

Superseded by #45893, which carries the serving side of this change on the sgl-flash-mla wheel.

@kpham-sgl kpham-sgl closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek dependencies Pull requests that update a dependency file jit-kernel memory-pool quant LLM Quantization sgl-kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant