Skip to content

spark-model: size DFlash SSM verify pools uniformly at K-1 - #38

Merged
AzeezIsh merged 1 commit into
mainfrom
fix/dflash-ssm-pool-uniform
Sep 19, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
fix/dflash-ssm-pool-uniform

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Under --dflash, every SSM verify slot's H-intermediate pool was silently tiered to the MTP K-ladder (≤3 intermediates at γ=8) and the first verify refused with SSM MTP intermediate buffers not allocated — finishing the request at one token. Only ATLAS_MTP_POOL_FULL_WIDTH=1 masked it (the current recipe's required env gate).

Root cause: the uniform-sizing detector was num_intermediates != num_drafts + 1, but DFlash verify rows resolve to exactly num_drafts + 1 (dspark_pool::dflash_verify_rows — [last_token, draft_1, .., draft_K], the anchor bonus is not a draft row). The comparison is always equal under --dflash, so the uniform branch was unreachable. Preflight already reserves uniform for args.dflash, so the serve boots and dies at runtime instead of at allocation.

Fix: detect DFlash directly from config.dflash_capture_layers — the same field impl_a1 feeds dflash_verify_rows — keeping the MTP-ladder tiers for MTP-only pools and the dead comparison as a defensive term. DSpark is covered through the same capture-layers path.

Once an image with this lands, ATLAS_MTP_POOL_FULL_WIDTH=1 can drop out of the DFlash2 recipe (the env remains a valid kill switch for the bs>32 slot-count diet).

Test plan

  • New MockGpuBackend regression test dflash_pools_size_h_intermediates_uniformly: γ=8 geometry (K=8 → 7 intermediates) across 16 slots — fails on pre-fix code (left: 3, right: 7, the exact tiered under-allocation), passes post-fix. Counterfactual pins the tiered path (slots 0/15/dummy = 3/1/7) when capture layers are absent.
  • cargo test -p spark-model --lib dflash_pools_size on GB10 (aarch64 + CUDA): red→green verified
  • cargo fmt --all -- --check, cargo clippy -p spark-model -p spark-server --tests on pinned 1.93.1: clean
  • End-to-end on GB10 (reiner, worktree dev binary, thinking off): --dflash γ=8 serve WITHOUT ATLAS_MTP_POOL_FULL_WIDTH — first request ran serial=0.00 mtp=1.00 p1=0.520 mean_na=1.680 tok_step=2.680, no intermediate buffers refusal. (9.6 tok/s is the debug build; acceptance, not throughput, is the signal.)

Generated with Devin

Under --dflash the H-intermediate pool tiered every slot to the MTP
K-ladder (<=3 at gamma=8) and the first verify refused "SSM MTP
intermediate buffers not allocated": the uniform-sizing detector was
`num_intermediates != num_drafts + 1`, but DFlash verify rows resolve to
exactly `num_drafts + 1` (`dspark_pool::dflash_verify_rows`), so the
comparison was always equal and the uniform branch was unreachable.
Preflight already reserved uniform for `args.dflash`, so the serve booted
and died on the first verify; only ATLAS_MTP_POOL_FULL_WIDTH masked it.

Detect DFlash directly from `config.dflash_capture_layers` — the same
field impl_a1 feeds dflash_verify_rows — keeping the tiered ladder for
MTP-only pools and the dead comparison as a defensive term. DSpark is
covered through the same capture-layers path. Adds a MockGpuBackend
regression test asserting uniform K-1 geometry at gamma=8 across all 16
slots plus the always-full-width dummy, with the no-capture-layers
geometry pinning the tiered counterfactual (3/1/7).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant