[None][fix] Announce MTP shapes to attention metadata in layer-wise benchmarks - #17247
Conversation
WalkthroughChangesGeneration metadata
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8aba404 to
f2a23c1
Compare
|
The DSA half checks out: One thing before this lands: the call is not inert on non-DSA backends. So an existing TRTLLM-backend layer-wise run at Not blocking on the missing unit test — the reasoning for skipping it is sound. |
…enchmarks
seq_len_q > 1 means MTP: each request submits 1 + num_draft tokens. In serving
the executor announces that via update_spec_dec_param(), the only place
max_draft_tokens is set. The harness never called it, so max_draft_tokens stayed
0 while batch_size * seq_len_q tokens were submitted. The DSA indexer's
kv_lens_cuda_2d then stayed one column wide, and DeepGEMM aborted on
DG_HOST_ASSERT(batch_size == __batch_size and next_n == _next_n)
Call it for DSA generation packs with seq_len_q > 1 so the buffers are rebuilt at
the right widths. Masking stays disabled; only shapes are announced.
The guard is kv_lens_cuda_2d rather than the method itself: update_spec_dec_param
is on the base metadata class, so hasattr() would admit every backend, and the
base sets max_total_draft_tokens unconditionally -- which flows to the attention
op cache key and FMHA kernel selection. kv_lens_cuda_2d exists only on DSA
metadata, so non-DSA runs are untouched by construction. On DSA the value now
matches what the executor sets for a real MTP step.
Verified on GB200 (8 ranks, DSv4-Pro, batch 32 / seq_len_q 4 / 2049 KV): aborted
before, 1985.4 us mean after.
Signed-off-by: Zhenhuan Chen <zhenhuanc@nvidia.com>
f2a23c1 to
5bc9c09
Compare
|
Good catch, and the trace is right — I checked each link: Pushed a fix: the guard is now One amendment to your framing, in the interest of not overclaiming in the other direction: the DSA override calls On the deeper point: the harness should not have to announce this at all. The consumer already derives the real width locally ( |
|
/bot run --disable-fail-fast |
|
PR_Github #63775 [ run ] triggered by Bot. Commit: |
|
PR_Github #63775 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #63885 [ run ] triggered by Bot. Commit: |
|
PR_Github #63885 [ run ] completed with state |
Description
seq_len_q > 1in the layer-wise benchmarks means MTP: each request submits1 + num_drafttokens. In serving, the executor announces that viaupdate_spec_dec_param()— the only placemax_draft_tokensis set on the attention metadata. The harness never called it, somax_draft_tokensstayed at its default of0whilecreate_run_pack()submittedbatch_size * seq_len_qtokens.The DSA indexer's 2D
context_lensbuffer (kv_lens_cuda_2d, shaped(max_num_sequences, 1 + max_draft_tokens)) therefore stayed one column wide. The call site already derives the real width locally (dsa.py:next_n = num_gen_tokens // num_generations, then sliceskv_lens_cuda_2d[:num_generations, :next_n]), so slicing 4 columns out of a 1-column buffer yielded 1, and DeepGEMM aborted incsrc/apis/attention.hpp:Concretely,
batch_size 32/seq_len_q 4submitted 128 tokens against 32 rows of KV length and never ran an iteration.Fix: call
update_spec_dec_param()for DSA generation packs withseq_len_q > 1, so the DSA override rebuildskv_lens_cuda_2d, the expanded MTP buffers and the radix/heuristic scratch at the right widths. Masking stays disabled (is_spec_decoding_enabled=False) — only shapes are announced.The guard is
hasattr(attn_metadata, "kv_lens_cuda_2d")rather than the method name:update_spec_dec_paramlives on the base metadata class, so ahasattrcheck on the method would admit every backend, and the base setsmax_total_draft_tokensunconditionally — a value that reaches the attention op cache key and FMHA/XQA kernel selection.kv_lens_cuda_2dexists only on DSA metadata, so non-DSA runs are untouched by construction. On DSA the value now matches what the executor sets for a real MTP step.Longer term the cleaner shape is for
max_draft_tokensto be a declared field onDSAMetadataParams, alongside the seven other construction-time settings__post_init__already copies before allocating the indexer buffers — then no announcement or rebuild is needed at all. That is a runtime change under different ownership and is deliberately not in this PR.Test Coverage
No new unit test: the layer-wise benchmarks are a manual profiling harness with no CI target, and reproducing this needs 8 GB200 ranks plus a DeepSeek-V4 checkpoint. The change cannot execute for anything CI exercises (
seq_len_q == 1,CTXpacks, and any non-DSA backend).Verified on GB200, 8 ranks / 2 nodes, DeepSeek-V4-Pro,
MEGAMOE_DEEPGEMM,kv_cache_dtype fp8:batch_size 32,seq_len_q 4,seq_len_kv_cache 2049attention.hppbatch_size 32,seq_len_q 1,seq_len_kv_cache 2049PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
Dev Engineer Review
Runner.create_run_packnow updates speculative-decoding shape metadata only for multi-tokenGENruns with DSA metadata. It sets draft-token widths while keeping speculative decoding and tree modes disabled. This addresses DSA buffer sizing forseq_len_q > 1.The implementation should narrow the guard to DSA metadata. The base metadata class also defines
update_spec_dec_param(), so ahasattrcheck can modifymax_total_draft_tokensfor non-DSA backends. This value can affect attention configuration, cache keys, and FMHA/XQA kernel selection.No configuration files or test-list files changed.
QA Engineer Review
No test changes.