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:
Deadcode committed 2026-10-23 11:57:52 +02:00
210 files changed
+14363 -2138

No files matched your search

+74 -7
View File
@@ -241,6 +241,9 @@ Global& G() {
return *g;
}
/* Set by aql_force_host_kargs before the backend starts. */
std::atomic<bool> g_force_host_kargs{false};
std::string agent_isa(hsa_agent_t a) {
char name[64] = {0};
hsa_agent_get_info(a, HSA_AGENT_INFO_NAME, name);
@@ -423,13 +426,10 @@ bool init_devices() {
"difference where the slot allows it",
i, bus);
}
/* The fallback on a card that needs none, to measure what reading each dispatch's
* arguments across the link costs against the same card's VRAM rings. */
const char* force_host_kargs = std::getenv("RADIANCE_DEBUG_AQL_HOST_KARGS");
if (force_host_kargs && *force_host_kargs && *force_host_kargs != '0') {
if (g_force_host_kargs.load(std::memory_order_acquire) && !g.dev[(size_t)i].host_kargs) {
g.dev[(size_t)i].host_kargs = true;
RAD_WARN("device: card %d (%s): RADIANCE_DEBUG_AQL_HOST_KARGS puts the kernel argument "
"rings in host memory", i, bus);
RAD_INFO("device: card %d (%s) keeps kernel arguments in pinned host memory, as a "
"test asked", i, bus);
}
}
/* Without the handler a fault falls back to the runtime's own handling, which the
@@ -829,7 +829,7 @@ hsa_status_t on_system_event(const hsa_amd_event_t* e, void*) {
/* The running kernel and its arguments. A queue's read index stays on a packet until it
* completes, so the packet there is in flight. Every pointer-shaped argument word is located
* like the address, which names the operand that got a stale or short buffer. Only card
* `card`'s queues; arguments are read back through the BAR. */
* `card`'s queues; the host reads the arguments at the packet's kernarg_address. */
std::lock_guard<std::mutex> sl(G().streams_mu);
for (Stream* s : G().streams) {
if (s->ord != card) continue;
@@ -3049,9 +3049,70 @@ int vres_ord(const void* addr) {
return -1;
}
/* The DRM interface version of card `gpu_id`'s render node, false when it cannot be read. */
bool drm_version(uint32_t gpu_id, int* major, int* minor, std::string* name) {
/* struct drm_version, a layout fixed since DRM's first release. */
struct DrmVersion {
int major, minor, patch;
size_t name_len;
char* name;
size_t date_len;
char* date;
size_t desc_len;
char* desc;
};
const int rm = render_minor(gpu_id);
if (rm < 0) return false;
char path[64];
std::snprintf(path, sizeof path, "/dev/dri/renderD%d", rm);
const int fd = open(path, O_RDWR | O_CLOEXEC);
if (fd < 0) return false;
char nm[32] = {0};
DrmVersion v{};
v.name = nm;
v.name_len = sizeof nm - 1;
const bool ok = ioctl(fd, _IOWR('d', 0x00, DrmVersion), &v) == 0;
close(fd);
if (!ok) return false;
*major = v.major;
*minor = v.minor;
*name = std::string(nm, std::min(v.name_len, sizeof nm - 1));
return true;
}
/* Whether hsa_amd_vmem mappings on card `dev` return. From HIP 7.16 (ROCm 10.1) the runtime maps
* a vmem handle with DRM_AMDGPU_GEM_VA, asks the kernel to signal a VM timeline syncobj once the
* page tables are written, and waits on that point with no timeout. amdgpu reads the timeline
* fields of GEM_VA from interface 3.64 (Linux 6.16) on; an older kernel ignores them, never
* signals the point, and the first commit waits forever in drm_syncobj_array_wait_timeout. The
* ROCm 7.2 runtime maps through the KFD and has no such wait. A card that would hang this way
* gets no virtual memory management: its pools are carved whole, as on a driver without it. */
bool vmem_maps_return(int dev) {
static std::once_flag once[kMaxDevices];
static bool ok[kMaxDevices];
std::call_once(once[dev], [dev] {
ok[dev] = true;
int hip = 0;
if (hipRuntimeGetVersion(&hip) != hipSuccess || hip < 71600000) return;
int major = 0, minor = 0;
std::string name;
if (!drm_version(G().dev[(size_t)dev].kfd_id, &major, &minor, &name) || name != "amdgpu")
return;
if (major > 3 || (major == 3 && minor >= 64)) return;
ok[dev] = false;
RAD_WARN("device %d: this kernel's amdgpu interface is %d.%d, and the HIP %d.%d runtime "
"waits after every virtual-memory map for a page-table timeline that amdgpu "
"signals only from 3.64 (Linux 6.16) on, so a map here would never return. The "
"card runs without virtual memory management; a 6.16 or later kernel restores it",
dev, major, minor, hip / 10000000, hip / 100000 % 100);
});
return ok[dev];
}
int64_t a_vmem_granularity(void) {
int dev = 0;
if (hipGetDevice(&dev) != hipSuccess || dev < 0 || dev >= (int)G().dev.size()) return 0;
if (!vmem_maps_return(dev)) return 0;
size_t gran = 0;
if (hsa_amd_memory_pool_get_info(G().dev[(size_t)dev].vram,
HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE, &gran) !=
@@ -3550,6 +3611,12 @@ const DeviceBackend* aql_backend_if_present(void) {
int64_t aql_pageable_bytes(void) { return aql::g_pageable_bytes.load(std::memory_order_relaxed); }
int aql_force_host_kargs(void) {
if (aql::G().ok) return RAD_E_STATE;
aql::g_force_host_kargs.store(true, std::memory_order_release);
return RAD_OK;
}
int aql_vmem_device_of(const void* addr, int* dev) {
const int d = vres_ord(addr);
if (d < 0) return RAD_E_NOTFOUND;