Repository navigation
[FlyDSL] DeepSeek-V4.1-Flash mono decode layer (WIP) - #6196
Fangzhou-Ai wants to merge 3 commits into
Conversation
…layer mono kernel (WIP) dsv41_mega_attn: the attention module of the 32 layers without their own compressor / indexer in two persistent launches (M <= 48, TP2 / TP4, vLLM's fp8_ds_mla KV records and row-major MXFP8 weights). dsv41_mono: an ATOM-style fused decoder layer (mHC seams, attention, both TP all-reduces in-kernel over peer memory, the MoE) in two launches. The seam and MoE stages are vendored from ROCm/ATOM (MIT) with vLLM numerics for the shared expert and epoch-tagged hand-offs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
…red code - Drop the standalone attention module (dsv41_mega_attn host and builders); its stages move to kernels/dsv41_mono/attention/ as the mono layer's. - Rename the vendored ATOM packages: atomfw -> common, atomv41 -> stages. Every adapted file names its ROCm/ATOM origin in its header. - Remove what the layer never runs: ATOM's own attention and indexer kernels, its engine-side modules, the step fence (epoch tags and parity-alternating peer regions replace per-step clears), debug mailboxes and build-time access tracing. - stages/seam.py: the mHC seam stages specialized to the mono layer (norm hands its bf16 row to a caller store); stages/gemv.py: the FP8 GEMV and LDS helpers the MoE shares. - MoE router: keep the logits f32 as vLLM's gate does (bf16-rounded logits flipped top-6 picks near ties: layer 3 out cos 0.970 -> 0.9998). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
At TP4 a rank's routed intermediate is 576 columns, which vLLM's loader pads to 640 with zero weights; the ug stage writes only the 576. The down stage's scaled 16x16x128 MFMA covers 4.5 K steps, so its last step read 64 never written columns: stale scratch (ATOM zeroes it every step, the mono layer's epoch tags do not), whose NaN patterns survived the zero weights. Zero those operand halves and give their groups the unit scale, in registers; TP2 (1152 columns, 9 whole steps) builds the same code as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
|
Superseded by vllm-project/vllm#60397 |
Summary
Work in progress: an ATOM-style mono decode layer for DeepSeek-V4.1-Flash on MI355X (gfx950), written in FlyDSL for vLLM to import. One decoder layer runs in two persistent launches:
The launches replace roughly 40 kernels per layer on vLLM's ROCm path. Both are drop-ins for
DeepseekV4DecoderLayer.forward(same tensors at the layer boundary).Scope:
Opened as a draft for early review of the structure. Same-node baselines are still running; see Status.
Layout
stages/andcommon/are adapted from ROCm/ATOM (MIT License; commit97359d6,atom/models/deepseek_v41/monoandatom/mono). Every adapted file names its origin in its header. The changes from ATOM:mxfp8_e4m3_quantizeandsilu_and_mul_with_clampmatch vLLM.Design notes
Test results (MI355X, real checkpoint weights)
The reference is vLLM's own modules in a TP process group:
DeepseekV4MoE, the mHC seam ops, the ROCm attention chain, and the all-reduce. The harness lives outside this repo for now. Full matrix: https://claude.ai/artifact/Duic63s8CfzydY2zhKRdWpKernel-level performance, µs per layer. Each run chains 8 layers of one type back to back in one HIP graph, with cold weights. vLLM's path is captured under its
graph_capture, so its all-reduces use the graph-registered custom all-reduce. 96 points: TP2/TP4 × concurrency 1–8 × 1–6 tokens per request × 2 layer types. Every point is faster.At M=48 both paths are bound by expert-weight reads: about 200 distinct experts × 8.8 MB per layer at TP2.
Kernel-level accuracy. Layer 0 of every point, both paths from the same inputs and caches:
Model eval (vLLM integration, separate PR; TP2, the InferenceX#3690 recipe with DSpark block rejection). InferenceX's GSM8K task, 5-shot, full 1,319, temperature 0, concurrency 8:
DSpark mean acceptance length over that eval: 3.911 with mono vs 3.949 baseline. Single-stream greedy decode, 1,024 tokens: 273.5 vs 208.9 tok/s (1.31×).
AgentX e2e, TP2 (InferenceX#3690 recipe, golden acceptance 3.51, 3600 s per point). The baseline is InferenceX's own run of the same image and recipe (run 37510490434):
AgentX e2e, TP4 (same baseline run; ¹ scored from aiperf's complete summary, see below):
¹ The shared home volume briefly hit its quota mid-run, which left holes in these two points' per-request exports. aiperf's summary covers every request, and on the intact points it reproduces InferenceX's p90 interactivity (1 / p90 ITL) and total throughput ((input + output tokens) / duration) exactly.
TTFT p90 was higher in our runs (0.47–0.81 → 1.08–1.28 s). The mono path does not touch prefill. We ran the four points at once on one node, which shares CPU tokenization of the ~300K-token prompts and the host-resident TP2 Engram tables; InferenceX runs each point alone. A same-node baseline will follow.
Fixes found by these tests
Status / TODO
op_tests/)VLLM_ROCM_DSV41_MONO=1) and GSM8KAI assistance
This PR was written with substantial AI assistance (Claude Code). I am reviewing it line by line before it leaves draft. Kernel-level results above come from the harness described; AgentX e2e results will be added before review.
🤖 Generated with Claude Code