Repository navigation
Conversation
caihuali95
requested review from
BBuf,
DarkSharpness,
Fridge003,
HaiShaw,
HydraQYH,
Qiaolin-Yu,
Ying1123,
alphabetc1,
celve,
hanming-lu,
hebiao064,
hnyls2002,
huangtingwei9988,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann,
yizhang2077 and
yuan-luo
as code owners
October 9, 2026 07:40
caihuali95
force-pushed
the
mainline/unified-fused-window-state-drafts
branch
2 times, most recently
from
October 13, 2026 22:19
328cc68 to
3d73c82
Compare
3 of 5 tasks
caihuali95
force-pushed
the
mainline/unified-fused-window-state-drafts
branch
2 times, most recently
from
October 14, 2026 07:01
b26c362 to
a9fb67b
Compare
ch-wan
force-pushed
the
mainline/unified-fused-window-state-drafts
branch
from
October 18, 2026 07:21
a9fb67b to
53a0d44
Compare
3 of 4 tasks
4 of 5 tasks
ch-wan
force-pushed
the
mainline/unified-fused-window-state-drafts
branch
from
October 18, 2026 08:13
53a0d44 to
3576c0c
Compare
`mask_ptr` is an int8 buffer, so `final_mask &= custom_mask` promotes the whole boolean mask to i8. Every arithmetic use survives that -- `final_mask.to(tl.int32)`, `tl.where(final_mask, ...)` -- but a score_mod receives this mask and passes it to `tl.load`, which requires i1: score_mod.py:52:8: error: 'tt.load' op operand #1 must be 1-bit signless integer or ranked tensor of 1-bit signless integer values, but got 'tensor<128x64xi8>' Triton then fails to build the IR at all, and the caller reports only "Capture cuda graph failed: error encountered during parsing". Reaching it needs a custom mask AND a score_mod at once, which is why it has stayed latent: the custom mask arrives from speculative verify and the score_mod from Inkling's relative-bias attention, so it takes an Inkling target running speculative decoding. The kernel is chosen by the attention backend, not the pool, so this is independent of --enable-unified-memory and of the fused draft series; both arms hit it. All three branches that fold a loaded mask into `final_mask` are narrowed at the load -- two in `_fwd_kernel`, one in `_fwd_kernel_unified`. The buffer holds 0/1, so `!= 0` and the previous bitwise AND agree on every value it can carry; `!= 0` also states the intent, since a mask is a predicate rather than a bit pattern.
…stry Until now a placement had exactly one host: `FusedDraftPlacement` held the "full" region and each runner's lane count, and `place_fused_draft` carried the other layer kinds as ad-hoc counters, so a second sub-pool a draft could fuse into would mean a wider signature, a keyed placement, and a new arm in the decline logic. The module now separates what the draft HAS (`LAYER_FULL` / `LAYER_WINDOW` / `LAYER_STATE`, one `DraftLayerSet` each in `DraftKVProfile.kinds`) from what a sub-pool can CARRY (`HostKind`, keyed by sub-pool name, registered in `HOST_KINDS`). A host kind says which layer kind it serves first, which binder family the draft worker uses, and which host it falls back to under the one-region-one-geometry fold rule; `place_fused_draft` walks the registry over the sub-pools the target builds (`_unified_host_names`), and `FusedDraftPlacement` keys `regions` and `RunnerLanes.ranges` by host name (`region(host)`, `hosts()`, `lanes_for(runner, host)`, `from_counts`), so registering a kind is the whole extension. Every sub-pool factory asks the placement for its own region by name, and the HybridSWA boot solve prices the swa entry the same way it prices the full one. Only "full" is registered here, so every draft places or declines exactly as before: a layer kind no host serves declines with the layer count, and the per-host factories keep deciding whether a declined draft may fall back to a private pool. The K/V row rules (asymmetric rows, the entry-part alignment) apply per layer kind, and every dense region carries the host's KV dtype. `note` records a fold, and the boot log walks `HostKind.describe`, keeping the dense line byte-identical. The draft worker binds through `unified_draft_pool.DRAFT_BINDERS`, one binder per host family, each refining a `FusedDraftBinding`; the dense binder is the former `bind_fused_draft`. `draft_state_layer_ids` reports state only for a per-depth conv-chain MTP head, the one the baseline serves with a cloned state cache; a NEXTN head of a linear-attention trunk is mamba-ish by config class but a full-attention block. `fused_entry_bytes` prices through a builder table keyed by sub-pool name. `kv_cache_hook`'s EAGLE host assert no longer names the full-attention envelope as the only home. Tests: the placement suite moves to the kind-keyed profile and the mapping placement (`counts=` / `regions=`), and gains the registry rules (duplicate host, second primary host, unregistered fallback, registration order, the dense boot line), the no-host decline, the per-depth state derivation with its NEXTN negative, and a boot-log walk; the five fixtures that build a placement move to the mapping API.
…as layers An MTP depth whose block is sliding-window gets a draft `SWAKVPool` with an empty full side. `get_v_head_dim` always read the full side's value buffer, and the Triton backend of an Inkling MTP head (mamba-ish, matching full/swa value widths) asks the pool for it at construction, so the head died with an IndexError before serving a token, on the baseline pool too. The lead side is now the full side when it has layers and the swa side otherwise; a mixed pool answers exactly as before.
…ow layers A draft's sliding-window layers now fuse into the target's swa sub-pool. `WindowHostKind` registers as the host for `LAYER_WINDOW` with the full sub-pool as its fold-back: it admits a draft window no wider than the target's. An undeclared window, a wider one, or a host without an swa sub-pool folds the layers into the full sub-pool with their own row geometry, noted in the boot log; when the two row geometries differ the fold is refused and the whole draft declines, which the hybrid-SWA and mamba factories turn into a boot error for an EAGLE draft. The swa sub-pool keeps what a fused draft reads, not only the target's window. A multi-layer MTP draft's widened extend starts `front` rows below the committed length, so each depth reads its window back from there, `front` tokens past the target's reads. `BaseSpecWorker.draft_swa_window` reports that reach (0 by default; the multi-layer EAGLE worker answers the widest window among its depths bound to the swa sub-pool plus its front rows), the scheduler hands it to `build_kv_cache`, and `CacheInitParams.swa_retain_window` resolves the wider of the two. A built cache records the reach as `draft_swa_window` and `BasePrefixCache.swa_retain_window` answers the same for it, so a cache that records none keeps its window. Only what frees or unlocks a running request's SWA reads it: the decode eviction trigger, the free in `evict_sliding_windows`, the free at a checkpoint insert, and the leaf-lock release. The match validator, the locks, the budgets and the PD tail keep `sliding_window_size`. Placement grows a `PlacementContext` (host names, target window, the asymmetric-row vouch, the draft worker's backends) and a `prerequisite` hook beside `admits`: a window layer is served fused only when the draft runs on a backend that builds the per-step sliding-window rails, which is the Triton multi-step draft backend, so any other draft backend declines the draft rather than sink-write its window layers. The draft worker binds `UnifiedDraftSWAKVPool`: one dense side per host sub-pool, routed per layer exactly like the target's composite so the attention backends run their swa rail for it; a window layer's write needs the swa loc and lands in the swa entry's draft part, and the full side writes through `loc` (the capture-stable `full_loc` alias is sized for the target's writes, not a per-step draft slice). The dense binder returns it whenever the runner holds swa lanes, and it reads each layer's kind from the PLACEMENT rather than re-deriving it from the draft config: the runner-local narrowing (`adjust_hybrid_swa_layer_ids`) clips that config's window list to the runner's own block range, so a per-depth head above the first block reports no window layer while the target placed it in the swa sub-pool from the pristine config. The config is consulted only when one runner holds both kinds, which means a replicated head carrying every draft layer. `fused_entry_bytes` gains the "swa" builder, from the same SWA head geometry the factory allocates, so the priced and the allocated entry agree, and the draft's KV dtype check covers every region it binds. A multi-layer draft plans each draft extend once, through its first depth's runner, and every depth reads that plan. With window layers placed per depth, a later depth can route window layers the first does not (Inkling's first depth is dense, its second a window layer), and the plan resolved a read's sub-pool through the runner that built it, which has none. `KVLocPlan.has_read_table` and `read_table` now take the reader, as `write_ids` already does, and the translator passes itself; called on the plan alone they keep resolving through its own runner. The tables stay keyed by sub-pool, so every depth still shares one build. An Inkling MTP depth listed in `mtp_local_layer_ids` keeps the trunk's window when the checkpoint declares no `mtp_local_extent`; the draft backend gates its whole sliding-window rail on the window being set. Tests: window placement rows (MiMoV2MTP shape, the per-depth Inkling shape, the four fold cases, the geometry-mix decline, the rail-backend decline), a per-depth runner binding swa against a clipped config that lists no window layer, the draft worker binding the composite, the translator handing the draft the target's swa write ids and window read table byte for byte, a window depth reading its window ids and table from a plan a dense depth built (an AttributeError before), the swa fused entry replacing the per-layer swa draft term in the boot solve, and the swa builder pricing this runner's window layers. The draft's reach: the multi-layer worker declaring 516 for three swa-bound depths at window 511 with 5 front rows (and nothing past the window for a full-sub-pool fold, a private pool, or an extend without front rows), and decode eviction, the free at a checkpoint insert and the leaf-lock release keeping that reach on the radix cache, enabled and disabled. With the retain window pinned to `sliding_window_size`, five of these fail; the decode fixture then frees the five oldest slots the draft reads.
…current state A per-depth conv-chain MTP head (Inkling) owns one recurrent-state block per depth. `StateHostKind` registers as the host for `LAYER_STATE`: the mamba sub-pool's entries take the draft's state block after the host's streams, laid out stream-major like the host's own block, so the slot that is the request's carries both and the host's whole-entry clear and copy restore the draft's state with the target's on every radix checkpoint. A host without a mamba sub-pool declines the draft, which its factory then refuses for an EAGLE draft as before. `MambaSubPoolSpec` gains the fused entry math (`host_entry_bytes`, `draft_offset_in_entry`, an aligned `entry_bytes` when a state region is set; byte-identical unfused), `build_mamba_entry_views` takes an entry stride and a block offset, `UnifiedKVPool.build_draft_state_views` views the draft block, and `UnifiedMambaPool.clear_slots`, `copy_from` and `move_kv_cache` work on whole entries: compaction relocates live and cached state slots, and a per-tensor move would leave the draft block behind. The draft worker binds `UnifiedDraftMambaPool` through the "state" binder: a request table cloned from the target's (same request->slot mappings, same allocator) whose `mamba_pool` is a view of the draft block keyed by the runner's own state layer ids. `UnifiedDraftMambaPool.clear_slots` / `copy_from` act on the draft's own block: a fused draft shares the host's slot, so the host's whole-entry ops never run for it and nothing else would reset the draft's conv and temporal streams. The multi-layer EAGLE worker drives its state pools with the request pool's translated indices, so the block is cleared and copied on decode and draft-extend, not only on plain extend. The boot solve prices what the factory carves out: with a fused state region the per-slot state bytes are the fused entry (host + draft + pad), not the host's raw entry, so `max_mamba_cache_size` is solved against the buffer that is actually allocated. `fused_entry_bytes` gains the "mamba" builder that answers that price; it prices the state layers in this runner's span, as the mamba pool factory slices them (`mamba2_cache_params.layers` is the whole model's). The draft worker's check of the built model now refuses recurrent layers only when the placement gives the runner no state lanes, and its KV dtype check reads the dense regions alone. Tests: state placement rows (per-depth and replicated heads, decline without a state host), the mixed boot-log line, the mamba builder pricing this runner's state layers, the fused state entry math, byte-disjoint host and draft blocks within a slot, the host's whole-entry clear, copy and move carrying the draft block, the draft pool's own slot ops clearing its block and sparing the host's, and the fused request-pool clone on the tri-pool factory. This makes Inkling's MTP draft placeable under the unified pool. The two track-id paths that reaches, draft-extend replay views and the verify commit, hand the conv kernels physical slots since sgl-project#38229.
A draft's sliding-window layer at step s attends the last min(seq_len + s + 1, window) tokens of its own chain: the committed prefix plus the draft's uncommitted tokens, which live in the chain slots the multi-step index kernel emits and not in req_to_token's live prefix. No mode built that rail: the target's `update_sliding_window_buffer` derives its window from req_to_token rows, which is right for the target and silently wrong for a draft, so a window draft layer reached the Triton decode kernel with `window_kv_indices=None` (eager and captured alike) and died on an unreadable IR-build error. `generate_draft_decode_window_kv_indices` is the window-clipped sibling of `generate_draft_decode_kv_indices`: same grid, same chain-slot layout (paged included), prefix ids first and chain ids after, with the clipped cumsum as the per-step indptr. It reads the iteration's sliding-window read source exactly as its sibling reads the full one (`KVIndexTranslator.read_source(..., kind=SLIDING_WINDOW)` and `_load_token_ids`): the plan's swa page table once a reader has built it, else the virtual rows translated through the swa side's v2p in the kernel's gather, so the draft adds no translate of its own. `TritonMultiStepDraftBackend` launches it beside the full kernel whenever the draft runs on a sliding-window KV pool with a window, into a fresh per-forward buffer in eager and a persistent per-step buffer under cuda graphs (refilled before replay by the same launch), and hands each step's slices to the per-step backend through `SpecInput.window_kv_indptr / window_kv_indices` (class-level defaults, so any spec input answers None; the EAGLE draft input declares them). The per-step backend's decode branch consumes the rail in eager, and the multi-step capture branch bakes the persistent buffer views. A static pool gets the legacy full-to-swa translate the target's window buffer applies. The captured draft-extend forward builds the rail on the same footing: `_update_draft_extend_buffers` fills the persistent window table before replay and the draft-extend metadata branch hands it over instead of a bare `None`, which the Triton IR builder could only report as `'NoneType' object has no attribute 'type'` from inside graph capture. `forward_decode` and `forward_extend` now assert the rail is present for a sliding-window draft, so a mode that forgets to build one names itself. The kernel reaches the backends through `speculative/spec_utils`, the re-export hub every speculative consumer imports from, declared there beside its siblings: importing it from the kernels package directly would have been a module-scope ImportError on every Triton server, speculation off included. Tests: `test_generate_draft_decode_window_kv_indices` pins the emitted ids to the window-clipped tail of prefix ++ chain (window narrower than the chain, wider than everything, page sizes 1 and 2, the paged chain layout at topk 2), the clipped indptr, the translation through the source's v2p, and the plan's physical page table emitting what the translated gather does. Two guards derived from the two ways the rail went missing: an AST scan refusing a bare `None` window rail in the captured-metadata builder, and a re-export surface check that every srt consumer of the hub resolves against what the hub actually declares. The read-source guard (`test_multi_step_containers_read_the_plans_table`) now counts the window kernel's launches with its sibling's, so both must pass the read table's entry granularity.
…capture, replay) A draft's window layer writes its KV through `swa_out_cache_loc`, the sliding-window ids of the batch's write window. Each per-step backend of the multi-step draft derived them from the batch it was initialized with, whose write ids are the whole draft window; the write then kept their first `bs * topk`. That is right for a padded batch and silently wrong here: `per_step_draft_out_cache_loc` lays the window out step-minor per row, so the first `bs * topk` ids mix every step's slots and the eager path wrote each step's window KV into the wrong swa slots. Under cuda graphs the whole window did not fit the per-step backend's capture-stable buffer, so the captured path got no swa target at all and asserted. `TritonMultiStepDraftBackend._step_writes` binds draft step `i`'s slice of the write ids and its columns of the iteration's write window (`kv_loc_cols`) while a per-step backend derives its targets: the step's columns of the draft's own window (`slice(i, None, num_steps)`, rows laid out topk x steps), or, for a chain draft writing the leading columns of the verify window, column `start + i`. The plan then hands out the step's swa ids from the ids it translated once for the iteration. On a sliding-window KV pool the eager per-step metadata init runs under it, the capture path bakes each step's view of its own swa buffer, and the replay path refills every per-step backend's swa buffer from its step's columns; any other pool binds nothing. The Triton decode forward asserts a draft step's swa target matches its loc's length, so a truncation can never hide again; `KVWriteLoc` documents that a draft step's slice is not a prefix. Test (test_cuda_graph_window_rail_completeness.py, CPU): every step's bound ids equal its `per_step_draft_out_cache_loc` slice of the window's swa ids, for the draft's own window at topk 1 and 2 and for a chain draft inside a wider verify window, and the whole window's leading ids are not step 1's slots.
`resolve_sliding_window_size` prefers a model's own `get_attention_sliding_window_size`, and Inkling's trunk answers one less than its extent. The MTP head declared no such method, so the resolver fell through to the config field: the head's backend ran one token wider than the trunk's window layers, and a banded depth's per-step window rail read one token further back than the swa sub-pool retains. The head now mirrors the trunk: a banded depth runs one under its own extent, every other depth one under the trunk's window. The config keeps the raw extent, which is what the swa host's admission compares against the target's. Test: the head's answer for a banded and a full depth, and the resolver taking it over the config field. The case is registered on a CUDA runner. It borrows the real head's window method, so it imports `sglang.srt.models.inkling`, which reaches the flash-attn cute interface and `cutlass`; a CPU image has neither, and the CPU gate would fail on the import rather than on the convention.
ch-wan
force-pushed
the
mainline/unified-fused-window-state-drafts
branch
from
October 18, 2026 12:38
c9ea98c to
451831a
Compare
hsthe29
added a commit
to hsthe29/sglang
that referenced
this pull request
Oct 29, 2026
- kv_cache_configurator: charge the default verify scratch from stage_per_req, so a fused draft's widened state entry is still priced (main switched the budget to it in sgl-project#43326). - kv_cache_configurator: reject --enable-linear-lossless-verify when building the unified pools; the guard lived in UnifiedHybridReqToTokenPool, which main removed. - test: import the verify kernel from ops/attention/linear and stub the commit hook's state_pool and layer_router. - ruff format the moved verify kernel.
DocShotgun
added a commit
to DocShotgun/sglang
that referenced
this pull request
Nov 9, 2026
Merges the v0.5.23 tag (main @ 2a7987f plus two release cherry-picks, sgl-project#46933 and sgl-project#47198). Takes upstream's pins: flashinfer 0.7.2, sglang-kernel 0.4.10, sgl-deep-gemm 0.2.3.post2, sgl-flash-mla 1.0.0; torch stays at 2.14.1. DSv4.1 decoder SWA bounded replay is now on by default. - triton_backend.py: take upstream; sgl-project#43326 fixes the SWA draft-extend CUDA-graph metadata the same way we did. Our test still covers it, with window_kv_kind added to its fake translator - fused_marlin_moe.py, marlin.py: take upstream; sgl-project#45462 serves -1 routes on the plain path (inactive prefix, zeroed down-GEMM rows), which replaces our has_masked_experts. KT still hands marlin valid local ids only - kt_ep_wrapper.py, compressed_tensors_wNa16_moe.py: drop the stale has_masked_experts notes - test_moe_wna16_marlin.py: the masked mxfp4 case now runs -1 routes through the plain path - test_dsa_glm52_hisparse.py: take upstream over v0.5.22's release-only cherry-pick
3 of 5 tasks
caihuali95
pushed a commit
to caihuali95/sglang
that referenced
this pull request
Nov 30, 2026
The multi-layer EAGLE draft-extend graph lays out each request's draft tokens plus its boundary-KV front rows (speculative_num_steps - 1 plus the conv warmup rows; 4 + 5 = 9 per request for Inkling-Small at 3 steps) and stamps that width on `spec_info.num_tokens_per_req`. The Triton backend's captured draft extend ignored it: `_update_draft_extend_buffers` strided `qo_indptr` by num_draft_tokens and the captured metadata took the same number as `max_extend_len`, so every request after the first was read at the wrong rows. With CUDA graphs on, an Inkling MTP head on Triton accepted 1.50 tokens per step instead of ~2.77, on both pools; graphs off, and FA, read the width from the batch and were right. The per-step window rail (sgl-project#43326) is what lets that graph capture, so this is now reached. Both now take the width from `_draft_extend_num_tokens_per_req`: the stamped `spec_info.num_tokens_per_req` when set, else the old num_draft_tokens (or num_steps + 1 outside V2), as the target-verify width already does. A graph replays only when the batch's stamped width equals its captured one, and the plain EAGLE draft-extend graph captures exactly num_draft_tokens, so nothing else changes. Test (test_triton_verify_metadata.py, CPU): test_graph_draft_extend_uses_the_runner_width captures and replays a draft extend with a stamped width of 9 and num_draft_tokens 4, and checks `qo_indptr` and `max_extend_len`; unset widths (None, -1, 0) keep 4. Before this change the width-9 case fails (`qo_indptr` [0, 4, 8], expected [0, 9, 18]). On SM90 the Inkling-Small MTP head on Triton then accepts 2.76-2.78 tokens per step with graphs on and off, on both pools. Co-Authored-By: Claude Opus 5.5 <[email protected]>
caihuali95
added a commit
to caihuali95/sglang
that referenced
this pull request
Nov 30, 2026
The multi-layer EAGLE draft-extend graph lays out each request's draft tokens plus its boundary-KV front rows (speculative_num_steps - 1 plus the conv warmup rows; 4 + 5 = 9 per request for Inkling-Small at 3 steps) and stamps that width on `spec_info.num_tokens_per_req`. The Triton backend's captured draft extend ignored it: `_update_draft_extend_buffers` strided `qo_indptr` by num_draft_tokens and the captured metadata took the same number as `max_extend_len`, so every request after the first was read at the wrong rows. With CUDA graphs on, an Inkling MTP head on Triton accepted 1.50 tokens per step instead of ~2.77, on both pools; graphs off, and FA, read the width from the batch and were right. The per-step window rail (sgl-project#43326) is what lets that graph capture, so this is now reached. Both now take the width from `_draft_extend_num_tokens_per_req`: the stamped `spec_info.num_tokens_per_req` when set, else the old num_draft_tokens (or num_steps + 1 outside V2), as the target-verify width already does. A graph replays only when the batch's stamped width equals its captured one, and the plain EAGLE draft-extend graph captures exactly num_draft_tokens, so nothing else changes. Test (test_triton_verify_metadata.py, CPU): test_graph_draft_extend_uses_the_runner_width captures and replays a draft extend with a stamped width of 9 and num_draft_tokens 4, and checks `qo_indptr` and `max_extend_len`; unset widths (None, -1, 0) keep 4. Before this change the width-9 case fails (`qo_indptr` [0, 4, 8], expected [0, 9, 18]). On SM90 the Inkling-Small MTP head on Triton then accepts 2.76-2.78 tokens per step with graphs on and off, on both pools. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
This PR is part of a stack (oldest at bottom):
Current head
451831a6e6, based on main19cb24f1e1. Stack predecessor: #43325. This PR targetsmainafter its stack predecessor merged.Motivation
Under
--enable-unified-memorya speculative draft's KV lives inside the target's pages (a fused draft), but only a draft whose layers are all full-attention can fuse: it goes into the full-attention sub-pool. An MTP head with sliding-window layers (MiMo-V2-Flash) or with recurrent state (Inkling's per-depth conv-chain head) declines, and for a hybrid sliding-window or Mamba-hybrid target, main then refuses to boot ("needs the draft's KV fused into the target's pages, but this draft cannot fuse"). So neither model can run NEXTN with--enable-unified-memory.Modifications
The Gemma4 graph and HiSparse registry test fixtures now follow the window-reader and retained-history interfaces.
Window layers build clipped decode indices whether placement uses FULL or SWA storage. Cache retention, locks, matching, replay floors and transfers share the widened draft history span in both Python and Rust TreeCore.
938efad6b4). A placement separates what the draft has (full-attention, sliding-window and state layers) from what a sub-pool can carry (aHostKind, keyed by sub-pool name).place_fused_draftwalks the registered kinds over the sub-pools the target builds; the draft's share of each sub-pool's entries, and which part of it each draft runner uses, are keyed by sub-pool. Only "full" is registered in this commit, so every draft places or declines exactly as before.dc703be11b). A draft's sliding-window layers fuse into the target's sliding-window sub-pool when the draft's window is no wider than the target's; otherwise they fold into the full sub-pool with their own geometry, or the draft declines when the geometries differ. The sliding-window sub-pool now retains what the draft reads: a multi-layer MTP draft's extend starts a few tokens below the committed length, soCacheInitParams.swa_retain_windowtakes the wider of the target's window and the draft's reach; the tree's locks, prefix matching, backup/load-back and request retention all use that same span. Window layers fuse only on the Triton multi-step draft backend, the one that builds per-step sliding-window KV indices. The draft worker bindsUnifiedDraftSWAKVPool, routed per layer like the target's composite. A multi-layer draft plans each draft extend once, through its first depth's runner, and a later depth can route window layers the first one does not:KVLocPlan.has_read_tableandread_tablenow resolve the sub-pool through the reader, aswrite_idsalready does, so every depth still shares one table per sub-pool.696947f22f). A per-depth conv-chain MTP head's recurrent state goes into the mamba sub-pool, laid out after the target's own state in each slot's entry.UnifiedMambaPool.clear_slots,copy_fromandmove_kv_cacheact on whole entries, so a radix checkpoint, a slot reset and a compaction move carry the draft's state with the target's. The rebase preserves main's whole-page compaction copy and invokes sibling reset/copy callbacks for ShortConv and NGram state as well. The draft bindsUnifiedDraftMambaPool, whose own slot ops reset the draft block on decode and draft extend. The memory sizing at startup counts the larger entry.22c9d158b2). A draft's window layer at step s attends the lastmin(seq_len + s + 1, window)tokens of its own chain, which no existing builder produced: a window draft layer reached the Triton decode kernel without window indices.generate_draft_decode_window_kv_indicesis the window-clipped sibling ofgenerate_draft_decode_kv_indices, selects FULL or SWA addresses through the runner's reader, and fills both an eager buffer and a persistent buffer for CUDA graph replay; the captured draft extend builds these indices too.dcb671120b). Each per-step backend took its sliding-window write ids as a prefix of the whole draft window, which is laid out step-minor per row, so eager window writes landed in other steps' slots and the captured path had no target. Each step now binds its own columns of the iteration's write window in eager, capture and replay.b3102250ff): with both a custom mask (speculative verify) and ascore_mod(Inkling's relative bias), Triton failed to build the kernel.SWAKVPool.get_v_head_dimanswers from whichever side has layers (a3f8458c59): an MTP depth whose block is sliding-window has an empty full side and raisedIndexErrorat backend construction. The Inkling MTP head reports its window the way the trunk does (7ed6dfa304): it ran one token wider than the trunk's window layers.Tests (CPU unless noted): window, state and fold placement rows, including the declines; per-runner binding against a clipped config; the KV index translator handing a fused draft the target's sliding-window write ids and window table byte for byte, including from a plan a dense first depth built; the retained window on the radix cache, enabled and disabled; the fused state entry math and the whole-entry clear, copy and move; the window index kernel against a reference, at page sizes 1 and 2 and topk 1 and 2 (CUDA); each draft step's sliding-window write ids; and the head's window convention (CUDA).
CI registration updates
Updated
est_timein 10 affected test files from observed file-level CI timings, including process/import cost and margin. Existing estimates with sufficient margin are retained. The expanded weekly configurator test also passed all 11 cases in a 30.1-second CPU measurement.The full page/top-k/window-translation kernel matrix runs in
nightly-test-1-gpu-large. Eager and CUDA-graph FULL/SWA placement regressions remain in base CI.The Inkling MTP window-convention test runs in
extra-a-test-1-gpu-small; it requires the CUDA image for its model imports.The CI registry check validated 2,960 registrations before landing. An AST comparison confirmed that this follow-up changes registration metadata only. Runtime test measurements elsewhere in this description refer to their stated earlier revisions.
Accuracy Tests
Earlier combined stack
b550cacde6adds a test-fixture correction in #43326: the Gemma4 read-stream fixture declares its FULL address space, and the HiSparse registry test uses realCacheInitParamsfor the retained-window calculation. Both complete test files pass locally with GPUs hidden: 4 Gemma4 tests and 26 registry tests. Pre-commit passed. The five descendant patches are unchanged (git range-diff); this follow-up changes no production code. The earlier 455-test run did not cover these two files; GitHub CI has not yet been revalidated for this head.Validation before the test-fixture follow-up, on combined stack
4cf27a551c: 455 tests and 921 subtests passed on B300, plus the two widened-history regressions against Rust TreeCore. The new FULL-fallback metadata cases cover eager execution and CUDA graph replay. New allocation-reclaim, explicit-prefill and JIT-reuse regressions fail on the previous code and pass with the fixes. These are combined-stack checks, not independent model reruns of each PR.The measurements in this section are historical results from before this rebase, at the revisions/configurations stated below. Current combined-stack validation is linked above.
SM90. Unless marked, runs used this stack over main 7224fce. Runs marked ‡ used the stack over the earlier main b130f8a, and runs marked † used main 4b384df, where this PR differed only in how a plan read names its sub-pool (item 2), which resolves to the same tables for every configuration in those rows. Default pool against
--enable-unified-memory; GSM8K, all 1314 test questions, 5-shot, greedy.The drafts this PR fuses: NEXTN with
--attention-backend triton(MiMo-V2-Flash at TP4, Inkling-Small at TP8), radix cache, overlap scheduler, CUDA graphs off and on. The unified pool runs withSGLANG_DEBUG_POISON_POOL=1, which fills every byte that is never written with NaN, so a draft that reads a slot nobody wrote loses accept length or accuracy. Accept length is the median of the server's logged values.--speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4--enable-multi-layer-eagle --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4Every unified server boots with its draft fused: MiMo's draft layer in the sliding-window sub-pool, Inkling-Small's draft across the full-attention, sliding-window and mamba sub-pools. Inkling-Small's lower accept length with CUDA graphs is the same on the default pool. Paired per question, every unified run is within run-to-run noise of its default-pool run.
Drafts that already fused (the registry moves every placement): GSM8K and accept length at parity
‡ Radix cache, overlap scheduler, CUDA graphs on; the unified pool runs with lazy (default) and eager (
SGLANG_DISABLE_LAZY_COMPACTION=1) compaction.gpt-oss-20b's GSM8K score moves by several points between identical runs.
Inkling-Small with DSPARK (
--speculative-algorithm DSPARK --speculative-draft-model-path RadixArk/Inkling-Small-DSpark,--attention-backend triton, TP8, radix cache, overlap scheduler), whose draft layers are all full-attention and fuse into the full-attention sub-pool: GSM8K 0.814 / 0.823 (default / unified) with CUDA graphs off and 0.828 / 0.833 with them on, accept length 4.08-4.27 on both pools.Targets without speculation (the mamba sub-pool's slot operations change for every Mamba-hybrid target): GSM8K at parity
Radix cache, overlap scheduler (Kimi: normal), CUDA graphs on.
GPU unit tests for unified memory, including the CUDA-registered kernel and window-convention tests: 4200 passed, 0 failed.
Speed Tests and Profiling
The measurements in this section are historical results from before this rebase, at the revisions/configurations stated below. Current combined-stack validation is linked above.
bench_serving, unified pool against the default pool, which runs twice per configuration; the spread of its two runs (A/A) is the noise floor.The drafts this PR fuses, same configurations as above with CUDA graphs on, under two load tests (accept length as
bench_servingreports it): 100 requests of 512 input / 4096 output tokens at concurrency 128, and 192 requests that share a 4096-token system prompt, each with a 128-token question and 2048 output tokens, at concurrency 192.MiMo's gain is the unified pool's capacity: either layer kind can take the bytes the default pool splits between them at boot. On Inkling-Small's 192 requests sharing a 4096-token prefix, serving traces at the same batch size show the unified pool's verify cycles 1.3% longer, all of it in the Triton attention kernel of the sliding-window layers (about 7% slower per call); the full-attention layers' kernel time is unchanged.
Targets without speculation: ‡ Qwen3.5-9B, 200 requests of 2048 input / 512 output tokens at concurrency 64, run back to back on one host with and without this PR. Unified-vs-default-pool req/s gap: −0.9% (fa3), −0.9% (triton), −0.9% (trtllm_mha) with this PR, against −0.7%, −0.6% and −0.8% without it; A/A at most 0.2%.
Drafts that already fused: req/s, one server at a time
Qwen3.5-9B and gpt-oss-20b, 200 requests of 2048 input / 512 output tokens and 100 requests of 8192 input / 64 output tokens, at concurrency 64. †
Accept length matches the default pool's within 0.1 in every row.
Inkling-Small with DSPARK, as configured above, CUDA graphs on, under the two load tests above: req/s −0.3% (A/A 0.0%) for 100 × 512 / 4096 and −0.1% (A/A 0.1%) for 192 × (4096 shared + 128) / 2048.
Checklist
CI States
Latest PR Test (Base): ⏳ Run #39128158014
Latest PR Test (Extra): ⏳ Run #39128157939
Latest PR Test (AMD ROCm 10): ⏳ Run #39128157855