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:
gearwave00001andClaude committed 2026-10-22 18:38:04 -05:00
commit a1a75da7e9
415 files changed
+78837 -5310

No files matched your search

+44
View File
@@ -16,6 +16,7 @@
#include "rad_philox.h"
#include <cmath>
#include <cstdlib>
#include <cstring>
namespace {
@@ -972,6 +973,17 @@ __global__ __launch_bounds__(kT) void iota_kernel(int* __restrict__ y, int n, in
if (i < n) y[i] = start + (period > 0 ? i % period : i) * step;
}
// y[j] = (src[j] < 0 ? 0 : x[src[j]]) * mul[j] + add[j], the lists by value.
constexpr int kAffMax = 16;
struct IntAffine { int src[kAffMax], mul[kAffMax], add[kAffMax]; };
__global__ __launch_bounds__(kAffMax) void int_affine_kernel(const int* __restrict__ x,
int* __restrict__ y, IntAffine p,
int n) {
const int j = threadIdx.x;
if (j < n) y[j] = (p.src[j] < 0 ? 0 : x[p.src[j]]) * p.mul[j] + p.add[j];
}
__global__ __launch_bounds__(kT) void cu_repeat_kernel(const int* __restrict__ len,
int* __restrict__ y, int n, int mult) {
const int j = blockIdx.x * kT + threadIdx.x;
@@ -1619,6 +1631,38 @@ extern "C" int r4d_rad_iota(const RadArgs* a, RadStream s) {
return st_of(hipGetLastError());
}
namespace {
int parse_ints(const char* s, int* v, int cap) {
int n = 0;
while (s && *s) {
char* e = nullptr;
const long x = std::strtol(s, &e, 10);
if (e == s) break;
if (n == cap) return -1;
v[n++] = (int)x;
s = e;
}
return n;
}
} // namespace
extern "C" int r4d_rad_int_affine(const RadArgs* a, RadStream s) {
const RadTensor *x = r4d_opt(a, 0), *y = r4d_opt(a, 1);
if (!x || !y) return R4D_NO(RAD_E_INVAL);
if (!is_i32(x) || !is_i32(y)) return R4D_NO(RAD_E_DTYPE);
if (!r4d_contig(x) || !r4d_contig(y)) return R4D_NO(RAD_E_STRIDE);
IntAffine p{};
const int n = parse_ints(r4d_gets(a, "src"), p.src, kAffMax);
if (n <= 0 || parse_ints(r4d_gets(a, "mul"), p.mul, kAffMax) != n ||
parse_ints(r4d_gets(a, "add"), p.add, kAffMax) != n || r4d_numel(y) < n)
return R4D_NO(RAD_E_SHAPE);
for (int j = 0; j < n; ++j)
if (p.src[j] >= r4d_numel(x)) return R4D_NO(RAD_E_SHAPE);
hipLaunchKernelGGL(int_affine_kernel, dim3(1), dim3(kAffMax), 0, (hipStream_t)s,
(const int*)x->data, (int*)y->data, p, n);
return st_of(hipGetLastError());
}
extern "C" int r4d_rad_cu_repeat(const RadArgs* a, RadStream s) {
const RadTensor *len = r4d_opt(a, 0), *y = r4d_opt(a, 1);
if (!len || !y) return R4D_NO(RAD_E_INVAL);