perf(deepseek-v4): accelerate indexer Q and packed FP8 quantization#563
Open
dongjiyingdjy wants to merge 9 commits into
Open
perf(deepseek-v4): accelerate indexer Q and packed FP8 quantization#563dongjiyingdjy wants to merge 9 commits into
dongjiyingdjy wants to merge 9 commits into
Conversation
dongjiyingdjy
force-pushed
the
perf/v4-trtllm-indexer-q
branch
from
July 1, 2026 01:10
886a3b9 to
3c45dfd
Compare
dongjiyingdjy
marked this pull request as ready for review
July 1, 2026 01:12
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Import Hadamard transforms through the tokenspeed-kernel transform facade after the old thirdparty module was removed. This keeps the TRT-LLM indexer Q preparation path registered instead of silently falling back. Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
dongjiyingdjy
force-pushed
the
perf/v4-trtllm-indexer-q
branch
from
July 6, 2026 06:22
0c08602 to
63f0b66
Compare
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
jasl
added a commit
to jasl/tokenspeed
that referenced
this pull request
Jul 9, 2026
…hain sm12x delta over the lightseekorg#563 cherry-picks (drop the picks and replay this when upstream merges): widen the capability gate + registration/kernel test guards to major 12, and cap the per-call launch envelope at 4096 tokens on consumer Blackwell — the envelope validated on GB10 (the 07-02 trial's full-suite wedges correlated with uncapped T=8192 calls). The chain is token-local (in-place RoPE, per-head Hadamard, per-token FP4 pack + weight scale), so deepseek_v4_prepare_indexer_q_mxfp4 runs larger prefill chunks in capped slices instead of falling back to the fused Triton path; the cap is exposed as trtllm_deepseek_v4_indexer_q_prepare_max_tokens for callers. GB10 microbench (07-02 trial): 14.6x at T=128, 2.8x at T=2048-4096 vs the Triton chain; the 30.5K-prefill profile attributes 1.13s/request to indexer_prepare_mxfp4 vs 0.08s for this chain on the vLLM fork.
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
Signed-off-by: jiyingd <87510204+dongjiyingdjy@users.noreply.github.com>
jasl
added a commit
to jasl/tokenspeed
that referenced
this pull request
Jul 11, 2026
…hain sm12x delta over the lightseekorg#563 cherry-picks (drop the picks and replay this when upstream merges): widen the capability gate + registration/kernel test guards to major 12, and cap the per-call launch envelope at 4096 tokens on consumer Blackwell — the envelope validated on GB10 (the 07-02 trial's full-suite wedges correlated with uncapped T=8192 calls). The chain is token-local (in-place RoPE, per-head Hadamard, per-token FP4 pack + weight scale), so deepseek_v4_prepare_indexer_q_mxfp4 runs larger prefill chunks in capped slices instead of falling back to the fused Triton path; the cap is exposed as trtllm_deepseek_v4_indexer_q_prepare_max_tokens for callers. GB10 microbench (07-02 trial): 14.6x at T=128, 2.8x at T=2048-4096 vs the Triton chain; the 30.5K-prefill profile attributes 1.13s/request to indexer_prepare_mxfp4 vs 0.08s for this chain on the vLLM fork.
jasl
added a commit
to jasl/tokenspeed
that referenced
this pull request
Jul 11, 2026
…hain sm12x delta over the lightseekorg#563 cherry-picks (drop the picks and replay this when upstream merges): widen the capability gate + registration/kernel test guards to major 12, and cap the per-call launch envelope at 4096 tokens on consumer Blackwell — the envelope validated on GB10 (the 07-02 trial's full-suite wedges correlated with uncapped T=8192 calls). The chain is token-local (in-place RoPE, per-head Hadamard, per-token FP4 pack + weight scale), so deepseek_v4_prepare_indexer_q_mxfp4 runs larger prefill chunks in capped slices instead of falling back to the fused Triton path; the cap is exposed as trtllm_deepseek_v4_indexer_q_prepare_max_tokens for callers. GB10 microbench (07-02 trial): 14.6x at T=128, 2.8x at T=2048-4096 vs the Triton chain; the 30.5K-prefill profile attributes 1.13s/request to indexer_prepare_mxfp4 vs 0.08s for this chain on the vLLM fork.
jasl
added a commit
to jasl/tokenspeed
that referenced
this pull request
Jul 12, 2026
…hain sm12x delta over the lightseekorg#563 cherry-picks (drop the picks and replay this when upstream merges): widen the capability gate + registration/kernel test guards to major 12, and cap the per-call launch envelope at 4096 tokens on consumer Blackwell — the envelope validated on GB10 (the 07-02 trial's full-suite wedges correlated with uncapped T=8192 calls). The chain is token-local (in-place RoPE, per-head Hadamard, per-token FP4 pack + weight scale), so deepseek_v4_prepare_indexer_q_mxfp4 runs larger prefill chunks in capped slices instead of falling back to the fused Triton path; the cap is exposed as trtllm_deepseek_v4_indexer_q_prepare_max_tokens for callers. GB10 microbench (07-02 trial): 14.6x at T=128, 2.8x at T=2048-4096 vs the Triton chain; the 30.5K-prefill profile attributes 1.13s/request to indexer_prepare_mxfp4 vs 0.08s for this chain on the vLLM fork.
jasl
added a commit
to jasl/tokenspeed
that referenced
this pull request
Jul 12, 2026
…hain sm12x delta over the lightseekorg#563 cherry-picks (drop the picks and replay this when upstream merges): widen the capability gate + registration/kernel test guards to major 12, and cap the per-call launch envelope at 4096 tokens on consumer Blackwell — the envelope validated on GB10 (the 07-02 trial's full-suite wedges correlated with uncapped T=8192 calls). The chain is token-local (in-place RoPE, per-head Hadamard, per-token FP4 pack + weight scale), so deepseek_v4_prepare_indexer_q_mxfp4 runs larger prefill chunks in capped slices instead of falling back to the fused Triton path; the cap is exposed as trtllm_deepseek_v4_indexer_q_prepare_max_tokens for callers. GB10 microbench (07-02 trial): 14.6x at T=128, 2.8x at T=2048-4096 vs the Triton chain; the 30.5K-prefill profile attributes 1.13s/request to indexer_prepare_mxfp4 vs 0.08s for this chain on the vLLM fork.
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.
Summary
tokenspeed-kernelboundary.mainand preserve the algorithm-specific CUDA Graph padding behavior from fix(perf): fix qwen3.5 tp8 agentic ci perf regression #594: MTP attention rows use request slot 0, DFLASH rows use the reserved sentinel, and state writes continue to use the sentinel sink.tokenspeed_kernel.ops.transform. The oldthirdparty.fast_hadamard_transformmodule was removed onmain; its guarded import silently disabled the optimized Q-preparation path.The two CUDA adapters are derived from TensorRT-LLM commit
1a4fc3e05cea6e2843db8ba7a14e0c3a1a2a7018and retain NVIDIA's Apache-2.0 attribution.Performance
Indexer Q
On B200, the eager Q-preparation microbenchmark improves from 1.57x at 128 tokens to 13.28x at 4,632 tokens. Small eager shapes remain on Triton because the multi-launch CUDA chain is slower there.
One fresh-server p1/p2/p4/p8 matched run improved TPS/GPU by 13.43%, 16.29%, 18.86%, and 20.73%, respectively. These endpoint numbers remain provisional because they have one paired repeat and predate the exact current stacked HEAD.
Packed FP8 quantization
With production
PDL=False, the B200 quantization microbenchmark improves:Two matched V4-Pro p1/p2/p4/p8 endpoint pairs completed all requests. Their aggregate median improvements were:
The aggregate medians are +3.98% TPS/GPU and +3.60% TPOT. The strict overall performance result remains inconclusive because p8 TTFT changed sign across the two pairs and no third pair was run during exploratory validation.
Prefill host synchronization cleanup
The runtime derives prefill workspace and indexer metadata from CPU length mirrors, reuses persistent request/prefix buffers for state reset, removes dead indexer slot metadata, and writes top-k output directly into the destination buffer. CUDA Graph tail padding preserves both the speculative verify-width contract and reserved state-write sink rows.
Main-rebase compatibility fix
A matched TP8 p8 cold SWE-smith diagnostic used eight concurrent, byte-identical prompts with 530,171 total prompt tokens and 500 output tokens per request. Restoring the registered Hadamard path changed:
This profile contains complete prefill and decode, with 8/8 successful requests. It is diagnostic attribution, not a replacement for a full matched p1/p2/p4/p8 sweep.
Validation
Exact rebased HEAD:
63f0b66d4.pre-commit run --all-files: passed.Risk and fallback
Both SM100 fast paths are optional optimizations.
The indexer path falls back to the existing fused Triton implementation for small batches and unsupported architectures, shapes, dtypes, layouts, or alignments. It applies RoPE to
index_qin place; the production caller supplies a disposable projection output. TensorRT-LLM evaluation order may produce rare FP4 rounding-boundary differences, while reference tests and the V4-Flash gate pass.The packed quantizer requires a contiguous, aligned CUDA BF16 matrix with
Kdivisible by 128 and the packed-UE8M0 scale contract. Unsupported inputs or an unavailable extension use the existing quantization path. PDL remains disabled by default, and the adapter preserves TokenSpeed's existing tiny-scale floor.The prefill cleanup relies on CPU length mirrors remaining consistent with dispatch. Its two pinned staging slots match the scheduler's current maximum overlap depth of one; a deeper pipeline must expand the ring to
depth + 1.Follow-up
Once equivalent APIs are exposed by
tokenspeed_trtllm_kernel, replace both standalone vendored extensions--the indexer-Q kernels and packed FP8 quantizer--with imports from that package.