Skip to content

[DeepSeek-V4.1] Replace Hopper prefill Torch indexer fallback with triton - #39086

Open
vladnosiv wants to merge 20 commits into
sgl-project:dsv4.1from
vladnosiv:dsv41-hopper-fp8-prefill
Open

vladnosiv wants to merge 20 commits into
sgl-project:dsv4.1from
vladnosiv:dsv41-hopper-fp8-prefill

Conversation

@vladnosiv

@vladnosiv vladnosiv commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Motivation

Based on #38798

V4.1 prefill path on Hopper currently reaches _low_ratio_index_topk_torch fallback.

This change replaces that Hopper prefill fallback with a Triton FP8 path.

Known limitation: the path is noticeably more optimal than the current torch-folback, but it still materializes fp32 scores for the entire context and then calls the top-k kernel.

Modifications

  • Add an SM90 Triton path for FP4 index-K unpacking and FP8 prefill scoring
  • Send its scores through the existing ragged top-k kernel (prefill-only change, decode path is unchanged)

Accuracy Tests

gsm8k

baseline (torch fallback)

Accuracy: 0.880
Invalid: 0.000
Latency: 38.305 s
Output throughput: 492.101 token/s

current changes

Accuracy: 0.900
Invalid: 0.000
Latency: 36.707 s
Output throughput: 510.689 token/s

Speed Tests and Profiling

Cold Prefill Benchmark (4xH200)

Input Torch fallback SM90 Triton Throughput
2K 10,649 tok/s 14,341 tok/s +34.7%
4K 13,779 tok/s 16,681 tok/s +21.1%
8K 15,607 tok/s 17,871 tok/s +14.5%
16K 15,255 tok/s 17,728 tok/s +16.2%
32K 14,481 tok/s 17,535 tok/s +21.1%
64K 13,100 tok/s 16,937 tok/s +29.3%
128K 10,904 tok/s 15,855 tok/s +45.4%
256K 8,186 tok/s 14,004 tok/s +71.1%

Serve command (4xH200):

SGLANG_ENABLE_DSV41_ENGRAM_HOST_TABLE=1 \
SGLANG_DSV41_ENGRAM_HOST_TABLE_LAYOUT=private \
SGLANG_DSV41_ENGRAM_HOST_TABLE_PIN=1 \
sglang serve \
  --model-path deepseek-ai/DeepSeek-V4.1-Flash \
  --served-model-name deepseek-ai/DeepSeek-V4.1-Flash \
  --host 0.0.0.0 \
  --trust-remote-code \
  --tp 4 \
  --ep-size 4 \
  --enable-decoder-swa-bounded-replay \
  --chunked-prefill-size 8192 \
  --mem-fraction-static 0.80 \
  --reasoning-parser auto \
  --tool-call-parser auto \
  --flashinfer-mxfp4-moe-precision fp8

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #34830001786
Latest PR Test (Extra): ❌ Run #34830001482
Latest PR Test (AMD ROCm 10): ❌ Run #34830001629

hnyls2002 and others added 13 commits September 9, 2026 22:35
Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: DarkSharpness <2040703891@qq.com>
Co-authored-by: DarkSharpness <76582120+DarkSharpness@users.noreply.github.com>
Co-authored-by: Ke Bao <ispobaoke@gmail.com>
Co-authored-by: Khoa Pham <khoa.pham@radixark.ai>
Co-authored-by: Xiaoyu Zhang <1182563586@qq.com>
Co-authored-by: Xiaoyu Zhang <xiaoyu.zhang@radixark.ai>
Co-authored-by: Yuhao Yang <47235274+yhyang201@users.noreply.github.com>
Co-authored-by: Yuwei An <ayw.sirius19@gmail.com>
Co-authored-by: Zhichen Zeng <zczeng@uw.edu>
Co-authored-by: Ziyi Xu <ziyi.xu@radixark.ai>
…or the lanes outside a row (sgl-project#38829)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…L names (sgl-project#38951)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ok/s) (sgl-project#38976)

Co-authored-by: DarkSharpness <2040703891@qq.com>
Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
…oject#38963)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-project#39068)

Co-authored-by: DarkSharpness <2040703891@qq.com>
Co-authored-by: DarkSharpness <ziyi.xu@radixark.ai>
@vladnosiv
vladnosiv force-pushed the dsv41-hopper-fp8-prefill branch from bfb1665 to ebc404c Compare September 11, 2026 13:01
…) (sgl-project#39098)

Co-authored-by: weireweire <20922698+weireweire@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants