Commit c6c9fda
wip(deltanet): hybrid batched path drafted, bailed for safety
Adds an experimental DeltaNet-aware batched prefill path: self_attn
layers use batched matmul, DeltaNet layers process per-token inside
the batched loop (recurrent SSM state can't be parallelized). Per-
token FFN inlined for DeltaNet layers.
Tested on Qwen3.5-4B Q4_K_M: output comes out empty. Root cause
narrowed to DeltaNet state double-advancement — my batched processes
all N tokens through DeltaNet state updates, then final tq_forward
re-processes the last token and advances state again. The N-1 skip
attempt (process 0..N-2 in batched, leave last to tq_forward) did
not fix it — likely additional state channels (conv_state, delta_state)
interact in ways that simple skip can't handle correctly.
Path preserved behind TQ_DELTANET_BATCH=1 for future debug:
DYLD_LIBRARY_PATH=build TQ_DELTANET_BATCH=1 build/quant qwen.gguf ...
Default: Qwen3.5 (and any DeltaNet model) continues to use per-token
forward, as before. 11/11 STRICT tests pass. No regression.
Proper fix path identified for future session:
- deltanet_forward writes to s->delta_state[l] and s->conv_state[l]
per-call. Need to snapshot+restore around the "final" tq_forward
re-run, OR process only the non-final tokens in batched and
skip DeltaNet layer in the final tq_forward entirely (would
require a mode flag on tq_forward).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0f90427 commit c6c9fda
1 file changed
Lines changed: 60 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3070 | 3070 | | |
3071 | 3071 | | |
3072 | 3072 | | |
3073 | | - | |
3074 | | - | |
3075 | | - | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
3076 | 3085 | | |
3077 | 3086 | | |
3078 | 3087 | | |
| |||
3137 | 3146 | | |
3138 | 3147 | | |
3139 | 3148 | | |
3140 | | - | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
3141 | 3197 | | |
3142 | 3198 | | |
3143 | 3199 | | |
| |||
0 commit comments