Archived
merge origin/main: the upstream LoRA-runtime refactor beneath the ref2va port
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>
This commit is contained in:
commit
a1a75da7e9
415 files changed
+78837
-5310
No files matched your search
+24
-6
@@ -370,8 +370,18 @@ int ref_vtile_stitch(const RadArgs* a, RadStream) {
|
||||
* ((W + pl + pr - k) / stride + 1) (floor divisions)
|
||||
*
|
||||
* with ft / bk and pt / pb / pl / pr the front / back and top / bottom / left / right pads. The
|
||||
* time axis is always zero-padded; `reflect` mirrors each spatial axis once, torch's `reflect`
|
||||
* (x[-n] = x[n], x[D + n] = x[D - 2 - n]), so each pad must be below the axis it pads. */
|
||||
* time axis is zero-padded unless `tpad` says otherwise (below); `reflect` mirrors each spatial
|
||||
* axis once, torch's `reflect` (x[-n] = x[n], x[D + n] = x[D - 2 - n]), so each pad must be below
|
||||
* the axis it pads.
|
||||
*
|
||||
* `tpad` sets the frames' padding (rows and columns stay zero-padded): `zero` (the default),
|
||||
* `replicate` (the edge frame repeated, kt/2 a side: LTX-2's decoder) or `causal` (the first
|
||||
* frame repeated kt - 1 times in front, nothing after: LTX-2's encoder). With `causal`, `tpre`
|
||||
* more copies of the first frame stand in front of those, and y has T + tpre frames (LTX-2's
|
||||
* temporal downsampler, which prepends its first frame before its convolution). It folds into
|
||||
* the same grid math: replicate keeps ft = kt / 2 and clamps the time reads to the volume;
|
||||
* causal-`tpre` takes ft = kt - 1 + tpre and bk = 0, clamping below. `tpad` `causal` repeats
|
||||
* where `causal` 1 zeroes, and the two are refused together. */
|
||||
static int64_t idiv_floor(int64_t a, int64_t b) {
|
||||
const int64_t q = a / b;
|
||||
return (a % b && (a < 0) != (b < 0)) ? q - 1 : q;
|
||||
@@ -382,21 +392,27 @@ int ref_conv3d_ndhwc(const RadArgs* a, RadStream) {
|
||||
const RadTensor *x = &a->t[0], *w = &a->t[1], *b = &a->t[2], *geom = &a->t[3];
|
||||
const RadTensor *res = t_in(a, 4), *y = &a->t[5];
|
||||
const int64_t cin = p_int(a, "cin", 0), cout = p_int(a, "cout", 0);
|
||||
const int64_t k = p_int(a, "k", 0), kt = p_int(a, "kt", 0);
|
||||
if (cin <= 0 || cout <= 0 || k <= 0 || kt <= 0 || !(k & 1) || !(kt & 1) || numel(geom) < 3)
|
||||
const int64_t k = p_int(a, "k", 0), kt = p_int(a, "kt", 0), tpre = p_int(a, "tpre", 0);
|
||||
static const char* const kPads[] = { "zero", "replicate", "causal" };
|
||||
const int tpad = p_enum(a, "tpad", kPads, 3, 0);
|
||||
if (tpad < 0 || (tpre && tpad != 2)) return RAD_E_INVAL;
|
||||
if (cin <= 0 || cout <= 0 || k <= 0 || kt <= 0 || !(k & 1) || !(kt & 1) || tpre < 0 ||
|
||||
numel(geom) < 3)
|
||||
return RAD_E_SHAPE;
|
||||
const int64_t sp = p_int(a, "stride", 1), st = p_int(a, "stride_t", 1);
|
||||
const int64_t causal = p_int(a, "causal", 0), reflect = p_int(a, "reflect", 0);
|
||||
const char* pads = p_str(a, "pad", "same");
|
||||
const bool down = pads && !std::strcmp(pads, "down");
|
||||
if (sp <= 0 || st <= 0 || (causal && causal != 1) || (reflect && reflect != 1) ||
|
||||
(causal && tpad) /* zero-causal and replicated-causal contradict */ ||
|
||||
!(!pads || !std::strcmp(pads, "same") || down))
|
||||
return RAD_E_SHAPE;
|
||||
const bool gen = sp != 1 || st != 1 || causal || down || reflect;
|
||||
if (gen && (k != 3 || kt != 3)) return RAD_E_SHAPE;
|
||||
const int64_t T = ldi(geom, 0), H = ldi(geom, 1), W = ldi(geom, 2);
|
||||
if (T <= 0 || H <= 0 || W <= 0) return RAD_E_SHAPE;
|
||||
const int64_t ft = causal ? kt - 1 : kt / 2, bk = causal ? 0 : kt / 2;
|
||||
const int64_t ft = causal ? kt - 1 : tpad == 2 ? kt - 1 + tpre : kt / 2;
|
||||
const int64_t bk = (causal || tpad == 2) ? 0 : kt / 2;
|
||||
const int64_t pt = down ? 0 : k / 2, pb = down ? 1 : k / 2;
|
||||
const int64_t pl = down ? 0 : k / 2, pr = down ? 1 : k / 2;
|
||||
if (reflect && (std::max(pt, pb) >= H || std::max(pl, pr) >= W)) return RAD_E_SHAPE;
|
||||
@@ -418,7 +434,9 @@ int ref_conv3d_ndhwc(const RadArgs* a, RadStream) {
|
||||
for (int64_t o = 0; o < cout; ++o) {
|
||||
float acc = 0.0f;
|
||||
for (int64_t dz = 0; dz < kt; ++dz) {
|
||||
const int64_t tz = t * st + dz - ft;
|
||||
int64_t tz = t * st + dz - ft;
|
||||
if (tpad) /* replicate and causal-tpre clamp; `zero`/`causal` pad */
|
||||
tz = std::min<int64_t>(std::max<int64_t>(tz, 0), T - 1);
|
||||
if (tz < 0 || tz >= T) continue;
|
||||
for (int64_t kh = 0; kh < k; ++kh) {
|
||||
int64_t iy = i * sp + kh - pt;
|
||||
|
||||
Reference in new issue
Block a user