Adds `shift` (video) and `audio_shift` (soundtrack) as per-request /v1/videos
fields, (0,100], each defaulting to the model's trained shift; echoed in the
video object and advertised in the model card as video_shift/video_audio_shift.
ABI-invisible: VideoRequest carries the two doubles, video_schedule() re-shifts
that stream's sigma grid, and the shifted sigmas ride RadVideoGenBatch::sched --
the plugin reads only sigmas/timesteps, never a shift scalar, so RAD_ABI_VERSION
stays 24 and no plugin rebuilds.
Diagnosis (cont.20): the review batch's blown-highlight/crushed-black "fried"
look is present in the text-only T2VA control at native res (clip 54-79% vs the
reference's ~4.5%), so it is not the keyframe/tower path (#52) and not a
regression (old ex10 T2VA has clip 51%). It is not the sampler (euler vs
res_multistep: clip 53-61% vs 56-65%) and not the shift: the container already
runs 12/3 (the reference's settings) and shift=4 leaves clip at ~54%. With
sampler, shift and CFG (=1, no guidance) all matched, the gap is downstream of
the schedule -- the video VAE decode scale parity and/or the DiT int8 quant, i.e.
#37/#44/#45. The shift field ships regardless: correct, useful, and requested.
Co-Authored-By: Claude <noreply@anthropic.com>
Image-conditioned MiniMax-H3 (I2VA/L2VA/FL2VA = first_frame/last_frame) rendered
over-saturated / posterized while T2VA was clean on the same container. Root cause:
the reference conditions a keyframe TWICE -- a vision-tower anchor (clip.tokenize
images=[kf] -> <Picture N> soft-tokens in the text conditioning) AND a VAE-latent pin --
but Radiance did only the VAE pin for endpoint keyframes. The absent semantic anchor
left the DiT reconstructing the frame from low-level VAE pixels alone -> posterize /
black-outline / oversaturation.
Route endpoint keyframes through the existing vision-tower media path, so they produce
<Picture N> anchor soft-tokens in addition to their VAE pin (the reference's dual
channel). No new kernels, no ABI / arena change: build_cond stages r->media generically
and the arch scatter is the generic op_mm.
- videos.cpp: keyframe index = <Picture> ordinal (first=1,last=2); stable-sort keys
by kind before merge; run the prepare+placement loops for FIRST/LAST_FRAME as well
as IMAGE (area-matched tower form, aspect-kept; the exact-canvas VAE pin is a
separate, unchanged second encode); budget wording covers keyframes.
- video_driver.cpp: a towerless container no longer refuses a keyframe request (skip
FIRST/LAST_FRAME in the "needs a vision tower" scan) -> pin-only path runs; the
encodes guard still requires the VAE encoder and now labels a keyframe correctly.
Device A/B (uncensored w8a8, TP2, seed 1234, 512^2): prompt tokens i2va 27->291,
fl2va 1560->2088 (the +256 / +2*256 keyframe vision tokens + labels), t2va 27->27.
T2VA output is bit-identical across binaries (text path untouched). Image-conditioned
output diverges (cos 0.77/0.80): the realistic I2VA mid-frame recovers foliage
structure (blobs -> trees), softens outlines and shadow detail toward the clean control;
FL2VA gains semantic adherence (prompted "wings spread" now renders). Endpoint-pin
cosine unchanged (0.971 / 0.988 / 0.980, at/above the 0.985 bar). No budget reject.
Tests: fl2va keyframes now feed the tower and still pin the ends (index 1/2, token
stream with both vision blocks); towerless fl2va pins-only; driver-level keyframe
conditions through the tower and needs no tower. NOTE-REF2VA.md #8 closed.
Co-Authored-By: Claude <noreply@anthropic.com>
Follow-up to the link-bound finding: tried --embedding-placement vram to
take the 1.45GiB/rank embedding read off the gen4 x8 link. It resolves to
VRAM but starves the KV cache: static weights fill the whole per-card
weight budget -> every MoE expert streams + vram_kv=0 MiB -> startup
aborts (invalid argument). So the shipped embedding-in-ram default is the
trade that keeps VRAM for KV+experts; forcing it to vram trades a small
streaming cost for a catastrophic one. No rows produced (aborted before
VRAM claim). Cards stayed 61MB.
Co-Authored-By: Claude <noreply@anthropic.com>
Removed the 215W cap + −75mV undervolt, re-ran bench2.sh. Uncapped vs
capped: ~2% at 6s, 5.3% at 12s (207→196), noise elsewhere; busy=100% on
519/528 samples. Conclusion: TP2 diffusion is NOT SM-clock-bound — the
gain is small because the step waits on the gen4 x8 fabric (all-reduce +
embedding/encoder reads over the link), which doesn't shrink with core
clock. Corrects the earlier note that implied the cap was a major
long-row handicap; the sol 12s gap is not the power cap — the link cap
is. Leaving the box at 215W costs ~5% worst-case on diffusion.
Co-Authored-By: Claude <noreply@anthropic.com>
Chaining already works via ref_video; the FL2VA exact-pin is an alternative
mechanism whose fidelity claim has no golden on this box, and its wiring lands
in the shared step_dit — so it is left pending rather than blind-changed.
Co-Authored-By: Claude <noreply@anthropic.com>
Record the fixed-shape TP2 wall-clock (plain 256/3s/25st=12s, 512/3s/25st=38s,
full-shape ref2va 256=93s / 512=121s). Encoder value-parity half of P6 is done;
the dual-vs-two-singles claim is documented as blocked on the external Hermes
sol-attn ComfyUI baseline (the 590/315 rows are stock-attention floors that
include queue wait), not on anything in this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
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>
Adds a fourth R4D_ENC_SEL=all shadow — the norm_out INPUT (v_lv[5].a, level-5 trunk) as an
f32 PERSIST cast twin (b_vtrunk), via a new trailing RadVideoGenDecl field dbg_ve_trunk (no ABI
bump) + layout rows + a 4-readback "all" slab (trunk|nout|q48|q2). ref_venc_parity.py gains
--evctrunk (whole-volume vs per-frame GroupNorm discriminator) and --expand/--zeropad (single-frame
temporal tests).
Device-anchored golden comparison on a 256x256 image exonerates, one by one: input normalization
(byte-identical affine + IMAGENET consts), norm_out (faithful, relFro 1.6e-3), GroupNorm extent
(device already per-frame; #20 closed), temporal handling (reference frame0 std flat 8.986 at N=1..17
under both replication and zero-padding vs device 4.40), a single multiplicative gain (nout differs
0.57 non-affinely after per-group norm => structural), and weight precision. The gap is a structural
~0.49x spatial-trunk deviation (conv_in/resnet/spatial-downsample), NOT confined/golden-fixable, so it
is documented precisely and left open — no shared-kernel edit. Host tier green.
Co-Authored-By: Claude <noreply@anthropic.com>
Rewrite the superseded "shared final-norm / encoder-norm-kernel scale fault"
narrative: the audio ~0.37x under-gain was a pre_block norm1/norm3 swap (a
wiring bug), now fixed and device-verified. Records that the shared LayerNorm
kernel is demonstrably fine (audio matches using it), which kills the
"one norm damps both families" hypothesis; the video/image (conv3d) encoder has
no pre_block and remains a separate, open divergence (with the GN-extent gap
#20 stacked on it). Keeps the pre-fix measurements as labelled history.
Co-Authored-By: Claude <noreply@anthropic.com>
Architecture refutes the "per-level attenuation compounding" reading: both encoders
TERMINATE in a normalisation that re-writes activation scale (video norm_out=venc_gn
before conv_out/quant_conv; audio pre-block norm1/2/3 LayerNorms before proj/mean_proj).
A GroupNorm/LayerNorm output has std ~= its per-channel gamma regardless of input, so
any gain accumulated in the encoder BODY is erased before the latent is emitted. The
~0.37 can therefore only originate in the FINAL norm's affine application or the final
conv/linear: video norm_out(gamma)->conv_out->quant_conv; audio norm3(gamma)->proj->
mean_proj. The two families' scale differing slightly (0.385 vs 0.369) is simply those
final chains differing per arch.
Re-explains encoder-confinement cleanly: the DiT uses RMSNorm (rmsnorm_op), the encoders
use GroupNorm/LayerNorm kernels (shared with the latent upscaler) -- a defect in those
kernels is invisible to the DiT's RMSNorm path, consistent with the DiT generating
correctly. Narrowed confirming step recorded: dump per-channel std of norm_out output and
conv_out/quant_conv output (and audio norm3/mean_proj) -- post-final-norm std ~0.37 pins
the norm affine/kernel; ~1.0 with collapse only after conv_out/quant_conv pins those
conv weights. Not blind-fixed (shared with live image/plain + upscaler paths).
Also records a SEPARATE real fidelity gap found while localising (task #20): the device
GroupNorm reduces statistics over a level's whole clip volume, but the reference
TemporalIsolatedGroupNorm normalises per frame. Exactly neutral for the single-image
parity measurement (T=1) but it biases real multi-frame video reference encodes -- what
DaSiWa actually feeds -- as a shape change stacked on the 0.37. Recorded, deliberately
not touched (shared kernel; whole-volume pooling may be an intentional temporal choice).
Co-Authored-By: Claude <noreply@anthropic.com>
Fit a single global affine dev_sorted ~ a*ref_sorted + b to both encoders' value
distributions (both harnesses now print it):
audio (conv1d): a=0.385 b=+0.009 R^2=0.975 relFro 0.79 -> 0.062 after affine
video (conv3d): a=0.369 b=+0.159 R^2=0.912 relFro 0.65 -> 0.114 after affine
Two entirely different encoder networks both reduce to ~0.37x the reference with
R^2 0.91-0.98 -- near-perfect linearity. This overrules the earlier "not a single
scale" and "suspect the strided conv1d temporal reduction" readings: a conv-reduction
or structural transform bug would not collapse to a clean global scale. The device
encoders compute the right SHAPE of latent, damped to ~0.37x amplitude. The scale is
~0.37 for both but not bit-identical (0.385 vs 0.369) => not one shared post-multiply,
but a fixed per-level attenuation compounding over each arch's own depth.
The DiT generates correctly on the same fp8 path and the same normal kernels, so this
is not a global kernel/quant fault -- the under-gain is confined to the encoder pass.
Prime suspect: the encoders' per-level / per-frame GroupNorm (the per-frame CS in
{8,4} template) applying a near-constant sub-unit gain that compounds level-over-level,
or an encoder-path dequant scale mismatch the convert round-trip does not see. If it is
a fixed encoder-norm gain, a fix is confined to the encoder path and never touches the
DiT's norms -- which is why this is worth localising rather than shipping. Not
blind-fixed (encoder kernels are shared with the live image/plain encode paths).
Confirming step is cheap and read-only: dump one encoder block's GroupNorm input AND
output on-device, check whether output std is a fixed fraction of the reference GN.
docs/NOTE-REF2VA.md point 4 corrected (the superseded "not a single scale" clause) and
the affine table + encoder-specific-under-gain hypothesis recorded.
Co-Authored-By: Claude <noreply@anthropic.com>
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>
The device stores a slot's stereo latent channel-major with per-channel row
stride MAXA=625 (ch1 at base+625), not contiguous after ch0; the harness sliced
contiguous rows and thus compared reference-ch1 against device zeros. Fix the
slice to vstack the two channel blocks. With the correct slice the audio encoder
measures relative Frobenius 0.79 / corr 0.67 / device std 0.23 vs ref 0.59 — a
real encoder-network divergence, not fp8 precision (unbiased, floor ~1.6e-3),
not preprocessing (device-input-anchored), not the reference export (97 shared
encoder tensors bit-identical to the HF source), not the norm constants
(identical). Recorded honestly in NOTE-REF2VA: measured on audio; video/image
VAE is a separate kernel family, not yet measured; functional conditioning is
unaffected; kernels deliberately not blind-fixed.
Re-baking golden.json under the on-box torch env (comfyui-rocm10-venv, torch
2.13.0+rocm) came out byte-identical, proving: (1) the reference model.py has not
drifted, and (2) the pack keyframe/cond golden is NOT stale or torch-blocked —
pack_golden_fl2va / _chain already assert kR2VCond layout bit-exact and pass. So
#8's PACK layer is reference-verified; only the engine consumption (driver keyframe
staging, step_dit cond scatter, tail input) is unwired. Corrects point 3's 'pack
keyframe rows remain unimplemented' and point 4/6's 'this host has no torch' (the
encoder value golden is now actionable, not blocked — not yet produced).
Wall-clock per job on TP2/dual-gfx1201 (empty queue, completed_at-created_at):
plain 256/512, step/duration/resolution scaling, and the full DaSiWa reference
shape (4 img + video + soundtrack + standalone audio). Conditioning cost is the
widened sequence, not the encoders. Self-contained scaling figures, NOT a
ComfyUI parity claim (parity = open, needs reference stack).
Acceptance test #5 on dual gfx1201/TP2: one request with 4 images + a video +
its soundtrack + a standalone audio is accepted and completes clean; changing
only the standalone audio at a fixed seed changes BOTH output streams, proving
the full-shape denoise consumes the audio reference (not just its count).
PLACEHOLDER AUTHOR — re-author before any push. Do NOT push.
Co-Authored-By: Claude <noreply@anthropic.com>
The gap note still asserted a defect the device probes disproved. All three
reference kinds (image, video, audio) are device-verified live + content-sensitive
+ deterministic on a warm-server fixed-seed content-control; the earlier
'video/audio give byte-identical output, encoder collapses' claim was a
measurement artifact (raw-MP4-byte comparison + a cold-start pair). Continuity
chaining is drivable today through the ref_video path (a control shows the tail
conditions scene B); the kR2VCond keyframe-pin mechanism stays open (FL2VA
exact-pin, reachable via image refs). Strict numeric encoder value-parity is
environment-blocked on a torch-less host and was never the claim.
PLACEHOLDER AUTHOR — re-author before any push. Do NOT push.
Co-Authored-By: Claude <noreply@anthropic.com>
Follows the merged-cell pin (c725a2d). That commit proved reference IMAGE
conditioning consumed on device; reference VIDEO and AUDIO were plumbed
through the pack and step but still refused at submit — only their decode
and encoder-enqueue were missing. This lands them.
Server (videos.cpp): `task ref2va` now decodes `ref_video_N` and
`ref_audio_N` (and a video's paired `ref_video_audio_N`) into encoder form
via the mm encoders and enqueues them as Vencode/Aencode passes, instead of
the old image-only decode loop that rejected them. A soundtrack is folded
into its video's row (the `audio` word), matching how the pack lays that
pair. Caps stay <=9 images / <=3 videos / <=3 audios.
Driver (video_driver.{h,cpp}): the encode queue `enc_q` now carries VIDEO,
VAUDIO and AUDIO items in presentation order; `ref_tab` stamps each
reference's latent counts straight from the encoder geometry (rad_arch_encode_geom:
a video's frame count eg[24]=its total latent frames, its soundtrack's eg[12]),
so the pack's ref segments are sized by the encoder, not hand arithmetic.
processor.{h,cpp}/iface.h/adapters.h gained the media decode entry points.
Arch (minimaxh3.cpp): step_dit scatters reference rows into the packed step —
picture/video via op_vin from b_evc, audio via op_ain from b_enca, at each
segment start, targets last. A bounds audit confirms the scatter reads exactly
the slot region the encode pass wrote this job (eg[24]=lat = the pass's
written row count = the pack's segment size; no stale-neighbor read).
DEVICE-VERIFIED on dual gfx1201 / TP2, warm server, fixed seed, comparing
DECODED stream md5 (never raw mp4 bytes — the muxer stamps a field): all three
reference kinds are DETERMINISTIC (a rerun of one reference is bit-identical,
including raw bytes) AND CONTENT-LIVE (a different reference at the same seed
gives different output video AND audio). Image (content tokens), audio
(tone/noise/880 distinct) and video (refv_a vs refv_b: both streams differ)
each steered the generation. An earlier "the video step is nondeterministic"
note was a measurement artifact — it compared raw mp4 bytes and straddled the
one-off cold-start outlier; the warm decoded-stream probe is bit-reproducible.
Debug scaffolding (R4D_ENC_DEBUG, 4 trailing RadVideoGenDecl fields + a pinned
driver slab + an FNV digest in done()) is entangled in these files. It is
env-gated and zero-touch when unset; STRIP IT BEFORE ANY PR.
tests: video_gen_test/videos_test/server_fakes cover the video/audio enqueue
paths; abi_layout_rows adds the new trailing rows; ref_audio_sensitivity.py is
a standalone host golden harness (audio reference separates 4/4), not a ctest
case. Host tier green (only mm_test's pre-existing webp demuxer gap fails, and
the GPU card/kbench tests fail solely on VRAM contention with a live server).
NOTE-REF2VA.md updated: continuity tail (#8) remains unimplemented; strict
numeric parity vs the ComfyUI CPU reference remains open.
PLACEHOLDER AUTHOR — repo has no git identity; re-author before any push.
DO NOT PUSH this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
A modulation cell is a pure function of a segment's kind -- (modality ada,
timestep block) -- so all reference photos share one cell. Runs of consecutive
same-cell segments collapse to a group; group boundaries are a subset of the
fine segment boundaries and the merge is sequence-length independent (the key
is kind alone). The modulated norm now reads COARSER group boundaries via a new
trailing RadVideoGenBatch::mod_cu while attention keeps the fine seg_cu, and the
fixed-width table is pitched by GROUP count. Nine photos therefore occupy four
groups (prompt / all-photos / soundtrack / video); buffer sizes and the arena
are unchanged (kMaxSegs stays 8, no kernel change, no re-convert).
No regression for <=5 photos: each photo cell already filled its own column from
the same input rows and weights, so it was bit-identical to the others; merging
issues it once instead of N times and yields the same per-row value. Only the
previously-rejected sixth through ninth photos change, by being allowed.
Driver: rad_arch_video_mod_segs (trailing plugin export) computes the merged
groups host-side; the driver stages them into R_MOD, guards the GROUP count
against max_ref_segs at submit (a clean refusal beats a step-loop fault), and
the plain path stages the fine table into both operands.
Device-verified on dual gfx1201 / TP2 with a CONTROLLED same-seed battery
(task=ref2va, seed fixed on every job, so neither the seed nor the token count
is a confounder): same prompt, same seed, same ref-count, DIFFERENT image
content give DIFFERENT outputs -- the reference is genuinely consumed. Nine
photos complete (the case the pinned build refused at submit), whole-run fault
scan clean.
Adds docs/NOTE-REF2VA.md: what this port reproduces of the DaSiWa workflow and
what it does not -- the residual 8-group ceiling under heavy interleaved mixed
refs, the reference-token / row budget, continuity tail (unimplemented), the
video/audio reference paths (plumbed, not yet device-verified), references x
latent-upscale exclusion, and open conditioned-step parity.
Co-Authored-By: Claude <noreply@anthropic.com>