A keyframe is pinned on the grid the steps run on, which is why 7935897 refused it with
latent_upscale. The pin can follow the switch instead: the server prepares each keyframe at the
small size too, the same way as at the canvas (stretch or centre crop), and the driver encodes
that picture into the keyframe's slot before the prompt pass, runs the small steps on the pack it
already lays out at the small size, and after the VUPSCALE pass encodes the canvas picture into
the same slot before the first full-size evaluation. The plugin reads its slots as before, so
neither the plugin nor the ABI changes; rad_builder.h documents the order. References keep their
own grids and are encoded once, as before.
Host: video_gen_test checks the pass order (E C S S U E S A D), each encode's size and slot and the
step rows at both sizes, and that a keyframe without its small picture is refused; videos_test
checks that each keyframe is prepared at both sizes with its stretch/crop and that the tower still
sees the canvas frame only. GUIDE, the ComfyUI node's README and tooltip no longer say keyframes
refuse latent_upscale.
New models:
- Tencent Hy-Memory (HYV3) from its BF16, FP8 and GGUF checkpoints, with its native tool calls
- M2XFP4: metadata-augmented MXFP4 weights for Qwen3.8-27B and its DFlash2 drafter (top-1 89.1% ->
92.4% against plain MXFP4), its quantiser and recipe, and ParoQuant's M2XFP4 checkpoints
- Gemma 4 E2B/E4B audio input; NVIDIA-Nemotron-3.5-Bolt-E4B in int8 and 4-bit, on two cards by
default; Ornith-1.5-122B compose files
Speed:
- Weight reads beside the decode all-reduces (qwen35_fp8, gemma3; --weight-prefetch, on by default):
the 27B MXFP4 with DFlash2 61.2 -> 67.9 tok/s at c1, TranslateGemma 27B +13%
- Head-256 split-KV decode attention at 256 workgroups and without bank conflicts (27B: +3-5% a
step at 25-41K context), and the prefill KV split for small launches (a short turn over a long
context decodes the other sequences 27% faster in that step)
- MXFP4 decode gate_up, activation and fp8 quantiser in one launch (27B, Gemma 3 up to 64 rows:
TranslateGemma +2-5% at 2-8 streams)
- ParoQuant int4/int5 tiled GEMMs 6-9% faster
- Speculation: a step's tokens are sent before the drafter's passes end, no step waits behind one
that ends its requests, and the MTP head's first draft no longer collapses after short chats in
the prefix cache
Features:
- --kv-resident N: KV streaming for a context bigger than VRAM (qwen4exp_fp8, GLM-5.3)
- MiniMax-H3: reference media and keyframe conditioning with the VAE encoders
- Krea 2 rebalance presets balanced, detail and subtle
- The dashboard's request history; a stall watch that reports a frozen step's thread and stack
- rad-tune at the served configuration, collectives measured as the exchange; Gemma 4 E2B/E4B's
per-layer embeddings read ahead off the step path
- A GPTQ calibration tap and recipe for Gemma 4 31B's w4a8 container
Fixes:
- The two-rank all-reduce checks that a peer's push has landed before reducing it
- z-lab's DFlash drafter on Gemma 4 31B keeps drafting after a prefix-cache hit
- MiniMax-H3's modulation rows
Changes: Plugin ABI 31: out-of-tree plugins must be rebuilt. RADIANCE_PREFETCH_BESIDE is
--weight-prefetch now; RADIANCE_NO_HUGE_PAGES, RADIANCE_IDS_EARLY, RADIANCE_ATTN_BAND_SPLIT,
R4D_PREFILL_SPLITS, RAD_PLE_TIMING and RAD_PLE_CACHE_ROWS are gone.
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>
The reference modulates by a per-token TAG: token_tags_from_embeds_info tags
every image embed span (with one flanking token on each side) 0 -- video --
inside the prompt, while audio pads keep tag 1 (parallel PR #236, point 3).
Our port modulated the whole prompt span as text, so every reference photo's
pad tokens read the text ada projection where the reference reads the video
one. The tags arrive in the prompt itself and nothing else carries them, so
the denoiser could not know, and the look drifted with the reference count.
The driver now writes each image item's token span into a tail of ref_tab --
one count, then {start, length} per run, audio items excluded (the reference
tags images only). The tail rides inert through the pack and ref_parts, and
is present exactly when the reference table is, so an i2va request keeps its
old bytes. ref2va_mod_groups grows a runs argument: it cuts the prompt at the
runs' edges and gives the pad pieces the VIDEO cell -- the video projection
on the video-schedule block; the prompt's own timestep row never changes,
only the projection.
Cells stay few however many photos interleave, but groups no longer equal
cells: two prompt pieces separated by a pad share one cell non-adjacently.
So the merged-group output gains a per-group column map, and the modulated-
norm kernels -- libr4d and libref alike -- accept an optional trailing
colmap (slot 9 quant, 7 bf16, past every other arch's last operand) that
redirects sequence -> table column, relaxing the row-count checks it binds.
rad_arch_video_mod_segs exports boundaries then map, the plugin stages both
only for a reference request -- the plain path still stages boundaries alone,
byte-identical -- and the half-split keeps its single video row by taking
the target's column instead of the last one. max_ref_segs now bounds the
DISTINCT CELLS, its old meaning was the group count. ABI 28; no struct's
shape moved, the layout table is re-stamped.
Co-Authored-By: Claude <noreply@anthropic.com>
Refs carry their own latent grids, so conditioning is grid-independent and
survives the draft->refine canvas switch; only the pack's video-target
segment resizes. shape_job now lays the pack out twice on a wide+refs job
(draft geometry -> seg_s/mod_seg_s/step_rows_s/lat_v_s + pos_small) and
stage_geom/build_step stage the draft tables while small_now holds. The
arch re-derives the pack from the staged geom, so the plugin needs no
change. Keyframes + upscale now refuse with a message that names the
keyframe and latent_upscale and points at sending the frame as a
reference image instead.
Host: 2 new video_gen tests (per-phase seg_cu/geom/lat/pos staging, the
by-name refusal). Device (dual R9700 TP2, dasiwa-fp8): 2x at 704x704
completes in 133s vs 212s un-upscaled, same-seed rerun bit-identical in
video and audio, refs held identity through both phases; t2va+upscale
control clean; fl2va+upscale refused by name.
conv1d keeps both stride forms: upstream's causal codec downsample with cu_div (Fish Audio) and the port's explicit-pad non-causal one (the H3 audio encoder's), in libref, libavx and libr4d alike; the ABI takes upstream's 27 on top of the port's RadVideoGenBatch growth.
A one-frame media -- a reference picture, or an endpoint keyframe -- never
shrinks through the temporal downsamplers (1->1->1->1 against a full clip's
17->17->9->5), so it rides every level alone, and a keyframe must ride the
TARGET canvas: it is resized to the output resolution before the VAE and its
latent rows share the target grid. The deep level buffers only held a full
clip's shrunken temporal volume, which capped a single frame at 5*256^2
(~572-sided) -- 480x736 was refused, 544x736 had died the server with
'venc.l3.in 6256>5120' before cont.36 added the accept-time 400.
declare_venc now sizes each level's rows as max(full clip, kEncOneFrames)
frames at the tile side, kEncOneFrames = ceil(1344*768 / 256^2) = 16, so a
single frame is bounded only by the model's whole canvas (16*256^2 >=
max_area); venc_geom applies the same max() per volume. Multi-frame media are
unchanged (the pixels volume still forces sides <= 256). Levels 2-5 grow
(R 36864->65536, 5120->16384, 1280->4096, 192->1024): about +150 MB arena,
plugin-only -- no kernel, ABI, or container change; the driver's accept-time
check delegates to the plugin export and follows automatically.
New models:
- GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget),
with decode kernels for a few rows and the DSA indexer split over the ranks
- Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter
- Unlimited-OCR (bf16)
- Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces
are fused with the junctions, overlapped with the compute and sent compressed
- Ornith-1.5-35B-A3B w4a8 compose files
Speed:
- Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued
ahead
- The four-rank all-reduce is faster for every --tp 4 model
- qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly
- --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20%
prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default
Features:
- Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch,
and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE)
- Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance
- Cards with a small PCI BAR run, with kernel arguments kept in host memory
- Dashboard: live acceptance figures; statsdump rotates its file at a size cap
- KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot
Fixes:
- Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore
makes room as memory pressure does and waits a step for the previous turn's release (two
conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now)
- Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory
management is turned off there, with a warning
- Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output
- The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start
- GLM-5.3: every refusal names the setting and the reason; its template keeps string content
- Several pictures in one request no longer refuse processors that take one image at a time
Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
The venc_geom cap tested only the pixels volume -- clip * h * w against 17
squares -- but the encoder arena holds five volumes, and the temporal
downsamplers shrink a full clip 17 -> 9 -> 5 while a one-frame clip stays 1:
the deep buffers (5 frames at their side) bind a single frame at
h * w <= 5 * kEncMaxSide^2, a ~572-sided square, not the 17-frame budget.
A 544x736 endpoint keyframe (the workflow-native Flair size) passed the
volume check and then killed the server mid-step: `operand 5 reaches past
buffer 'venc.l3.in': [6256,256] at offset 0, declared [5120,256]`. Check
every volume; the spatial divisor cancels between clip and arena, so the
temporal factors alone decide. 512^2 keyframes, every reference video and
the 256-side pictures all ride exactly as before.
The driver's picture and keyframe branches never asked the encoder at all
(only videos queried rad_arch_encode_geom), so the refusal has to arrive at
accept: probe the geometry for one-frame media and name the size in the
error, instead of a step-time rad_step_fail -- which stops the engine and
takes the server with it.
Co-Authored-By: Claude <noreply@anthropic.com>
Merges upstream 1.10.0 (152 commits: the LoRA acquire/runtime refactor, the
form-1 LTX-2 scheduler family, guidance terms + negative prompts, decoder
selection, input_reference, new architectures) into the ref2va port branch.
Resolution rule throughout: keep BOTH feature sets; ABI numbering follows
upstream (RAD_ABI_VERSION 26, RAD_FORMAT_VER 2), with the port's video fields
unioned into RadVideoGenBatch/RadVideoGenDecl and abi_layout_table.h
regenerated from the live table.
Notable reconciliations:
* videos.cpp: the task grammars are disjoint by capability -- keyframe tasks
(i2va/l2va/flash-attn l2va/fl2va) are recognized only when decl.encodes,
so upstream models keep refusing them as unknown tasks; input_reference,
the LoRA tag/field pipeline, and the guidance/negative_prompt rendering
coexist with refs/ref2va; the prompt put() helper hoisted to block scope
for the media branch.
* video_schedule(): upstream's (steps, video_tokens, refine) keeps its
positional slots; the port's shift_video/shift_audio overrides move to the
tail so upstream's schedule tests call unchanged.
* r4d_selftest conv3d cases: the port's sp/st/causal/down/refl geometry and
upstream's tpad/tpre fold into one reference (ft = causal ? 2 : tpad==2 ?
2+tpre : 1); rms_mod rows keep the port's i8/fp8 quant modes alongside
upstream's wadd/norm_once/norm parameters.
* tests/oot_plugins.sh: the per-plugin cmake --install gains a --prefix
staging dir -- plugin .so files still land in the absolute
RAD_PLUGIN_INSTALL_HOME, but libr4d now also installs r4d_selftest to a
relative bin/, which needs no root.
Host ctest: 112/113 (mm_test's webp gap pre-exists this merge); r4d_selftest,
engine_e2e, oot_plugins, abi_layout, all LoRA tests green.
Co-Authored-By: Claude <noreply@anthropic.com>
b_nout is declared with row width kMaxSegs*2*D, but the cond pass staged it
through bcol_at with a narrower pitch ARGUMENT (ncell*2*D) and the step pass
indexed row (lane,step) with that same narrow multiplier. The runtime strides a
buffer operand by its DECLARED row width, so every staging row past the first
landed beyond the consumer's window: the shift/scale table the rms_mod head
reads was ALL ZEROS for every denoise step after the first. Step 0 aligned by
coincidence (staging row #0 == the cell starts), which is why step 0 always
reproduced and hid this. The heads -- video and audio alike -- then ran
un-modulated at t>0: rms(h)*w*(1+0)+0, silently dropping a scale field of std
0.295 per step, inflating the velocity (measured 2.90 vs reference-math 2.05 at
step 1) and baking the fried look into every render.
Fix: stage and consume b_nout at its declared width, the pattern b_ada/b_modg
already use (block modulation was never wrong -- only the head table was). No
kernel, arena, or ABI change; the shared host issue path is fixed with it.
Proof chain: the nout shadow re-cast AT THE KERNEL'S OWN POINTER (the old one
sampled the declared pitch and lied -- zero_frac 1.0 at step 1 pre-fix) shows
cells matching emb(t)@W+b to 2e-3, modality-correct; torch replay on the device
stream: step-1 velocity cos 0.970->0.9975, device std 2.901->2.065 vs 2.051
reference math; device renders (512^2 6s seed 1234, flair FL2VA + T2VA control,
workflow prompt) read frame-by-frame: fried look gone on every arm, pins force,
bitrate 6.75MB->1.88MB at identical settings.
Kept (R4D_DIT_SEL-gated): per-step dump tagging dit_s{K}_*, kernel-pointer nout
shadow, tvid/tarr schedule dumps.
Co-Authored-By: Claude <noreply@anthropic.com>
Three map_rows sites reordered ff.net.0.proj rows so the gate landed SECOND, while
silu_mul / gated_quant_fp8 gate with the FIRST half (comfy's _swiglu_eager — the
reference that produced the ground-truth clips — chunks gate-first). Every DiT,
refiner and video-VAE-decoder FFN therefore computed silu(up)*gate instead of
silu(gate)*up: the block-0 device internals dump measured the FFN down-projection at
cos 0.49 against the reference while attn/to_out sat at the bf16 floor, and renders
came out over-bright with 37.8% of pixels clipping high. The maps are now identity
(checkpoint order) at all three sites; quant scales follow because they are computed
from the mapped rows. TE blocks were never affected (separate gate/up concat,
already gate-first).
Reconverted with --reuse (707 tensors / 803 weights): minimax-h3-dasiwa-w8a8-gatefix.rad.
Byte check flips in every class (vae relFro 1.7e-3 vs 1.24 swapped, bias exact, dit
sign-match 0.989 vs 0.484, ref fp8 2.6e-2 vs 1.37). Device A/B 512² 6s seed 1234:
clipHi 37.8% -> 0.1%, luma 136 -> 81 (reference 86), T2VA control clean; step-0
velocity vs the full CPU reference cos 0.9886, std ratio 1.071 (was a 7.6x gap) —
the W8A8 quant floor.
Kept: the R4D_DIT_SEL-gated decoder parity shadows (dbg_vd_* decl fields + driver
readback) that localised the fault.
Co-Authored-By: Claude <noreply@anthropic.com>
The per-block window verdict showed the block stack faithful to its quantization
floor (cos 0.98 -> 0.78 smooth decay over blocks 0-19, cascade at 20), leaving
the 7.6x step-0 velocity-std gap pointing at the FinalLayer. Dump its two own
operands so a CPU replay can judge them without the trunk: norm_out's modulated
stream over the first 256 video rows (bf16 -> f32 cast shadow) and lane/step's
shift|scale table row. The driver writes them as dit_hn.f32 / dit_nout.f32
after the existing slab files.
Replay verdict (compare_head.py, dasiwa-w8a8 dump): the table's video cell
equals t8 @ norm_out.linear + bias to the bf16 floor (relFro 1.5e-3, no silu --
the curve form bakes it, a_temb.x aliases b_temb), and the checkpoint head
reproduces the device velocity exactly (row cos 1.000000, affine 1.0000). The
head and its modulation are faithful; the vel-std gap is a harness-side
statistic, not a device op.
Co-Authored-By: Claude <noreply@anthropic.com>
The first replay verdict (dev vs ref step-0 velocity) came back decorrelated
(cos -0.45, affine relFro 0.89) -- the fork is somewhere in the 50-block trunk,
and the modulation interface is EXONERATED against the checkpoint (dev_mod
cross-check: every block's cell = ada_w_block @ the step temb + bias, cos
1.0000, std ratio 1.000; weight order [video,text,audio] for stream cells
[text,audio,video]). To say WHO diverges and WHERE, declare_dit (env-gated) now
also casts the stream's first 64 rows into [L, 64, D] f32 PERSIST after every
block -- the same rows and ordering point the next block's norm reads -- and
the driver reads it back as dit_blk.f32. 69 MB, one cast op, no fingerprint
lost: the CPU harness gained the matching window stats (win64std) + ref_blkwin.
Co-Authored-By: Claude <noreply@anthropic.com>
The DaSiWa overlay ships its modulation curve as a precomputed table (adaln_t_table
[1025,8]): timestep_embed gains a curve mode -- y[m] = the table linearly sampled at the
timestep, no sinusoid, no MLP -- in the HIP, AVX and ref tiers, and the arch drives the four
timestep rows (video, audio, and each re-embedded with its reference pin) through it with the
ada projections as plain bf16 K=8 lines. The dasiwa-w8a8 recipe carries the overlay.
Device-verified at 512: T2VA, I2VA and FL2VA complete clean and the T2VA re-run is
bit-identical; the fried look PERSISTS on the exact finetune the reference clips rendered
from, which kills the checkpoint-style theory and pins the fork to Radiance's forward.
For the value-parity localisation: R4D_DIT_SEL (env, driver and plugin) declares f32 PERSIST
shadows of the stream entering block 0, the timestep table and the step-0 modulation, and the
driver reads those plus the velocity head back on a plain request's step 0 into
R4D_ENC_DUMPDIR, for the CPU reference DiT replay to diff against.
Co-Authored-By: Claude <noreply@anthropic.com>
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>
Radiance's video denoising had only first-order Euler. The DaSiWa reference
workflow samples MiniMax-H3 with res_multistep + simple, so add it as a second
order option, exposed as a `sampler` field on /v1/videos (default euler).
New op `flow_res_multistep` across all three kernel tiers (device==avx==libref),
closed form reusing the driver's per-step scalars:
x' = r*x + hb1*den + hb2*x0, den = x + sigma*v, r = sigma_next/sigma
order 2: h=ln(sg/sgn), h_last=ln(sg_prev/sg), r_s=h_last/h,
hb1=(1-r)(1+1/(2 r_s)), hb2=-(1-r)/(2 r_s)
hb1+hb2 == 1-r, so it collapses to Euler when x0==den. Order 1 (Euler) is forced
at the first step, the first full-size step after a latent upscale (stale
history), and the last step (sigma_next==0); order 2 otherwise. The previous
denoised estimate persists in new PERSIST buffers b_vx0/b_ax0. Verified equal to
k-diffusion sample_dpmpp_2m to 5.6e-17 on three sigma grids.
- ABI 23->24: trailing int32_t sampler on RadVideoGenBatch; RAD_SAMPLER_EULER=0
/ RAD_SAMPLER_RES_MULTISTEP=1 in rad_runtime.h.
- driver: R_SCHED region widened 6->16 f32 ([0..5] Euler, [6..10] video coeffs,
[11..15] audio); step_dit branches on V->sampler.
- server: `sampler` string field ("euler"/empty, "res_multistep", else
invalid_request_error with the supported list); echoed on the job object;
capabilities advertise video_samplers.
Tests: rad-avx-check 816 + 451 hand-built, 0 fail (left-assoc grouping matches
ref/device at tol 0); r4d_selftest --case flow_res_multistep_f32 f32|bf16 x
order {1,2} exact, both INOUT pitch gaps untouched.
Device-verified (TP2, fp8 container, 256^2/2s/10-step, seed 1234 identical):
both samplers complete clean 73-frame h264; outputs differ (branch genuinely
consumed, not ignored); bad value rejected; field omitted -> euler. res_multistep
renders warmer/higher-contrast than euler -- a tone lever, not an over-exposure
fix. The euler default path is unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
LoRA for image and video generators:
- civitai and Hugging Face adapter files as published: kohya, ComfyUI and diffusers/PEFT key names;
LoRA, LoCon, LoHa, LoKr and full-weight diffs; DoRA, OFT and Tucker are refused by name
- stacked per request with a strength each, through the `loras` field or <lora:name:strength> tags
in the prompt; --lora-dir serves every file in a directory, GET /v1/loras lists them, and
--max-loras / --max-lora-rank size the slots on the card (generators default to rank 64)
- Krea 2, Qwen-Image 2.1, FLUX.3 [klein], MiniMax H3, LTX-2.5, Anima and SDXL
New models:
- Anima (base, aesthetic and turbo): Cosmos-Predict2 DiT with the Qwen3-0.6B text encoder and the
Qwen-Image VAE, on one card
- Stable Diffusion XL and its single-file finetunes (Illustrious, NoobAI including V-Pred, Pony),
read as civitai ships them, with the Euler, Euler a and DPM++ 2M samplers
Recipes:
- q38-27b-mxfp4-df2: any bf16 Qwen3.8-27B or finetune at MXFP4 with the DFlash2 drafter
- Krea 2 finetunes from civitai: scripts/krea2_native.py reads Krea's own key names, and
krea-2-fp8-unscaled keeps a plain-fp8 file's codes exactly
Changes: --max-num-batched-tokens defaults to 2048 (was 8192). Plugin ABI 25: out-of-tree plugins
must be rebuilt.
One keyframe path serves three DaSiWa modes: first_frame pins output frame 0,
last_frame pins the last frame, and the gap is diffused. A keyframe is pure
attention conditioning -- its VAE latent rides as a pinned (update=0) cond row
at its frame's time position, faithful to comfy/ldm/minimax/model.py where
keyframe latents are img_update==False rows. The sampler is untouched; the step
merely widens to carry the extra cond rows.
- server (videos.cpp/iface.h/adapters.h): first_frame/last_frame form parts ->
VideoRefMedia::FIRST_FRAME/LAST_FRAME; kf_task validation (i2va/fl2va need
first, l2va/fl2va need last); keyframes are mutually exclusive with refs;
encoder_image_canvas(cover=LAST) sizes the anchor.
- driver (video_driver.cpp): keyframe pass issues a RAD_ENC_IMAGE Vencode per
anchor (slot = ++ref_tab[1], ordered), appends ref_tab key triples
{frame(0|frames-1), video_t=1, audio_t=0}.
- arch (minimaxh3.cpp): ref_parts emits keyframe cond parts FIRST; the step
scatter admits kR2VCond/kR2VCondAudio rows.
- tests: video_gen_test keyframe-completes-widens-the-step-and-pins-the-ends
(2x Vencode at slot 1,2; widened step; seg_cu/lat_cu/ref_tab pinned); fake_pack_ref
lays keyframe rows (nk=0 byte-identical to before); videos_test keyframe API.
Device-verified (TP2, seed 9999): FL2VA completes a valid 73-frame MP4+AAC; pins
are consumed (fl2va != same-seed t2va) and force the endpoints (frame0 vs anchor
0.687 pinned vs 0.460 un-pinned; last 0.719 vs 0.521). Fidelity follow-up (not
function): anchors ride as pins only; the reference also feeds them through the
TE as vision tokens, so a prompt that contradicts the anchor lets text win --
full endpoint parity vs a golden needs TE-anchor tokens (#10/P6 bucket).
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>
The reference AttnProjection (comfy/ldm/minimax/audio_vae.py:267) computes
proj(norm3(x)) + attn(norm1(x)), then + mlp(norm2(·)). The two 2048-wide
LayerNorms are not interchangeable: norm3's affine |w|mean is 0.60, norm1's
0.27, so the projection branch carries most of the block's magnitude (std 6.6
via norm3 vs 0.4 for the attention via norm1).
The device had them wired the other way -- it staged norm1 into the projection
and norm3 into the attention (qkv). Feeding the small-affine norm1 to the
projection shrank it 6.6 -> 1.8, collapsing the pre_block output and every
audio latent downstream to ~0.25-0.27x the reference.
Fix: stage norm1 for the attention (feeding p_op_qkv) and norm3 for the
projection (feeding p_op_proj). Both LN ops are the same ln(...,2048,b_apb->
b_aln3) kernel, so only the consumer wiring changed -- no kernel touched, no
re-convert (norm1.*/norm3.* weights are already loaded correctly).
Also adds a gated read-only R4D_ENC_SEL=amb readback (dbg_ae_amb = b_amb, the
f32 mean_proj input): the bf16 b_ax2 readback lags the arena and dumps garbage,
so b_amb is the reliable pre_block output used to localise the gap. Inert when
R4D_ENC_SEL is unset.
Device-verified (seed=7 tone, minimax-h3-ref2va-fp8, warm TP2): pre_block out
b_amb std 1.65 -> 6.43 (ratio 0.25 -> 0.97); final latent b_enca std 0.23 ->
0.546 vs reference 0.588 (ratio 0.39 -> 0.93), affine slope 0.385 -> 0.923,
R^2 0.975 -> 0.989. Host tier green (abi_layout/arch/ref/videos).
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>
Unblocked by the on-box torch env. ref_aenc_parity.py loads the reference HF audio
VAE (fp32) under ComfyUI's --cpu branch (no GPU context — the TP2 server holds both
cards), and compares the device's b_enca normalised latent to the reference encode()
run on the device's OWN staged enc_samples buffer. Device-input-anchored => removes
every decode/normalise/pad confound; a kernel bug shows gross, a correct fp8 port
shows at/below the ~1.6e-3 convert quant floor. --selftest validates the reshape /
slot / metric logic without a device (perfect->0, temporal-misalign->0.24).
Driver side: extend the R4D_ENC_DEBUG scaffolding to raw-dump the staged enc_samples
(host buffer at stage time) and the b_enca / b_evc readback to R4D_ENC_DUMPDIR.
Inert unless R4D_ENC_DEBUG + R4D_ENC_DUMPDIR are both set; host tier green.
Reference model.py re-baked golden.json byte-identical (no reference drift).
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>
New models:
- LTX-2.5 (base and distilled): video with a stereo soundtrack from text or from text and a first
frame, on one card, with its duration head, tiled VAE decoding, the diffusion decoder and the x2
latent upsampler
- Krea 2 Raw and Turbo, and FLUX.3 [klein] and its base: text to image, and for FLUX.3 edits from up
to ten reference pictures, on one card
- GLM-5.3-Flash from AMD's Quark MXFP4 export, on eight cards (John McDonough, Nunze)
- Gemma 3 / TranslateGemma 27B with an optional DFlash2 drafter (mici81)
Engine:
- --kv-cache-dtype fp8_v4 and k6_v4 for Gemma 3 and Qwen3.8-Flash-Next (mici81)
- the rotated int8 trunk (i8a8h) for Qwen3.8-27B (eddie168168)
- eight-rank all-reduce bands, weighted shards and pieces (Nunze); --host-headroom-mib (sfjes)
- the dashboard shows the single-stream decode floor and its most recent window (Memoria)
Fixes: prefix-cache reservations kept until their save lands (baKon), tool calls in Responses
namespaces (#119), system messages merged when a template refuses several (#137), a prefill
continued with no open step (#127), calibration of a Gram accumulation (#122), JSON Schema patterns
read unanchored (davetha), GLM-style tool calls, the KV floor counting every sequence's state.
Plugin ABI 24.
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>
Ref2VA ref-image conditioning verified on-device: ref step runs all steps no
fault; output differs ref-present vs ref-absent (by log). 6-9 images rejected
cleanly at submit (no engine crash). Merged-cell modulation (<=9) tracked next.
NOTE: placeholder author -- re-author before any push. Do NOT push this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
- MiniMax-H3 and FastH3 no longer stop the server on a prompt longer than 16 tokens (FastH3) or
128 tokens (MiniMax-H3)
- latent upscaling for the MiniMax-H3 containers: with LBH-123-AI's latent upscaler in the
container, `latent_upscale` runs the first steps at a smaller size and refines the latent at the
full size; `upscale_refine_steps` sets how many steps refine, and the video object reports both
- rad-convert --in-place extends a container whose weights the plugin has regrouped since
- plugin ABI 22: out-of-tree plugins must be rebuilt
- video: MiniMax-H3 and FastVideo's FastH3 8-Step V2, a video with its stereo soundtrack from text
on OpenAI's /v1/videos, block fp8 on two cards
- music: MiniMax-Music3, songs from lyrics and a description on /v1/audio/speech
- speech: Breeze-TTS-2 on /v1/audio/speech and vLLM-Omni's realtime WebSocket
- runtime LoRA adapters beside the base model, picked per request by `model` (baKon, #105)
- several agent streams keep their cached history: --checkpoint-slots auto, the new default, sizes
the snapshot store by --max-num-seqs (#108)
- the Swift 1.5 27B W4 releases convert and serve: compressed-tensors AWQ and GPTQ int4, AutoRound,
ModelOpt NVFP4 (#110)
- the image's host tests pass where perf_event_open is refused, as in BuildKit's sandbox (#106)
- plugin ABI 21: out-of-tree plugins must be rebuilt