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
@@ -208,6 +208,9 @@ int Registry::commit_(Staged& s, int order) {
|
||||
* container, which "" means. */
|
||||
if (auto q_fn = dl_fn<const char* (*)(void)>(s.handle, "rad_arch_quant"))
|
||||
p.arch_quant = or_empty(q_fn());
|
||||
/* Optional: absent means the plugin may serve an imported quantisation (startup.h). */
|
||||
if (auto i_fn = dl_fn<int (*)(void)>(s.handle, "rad_arch_serves_imports"))
|
||||
p.arch_serves_imports = i_fn() != 0;
|
||||
|
||||
/* Optional: answers what the core needs before it builds the RadBuildCtx for declare.
|
||||
* Absent means every answer is zero (rad_builder.h). */
|
||||
@@ -457,6 +460,7 @@ int Registry::commit_(Staged& s, int order) {
|
||||
}
|
||||
const auto concurrent = dl_fn<RadKernelConcurrentFn>(s.handle, "rad_kernel_concurrent");
|
||||
const auto collective = dl_fn<RadKernelCollectiveFn>(s.handle, "rad_kernel_collective");
|
||||
const auto chainable = dl_fn<RadKernelChainFn>(s.handle, "rad_kernel_chain");
|
||||
for (const auto& sr : staged_rows) {
|
||||
KernelRow row;
|
||||
row.info = sr.first;
|
||||
@@ -468,6 +472,7 @@ int Registry::commit_(Staged& s, int order) {
|
||||
row.collective = coll != 0;
|
||||
row.releases_link = coll == 2;
|
||||
row.reference = p.reference;
|
||||
row.chain = chainable && chainable(sr.second) != 0;
|
||||
rows_.push_back(row);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ struct Plugin {
|
||||
int64_t (*arch_text_prepare)(int, const char*, char*, int64_t) = nullptr;
|
||||
/* Required of a video generator (rad_builder.h); null for every other plugin. */
|
||||
int64_t (*arch_video_positions)(int, const RadVideoGeom*, float*, int64_t) = nullptr;
|
||||
/* Optional (rad_builder.h, rad_arch_serves_imports); absent is true. False keeps the plugin
|
||||
* out of the pick for an imported checkpoint (startup.h). */
|
||||
bool arch_serves_imports = true;
|
||||
/* Optional (rad_builder.h); null means the video driver stages the plain
|
||||
* [text | audio | video] boundary table itself. */
|
||||
int64_t (*arch_video_segs)(const RadVideoGeom*, int32_t*, int64_t) = nullptr;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* one. A match is necessary, not sufficient: strides, contiguity, alignment and buffer sizes are
|
||||
* properties of a call, and the entry point still rejects what it cannot run.
|
||||
*/
|
||||
#include "../device/device.h"
|
||||
#include "registry.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -384,6 +385,10 @@ Resolved Registry::resolve(std::string_view op, const Geometry& g, int domain, S
|
||||
for (const auto& kv : chosen) r.geom.set_i(kv.first, kv.second);
|
||||
r.choice = TuneCache::canon_choice(chosen);
|
||||
}
|
||||
/* A chainable row runs its chained form wherever chaining is on (RadKernelChainFn); the
|
||||
* parameter is outside the tune cache's key, which was taken above. */
|
||||
if (r.row->chain && rad_dev_chain_enabled())
|
||||
r.geom.set_i("chain", 1);
|
||||
|
||||
/* scratch_bytes stays 0: the scratch hook needs a RadArgs with the operand tensors, which the
|
||||
* builder owns and sizes the arena with. */
|
||||
|
||||
@@ -60,6 +60,11 @@ foreach(q plain fp8 w4)
|
||||
RADTEST_ARCHQ_NAME="radtest_archq_${q}"
|
||||
RADTEST_ARCHQ_QUANT="${_rad_q}")
|
||||
endforeach()
|
||||
# A fourth member, quantised but declining imported checkpoints (rad_arch_serves_imports).
|
||||
rad_add_plugin(radtest_archq_w8 testarchq SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/testplugin.cc)
|
||||
target_compile_definitions(radtest_archq_w8 PRIVATE RADTEST_ARCHQ=1
|
||||
RADTEST_ARCHQ_NAME="radtest_archq_w8" RADTEST_ARCHQ_QUANT="w8"
|
||||
RADTEST_ARCHQ_NO_IMPORTS=1)
|
||||
|
||||
# KV tier transfer test plugin. Unlike the others it computes (byte-row gather and scatter in the
|
||||
# device domain, on host backend memory), so only tests/mem_test.cpp loads it, by path. It calls
|
||||
|
||||
@@ -346,8 +346,8 @@ extern "C" int rad_plugin_reference(void) { return 1; }
|
||||
|
||||
/* ================================================================== radtest_extra */
|
||||
/* Rows for rules the base plugin's ops do not reach: a constraint on the ranged key that is not an
|
||||
* interval, a tunable axis with a cross-axis test, a kernel that relayouts its weight, and a
|
||||
* capacity parameter. In testkernels/extra, so loading testkernels/ alone is unchanged. */
|
||||
* interval, a tunable axis with a cross-axis test, a kernel that relayouts its weight, a kernel
|
||||
* that reads any stored form, and a capacity parameter. In testkernels/extra, so loading testkernels/ alone is unchanged. */
|
||||
#elif defined(RADTEST_EXTRA)
|
||||
|
||||
static const RadOperandSpec kOpdCap[] = {
|
||||
@@ -368,6 +368,8 @@ static const RadOpSchema kSchemas[] = {
|
||||
"a kernel that stores its weight in its own layout" },
|
||||
{ "t_join", kPGemm, NELEM(kPGemm), kOpdGemm, NELEM(kOpdGemm),
|
||||
"a weight of several planes: a device kernel's own form, a host kernel's joined one" },
|
||||
{ "t_any", kPGemm, NELEM(kPGemm), kOpdGemm, NELEM(kOpdGemm),
|
||||
"a kernel that reads its weight's stored bytes uninterpreted (a prefetch)" },
|
||||
{ "t_cap", kPCap, NELEM(kPCap), kOpdCap, NELEM(kOpdCap),
|
||||
"a capacity a sizing declare may shrink" },
|
||||
};
|
||||
@@ -417,6 +419,12 @@ static int t_join_host_layout(const RadParam* p, int n_p, int operand, const Rad
|
||||
return rad_planes_layout(enc, sel, planes, n_planes, out);
|
||||
}
|
||||
|
||||
/* Reads the stored bytes without interpreting them: any form, and claims none. */
|
||||
static int t_any_layout(const RadParam*, int, int, const RadEncoding*, const int*,
|
||||
const RadTensor*, int, RadLayout*) {
|
||||
return RAD_LAYOUT_ANY;
|
||||
}
|
||||
|
||||
static const RadConstraint kCLayTiled[] = { RAD_CLE("M", 16) };
|
||||
static const RadConstraint kCLayPlain[] = { RAD_CLE("M", 4096) };
|
||||
|
||||
@@ -462,6 +470,11 @@ static const RadKernelInfo kKernels[] = {
|
||||
.domain = RAD_DOMAIN_HOST, .priority = 10, .launch = t_launch,
|
||||
.layout = t_join_host_layout },
|
||||
|
||||
{ .name = "t_any_read", .op = "t_any", .family = "misc",
|
||||
.computes = "nothing; a registry row", .shape = "any", .dtypes = "any stored form",
|
||||
.domain = RAD_DOMAIN_DEVICE, .priority = 10, .launch = t_launch,
|
||||
.layout = t_any_layout },
|
||||
|
||||
{ .name = "t_cap_any", .op = "t_cap", .family = "norm",
|
||||
.computes = "nothing; a registry row", .shape = "any", .dtypes = "any",
|
||||
.domain = RAD_DOMAIN_DEVICE, .priority = 10, .launch = t_launch },
|
||||
@@ -623,6 +636,10 @@ const RadPluginInfo* rad_plugin_info(void) { return &kInfo; }
|
||||
const char* rad_arch_id(void) { return RADTEST_ARCH_ID; }
|
||||
/* The other half of the selection key (spec §2.4); "" is an unquantised container. */
|
||||
const char* rad_arch_quant(void) { return RADTEST_ARCH_QUANT; }
|
||||
#if defined(RADTEST_ARCHQ_NO_IMPORTS)
|
||||
/* Quantised, but never the plugin an imported checkpoint is handed to. */
|
||||
int rad_arch_serves_imports(void) { return 0; }
|
||||
#endif
|
||||
/* The core loads and identifies architecture plugins; the build component drives them. Neither
|
||||
* hook is called by anything this test exercises, and declare refuses rather than pretending. */
|
||||
int rad_arch_declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* ctx) {
|
||||
|
||||
Reference in new issue
Block a user