fix: segmenter tail latent registered before gallocr alloc (DBCache crash) - #3
Conversation
…BCache) Building latent after ggml_gallocr_alloc_graph leaves it unallocated and computing it is UB — with DBCache enabled (--cache-threshold) on the medium model (latent_layer_idx=6, fn_blocks=1) this crashed with ACCESS_VIOLATION. Build both outputs first, then alloc.
|
@coderabbitai full review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe segmenter tail now registers and expands the main output and optional latent output before backend graph allocation. It then checks backend support, creates the allocator, and allocates the complete graph. ChangesSegmenter graph allocation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change registers the segmenter outputs before graph allocation and reports successful verification with matching notes; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Action performedFull review finished. |
Problem
With DBCache enabled (--cache-threshold), the 3-stage segmenter split path
built \outs.latent\ after \ggml_gallocr_alloc_graph, leaving the latent
nodes unallocated. Computing them is UB — on the medium model (latent at
layer 6, fn_blocks=1) the CLI crashed with ACCESS_VIOLATION
(exit 0xC0000005) at the first D3PM step. CI only runs --version, so this
was never caught.
Fix
Register both outputs (x_run + latent) and build the graph before allocating;
alloc only once both are in the graph.
Verified (local CPU build, 30s 44.1k mono, Q8_0, nsteps=4)
(DBCache gives ~16% end-to-end, ~20% segmenter speedup at nsteps=4)
Summary by CodeRabbit