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 -3
View File
@@ -8,7 +8,7 @@
*
* Checked: a C translation unit (abi_c_test.c, strict C11) lays every struct out as C++ does; every
* struct's listed fields account for its size, so the list in abi_layout_rows.h is complete; and
* the layout agrees with the table below, taken at RAD_ABI_VERSION 27 and RAD_FORMAT_VER 2. Under
* the layout agrees with the table below, taken at RAD_ABI_VERSION 28 and RAD_FORMAT_VER 2. Under
* those versions a listed field may not move or change size, an ABI struct may only grow by fields
* past its old end, and an on-disk struct may not change at all. The table is a snapshot of the
* headers: nothing else states the layout. When it disagrees the test prints the live table.
@@ -58,8 +58,10 @@ std::vector<Row> cpp_rows() {
};
}
/* The layout at RAD_ABI_VERSION 27 / RAD_FORMAT_VER 2 (see the file header). */
constexpr uint32_t kTableAbi = 27, kTableFormat = 2;
/* The layout at RAD_ABI_VERSION 28 / RAD_FORMAT_VER 2 (see the file header). ABI 28 changed table
* semantics (the reference table's tag-run tail, the mod-cu column map) and the rms_mod operand
* slots, not any struct's shape -- the snapshot is unchanged from 27, only re-stamped. */
constexpr uint32_t kTableAbi = 28, kTableFormat = 2;
const AbiRow kTable[] = {
#include "abi_layout_table.h"
};