minimaxh3+r4d+driver: the prompt's vision pads are modulated as video, not as text

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>
This commit is contained in:
gearwave00001andClaude committed 2026-10-25 07:29:27 -05:00
1 parent c5483e3241
commit 8a6a1180ce
14 files changed
+548 -139

No files matched your search

+5 -4
View File
@@ -104,10 +104,11 @@ struct Plugin {
* out and refuses requests that carry VAE references. */
int64_t (*arch_video_pack)(const RadVideoGeom*, const int32_t*, int32_t*, int64_t, float*,
int64_t) = nullptr;
/* Optional (rad_builder.h); the merged modulation-group boundaries a conditioned pack collapses
* to (rad_arch_video_mod_segs). Null with arch_video_pack present means the driver stages the
* fine table into the norm operand too -- correct whenever nothing merges (a plain or a
* single-reference sequence), and refused at submit only when a wide pack would need it. */
/* Optional (rad_arch_video_mod_segs, documented at the plugin's definition); the merged
* modulation groups a conditioned pack collapses to, as boundaries then the group->column map.
* Null with arch_video_pack present means the driver stages the fine table into the norm operand
* too, boundaries only -- correct whenever nothing merges (a plain or a single-reference
* sequence), and refused at submit only when a wide pack would need it. */
int64_t (*arch_video_mod_segs)(const RadVideoGeom*, const int32_t*, int32_t*, int64_t) =
nullptr;
/* Optional (rad_builder.h); null means the driver runs no encode pass. */