Archived
ref2va: merged-cell modulation lifts the reference-photo ceiling from five to nine
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>
This commit is contained in:
1 parent
490d4c604a
commit
72624973ad
15 files changed
+454
-59
No files matched your search
@@ -271,6 +271,44 @@ int ref2va_mod_rows(const Ref2VAPack& p, double t_v, double t_a, std::vector<int
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* A kind's modulation cell, independent of the timesteps -- the single source shared with the arch's
|
||||
* ref_cell_of. The blocks are [0,S) video schedule, [S,2S) audio schedule, [2S,3S) video-pinned,
|
||||
* [3S,4S) audio-pinned; `r0` is a block's first row. The two target streams read their schedule;
|
||||
* every reference block reads its modality's pinned block (filled with embed(max(t,pin))). */
|
||||
static void cell_of_kind(int kind, int64_t S, int* md, int64_t* r0) {
|
||||
switch (kind) {
|
||||
case kR2VAudio: *md = 2; *r0 = S; break; /* audio schedule */
|
||||
case kR2VCondAudio:
|
||||
case kR2VRefAudio: *md = 2; *r0 = 2 * S; break; /* audio-pinned block */
|
||||
case kR2VText: *md = 1; *r0 = 0; break; /* video schedule */
|
||||
case kR2VCond:
|
||||
case kR2VRefImg: *md = 0; *r0 = 2 * S; break; /* video-pinned block */
|
||||
default: *md = 0; *r0 = 0; break; /* video target: video schedule */
|
||||
}
|
||||
}
|
||||
|
||||
void ref2va_mod_groups(const Ref2VAPack& p, int64_t S, Ref2VAModGroups* out) {
|
||||
out->bound.clear(); out->md.clear(); out->r0.clear();
|
||||
/* Walk the segments in sequence order, opening a new group whenever the cell changes or a gap
|
||||
* would otherwise appear. Empty segments carry no rows: they neither extend nor split a group,
|
||||
* so a run of photos with an empty cond between them still rides one cell. */
|
||||
int cur_md = 0; int64_t cur_r0 = 0; bool open = false;
|
||||
int64_t prev_end = 0;
|
||||
for (const Ref2VASeg& s : p.segs) {
|
||||
if (s.end <= s.start) continue;
|
||||
int md; int64_t r0;
|
||||
cell_of_kind(s.kind, S, &md, &r0);
|
||||
if (!open || md != cur_md || r0 != cur_r0 || s.start != prev_end) {
|
||||
if (open) out->bound.push_back(s.start); /* close the previous group at this start */
|
||||
else out->bound.push_back(0);
|
||||
cur_md = md; cur_r0 = r0; open = true;
|
||||
out->md.push_back(md); out->r0.push_back(r0);
|
||||
}
|
||||
prev_end = s.end;
|
||||
}
|
||||
if (open) out->bound.push_back(p.rows); /* the last group runs to the end of the sequence */
|
||||
}
|
||||
|
||||
void ref2va_ada_cell(const Ref2VAPack& p, double t_v, double t_a, std::vector<int>* md,
|
||||
std::vector<int>* trow) {
|
||||
md->resize(p.segs.size());
|
||||
|
||||
Reference in new issue
Block a user