Archived
radiance 1.15.0
New models and formats: - IQR for Qwen3.8-27B: weights on the int8 grid under GPTQ, a trellis down each GPTQ column (IQR-V2), and IQR-V3, a computed trellis code under one scale a row, kept at its codes' width in VRAM and decoded in the GEMM; 15 IQR-V3 recipes from ~2 to ~7 bits a weight (data/recipes/q38-27b-*-v3.recipe, docs/IQR.md) - libhalo: a kernel library for Strix Halo (gfx1151), preferred there over libr3d - Nemotron 3.5 Embed 1B and 8B (nemotron35_embed): text and image embeddings through a Pixtral tower, on the card and on the CPU - Nemotron 3.5 Rerank 8B - /v1/systemone: Cloudflare's clef and clef-flash, Convai Innovations' Laya and Mica beside LiquidAI d1; scored steps read the candidates' logits from the head table with no lm_head pass - LFM2's 8-bit trunk: block-fp8 or int8 linears with the fused producers, and the d1-3B recipe - DeepSeek-V4.1's reply format with DSML tool calls and typed argument tags Weights on the drive: - The file tier reads only the experts the pass routes rows to; the draft head's weights stay in the host pool - A hot VRAM cache for routed experts read off the drive, reads deposited straight into free host pool slots, and copyless evictions; the file tier's counters are now ssd_* - GLM-5 Next shards its routed experts by expert, not by width, so they can live on the drive - The stall watch counts drive reads as progress, and the DMA lane's room check reads the lane's own completion fence Quantisation tooling: - --calib-corpus, --calib-dir and --calib-layers record each linear's input Hessian; beside --kld-record the reference's own run records them - --kld-top N records a sparse KL reference (the N most likely tokens and the tail's mass) - GPTQ in a third of the time with the same codes, trellis GPTQ on the card, vector codebooks with coordinate descent, and rad-convert --reuse repeated, each container supplying what the earlier ones lack Speculation: - Prompt lookup alone (--spec-ngram K, --spec-ngram-min/-max): each sequence keeps an index of its n-grams, and a proposal is verified only when its measured step cost says it pays; --draft-window adaptive follows it Speed: - IQR decode: the narrow tile splits K for four times the int8 tile's waves and folds each 128-K block once; at 8 tokens down and the output projections run in 0.61-0.82x and 0.70-0.92x FP8's time (2-6 bits); IQ6R-S-V3 with its DFlash2 drafter steps in 26.3 ms at TP2, against 29.4 ms before and FP8's 27.3 - Qwen MXFP4 feed-forward: the gated fold up to 16 rows, not 8 - libr4d: the gated prefill fold, the short-prompt split row, and the rows forms of rmsnorm and rope; KLATE again for the head-256 gqa6 paged prefill; gram_accum on the matrix cores Features: - /health, /v1/health and /ping answer 503 with "status": "stuck" once the device has advanced nothing for a minute or a queue has faulted, so a supervisor can restart a wedged server (#356) - --image-gen-max-pixels and --image-gen-max-refs size an image generator's buffers (#344) - The startup report lists only the options not at their default, with a count; -v lists all (#250) - --preempt-wait-ms bounds how long a preempted prefill waits for its whole-recompute room - --placement layer_offload spills dense layers so one --max-model-len sequence fits - Startup refuses amdgpu with CWSR off and says how to fix it; --proceed-with-incompatible-configuration starts anyway under an UNSUPPORTED banner Fixes: - The n-gram read-ahead hands each row to the reader once and reads only as far ahead as the row cache holds, and pauses while decode reads: about one drive read a row instead of two (#355) - A file-tier window reads each of its runs once, not once a run per run - The decode split law's verify floor is bounded by the batch's workgroups: max_seqs 256 no longer declares 64x the scratch (#342) - A prefetch DMA list's mark stays out of the signal pool until the engine has read it, and a prefill stage copies only the blocks its own tables name (#343) - The split-KV row sum is read with fetch-inactive (#328) - LFM2 on the host backend: libref and libavx serve the row-form ops it declares (#348) - The preempted-prefill gate skips a KV group that holds no blocks (#352) - Every request entry point bounded, gated and sanitised (JSON depth, invalid UTF-8, control bytes in the log, the dashboard's CSP, cross-origin browsers on the loopback-only routes); a prompt id outside the vocabulary refused at admission; --api-key "" refused at startup - The telemetry the HTTP thread reads is atomic - An RMS norm row no longer depends on how many rows its launch carries; prefill attention's rescale is decided by live rows only - A --kld-record prefill chunk that finishes no sequence gets its logits on a tied-head model - A kernel's lazily made counter block is zeroed outside the lock other ranks take (a TP2 first-step hang) Changes: Plugin ABI 32. Every plugin exports a layout fingerprint of the ABI structs and the loader refuses a plugin without it or with another (#302), so out-of-tree plugins must be rebuilt. Appended: RadBuildCtx calib_* and gen_max_*, RadArchProbe gen_max_*, RadBatch score_only and plugin_words, RadDeviceProps::unified, RadChatFormat arg_json_value_prefix.
This commit is contained in:
commit
9ed3ef7a7b
452 files changed
+167762
-1346
No files matched your search
+93
-4
@@ -636,11 +636,25 @@ inline Stream* ours(const void* s) {
|
||||
return p->magic == kStreamMagic ? const_cast<Stream*>(p) : nullptr;
|
||||
}
|
||||
|
||||
/* The device's stuck state, for dev_stuck_ms, in steady-clock ns (0: none). `g_stuck_at` is the
|
||||
* last moment anything advanced, set by the stall verdict (Stall::check) with the read-progress sum
|
||||
* it saw in `g_stuck_progress`; `g_fault_at` is when the first queue faulted. */
|
||||
std::atomic<uint64_t> g_stuck_at{0};
|
||||
std::atomic<uint64_t> g_stuck_progress{0};
|
||||
std::atomic<uint64_t> g_fault_at{0};
|
||||
|
||||
inline uint64_t steady_ns() {
|
||||
return (uint64_t)std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
void on_queue_error(hsa_status_t st, hsa_queue_t*, void* data) {
|
||||
Stream* s = static_cast<Stream*>(data);
|
||||
const char* m = nullptr;
|
||||
hsa_status_string(st, &m);
|
||||
s->fault.store((int)st, std::memory_order_release);
|
||||
uint64_t none = 0;
|
||||
g_fault_at.compare_exchange_strong(none, steady_ns(), std::memory_order_acq_rel);
|
||||
G().faulted.store(true, std::memory_order_release);
|
||||
hsa_signal_store_screlease(G().fault, 1);
|
||||
RAD_ERR("device %d: the AQL queue faulted: %s", s->ord, m ? m : "?");
|
||||
@@ -903,6 +917,9 @@ struct Stall {
|
||||
const uint64_t p = read_progress();
|
||||
if (sampled && p == progress) {
|
||||
told = true;
|
||||
/* Nothing has advanced since the previous sample, a stall period ago. */
|
||||
g_stuck_progress.store(p, std::memory_order_relaxed);
|
||||
g_stuck_at.store(steady_ns() - (uint64_t)kStallMs * 1000000u, std::memory_order_release);
|
||||
dump_queues(where);
|
||||
RAD_ERR("device: nothing has advanced in the %u s since: the GPU is not running the "
|
||||
"packet named above -- a hung kernel, or a queue the driver evicted and could "
|
||||
@@ -914,6 +931,22 @@ struct Stall {
|
||||
}
|
||||
};
|
||||
|
||||
/* dev_stuck_ms. A standing verdict is dropped as soon as the read progress moves again. */
|
||||
int64_t stuck_ms() {
|
||||
const uint64_t now = steady_ns();
|
||||
if (G().faulted.load(std::memory_order_acquire)) {
|
||||
const uint64_t f = g_fault_at.load(std::memory_order_acquire);
|
||||
return f && now > f ? (int64_t)((now - f) / 1000000u) : 0;
|
||||
}
|
||||
uint64_t at = g_stuck_at.load(std::memory_order_acquire);
|
||||
if (!at) return 0;
|
||||
if (read_progress() != g_stuck_progress.load(std::memory_order_relaxed)) {
|
||||
g_stuck_at.compare_exchange_strong(at, 0, std::memory_order_acq_rel);
|
||||
return 0;
|
||||
}
|
||||
return now > at ? (int64_t)((now - at) / 1000000u) : 0;
|
||||
}
|
||||
|
||||
/* Reserves packet `idx` once the packet processor has consumed far enough that its slot is free.
|
||||
* A launched barrier-bit packet means every packet before it has completed, which a kernel
|
||||
* argument slot (read for the kernel's whole run) needs. A played tape clears the bit on at most
|
||||
@@ -1616,6 +1649,11 @@ struct Sig {
|
||||
hsa_agent_t agent{}; /* where it was recorded */
|
||||
std::vector<std::pair<uint32_t, uint64_t>> waiters; /* queue id, packet index */
|
||||
bool stamped = false; /* its times not read yet (stamp_hold) */
|
||||
/* A prefetch DMA queue's list polls it (a_xp_list): the card whose queue, -1 for none, and the
|
||||
* list number the queue writes to its finish word once the engine is past the poll. A DMA
|
||||
* poll is no queue packet, so `waiters` cannot hold it. */
|
||||
std::atomic<int32_t> xp_dev{-1};
|
||||
std::atomic<uint32_t> xp_list{0};
|
||||
};
|
||||
|
||||
struct SigPool {
|
||||
@@ -1630,15 +1668,29 @@ SigPool& pool() {
|
||||
return *p;
|
||||
}
|
||||
|
||||
bool xp_list_finished(int ord, uint32_t k);
|
||||
|
||||
/* A signal at 0 can still be awaited: by a queue packet not yet consumed (`waiters`), or by a
|
||||
* prefetch DMA list that has not yet read it (`xp_dev`). Reused then, its next user's 1 would be
|
||||
* what that wait sees, and the wait would hang behind work that waits for it. */
|
||||
bool reusable(const Sig* g) {
|
||||
if (g->stamped || hsa_signal_load_relaxed(g->h) != 0) return false;
|
||||
for (const auto& w : g->waiters) {
|
||||
hsa_queue_t* q = g_queue_by_id[w.first].load(std::memory_order_acquire);
|
||||
if (q && hsa_queue_load_read_index_relaxed(q) <= w.second) return false;
|
||||
}
|
||||
const int32_t xd = g->xp_dev.load(std::memory_order_acquire);
|
||||
if (xd >= 0 && !xp_list_finished(xd, g->xp_list.load(std::memory_order_relaxed))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Back to the free list: what held it is over. */
|
||||
void sig_free(SigPool& p, Sig* g) {
|
||||
g->waiters.clear();
|
||||
g->xp_dev.store(-1, std::memory_order_relaxed);
|
||||
p.free[g->irq].push_back(g);
|
||||
}
|
||||
|
||||
/* A signal for one record: an interrupt signal if the host waits on the event, else GPU_ONLY.
|
||||
* Only interrupt signals can end a host wait (see "host waits"), but each costs a driver event (a
|
||||
* process has a few thousand) and an interrupt per completion, wasted on events recorded dozens
|
||||
@@ -1653,8 +1705,7 @@ Sig* sig_get(bool irq) {
|
||||
while (p.free[irq].empty() && !p.retiring.empty() && reusable(p.retiring.front())) {
|
||||
Sig* g = p.retiring.front();
|
||||
p.retiring.pop_front();
|
||||
g->waiters.clear();
|
||||
p.free[g->irq].push_back(g);
|
||||
sig_free(p, g);
|
||||
}
|
||||
if (p.free[irq].empty()) {
|
||||
/* In place and in order, so the front stays the oldest. */
|
||||
@@ -1662,8 +1713,7 @@ Sig* sig_get(bool irq) {
|
||||
for (size_t i = 0; i < p.retiring.size(); ++i) {
|
||||
Sig* g = p.retiring[i];
|
||||
if (reusable(g)) {
|
||||
g->waiters.clear();
|
||||
p.free[g->irq].push_back(g);
|
||||
sig_free(p, g);
|
||||
} else {
|
||||
p.retiring[kept++] = g;
|
||||
}
|
||||
@@ -2835,6 +2885,15 @@ DmaQueue* xp_queue(int ord) {
|
||||
return q.ok ? &q : nullptr;
|
||||
}
|
||||
|
||||
/* Whether card `ord`'s prefetch queue has finished list `k`, or a later one: its lists finish in
|
||||
* order, so the engine is then past every packet list `k` holds. */
|
||||
bool xp_list_finished(int ord, uint32_t k) {
|
||||
if (ord < 0 || ord >= kMaxDevices) return true;
|
||||
const DmaQueue& q = g_dma_xp[ord];
|
||||
if (!q.fin) return true;
|
||||
return (int32_t)(*q.fin - k) >= 0;
|
||||
}
|
||||
|
||||
int a_xp_supported(int device) { return xp_queue(device) != nullptr; }
|
||||
|
||||
int a_xp_stream_create(RadStream* out) {
|
||||
@@ -2971,6 +3030,15 @@ int a_xp_list(int ord, void* mark, int n, const uint64_t* src, const uint64_t* d
|
||||
(uint32_t)ia, (uint32_t)(ia >> 32), 0u, 0xffffffffu,
|
||||
10u /* interval */ | (0xfffu << 16) /* retry forever */ };
|
||||
rc = dma_put(dq, poll, 6);
|
||||
/* The mark stays out of the pool until the engine is past this poll: the finish word
|
||||
* reaches lists + 1 only behind it, whether this list's own fence writes it or, if the
|
||||
* list below fails, the next list's. Returned earlier, a mark at 0 can be handed out and
|
||||
* set to 1 before the engine reads it, and the list then waits for whatever completes
|
||||
* the next use, which can sit behind the stream's wait for this list. */
|
||||
if (rc == RAD_OK) {
|
||||
in->xp_list.store(dq->lists + 1, std::memory_order_relaxed);
|
||||
in->xp_dev.store(ord, std::memory_order_release);
|
||||
}
|
||||
}
|
||||
if (rc == RAD_OK && n > 0 && lane && lane->ever_held && lane->gate.handle &&
|
||||
!(flags & RAD_XP_NO_YIELD)) {
|
||||
@@ -3925,6 +3993,15 @@ DeviceBackend g_aql;
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace aql {
|
||||
bool ride_reusable(void* token) {
|
||||
Sig* g = static_cast<Sig*>(token);
|
||||
if (!g) return false;
|
||||
std::lock_guard<std::mutex> lk(pool().mu);
|
||||
return reusable(g);
|
||||
}
|
||||
} // namespace aql
|
||||
|
||||
size_t aql_code_registered(void) { return a_code_mark(); }
|
||||
|
||||
const DeviceBackend* aql_backend_if_present(void) {
|
||||
@@ -3985,6 +4062,7 @@ const DeviceBackend* aql_backend_if_present(void) {
|
||||
g_aql.alloc_uncached = a_alloc_uncached;
|
||||
g_aql.free_uncached = a_free_uncached;
|
||||
g_aql.dma_lane = a_dma_lane;
|
||||
g_aql.stuck_ms = stuck_ms;
|
||||
g_aql.vmem_granularity = a_vmem_granularity;
|
||||
g_aql.vmem_reserve = a_vmem_reserve;
|
||||
g_aql.vmem_release = a_vmem_release;
|
||||
@@ -4208,4 +4286,15 @@ hipError_t hipPeekAtLastError(void) {
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#else
|
||||
|
||||
#include "aql.h"
|
||||
|
||||
namespace rad {
|
||||
namespace aql {
|
||||
/* A build without the AQL backend hands out no ride. */
|
||||
bool ride_reusable(void*) { return false; }
|
||||
} // namespace aql
|
||||
} // namespace rad
|
||||
|
||||
#endif /* RAD_HAVE_HIP */
|
||||
Reference in new issue
Block a user