Skip to content

spark-model: build SSM pools before the KV budget snapshot (fixes #61) - #63

Merged
AzeezIsh merged 1 commit into
mainfrom
fix/ssm-pools-positional-budget
Sep 24, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
fix/ssm-pools-positional-budget

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

Fixes #61 — spark serve dying with Failed to build model / cuMemAlloc_v2 status 2 at long --max-seq-len (reproduced at 49152 on gfx1151, both Windows and the failing profile's exact flags).

Root cause: TransformerModel::new allocated the SSM state pool, Marconi snapshot pool, and decode-rollback ring after the KV cache was sized from util × total − used_so_far. Those allocations were invisible to the budget — at seq 49152 roughly 20 GB of post-KV allocations overflowed the physical remainder.

Fix: hoists pool construction into a new SsmPools bundle built in factory::build_model before the gpu.free_memory() snapshot, so the pools land in used_so_far and the KV pool shrinks to fit — the same positional-budgeting rule the LoRA adapter load already documents. TransformerModel::new takes the bundle and reads has_mtp/dflash_kgamma back from it (SSOT — the flag derivations moved with the pool construction).

Test plan

Generated with Devin

@AzeezIsh
AzeezIsh merged commit f6401c6 into main Sep 24, 2026
25 of 26 checks passed
@AzeezIsh
AzeezIsh deleted the fix/ssm-pools-positional-budget branch September 27, 2026 07:15
AzeezIsh added a commit that referenced this pull request Sep 27, 2026
…QLite side files (#116)

data/benchmarks.sqlite-wal (227 KB) and -shm (33 KB) were committed with #63
(e146bef, 2026-05-22) while the database itself is gitignored (*.sqlite), so
the pair can never be opened and nothing in the tree references them (git grep
finds no reader). Ignore *.sqlite-wal / -shm / -journal so a local benchmark DB
cannot be committed again.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

Windows gfx1151: DFlash2 NVFP4 serve exits with generic Failed to build model before API bind

1 participant