Repository navigation
Conversation
…OMMIT)
wyN verify (K=5..16, serial and batched) writes K-1 full h_state
snapshots + the final H per (seq, v-head, layer) — ~64 KB each on
qwen3.8-27b — but every accept path consumes only intermediates[a-1].
Under the opt-in lever the new gated_delta_rule_wy{K}_defer entries
run the identical gated_delta_rule_wyn_impl arithmetic with all state
stores removed (h_state stays H0), and gated_delta_rule_commit replays
the accepted prefix 0..a-1 through the same impl body, storing only
H_{a-1} — bit-identical to intermediates[a-1]/final H.
Conv outputs/gates are staged into per-slot commit buffers at verify
time (the shared ctx.buffers scratch is reused by the next forward).
Accept paths (commit_accepted_prefix, rollback_ssm_states, batched
DFlash) launch the commit kernel whenever a layer's
gdn_commit_pending flag is set — full accept is no longer a no-op for
deferred layers, since h_state was never written. Conv intermediates
are unchanged; wy2/3/4/wy17 and the f16/resident variants are
untouched; the strix-hip wyN port predates the table form so the
lever stays inert there (handles resolve to 0).
Lever off is byte-identical to main.
Test: cargo test -p spark-model --release --features cuda
gdn_deferred_commit -- --ignored (K in {5,8,9,12,16}, every
a in 1..=K, outputs + committed state vs storing oracle)
Devin-Review-Token: gdn-deferred-commit
cd02041 could not reach a GPU: - ATLAS_WYN_INSTANTIATE still called gated_delta_rule_wyn_impl<K>(...) after the impl gained a MODE parameter and an accepted_count argument (nvcc error). The legacy wy{K} entries now call impl<K, 0> with an unused accepted_count; their extern signature is unchanged from main. - ATLAS_WYN_DEFER_INSTANTIATE was invoked for K=5..16 but never defined. It now emits gated_delta_rule_wy{K}_defer with the same 18-param signature (same gdn_decode_wyn launcher) calling impl<K, 1>. - then_some(self.gdn_wyn_defer_k[k - 5]) evaluated the index eagerly: an underflow panic for k <= 4 (the existing r4/r7 dispatch tests hit it) and an out-of-bounds index at k = 17. Both sites now branch first. - Under defer a full accept still runs commit_accepted_prefix, and the deferred branch restored conv state from conv_intermediate(k - 1), a slot the fused conv path never writes. Skip the conv restore on a full accept; the verify's final conv state is already canonical. gdn_wyn_launcher_arg_count_matches_kernel_param_count pins the wy{K}, wy{K}_defer and commit entries against their launchers (18/18/14); it fails on cd02041 because the _defer entry does not exist. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 of 8 tasks
Contributor
Author
|
reiner job 621 (0f5ec00): the lever changes outputs, so this stays draft. Root cause is below; a fix is in progress. Passes:
Fails:
Cause:
Fix direction:
|
… in the captured forward (#58) Reiner job 621: with ATLAS_GDN_DEFERRED_COMMIT=1 greedy output diverged after ~20 tokens (json "population" 1250000 -> 2847000, code 256 -> 181 tokens) although the kernel oracle passes. The verify forward is graph- captured (verify_d logs "Captured CUDA graph for K=gamma verify"), and the layer set gdn_commit_pending and lazily allocated its staging buffers as host code inside that forward. On replay the graph still ran the MODE-1 _defer kernel (no state stores) while the flag stayed false, so the accept path restored h_state from intermediates MODE 1 never wrote. - mark_gdn_deferred_commit assigns the flag at every decode_verify* entry, on the capture pass and on every replay, from TransformerLayer::gdn_deferred_wyn (the wyN arm's own gates) plus the shared SsmLayerState::h_inter_pool_layout precondition. - Staging lives in lever-gated SsmStatePool pools, bound at slot bind and rebind like h_state; the forward only issues the capturable copies and fails fast if the staging is missing. - decode_verify_batched checks that it has one depth per sequence. gdn_commit_pending_is_set_at_dispatch_not_in_the_layer fails on 0f5ec00; cargo test -p spark-model --lib: 857 passed. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
Folded into #127 (same three commits, patch-identical per git range-diff) to keep the DFlash2 work in one PR. |
Merged
2 of 4 tasks
This was referenced Sep 28, 2026
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
Opt-in
ATLAS_GDN_DEFERRED_COMMIT=1for the wyN GDN verify (K=5..16, serial and batched). This targets the top kernel in the DFlash2 C=16 profile (gated_delta_rule_wy8, 21.7 % of GPU time in reiner job 596).The problem. The storing verify writes K-1 full
h_statesnapshots plus the final H per (seq, v-head, layer), ~64 KB each on qwen3.8-27b. Every accept path consumes onlyintermediates[a-1].What the lever does:
gated_delta_rule_wy{K}_deferruns the identicalgated_delta_rule_wyn_implarithmetic with every state store removed, soh_statestays at H0.gated_delta_rule_commitreplays the accepted prefix 0..a-1 through the same impl body and stores only H_{a-1}.commit_accepted_prefix,rollback_ssm_states, batched DFlash) run the commit whenever a layer'sgdn_commit_pendingis set. A full accept is no longer a no-op for deferred layers.gated_delta_rule_wy{K}entries keep main's extern signature and store contract (impl<K, 0>).Scope limits:
Commits:
ATLAS_WYN_DEFER_INSTANTIATEand fixesimpl<K, 0>arity inATLAS_WYN_INSTANTIATE.then_some(arr[k-5])index that panicked for k<=4 and went out of bounds at k=17.conv_intermediate(k-1)slot.Draft: stays opt-in until reiner proves parity and a benefit.
Test plan
cargo test -p spark-model --lib: 856 passed. This includes the newgdn_wyn_launcher_arg_count_matches_kernel_param_count(18/18/14; it fails on the lever commit alone) and the r4/r7 dispatch tests that the lever commit alone broke.nvcc -> PTX (all gb10 targets): the first compile of the new entries.cargo test -p spark-model --release --features cuda gdn_deferred_commit -- --ignored(K in {5,8,9,12,16}, every a in 1..=K, outputs and committed state vs the storing oracle);Generated with Devin
Supersedes #126: same tree, with the lever commit re-authored so the CLA check can pass.