Archived
venc: value-parity fix — shortcut must read the raw input, not silu(norm1)
In step_venc the ResnetBlock shortcut conv (op_sc) was issued after norm1
(op_n1), but on a shortcut level norm1 normalizes the input `in` IN PLACE
(nb = E.in), so the 1x1 nin_shortcut residual was fed silu(norm1(x))
instead of the raw x the reference uses:
ResnetBlock3D.forward: x = self.nin_shortcut(x) # raw, before any norm
return self.conv2(h, pre_norm=norm2, residual=x)
This shrank the residual term on every shortcut level (cout != cin, i.e.
levels 1 and 3), producing the ~0.49x structural deficit that accumulated
down the video/image VAE trunk. Reorder op_sc to read `in` before op_n1
overwrites it -- an op reorder, not a kernel change; it corrects the SHARED
trunk so the image encoder's fidelity is fixed too.
Localised by a frame-0 per-level bisection: R4D_ENC_SEL=all now dumps
frame-0 f32 shadows of every level's post-resnet output v_lv[0..4].a
(dbg_ve_l0..l4, a 9-buffer host slab) alongside the existing tail, and
ref_venc_parity.py --evcl0..--evcl4 compares each against the reference
level output on the device's own staged pixels. The std ratio walks to the
exact entry point -- conv_in 0.999, L0 0.999, L1 0.455 (first shortcut
level) -> every level 1.000 after the fix, tail nout/q48/q2 to the bf16
floor (relFro ~4e-3, affine 1.000). Device-live: a single-image ref2va
encode generates clean with the fix loaded.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
1dc850d17f
commit
40e4e3c2d8
6 files changed
+281
-63
No files matched your search
@@ -1019,6 +1019,24 @@ typedef struct RadVideoGenDecl {
|
||||
* per-frame (the reference is TemporalIsolatedGroupNorm, per-frame). Trailing debug field. */
|
||||
rad_buf dbg_ve_trunk;
|
||||
int64_t dbg_ve_trunk_bytes;
|
||||
/* frame-0 of the video encoder's conv_in output (v_lv[0].a) as an f32 PERSIST twin, read with
|
||||
* R4D_ENC_SEL=cin; tests whether the trunk deficit is already present at conv_in (confined to the
|
||||
* pixel/conv_in stage) or accumulates across the spatial downsamplers. Trailing debug field. */
|
||||
rad_buf dbg_ve_cin;
|
||||
int64_t dbg_ve_cin_bytes;
|
||||
/* frame-0 of each level's post-resnet output (v_lv[0..4].a) as an f32 PERSIST twin, read with
|
||||
* R4D_ENC_SEL=all; with cin and trunk they bisect which stage introduces the trunk deficit.
|
||||
* Trailing debug fields. */
|
||||
rad_buf dbg_ve_l0;
|
||||
int64_t dbg_ve_l0_bytes;
|
||||
rad_buf dbg_ve_l1;
|
||||
int64_t dbg_ve_l1_bytes;
|
||||
rad_buf dbg_ve_l2;
|
||||
int64_t dbg_ve_l2_bytes;
|
||||
rad_buf dbg_ve_l3;
|
||||
int64_t dbg_ve_l3_bytes;
|
||||
rad_buf dbg_ve_l4;
|
||||
int64_t dbg_ve_l4_bytes;
|
||||
} RadVideoGenDecl;
|
||||
|
||||
int rad_declare_video_generator(RadBuilder* b, const RadVideoGenDecl* d);
|
||||
|
||||
Reference in new issue
Block a user