You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ROOT CAUSE: the direct-chain planner (plan_path_c_direct_fusion_chain_for_region)
skipped build_path_c_aot_autograd_region whenever ANY _bwd node was already in the
region. Flag ON appends the chunked mamba B2/B1/B0 _bwd surfaces into the forward
node list, so that guard suppressed the AOT-backward derivation for ALL OTHER
bricks -> the chain had only the 3 chunked mamba bwd (interleaved mid-forward) and
nothing seeded the mamba delta_grad cotangent (zero mamba grads).
FIX (shared by both flag states):
- build_path_c_aot_autograd_region: drop explicit owner_output _bwd nodes from
the forward list; _aot_backward_surfaces_for walks reversed(forward_nodes) and
emits each chunked-mamba brick's pre-built B2/B1/B0 at that reverse position, so
residual_rmsnorm_bwd (which produces {brick}_delta_grad) runs BEFORE the mamba
backward and seeds its cotangent.
- planner guard now short-circuits only on a SYNTHESIZED (non-owner_output) _bwd.
VERIFIED: flag-OFF chain unchanged (14 segs, byte-identical). flag-ON chain now 18
segs (9 fwd + 9 bwd) in correct reverse order; brick_10_M_delta_grad nonzero and
read by B2; live route grads 2 -> 18 (m2rnn+attention+suffix now flow). New tests:
full-backward-chain OFF/ON ordering + delta_grad seam (13 passed).
REMAINING (separate feature, NOT this change): 163-grad parity still blocked by the
absence of an eager mamba projection fwd/bwd bridge -- the chunked projected inputs
(x/B/C/A/dt/z/h0) are zero-seeded in the pre-step owner (no in_proj/conv/norm
forward), so chunked grads are zero AND are w.r.t. SSD-core inputs, not the
mamba3_*_weight model params the grad-tree aliases expect. Documented in
scratch/MAMBA3-RUNTIME-WIRING-RESULTS.md. RULE #1: did NOT alias mismatched grads.
Flag CPPMEGA_PATH_C_MAMBA3_CHUNKED_SCAN default OFF (merge-safe).
0 commit comments