Repository navigation
Conversation
…om num_seq_slots Port of NVIDIA#17154 (closed unmerged against main) onto feat/k3_26.08. DFlashWorker._lazy_init_ctx_buffers and DSv4DSparkWorker._lazy_init allocate their per-request slot pools once and reuse them for every later batch shape. Both sized the pool from spec_metadata.max_num_requests, which create_cuda_graph_metadata narrows to the captured graph bucket, so a first call on a small bucket pinned the pool to that bucket. Under disaggregated attention DP with overlap headroom the seq-slot pool is 2 * max_batch_size, which max_num_requests never covers. feat/k3_26.08 already threads num_seq_slots into DFlashSpecMetadata and DSparkSpecMetadata through get_spec_metadata. This change makes both workers size their pools from it, and normalizes its default in __post_init__ so directly built metadata and graph copies keep the full capacity. Co-authored-by: Xiwen Yu <13230610+VALLIS-NERIA@users.noreply.github.com> Signed-off-by: Viraat Chandra <viraatc@nvidia.com>
This was referenced Nov 3, 2026
viraatc
marked this pull request as ready for review
November 3, 2026 22:32
Author
|
/bot run |
Collaborator
|
PR_Github #83641 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #83641 [ run ] completed with state
|
1 task done
dc3671
reviewed
Nov 11, 2026
dc3671
reviewed
Nov 11, 2026
dc3671
reviewed
Nov 11, 2026
…atch, not the slot pool The seq-slot pool can be 2 * max_batch_size under disaggregated attention DP overlap, but a generation step never carries more than the engine's generation batch. Keep the un-narrowed max_num_requests on the metadata and pass it to configure_generation_autotuner, so the MXFP8 projection buckets top out at the real batch. The slot-exhaustion error now names max_batch_size, the knob users set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Viraat Chandra <viraatc@nvidia.com>
The base branch pins it with a direct .pin_memory(), which the pinned-memory pre-commit hook rejects for any PR that touches dflash.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Viraat Chandra <viraatc@nvidia.com>
This branch has not been deployed
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.
Description
Port of #17154 (closed unmerged against
main) ontofeat/k3_26.08.DFlashWorker._lazy_init_ctx_buffersandDSv4DSparkWorker._lazy_initallocate their per-request slot pools once and reuse them for every later batch shape. Both sized the pool fromspec_metadata.max_num_requests. That value is not a stable bound:create_cuda_graph_metadatanarrows it to the captured graph bucket, so a first call on a small bucket pins the pool to that bucket.compute_max_num_sequences) is2 * max_batch_size, whichmax_num_requestsnever covers.feat/k3_26.08already passesnum_seq_slotsintoDFlashSpecMetadataandDSparkSpecMetadatathroughget_spec_metadata. This PR:spec_metadata.num_seq_slots;num_seq_slots or max_num_requests) in both metadata__post_init__s, so directly built metadata and CUDA-graph copies keep the full capacity.The tests from #17154 do not apply here: the DSpark worker on this branch uses manager-owned draft pages instead of
_kv_windows. New tests are written against this branch's layout.Memory: when the pool is
2 * max_batch_size, the private DFlash context cache (used when the draft KV is not in the unified pool) doubles with it. The DSpark progress buffers are small.Test Coverage
test_dspark_worker.py::test_metadata_preserves_seq_slot_pool_in_graph_copytest_dspark_worker.py::test_worker_graph_bucket_uses_full_seq_slot_pool[pool-eq-batch|disagg-adp-2x-pool]test_dflash_worker.py::test_context_cache_spans_full_seq_slot_pool_on_graph_bucketSimpleNamespacemetadata stubs gainnum_seq_slots.feat/k3_26.08@e8a5275c4f(both test files): 37 passed, 3 failed with this PR; 33 passed, 3 failed on the unpatched base. The 3 failures are the same tests on both, so they predate this PR:test_dspark_worker.py::test_prepare_keeps_cuda_graph_slots_across_replays,::test_position_ceiling_covers_the_config_cap_and_grows_after_kv_estimationand::test_position_bound_holds_across_cuda_graph_replays. The 4 new test cases pass.test_freqs_table_prefers_the_runtime_ceiling_over_the_config_capneedspytest-mock.feat/k3_26.08@e8a5275c4fimage, with [https://nvbugs/6535874][fix] Size DFlash/DSpark worker slot pools from num_seq_slots #21305, [None][fix] Disaggregated generation: one-hot draft probabilities for placeholder drafts at the handoff #21496, [None][perf] Kimi K3: split-K FP8-KV MLA context FMHA for SM100/SM103 #21529 and [None][fix] Port #17850 to feat/k3_26.08: keep the KV cache estimation managers off the host tier #21530 applied together:_torch/executor,_torch/speculative/hw_agnostic,_torch/attention/test_attention_mla.pyandtest_fp4_mla.py, run fromtests/unittestwith its pytest config.PR Checklist