radiance 1.9.0

New models:
- LTX-2.5 (base and distilled): video with a stereo soundtrack from text or from text and a first
  frame, on one card, with its duration head, tiled VAE decoding, the diffusion decoder and the x2
  latent upsampler
- Krea 2 Raw and Turbo, and FLUX.3 [klein] and its base: text to image, and for FLUX.3 edits from up
  to ten reference pictures, on one card
- GLM-5.3-Flash from AMD's Quark MXFP4 export, on eight cards (John McDonough, Nunze)
- Gemma 3 / TranslateGemma 27B with an optional DFlash2 drafter (mici81)

Engine:
- --kv-cache-dtype fp8_v4 and k6_v4 for Gemma 3 and Qwen3.8-Flash-Next (mici81)
- the rotated int8 trunk (i8a8h) for Qwen3.8-27B (eddie168168)
- eight-rank all-reduce bands, weighted shards and pieces (Nunze); --host-headroom-mib (sfjes)
- the dashboard shows the single-stream decode floor and its most recent window (Memoria)

Fixes: prefix-cache reservations kept until their save lands (baKon), tool calls in Responses
namespaces (#119), system messages merged when a template refuses several (#137), a prefill
continued with no open step (#127), calibration of a Gram accumulation (#122), JSON Schema patterns
read unanchored (davetha), GLM-style tool calls, the KV floor counting every sequence's state.
Plugin ABI 24.
This commit is contained in:
Deadcode committed 2026-10-19 21:58:07 +02:00
1 parent 778cbf315e
commit 685ec5bd85
136 files changed
+18917 -3821

No files matched your search

+38 -84
View File
@@ -1,24 +1,24 @@
/* tests/r4d_emu: gemm_nt_f32 (r4d_glm.hip) on the host SIMT emulator. Every tile form
* (RADIANCE_F32_GEMM_TILE) must match the one-wave-per-output legacy kernel bit for bit, and the
* legacy kernel must match its arithmetic written out here: lane l folds k = l, l+32, ... with
* fmaf, then the xor butterfly over 16, 8, 4, 2, 1. Tail rows and columns and the pitch's padding
* stay untouched.
/* tests/r4d_emu: gemm_nt_f32 (r4d_glm.hip) on the host SIMT emulator. The form the launcher picks
* at each shape (one wave an output at one row, else a tile of rows x columns a wave, by M; the
* shapes reach every one) must match the arithmetic written out here bit for bit: lane l folds
* k = l, l+32, ... with fmaf, then the xor butterfly over 16, 8, 4, 2, 1. Tail rows and columns
* and the pitch's padding stay untouched.
*
* router_sigmoid_topk from the same unit: the wave-per-row select must match the serial scan
* (RADIANCE_ROUTER_SELECT=old) bit for bit, and the scan its arithmetic written out here, on
* random and on tied ranks, with the outputs' pitch padding untouched. */
* router_sigmoid_topk from the same unit: the wave-per-row select must match a serial scan written
* out here bit for bit, on random and on tied ranks, with the outputs' pitch padding untouched. */
#include "rad_abi.h"
#include "rad_plugin.h"
#include "r4d_plugin.h"
#include "ref_host.h"
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <random>
#include <vector>
static float legacy_model(const uint16_t* x, const float* w, int k) {
extern const char* emu_last_kernel;
static float gemm_model(const uint16_t* x, const float* w, int k) {
float lane[32];
for (int l = 0; l < 32; ++l) {
float s = 0;
@@ -115,62 +115,41 @@ static void router_cases(std::mt19937& rng, int& cases, int& fails) {
a.n_t = 4;
a.p = p;
a.n_p = 6;
auto run = [&](const char* form, std::vector<int>& ids, std::vector<float>& w) {
ids.assign((size_t)M * ip, -77);
w.assign((size_t)M * wp, -7.25f);
t[2].data = ids.data();
t[3].data = w.data();
if (form)
setenv("RADIANCE_ROUTER_SELECT", form, 1);
else
unsetenv("RADIANCE_ROUTER_SELECT");
return r4d_rad_router_sigmoid_topk(&a, nullptr);
};
std::vector<int> ids_old, ids_new;
std::vector<float> w_old, w_new;
std::vector<int> ids((size_t)M * ip, -77);
std::vector<float> w((size_t)M * wp, -7.25f);
t[2].data = ids.data();
t[3].data = w.data();
++cases;
if (run("old", ids_old, w_old) != RAD_OK) {
std::printf("FAIL router scan launch M=%d ne=%d\n", M, ne);
++fails;
continue;
}
const int rc = r4d_rad_router_sigmoid_topk(&a, nullptr);
int bad = 0;
for (int r = 0; r < M; ++r) {
for (int r = 0; r < M && rc == RAD_OK; ++r) {
int mi[32];
float mw[32];
router_model(&lg[(size_t)r * lp], bias.data(), bp, ne, k, sh.norm, factor, mi, mw);
bad += std::memcmp(mi, &ids_old[(size_t)r * ip], (size_t)k * 4) != 0;
bad += std::memcmp(mw, &w_old[(size_t)r * wp], (size_t)k * 4) != 0;
for (int c = k; c < ip; ++c) bad += ids_old[(size_t)r * ip + c] != -77;
for (int c = k; c < wp; ++c) bad += w_old[(size_t)r * wp + c] != -7.25f;
bad += std::memcmp(mi, &ids[(size_t)r * ip], (size_t)k * 4) != 0;
bad += std::memcmp(mw, &w[(size_t)r * wp], (size_t)k * 4) != 0;
for (int c = k; c < ip; ++c) bad += ids[(size_t)r * ip + c] != -77;
for (int c = k; c < wp; ++c) bad += w[(size_t)r * wp + c] != -7.25f;
}
if (bad) {
std::printf("FAIL router scan against its model at M=%d ne=%d k=%d: %d\n", M, ne, k,
bad);
++fails;
}
++cases;
const int rc = run(nullptr, ids_new, w_new);
if (rc != RAD_OK || ids_new != ids_old ||
std::memcmp(w_new.data(), w_old.data(), w_new.size() * 4) != 0) {
std::printf("FAIL router wave select at M=%d ne=%d k=%d%s (rc %d)\n", M, ne, k,
sh.ties ? " tied" : "", rc);
if (rc != RAD_OK || bad) {
std::printf("FAIL router wave select against the scan at M=%d ne=%d k=%d%s (rc %d): "
"%d\n",
M, ne, k, sh.ties ? " tied" : "", rc, bad);
++fails;
}
}
unsetenv("RADIANCE_ROUTER_SELECT");
}
int main() {
std::mt19937 rng(17);
std::normal_distribution<float> nd(0.f, 1.f);
const char* forms[] = { "1x1", "2x1", "4x1", "8x1", "4x2", "8x2",
"4x4", "8x4", "16x2", "16x4", nullptr };
struct Shape {
int M, N, K;
};
const Shape shapes[] = { { 1, 288, 512 }, { 3, 36, 129 }, { 8, 288, 129 }, { 33, 32, 512 },
{ 70, 36, 129 }, { 70, 4, 512 }, { 7, 31, 129 }, { 65, 13, 130 } };
// One wave an output (M 1), the 2x1, 4x1 (M under 16 or N up to 8), 4x4 and 8x4 tiles.
const Shape shapes[] = { { 1, 288, 512 }, { 2, 288, 129 }, { 3, 36, 129 },
{ 8, 288, 129 }, { 33, 32, 512 }, { 70, 36, 129 },
{ 70, 4, 512 }, { 7, 31, 129 }, { 65, 13, 130 } };
int fails = 0, cases = 0;
for (const Shape& sh : shapes) {
const int M = sh.M, N = sh.N, K = sh.K, xp = K + 5, yp = N + 3;
@@ -211,49 +190,24 @@ int main() {
a.n_t = 3;
a.p = p;
a.n_p = 4;
auto run = [&](const char* form, std::vector<float>& y) {
y.assign((size_t)M * yp, -7.25f);
t[2].data = y.data();
if (form)
setenv("RADIANCE_F32_GEMM_TILE", form, 1);
else
unsetenv("RADIANCE_F32_GEMM_TILE");
return r4d_rad_gemm_nt_f32(&a, nullptr);
};
std::vector<float> legacy, got;
std::vector<float> y((size_t)M * yp, -7.25f);
t[2].data = y.data();
++cases;
if (run("legacy", legacy) != RAD_OK) {
std::printf("FAIL legacy launch M=%d N=%d K=%d\n", M, N, K);
++fails;
continue;
}
const int rc = r4d_rad_gemm_nt_f32(&a, nullptr);
int bad = 0;
for (int r = 0; r < M; ++r) {
for (int r = 0; r < M && rc == RAD_OK; ++r) {
for (int c = 0; c < N; ++c) {
const float e = legacy_model(&x[(size_t)r * xp], &w[(size_t)c * K], K);
bad += std::memcmp(&e, &legacy[(size_t)r * yp + c], 4) != 0;
const float e = gemm_model(&x[(size_t)r * xp], &w[(size_t)c * K], K);
bad += std::memcmp(&e, &y[(size_t)r * yp + c], 4) != 0;
}
for (int c = N; c < yp; ++c) bad += legacy[(size_t)r * yp + c] != -7.25f;
for (int c = N; c < yp; ++c) bad += y[(size_t)r * yp + c] != -7.25f;
}
if (bad) {
std::printf("FAIL legacy kernel against its model at M=%d N=%d K=%d: %d words\n", M, N,
K, bad);
if (rc != RAD_OK || bad) {
std::printf("FAIL %s at M=%d N=%d K=%d against its model (rc %d): %d words\n",
emu_last_kernel, M, N, K, rc, bad);
++fails;
}
for (const char* const* f = forms;; ++f) {
++cases;
const int rc = run(*f, got);
const bool same =
rc == RAD_OK && std::memcmp(got.data(), legacy.data(), got.size() * 4) == 0;
if (!same) {
std::printf("FAIL form %s at M=%d N=%d K=%d (rc %d)\n", *f ? *f : "default", M, N,
K, rc);
++fails;
}
if (!*f) break;
}
}
unsetenv("RADIANCE_F32_GEMM_TILE");
router_cases(rng, cases, fails);
std::printf("%d case(s), %d failure(s)\n", cases, fails);
return fails ? 1 : 0;