ops+minimaxh3+driver: the condition-noise augmentation the reference adds to visual cond rows

The reference's _cond_video_rows runs every visual conditioning latent through
x = aug x + (1 - aug) z at VISUAL_COND_TIMESTEP 0.999, its generator restarted
per item, while audio conditioning is untouched (its aug is 1.0, a no-op). We
staged the clean latent instead, so every image-, keyframe- and reference-
conditioned render started from un-augmented conditioning.

New op cond_aug: x = f32(f32(a x) + f32(oma z)), a the aug parameter and oma
the f32 of the double 1 - aug -- the reference subtracts in double and rounds
once -- with z the (seed, stream) normal stream at element k n + c on stream
2, the reference's noise never sharing the generator that fills x. Seed words
0-1 of the video's seed, per-item restart by per-row offset. Issued once at
the end of step_venc over the conditioning rows: staging once at encode-build
time is equivalent to the reference's per-call restart because each item's
rows are exactly its own, and the driver's build_encode now re-stages the
seed, where a stale lane's words used to ride through.

Reference RNG is MT19937 and ours Philox, so the noise is distributionally
faithful, not bit-exact. ABI unchanged at 28. Device: r4d_selftest 0 failures,
cond_aug rows 1.13e-9/4.42e-8 rel_l2 against libref.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
gearwave00001andClaude committed 2026-10-25 08:45:29 -05:00
1 parent 8c547fe240
commit 47b7aae7a3
16 files changed
+320 -4

No files matched your search

+23
View File
@@ -1729,6 +1729,29 @@ Every op honours its activation operands' row pitches. `rd` is a rounding into t
first, `stream` the parameter. `x` f32 `[M, n]` at its row pitch. MiniMax-H3: `n` 96 (the video's
patch rows) and 32 (the soundtrack's), `stream` 1.
### Condition-noise augmentation
MiniMax-H3's reference blends every visual condition's patchified latents with fresh noise before
they condition the transformer (`_cond_video_rows`, `comfy/ldm/minimax/model.py`: the blend weight
is `VISUAL_COND_TIMESTEP` 0.999 and every condition intentionally restarts the same RNG stream).
The arch applies the blend once, per media item, over the item's encoded rows after the VAE
encoder's fold. Unlike `flow_renoise`'s staged `sigma` the weight is a declared parameter: it is a
constant of the recipe, not a value the request carries. The audio twin's aug defaults to 1.0 —
disabled — so no audio-side form exists.
| op | params | operands |
|---|---|---|
| `cond_aug` | `M`(range) `n` `stream` `aug`:f64 `dtype` | `seed`, `x`:inout |
- `cond_aug` blends condition rows with fresh noise, over `x`'s rows:
`x[k, c] = f32(f32(a x[k, c]) + f32(oma z(k n + c)))`, `a` = `aug` in `[0, 1)`, `oma` the f32 of
the f64 `1 - aug` computed in double (the reference subtracts that scalar in python),
`z(e) = rad_philox_normal_s(seed, stream, e)` (`abi/rad_philox.h`), `seed` u32 `[2]` low word
first, `stream` the parameter. `x` f32 `[M, n]` at its row pitch. The caller issues one media
item's rows at a time with the same `(seed, stream)`, so every item's draws restart at `e = 0`
as the reference's per-latent generator does. MiniMax-H3: `n` 96 (the video's patch rows),
`stream` 2, `aug` 0.999.
## LTX-2
The ops LTX-2's audio-video transformer adds (`libref/ref_ltx.cpp`): its rotary over fractional