Archived
test(ref2va): measure video/image VAE encoder parity = DIVERGED (#14)
The audio half of the #14 strict numeric value-parity was already measured and found to diverge. This measures the OTHER half — the conv3d_ndhwc video/image encoder, a separate kernel family — the same device-INPUT-anchored way, and it diverges too, with the SAME signature. New harness tests/data/ref2va/ref_venc_parity.py: - Does NOT import comfy.ldm.minimax.vae (that drags comfy attention -> an aiter JIT build that fails on this box), so like vae_geom/gen_golden.py it AST-extracts just the encoder classes + the _normalize_pixels / _encode_moments methods, execs them on torch alone, and loads the REAL fp16 minimax_h3_video_vae_fp16.safetensors into encoder+quant_conv (decoder excluded; the encode path has no attention). --selftest validates the reshape / normalisation / sorted metric with no device involvement. - Device stores b_evc PATCH-FOLDED (op_ve_fold: 24ch x 2x2 = 96-wide rows) and per-channel-normalised. The fold is a pure bijection and the norm is per-channel, so the value MULTISET of the device slot region matches the reference's normalised latent regardless of fold order; the harness compares the two SORTED value vectors. This is immune to re-deriving the fold's (t,h,w)+channel packing — the mistake that once cost a bogus audio reading. - A single reference IMAGE is the cleanest case (encode()'s T==1 branch, one clip, exactly one latent frame), so keep-first/last is moot; the harness refuses T_pad!=1. Two inert, R4D_ENC_DEBUG-gated dumps added to core/gen/video_driver.cpp (the staged pixel buffer + enc_geom, next to the existing audio ones) so the reference can be fed the device's OWN staged input and only encoder math can differ. Zero-touch when R4D_ENC_DEBUG is unset. Result on a 256x256 gradient picture: sorted relative Frobenius 0.65, device latent std 0.44 vs reference 1.15 (~2.6x under-spread), max-abs 4.26. DIVERGED like the audio path. The finding is the SHARED signature: audio collapsed std 0.59->0.23 (~2.6x) and video 1.15->0.44 (~2.6x) across two entirely different kernel families, AND for BOTH families the latent-normalisation constants are byte-identical to the reference (kVaeLatentsMean/Std vs LATENTS_MEAN/STD max rel-diff 0.0). So the collapse is NOT the norm constants and NOT audio-specific — this refines the earlier "suspect the strided conv1d temporal reduction" note. Localising it needs stage-by-stage activation dumps on kernels the live image/plain paths also run through, so the kernels are deliberately NOT blind-fixed. The device encoders remain content-live and deterministic (cont.3/5/19): self-consistent, so conditioning is genuinely live; only reference-matching OUTPUT fidelity is open (= #10 / P6). docs/NOTE-REF2VA.md point 4 records the video-half result and the sharpened ruling-out of the normalisation constants. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
04daf51e42
commit
241629fe8c
3 files changed
+314
-2
No files matched your search
@@ -1196,8 +1196,14 @@ const RadBatch* VideoDriver::build_encode(Job& j, int step) {
|
||||
for (int64_t f = nf; f < stage_frames; ++f)
|
||||
std::memcpy(px + f * area, px + (nf - 1) * area, (size_t)area * 4);
|
||||
reg_[R_ENCPX].used = stage_frames * area * 4;
|
||||
if (enc_dbg_)
|
||||
enc_dbg_dump_file("encpx_" + std::to_string((int)it.kind) + "_" +
|
||||
std::to_string((int)it.slot), px, (size_t)stage_frames * area * 4);
|
||||
}
|
||||
reg_[R_ENCG].used = 25 * 4;
|
||||
if (enc_dbg_)
|
||||
enc_dbg_dump_file("encg_" + std::to_string((int)it.kind) + "_" +
|
||||
std::to_string((int)it.slot), gd, 25 * 4);
|
||||
stage_geom(j, j.geom, j.rows, 0);
|
||||
if (upload() < 0) return nullptr;
|
||||
base_batches(j, j.geom, 0, step);
|
||||
|
||||
Reference in new issue
Block a user