Archived
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:
1 parent
778cbf315e
commit
685ec5bd85
136 files changed
+18917
-3821
No files matched your search
@@ -1,20 +1,22 @@
|
||||
/* tests/r4d_emu: the dense E4M3 GEMM with F32 block scales (r4d_fp8_f32scale.hip) on the host SIMT
|
||||
* emulator. The decode and row-tile forms (RADIANCE_FP8F32_FORM, each R x S x C and row count) must
|
||||
* match the legacy 16x64 tile
|
||||
* bit for bit: the same fragments, the same mma chain per 128-K block and the same fold order.
|
||||
* Ragged row counts, pitched rows and a K that leaves the decode form's last wave group partly
|
||||
* idle are covered; the output's pitch padding stays untouched. */
|
||||
* emulator. The form the rule picks at each shape (the decode form at one and two column tiles a
|
||||
* wave and one to eight waves a block, the 16- and 32-row tiles) must match the legacy 16x64 tile,
|
||||
* which serves an activation pitch off 16 bytes, bit for bit: the same fragments, the same mma
|
||||
* chain per 128-K block and the same fold order. Ragged row counts, pitched rows and a K that
|
||||
* leaves the decode form's last wave group partly idle are covered; the output's pitch padding
|
||||
* stays 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>
|
||||
|
||||
extern const char* emu_last_kernel;
|
||||
|
||||
static RadTensor mat(void* p, uint32_t dt, int64_t rows, int64_t cols, int64_t ld) {
|
||||
RadTensor t{};
|
||||
t.data = p;
|
||||
@@ -32,19 +34,26 @@ int main() {
|
||||
std::normal_distribution<float> nd(0.f, 1.f);
|
||||
struct Shape {
|
||||
int M, N, K;
|
||||
const char* kernel;
|
||||
};
|
||||
const Shape shapes[] = { { 1, 256, 512 }, { 6, 128, 1536 }, { 17, 256, 512 },
|
||||
{ 48, 128, 512 }, { 70, 128, 384 }, { 130, 128, 256 },
|
||||
{ 3, 128, 4096 } };
|
||||
const char* forms[] = { "decode", "decode1x4", "decode1x32", "decode2x8",
|
||||
"decode3x16", "decode1x8x2", "decode1x4x4", "decode2x8x2",
|
||||
"decode3x4x2", "decode2x4x4", "rows1", "rows2",
|
||||
"rows4", nullptr };
|
||||
const char* const dec1 = "(fp8_f32scale_decode<1, 1>)";
|
||||
const char* const dec2 = "(fp8_f32scale_decode<1, 2>)";
|
||||
const char* const rows = "fp8_f32scale_rows<R>";
|
||||
// Decode at eight, four, two and one waves a block (K blocks 12/32, 4, 2, 1), at two column
|
||||
// tiles a wave from 17 rows over N 1024 and 640; the 16-row tile, and the 32-row one at N 4096.
|
||||
const Shape shapes[] = { { 1, 256, 512, dec1 }, { 6, 128, 1536, dec1 },
|
||||
{ 17, 256, 512, dec1 }, { 48, 128, 512, dec1 },
|
||||
{ 2, 128, 256, dec1 }, { 5, 256, 128, dec1 },
|
||||
{ 3, 128, 4096, dec1 }, { 40, 1024, 512, dec2 },
|
||||
{ 20, 640, 256, dec2 }, { 70, 128, 384, rows },
|
||||
{ 130, 128, 256, rows }, { 33, 4096, 512, rows },
|
||||
{ 70, 4096, 128, rows } };
|
||||
int fails = 0, cases = 0;
|
||||
for (const Shape& sh : shapes) {
|
||||
const int M = sh.M, N = sh.N, K = sh.K, kb = K / 128, ap = K + 16, yp = N + 8;
|
||||
std::vector<uint8_t> a((size_t)M * ap), w((size_t)N * K);
|
||||
const int M = sh.M, N = sh.N, K = sh.K, kb = K / 128, ap = K + 16, lp = K + 8, yp = N + 8;
|
||||
std::vector<uint8_t> a((size_t)M * ap), al((size_t)M * lp), w((size_t)N * K);
|
||||
for (auto& v : a) v = rad_f32_to_fp8e4m3(nd(rng));
|
||||
for (int r = 0; r < M; ++r) std::memcpy(&al[(size_t)r * lp], &a[(size_t)r * ap], K);
|
||||
for (auto& v : w) v = rad_f32_to_fp8e4m3(nd(rng) * 0.5f);
|
||||
std::vector<float> as((size_t)M * kb), ws((size_t)(N / 128) * kb);
|
||||
// Scales over twelve octaves: K blocks of very different weight cancel, so a changed
|
||||
@@ -67,10 +76,12 @@ int main() {
|
||||
p[4].key = "dtype";
|
||||
p[4].kind = RAD_P_STR;
|
||||
p[4].sval = "fp8a8f32";
|
||||
auto run = [&](const char* form, std::vector<uint16_t>& y) {
|
||||
// The pitch off 16 bytes takes the legacy tile.
|
||||
auto run = [&](bool legacy, std::vector<uint16_t>& y) {
|
||||
y.assign((size_t)M * yp, 0x7777);
|
||||
t[0] = legacy ? mat(al.data(), RAD_F8E4M3, M, K, lp)
|
||||
: mat(a.data(), RAD_F8E4M3, M, K, ap);
|
||||
t[4] = mat(y.data(), RAD_BF16, M, N, yp);
|
||||
setenv("RADIANCE_FP8F32_FORM", form, 1);
|
||||
RadArgs ar{};
|
||||
ar.t = t;
|
||||
ar.n_t = 7;
|
||||
@@ -80,8 +91,8 @@ int main() {
|
||||
};
|
||||
std::vector<uint16_t> legacy, got;
|
||||
++cases;
|
||||
if (run("legacy", legacy) != RAD_OK) {
|
||||
std::printf("FAIL legacy M=%d N=%d K=%d\n", M, N, K);
|
||||
if (run(true, legacy) != RAD_OK || std::strcmp(emu_last_kernel, "fp8_f32scale")) {
|
||||
std::printf("FAIL legacy M=%d N=%d K=%d ran %s\n", M, N, K, emu_last_kernel);
|
||||
++fails;
|
||||
continue;
|
||||
}
|
||||
@@ -92,19 +103,16 @@ int main() {
|
||||
std::printf("FAIL legacy output mostly zero at M=%d\n", M);
|
||||
++fails;
|
||||
}
|
||||
for (const char* const* f = forms; *f; ++f) {
|
||||
++cases;
|
||||
const int rc = run(*f, got);
|
||||
if (rc != RAD_OK || got != legacy) {
|
||||
size_t i = 0;
|
||||
while (rc == RAD_OK && i < got.size() && got[i] == legacy[i]) ++i;
|
||||
std::printf("FAIL form %s at M=%d N=%d K=%d (rc %d, first word %zu)\n", *f, M, N, K,
|
||||
rc, i);
|
||||
++fails;
|
||||
}
|
||||
++cases;
|
||||
const int rc = run(false, got);
|
||||
if (rc != RAD_OK || std::strcmp(emu_last_kernel, sh.kernel) || got != legacy) {
|
||||
size_t i = 0;
|
||||
while (rc == RAD_OK && i < got.size() && got[i] == legacy[i]) ++i;
|
||||
std::printf("FAIL %s (want %s) at M=%d N=%d K=%d (rc %d, first word %zu)\n",
|
||||
emu_last_kernel, sh.kernel, M, N, K, rc, i);
|
||||
++fails;
|
||||
}
|
||||
}
|
||||
unsetenv("RADIANCE_FP8F32_FORM");
|
||||
std::printf("%d case(s), %d failure(s)\n", cases, fails);
|
||||
return fails ? 1 : 0;
|
||||
}
|
||||
Reference in new issue
Block a user