Skip to content

[AMD] Enable DeepSeek-V4 FP4 Indexer on ROCm gfx950 - #36581

Closed
AMD-yanfeiwang wants to merge 10 commits into
sgl-project:mainfrom
AMD-yanfeiwang:rocm/fp4-indexer
Closed

AMD-yanfeiwang wants to merge 10 commits into
sgl-project:mainfrom
AMD-yanfeiwang:rocm/fp4-indexer

Conversation

@AMD-yanfeiwang

@AMD-yanfeiwang AMD-yanfeiwang commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Enable the DeepSeek-V4 FP4 Indexer (--enable-deepseek-v4-fp4-indexer) on AMD Instinct MI355X (gfx950) through AITER. NVIDIA SM100/SM120 behavior is unchanged.

Requires ROCm/aiter#5034 and the FP4 prefill module-lifetime fix ROCm/aiter#5126.

Modifications

  • Add the AITER FP4 Q/K and paged-MQA logits adapter for decode, prefill, and target verification.
  • Integrate the ROCm cache layout, memory accounting, CUDA graph metadata, and shared RoPE tables.
  • Gate the feature on gfx950 and the required AITER API; reject unsupported HIP HiCache and PD configurations.
  • Add physical zero guards for AITER page-table lookahead while preserving logical sequence lengths.
  • Add unit, MI355X integration, and documentation coverage.

The initial ROCm scope is single-node.

Accuracy Tests

Validated on 8x AMD Instinct MI355X (gfx950) with ROCm 7.2.4:

  • GSM8K (8-shot, greedy, 512 max new tokens): 1,255/1,319 correct (95.15%) with 0 invalid responses.

Speed Tests and Profiling

Common environment: 8x AMD Instinct MI355X (gfx950), DeepSeek-V4-Pro, DSV4 attention, FP8 KV cache, and page size 256. Each serving profile below lists its TP/DP, radix-cache, speculative-decoding, and sequence-length settings. Within every paired comparison, the only FP4 functional difference is --enable-deepseek-v4-fp4-indexer.

End-to-End Serving

8K/1K Standard Serving

Concurrency Repetitions FP8 output tok/s FP4 output tok/s FP4 change FP8 CV FP4 CV
32 5 1275.296 1283.841 +0.670% 0.506% 0.358%
256 3 2328.684 2366.072 +1.606% 0.223% 0.093%
Concurrency FP8 TPOT FP4 TPOT TPOT improvement FP8 TTFT FP4 TTFT TTFT improvement
32 20.1347 ms 20.0739 ms +0.302% 5084.51 ms 4985.86 ms +1.940%
256 71.8514 ms 70.8825 ms +1.349% 38963.75 ms 38194.20 ms +1.975%

128K/1K DP8 EAGLE/MTP Serving

Global concurrency FP8 decode tok/s FP4 decode tok/s FP4 change FP8 median TPOT FP4 median TPOT TPOT improvement
32 2281.764 2246.078 -1.564% 13.8862 ms 14.1209 ms -1.690%
64 3810.882 3876.540 +1.723% 16.3605 ms 16.3320 ms +0.174%
128 6105.827 6157.750 +0.850% 20.8970 ms 20.8646 ms +0.155%

Capacity

Indexer Auto-sized tokens Change
FP8 7,923,200 baseline
FP4 8,228,864 +305,664 (+3.858%)

Paged-MQA Logits Kernel

The MI355X rows compare production-layout AITER FlyDSL FP4 against preshuffled Gluon FP8 in the same process; Q/K are prequantized and both paths write FP32 logits. Lower latency is better.

Platform Shape FP8 FP4 FP4 speedup
MI355X B256 / L2048 16.40 us 11.32 us 1.45x
MI355X B256 / L8192 53.54 us 28.01 us 1.91x

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 #33465268058
Latest PR Test (Extra): ❌ Run #33465267933
Latest PR Test (AMD ROCm 7.2): ❌ Run #33465268106

@AMD-yanfeiwang

Copy link
Copy Markdown
Contributor Author

128K ROCm fault root cause and fix

The TP8/DP8-attention + EAGLE + radix-on FP4 fault has been independently localized and fixed upstream in ROCm/aiter#5126.

Root cause: the AITER paged FP4 prefill compiler specialized on changing page-table width behind a 32-entry LRU. A 128K chunked prefill creates 125 widths. Eviction releases the FlyDSL launcher, whose GpuJitModule.__del__ calls mgpuModuleUnload/hipModuleUnload without synchronizing queued dispatches. ROCm Debug Agent captured an unresolved kernel_object with grid=131072, workgroup=256, and 2048 illegal-instruction waves, exactly matching this kernel's 512-CTA x 256-thread launch. Full --disable-overlap-schedule reproduced the same signature, while the FP4-off 128K C32/C64/C128 controls passed.

Production A/B: on the exact PR image and 8x MI355X setup, changing only the prefill compiler cache to maxsize=None made the normal-overlap global-C16 128K warmup and measured wave pass. It crossed the prior 126720 cached + 1024 + 256 failure boundary with zero HSA/illegal-instruction markers; all eight scheduler workers and the health endpoint remained alive afterward.

Additional validation: the complete AITER paged-prefill/varqlen op test passed (4 prefill + 5 varqlen cases, exact-reference cosine 1.0), along with focused cache-policy, Black 26.3.0, Ruff 0.15.7, py_compile, and git diff --check.

This is a #36581 integration-level stability regression because the new path makes the defect reachable, but the underlying bug is the pre-existing AITER/FlyDSL code-object lifetime policy rather than SGLang scheduler or allocator logic.

@AMD-yanfeiwang
AMD-yanfeiwang force-pushed the rocm/fp4-indexer branch 3 times, most recently from a47bc82 to 8f31071 Compare September 1, 2026 02:47
@AMD-yanfeiwang

Copy link
Copy Markdown
Contributor Author

#37353 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amd amd-aiter-not-ready deepseek documentation Improvements or additions to documentation hicache Hierarchical Caching for SGLang jit-kernel memory-pool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants