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

+16
View File
@@ -2693,6 +2693,11 @@ static const RadParamSpec pFlowRenoise[] = { P_INT("M"), P_INT("n"), P_INT("stre
static const RadOperandSpec oFlowRenoise[] = {
{ "sigma", RAD_OPD_IN, 0 }, { "seed", RAD_OPD_IN, 0 }, { "x", RAD_OPD_INOUT, 0 },
};
static const RadParamSpec pCondAug[] = { P_INT("M"), P_INT("n"), P_INT("stream"), P_F64("aug"),
P_STR("dtype") };
static const RadOperandSpec oCondAug[] = {
{ "seed", RAD_OPD_IN, 0 }, { "x", RAD_OPD_INOUT, 0 },
};
/* ---- LTX-2 (r4d_ltx.hip); the same specs as libref's. */
static const RadParamSpec pRopeSplit[] = { P_INT("M"), P_INT("n_head"), P_INT("head_dim"),
@@ -3620,6 +3625,10 @@ static const RadOpSchema kSchemas[] = {
SCHEMA("flow_renoise", pFlowRenoise, oFlowRenoise,
"x = (1 - sigma) x + sigma z, z the (seed, stream) normal stream at element k n + c, "
"each step one f32 rounding."),
SCHEMA("cond_aug", pCondAug, oCondAug,
"x = a x + oma z, a the `aug` parameter, oma the f32 of the f64 1 - aug, z the "
"(seed, stream) normal stream at element k n + c, each step one f32 rounding: the "
"reference's condition-noise augmentation."),
SCHEMA("rope_split", pRopeSplit, oRopeSplit,
"LTX-2's split rotary over fractional coordinates: the pairs of all heads on one "
"ladder, the first `pad` unrotated, the axes interleaved; each head's halves turned "
@@ -9368,6 +9377,13 @@ R4D_WIN_PAIR(512, 1) R4D_WIN_PAIR(512, 2) R4D_WIN_PAIR(512, 4) R4D_WIN_PAIR(512,
ROW(cGenF32), NOTUNE,
nullptr, nullptr, r4d_rad_flow_renoise },
{ "cond_aug_f32", "cond_aug", "elem",
"condition rows blended with fresh noise at the declared aug: a thread a value",
"any M and n, row pitches honoured", "f32 rows, u32 seed words",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
ROW(cGenF32), NOTUNE,
nullptr, nullptr, r4d_rad_cond_aug },
{ "rope_split", "rope_split", "elem",
"LTX-2's rotary: a workgroup a (head, 64 rows), the head's ladder in LDS, sincosf a pair",
"any M, row pitches honoured; head_dim / 2 dividing 256; up to four axes",