Repository navigation
dflash_head: read the tree lattice at the launched selector's own lists offset (tree verify accepted nothing since #328) - #369
Conversation
…ts offset #328's 32-candidate selector (48cfe3c) sized the shared selector scratch for K=32, but tree_lattice still located the merged top-K lists as scratch_bytes - lists_bytes(K=16). The 16-candidate kernel writes them past its own K=16 slice lists (df2_sel_scratch), so the host read the wrong bytes: the tree's candidates were garbage (duplicate siblings, the #368 500) and no draft was ever accepted. dflash2_selector_lists_offset(gamma, max_top_k) now mirrors the kernel layout per build, and scratch_bytes is derived from it. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
data-angel
left a comment
There was a problem hiding this comment.
I checked the layout against the kernel. df2_sel_scratch puts 4 ticket words first, then the gamma × SPLITS × K slice values and ids, then gamma row tickets, then the merged values and ids, all sized by its own DF2_SEL_MAX_TOP_K. That is 16 + 8·gamma·SPLITS·K + 4·gamma bytes, which is what dflash2_selector_lists_offset returns, and the merged ids follow the values contiguously, so the 2·4·gamma·kmax read is right for both builds. DF2_SEL_MAX_SPLITS (16) matches DFLASH2_SELECTOR_MAX_SPLITS, and the other scratch users (rank_split_topk, dspine, dflash2_selector_exact) only size the buffer, so they're unaffected. Sorry #328 caused this.
One blocker: ops/sampling.rs is now 508 lines (main: 500), so this PR's own "File size cap" job fails. Moving dflash2_selector_lists_offset (and dflash2_selector_scratch_bytes with it) into dflash2_selector_build.rs, which is at 115 lines and already holds the test, fixes it without changing anything else.
…uild.rs (sampling.rs back under the 500-line cap) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@data-angel Thanks for checking the layout against the kernel. Your fix for the blocker is in Re-gated on one GB10 (sparky). Qwen3.8-27B NVFP4, the #333 exact profile at 8 sequences, DFlash2 with
These numbers are from one harness on one box. The main column comes from main + #332 + #397, which has the same tree-lattice code as main. For reference, DFlash2 without tree verify on main decodes prose at 27.75 and code at 45.42 tok/s under the same harness. Generated with Devin |
|
Queued in train #421 ( 🤖 Generated with Claude Code |
Summary
This is the root cause behind #368's symptom. After #328's 32-candidate selector (
48cfe3c68), the shared selector scratch is sized for K=32 (dflash2_selector_scratch_bytes). But the tree lattice (dflash_head/tree_lattice.rs) still located the rows' merged top-K lists atscratch_bytes − lists_bytes(K=16). The 16-candidate kernel writes them right after its own K=16 slice lists and row tickets (df2_sel_scratch). So the host read the wrong bytes:dflash2_selector_lists_offset(gamma, max_top_k)now mirrors the kernel layout per build, and the lattice reads by the launched build's own K.dflash2_selector_scratch_bytesis derived from the same function, with an unchanged value.Results (one GB10, Qwen3.8-27B NVFP4, #333 exact profile at 8 seqs +
ATLAS_DFLASH_TREE=16)b3732cd5(#368)mean_na)tok_step=1.000, 10.7 tok/s)ATLAS_ATTN_SHARED_SCAN=1vs the switch-on serial0 serve errors. This also explains why #333's measured +4% tree gain disappeared after #328 landed.
Still open:
ATLAS_DFLASH_TREEat--max-num-seqs 64OOMs at load. It sizes 15 SSM verify snapshots for all 65 slots, although tree verify runs only at C1.Test plan
merged_lists_follow_each_builds_own_layout(both builds; gamma 8/16/32);dflash2_selector+draft_tree11/11; fmt; clippynq-139-tree-latticeon sparky)Generated with Devin