fix(qwen35): route non-tree GDN capture through persist buffer (src[7])#469
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
a545f03 to
ac34227
Compare
Fast rollback / chain verify captures per-token SSM intermediate states for spec-decode rollback. Tree verify already wrote those states directly to a persistent buffer via src[7], while non-tree capture still copied from the GDN result tensor's embedded intermediate region. Route non-tree capture through the same persist mechanism: build the normal non-tree GDN op, attach cap->ssm_intermediate_states as result->src[7], and let the kernel write intermediates directly to external cache storage. This avoids allocator lifetime issues and removes the redundant result-region copy for the configured F16 capture path. The rebase keeps current main's can_skip_gdn_intermediate behavior intact, so pure chain prefill can still skip unused intermediates when no capture is requested.
With non-tree capture routed through src[7], the configured F16 intermediate buffer no longer needs the legacy result-region copy path. If a future caller requests capture with a type the persist path cannot handle, abort explicitly instead of leaving rollback state stale. This keeps fast-rollback failures obvious and prevents silent state corruption.
ac34227 to
e57903a
Compare
Contributor
|
Validated on lucebox2 (RTX 3090 CUDA, stability profile, Qwen3.6-27B-Q4_K_M + dflash-draft-3.6-q8_0, greedy):
|
Contributor
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.

Summary
Route Qwen35 non-tree GDN capture through the persistent intermediate buffer (
src[7]) instead of copying from the GDN result tensor embedded intermediate region.This preserves the current main/#465 pure-chain prefill optimization:
ggml_gated_delta_net_set_skip_intermediate()is still applied only whencan_skip_gdn_intermediateis true. Capture paths keep intermediates available through the explicit persist buffer.Why
Fast rollback / chain verify needs per-token SSM intermediate states for rollback. Tree verify already had a persist path via
_tree_persist; non-tree capture was still using the legacy result-region copy path. Routing non-tree capture throughsrc[7]avoids allocator lifetime issues and keeps the rollback buffer populated directly.The unsupported fallback now fails loudly if capture is requested with a non-F32/F16 intermediate buffer, rather than leaving rollback state stale.
Relationship
mainincluding perf(qwen/qwen35moe): speed up prefill by skipping unused GDN writes #465.Validation
env CCACHE_DIR=/tmp/lucebox-ccache CCACHE_TEMPDIR=/tmp/lucebox-ccache-tmp cmake --build server/build --target test_server_unit -j 8server/build/test_server_unit2022 assertions, 0 failures