Archived
radiance 1.11.0
New models: - GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget), with decode kernels for a few rows and the DSA indexer split over the ranks - Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter - Unlimited-OCR (bf16) - Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces are fused with the junctions, overlapped with the compute and sent compressed - Ornith-1.5-35B-A3B w4a8 compose files Speed: - Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued ahead - The four-rank all-reduce is faster for every --tp 4 model - qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly - --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20% prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default Features: - Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch, and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE) - Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance - Cards with a small PCI BAR run, with kernel arguments kept in host memory - Dashboard: live acceptance figures; statsdump rotates its file at a size cap - KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot Fixes: - Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore makes room as memory pressure does and waits a step for the previous turn's release (two conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now) - Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory management is turned off there, with a warning - Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output - The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start - GLM-5.3: every refusal names the setting and the reason; its template keeps string content - Several pictures in one request no longer refuse processors that take one image at a time Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
This commit is contained in:
commit
9eaf10da6e
210 files changed
+14363
-2138
No files matched your search
+81
-4
@@ -20,6 +20,8 @@
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
namespace rad {
|
||||
|
||||
@@ -47,6 +49,33 @@ int Engine::run_encodes() {
|
||||
|
||||
Rank& r0 = *ranks_[0];
|
||||
const Program& prog = r0.program;
|
||||
|
||||
/* Diagnostic: RADIANCE_DEBUG_MM_BUFFERS names encoder buffers (comma separated, with an
|
||||
* optional `:rows` cap) and each pass writes them, as raw bytes, to `<dump dir>/buf.<name>`.
|
||||
* The pass has finished and been read back, so the copy sees each buffer's last writer; the
|
||||
* tower's per-stage intermediates are tapped inside the pass instead (rad_block_sam.h). */
|
||||
struct DumpBuf { std::string name; int64_t rows; };
|
||||
std::vector<DumpBuf> dump_bufs;
|
||||
static const char* const dump_list = std::getenv("RADIANCE_DEBUG_MM_BUFFERS");
|
||||
if (dump_dir && *dump_dir && dump_list) {
|
||||
for (const char* s = dump_list; *s; ) {
|
||||
const char* e = s;
|
||||
while (*e && *e != ',') ++e;
|
||||
std::string want(s, (size_t)(e - s));
|
||||
s = *e ? e + 1 : e;
|
||||
int64_t rows = 0;
|
||||
if (const size_t colon = want.find(':'); colon != std::string::npos) {
|
||||
rows = std::strtoll(want.c_str() + colon + 1, nullptr, 10);
|
||||
want.resize(colon);
|
||||
}
|
||||
if (!want.empty()) dump_bufs.push_back({ want, rows });
|
||||
}
|
||||
}
|
||||
auto answers_to = [](const std::string& name, const std::string& want) {
|
||||
if (name.size() < want.size() ||
|
||||
name.compare(name.size() - want.size(), want.size(), want) != 0) return false;
|
||||
return name.size() == want.size() || name[name.size() - want.size() - 1] == '.';
|
||||
};
|
||||
for (auto& ip : items) {
|
||||
if (ip->encoded) continue;
|
||||
const RadEncoderDecl& e = ip->kind == mm::Kind::Audio ? prog.audio_encoder : prog.encoder;
|
||||
@@ -74,6 +103,10 @@ int Engine::run_encodes() {
|
||||
|
||||
size_t i = 0;
|
||||
int32_t seg = 0;
|
||||
/* The pass's grid, when the encoder declares that a pass is one geometry
|
||||
* (RadEncoderDecl::one_grid). */
|
||||
const bool one_grid = enc.one_grid != 0;
|
||||
int32_t seg_grid = 0;
|
||||
while (i < mine.size()) {
|
||||
std::vector<BatchBuilder::EncoderPart> parts;
|
||||
int64_t np = 0;
|
||||
@@ -81,16 +114,31 @@ int Engine::run_encodes() {
|
||||
mm::Item& it = *mine[i];
|
||||
const int32_t first = seg;
|
||||
for (; seg < it.n_seg; ++seg) {
|
||||
const int32_t g = it.seg_h(seg);
|
||||
/* The one-output-row view separator (core/mm marks it explicitly) belongs to
|
||||
* the pass of the view before it, so it neither breaks at a "grid change" nor
|
||||
* sets the pass's grid. A square segment that is a real view (a chunked line
|
||||
* of one tile) keeps the ordinary geometry rule below. */
|
||||
const bool sep = it.seg_is_sep(seg);
|
||||
const int64_t seg_p = it.patch_at(seg + 1) - it.patch_at(seg);
|
||||
if (seg_p > max_p) {
|
||||
RAD_ERR("encoder: a segment of %lld patches does not fit a pass of %lld",
|
||||
(long long)seg_p, (long long)max_p);
|
||||
return RAD_E_STATE;
|
||||
}
|
||||
if (one_grid && !sep && np > 0 && seg_grid != 0 && g != seg_grid) break;
|
||||
if (np + seg_p > max_p) break;
|
||||
np += seg_p;
|
||||
if (!sep) seg_grid = g;
|
||||
}
|
||||
if (seg == first) {
|
||||
/* Nothing of this item packed into the pass: its first segment did not fit
|
||||
* a pass that already has content (a segment larger than the whole pass was
|
||||
* refused above). `seg` addresses a real segment only below `it.n_seg`;
|
||||
* a degenerate zero-segment item leaves seg_grid alone. */
|
||||
if (seg_grid == 0 && seg < it.n_seg) seg_grid = it.seg_h(seg);
|
||||
break;
|
||||
}
|
||||
if (seg == first) break;
|
||||
parts.push_back({ &it, first, seg - first });
|
||||
if (seg == it.n_seg) { ++i; seg = 0; }
|
||||
}
|
||||
@@ -132,6 +180,35 @@ int Engine::run_encodes() {
|
||||
}
|
||||
/* Sync every rank's stream: the next pass rewrites every rank's staging and arena. */
|
||||
for (auto& rk : ranks_) RAD_TRY(rad_stream_sync(rk->ctx.stream()));
|
||||
|
||||
if (dump_dir && *dump_dir && !dump_bufs.empty()) {
|
||||
for (const DumpBuf& d : dump_bufs) {
|
||||
for (size_t bi = 1; bi < prog.buffers.size(); ++bi) {
|
||||
const BufferInfo& info = prog.buffers[bi];
|
||||
if (!answers_to(info.name, d.name) || info.bytes <= 0) continue;
|
||||
const int64_t nrow = info.decl.rank >= 1 ? info.decl.shape[0] : 1;
|
||||
const int64_t rowb = nrow > 0 ? info.bytes / nrow : info.bytes;
|
||||
const int64_t rows = d.rows > 0 ? std::min<int64_t>(d.rows, nrow) : nrow;
|
||||
void* ptr = r0.ctx.buf_ptr((rad_buf)bi);
|
||||
std::vector<char> raw((size_t)(rows * rowb));
|
||||
if (!ptr || rad_memcpy_async(raw.data(), ptr, raw.size(),
|
||||
r0.ctx.stream()) < 0)
|
||||
continue;
|
||||
rad_stream_sync(r0.ctx.stream());
|
||||
char path[512];
|
||||
std::snprintf(path, sizeof path, "%s/mm_%016llx%016llx_buf.%s.raw",
|
||||
dump_dir, (unsigned long long)parts.front().item->key_hi,
|
||||
(unsigned long long)parts.front().item->key_lo,
|
||||
info.name.c_str());
|
||||
if (FILE* f = std::fopen(path, "wb")) {
|
||||
std::fwrite(raw.data(), 1, raw.size(), f);
|
||||
std::fclose(f);
|
||||
RAD_INFO("encoder: wrote %s (%lld rows of %lld bytes)", path,
|
||||
(long long)rows, (long long)rowb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +220,9 @@ int Engine::run_encodes() {
|
||||
it.pixels.shrink_to_fit();
|
||||
if (dump_dir && *dump_dir) dump(it, ".bf16", it.embd.data(), it.embd.size());
|
||||
}
|
||||
RAD_DEBUG("encoder: %zu item(s) encoded in %.1f ms", items.size(),
|
||||
std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0)
|
||||
.count());
|
||||
const double ms = std::chrono::duration<double, std::milli>(
|
||||
std::chrono::steady_clock::now() - t0).count();
|
||||
RAD_DEBUG("encoder: %zu item(s) encoded in %.1f ms", items.size(), ms);
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user