vae/dit/refiner FFN: store the SwiGLU gate half FIRST — the container's row swap was the fried look

Three map_rows sites reordered ff.net.0.proj rows so the gate landed SECOND, while
silu_mul / gated_quant_fp8 gate with the FIRST half (comfy's _swiglu_eager — the
reference that produced the ground-truth clips — chunks gate-first). Every DiT,
refiner and video-VAE-decoder FFN therefore computed silu(up)*gate instead of
silu(gate)*up: the block-0 device internals dump measured the FFN down-projection at
cos 0.49 against the reference while attn/to_out sat at the bf16 floor, and renders
came out over-bright with 37.8% of pixels clipping high. The maps are now identity
(checkpoint order) at all three sites; quant scales follow because they are computed
from the mapped rows. TE blocks were never affected (separate gate/up concat,
already gate-first).

Reconverted with --reuse (707 tensors / 803 weights): minimax-h3-dasiwa-w8a8-gatefix.rad.
Byte check flips in every class (vae relFro 1.7e-3 vs 1.24 swapped, bias exact, dit
sign-match 0.989 vs 0.484, ref fp8 2.6e-2 vs 1.37). Device A/B 512² 6s seed 1234:
clipHi 37.8% -> 0.1%, luma 136 -> 81 (reference 86), T2VA control clean; step-0
velocity vs the full CPU reference cos 0.9886, std ratio 1.071 (was a 7.6x gap) —
the W8A8 quant floor.

Kept: the R4D_DIT_SEL-gated decoder parity shadows (dbg_vd_* decl fields + driver
readback) that localised the fault.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
gearwave00001andClaude committed 2026-10-22 00:57:09 -05:00
1 parent bf6dc374d4
commit d480a47bef
4 files changed
+193 -7

No files matched your search

+21
View File
@@ -1059,6 +1059,27 @@ typedef struct RadVideoGenDecl {
int64_t dbg_dit_hn_bytes;
rad_buf dbg_dit_nout; /* [1, 3 * 2 * D] f32: this step's norm_out shift/scale row */
int64_t dbg_dit_nout_bytes;
/* #63 video-decoder value parity: f32 PERSIST windows of the ViT decoder's chain, read with the
* same R4D_DIT_SEL as the DiT dump (the decoder has no step; chunk 0 of one request carries it).
* The decoder is the one stage never parity-harnessed, and a pinned keyframe frame renders fried,
* which convicts decode, not denoise. blk/n/pix are PERSIST f32 twins of bf16 sources (the
* widening cast); lat/x0 shadow f32 sources through the f32-bf16 narrowing cast (the only cast
* row that reads f32), so those two files are raw bf16 (read as uint16, viewed as bfloat16) --
* a few mantissa bits lost, far under the bf16 chain's own noise. lat is the latent window
* exactly as patch_unfold reads it, x0 the gathered stream before block 0, blk the norm1 output
* entering every block, n the final layernorm, pix tile 0's proj_out rows. The replay
* recomputes unfold / post_quant_conv / proj_in / the tile gather from the checkpoint before
* comparing block windows. */
rad_buf dbg_vd_lat; /* [2048, 96] bf16: latent source rows (2x2x4-frame each) */
int64_t dbg_vd_lat_bytes;
rad_buf dbg_vd_x0; /* [64, 2048] bf16: gathered stream before block 0, this rank */
int64_t dbg_vd_x0_bytes;
rad_buf dbg_vd_blk; /* [36, 64, 2048] bf16: norm1 output window entering every block */
int64_t dbg_vd_blk_bytes;
rad_buf dbg_vd_n; /* [256, 2048] bf16: final layernorm output head */
int64_t dbg_vd_n_bytes;
rad_buf dbg_vd_pix; /* [1797, 3072] bf16: proj_out pixels of the first tile */
int64_t dbg_vd_pix_bytes;
} RadVideoGenDecl;
int rad_declare_video_generator(RadBuilder* b, const RadVideoGenDecl* d);