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:
Deadcode committed 2026-10-30 22:01:01 +01:00
commit 9ed3ef7a7b
452 files changed
+167762 -1346

No files matched your search

+160 -5
View File
@@ -283,10 +283,11 @@ set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES
# ================================================================== the device tests on a card
#
# The unit entries run on the host backend. These run the tests whose code differs on a card (the
# AQL backend, the driver's elastic commit, the mover's copies) on the card, one at a time: a test
# that commits device memory fails beside another holding it, or beside a server.
# AQL backend, the driver's elastic commit, the mover's copies, libquant's trellis GPTQ) on the
# card, one at a time: a test that commits device memory fails beside another holding it, or beside
# a server.
if(RAD_HIP_FOUND)
foreach(n device_test mem_test place_test runtime_test)
foreach(n device_test mem_test place_test runtime_test quant_tcq_gpu_test)
add_test(NAME ${n}_card COMMAND ${n} -perf_)
set_tests_properties(${n}_card PROPERTIES
LABELS gpu
@@ -323,12 +324,24 @@ set(RAD_E2E_DEPS radiance rad-convert libref libquant nemotron35_embed qwen35_bf
if(TARGET libavx)
list(APPEND RAD_E2E_DEPS libavx)
endif()
foreach(t engine_e2e_test convert_test)
foreach(t engine_e2e_test convert_test clef_decision_test laya_decision_test)
if(TARGET ${t})
target_compile_definitions(${t} PRIVATE
RAD_E2E_SERVER="$<TARGET_FILE:radiance>" RAD_E2E_CONVERT="$<TARGET_FILE:rad-convert>"
RAD_E2E_HOME="${RAD_PLUGIN_OUT}" RAD_E2E_RECIPES="${CMAKE_SOURCE_DIR}/data/recipes")
add_dependencies(${t} ${RAD_E2E_DEPS})
if(t STREQUAL "clef_decision_test")
# The tiny clef's golden (tests/mkclefgolden.py) and the one plugin a clef container selects.
target_compile_definitions(${t} PRIVATE
RAD_CLEF_GOLDEN="${CMAKE_CURRENT_SOURCE_DIR}/data/golden/clef_tiny.json")
add_dependencies(${t} radiance rad-convert libref libquant clef_bf16)
elseif(t STREQUAL "laya_decision_test")
# The tiny Laya's golden (tests/mklayagolden.py) and the plugin a Laya container selects.
target_compile_definitions(${t} PRIVATE
RAD_LAYA_GOLDEN="${CMAKE_CURRENT_SOURCE_DIR}/data/golden/laya_tiny.json")
add_dependencies(${t} radiance rad-convert libref libquant laya)
else()
add_dependencies(${t} ${RAD_E2E_DEPS})
endif()
endif()
endforeach()
# 6 to 17 s by build type and load, mostly libref's GEMMs and decode steps and the engine's own
@@ -336,6 +349,12 @@ endforeach()
if(TARGET engine_e2e_test)
set_tests_properties(engine_e2e_test PROPERTIES LABELS "e2e" TIMEOUT 300)
endif()
if(TARGET clef_decision_test)
set_tests_properties(clef_decision_test PROPERTIES LABELS "e2e" TIMEOUT 300)
endif()
if(TARGET laya_decision_test)
set_tests_properties(laya_decision_test PROPERTIES LABELS "e2e" TIMEOUT 300)
endif()
# abi_layout_test compares the ABI's struct layouts with a C translation unit's: abi_c_test.c
# includes every abi/ header as strict C11, so a header only C++ accepts fails the build.
@@ -387,6 +406,17 @@ if(RAD_HIP_FOUND AND TARGET r4d_selftest)
ENVIRONMENT "RADIANCE_HOME=${CMAKE_BINARY_DIR}/radiance_home")
endif()
# ================================================================== libhalo's interface parity
#
# libhalo serves gfx1151 behind libr4d's exact interface (libhalo/halo_parity.cpp): the same op
# schemas and rows, so every model plugin runs on either. Host-only (the tables, no device calls);
# present when one build produces both plugins.
if(TARGET halo_parity)
add_test(NAME halo_parity
COMMAND halo_parity ${RAD_PLUGIN_OUT}/kernels/libr4d.so ${RAD_PLUGIN_OUT}/kernels/libhalo.so)
set_tests_properties(halo_parity PROPERTIES LABELS "fast" TIMEOUT 60)
endif()
# ================================================================== the device layer without SVM
#
# Without the KFD SVM API (e.g. a KVM guest whose amdgpu registered no device memory with HMM), ROCr
@@ -594,6 +624,131 @@ if(R4D_EMU_BUILT)
set_tests_properties(r4d_emu_qsa_sweep PROPERTIES LABELS "r4d_emu;slow" TIMEOUT 900)
endif()
# ================================================================== libhalo on the emulator
#
# tests/halo_emu runs libhalo units (gfx1151) on the same SIMT emulator through its gfx11 WMMA
# forms: the LDS-tiled prefill GEMMs against the narrow rows whose bytes they promise, and the
# MXFP4 decode's activation plane against its in-kernel decode (test_gemm.cpp says which). The
# units are the plugin's own sources, compiled as C++ the way r4d_emu compiles libr4d's, so a
# card-less build checks them on every run. Same toolchain rules as r4d_emu above.
set(HALO_DIR ${CMAKE_SOURCE_DIR}/libhalo)
set(HALO_EMU ${CMAKE_CURRENT_SOURCE_DIR}/halo_emu)
set(HALO_EMU_HIP ${HALO_DIR}/halo_gemm_fp8a8.hip ${HALO_DIR}/halo_gemm_mxfp4a8_tiled.hip
${HALO_DIR}/halo_gemm_mxfp4a8_nt_m64.hip ${HALO_DIR}/halo_gemm_mxfp4a8_decode.hip
${HALO_DIR}/halo_norm_join_bf16.hip ${HALO_DIR}/halo_expert_scale_bf16.hip
${HALO_DIR}/halo_pair_argmax_f32.hip ${HALO_DIR}/halo_attn_paged_window.hip
${HALO_DIR}/halo_qsa_select_bf16.hip ${HALO_DIR}/halo_lora_bf16.hip
${HALO_DIR}/halo_glm.hip ${HALO_DIR}/halo_mhc.hip
${HALO_DIR}/halo_gemm_fp8_f32scale.hip ${HALO_DIR}/halo_kda.hip
${HALO_DIR}/halo_moe_mxfp4.hip ${HALO_DIR}/halo_mla.hip
${HALO_DIR}/halo_quant_act_fp8.hip ${HALO_DIR}/halo_kv_resolve.hip
${HALO_DIR}/halo_dsa.hip ${HALO_DIR}/halo_gemm_nt_f32.hip
${HALO_DIR}/halo_router_sigmoid_topk_f32.hip ${HALO_DIR}/halo_router_scatter.hip
${HALO_DIR}/halo_gen.hip ${HALO_DIR}/halo_audio.hip ${HALO_DIR}/halo_encoder_bf16.hip
${HALO_DIR}/halo_model_bf16.hip ${HALO_DIR}/halo_hc_bf16.hip
${HALO_DIR}/halo_p2p_copy2d.hip
${HALO_DIR}/halo_attn_paged_gqa8.hip ${HALO_DIR}/halo_attn_paged_h128_gqa1.hip
${HALO_DIR}/halo_attn_paged_h128_gqa2.hip ${HALO_DIR}/halo_attn_paged_h128_gqa2w.hip
${HALO_DIR}/halo_attn_paged_h128_gqa4.hip ${HALO_DIR}/halo_attn_paged_h256_gqa2.hip
${HALO_DIR}/halo_attn_paged_h256_gqa4.hip ${HALO_DIR}/halo_attn_paged_h256_gqa6.hip
${HALO_DIR}/halo_gemm_bf16_nt_tiled.hip ${HALO_DIR}/halo_gemm_bf16_nt_m64.hip)
# gemm: test_gemm.cpp above. norm, escale, pick: r4d_emu's tests of the same three ops, renamed --
# the sandwich-norm joins, expert_scale and pair_argmax have no libref oracle by design (Gemma 4's
# trunk runs the joins every layer), so the unfused chain bit for bit is the only check they get.
# attn: r4d_emu's windowed paged attention test against its port of libref's ref_attn_paged --
# the h128/h256/h512 window rows Gemma 4 runs, prefill and decode, plus a seeded shape sweep.
# The rest are r4d_emu's other tests by the rename transform, over the libhalo ports of the same
# units: QSA selection, the LoRA pair, GLM's F32 routing projection and MoE decode fusions, mHC,
# the F32-scale E4M3 GEMM, KDA, the MXFP4 expert GEMM, MLA, kv_resolve and DSA's split.
# ref: the elementwise and data-movement rows no model fixture reaches and halo_selftest has no
# case for, each held to libref's row on operands drawn from libref's own descriptions.
# paged: every block-size-16 attn_paged decode and prefill row (the decode and prefill bodies through
# the units that own each geometry) against test_attn's reference.
set(HALO_EMU_TESTS gemm norm escale pick attn qsa lora f32 mhc fp8f32 kda moemx mla moefuse kvres
dsa ref paged)
set(HALO_EMU_BUILT OFF)
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$")
# No fiber switch for this ISA.
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT RAD_ASAN AND NOT RAD_TSAN)
set_source_files_properties(${HALO_EMU_HIP} PROPERTIES LANGUAGE CXX COMPILE_OPTIONS "-x;c++")
add_library(halo_emu_kernels OBJECT ${HALO_EMU_HIP} ${HALO_EMU}/cfg_host.cpp ${R4D_EMU}/ref_host.cpp
${R4D_EMU}/emu/emu.cpp)
target_include_directories(halo_emu_kernels PUBLIC ${R4D_EMU}/emu ${R4D_EMU} ${HALO_DIR})
target_link_libraries(halo_emu_kernels PUBLIC rad_abi)
target_compile_options(halo_emu_kernels PRIVATE -ffp-contract=off -Wno-psabi)
foreach(t ${HALO_EMU_TESTS})
add_executable(halo_emu_${t} ${HALO_EMU}/test_${t}.cpp)
target_link_libraries(halo_emu_${t} PRIVATE halo_emu_kernels ${CMAKE_DL_LIBS})
target_compile_options(halo_emu_${t} PRIVATE -ffp-contract=off -Wno-psabi)
set_target_properties(halo_emu_${t} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
endforeach()
set(HALO_EMU_BUILT ON)
elseif(R4D_EMU_CXX)
set(dir ${CMAKE_CURRENT_BINARY_DIR}/halo_emu)
file(MAKE_DIRECTORY ${dir})
set(flags -std=c++20 -O2 -ffp-contract=off -Wno-psabi -I${R4D_EMU}/emu -I${R4D_EMU} -I${HALO_DIR}
-I${CMAKE_SOURCE_DIR}/abi)
set(objs "")
set(srcs ${HALO_EMU_HIP} ${HALO_EMU}/cfg_host.cpp ${R4D_EMU}/ref_host.cpp ${R4D_EMU}/emu/emu.cpp)
foreach(t ${HALO_EMU_TESTS})
list(APPEND srcs ${HALO_EMU}/test_${t}.cpp)
endforeach()
foreach(src ${srcs})
get_filename_component(stem ${src} NAME_WE)
set(lang "")
if(src MATCHES "\\.hip$")
set(lang -x c++)
endif()
add_custom_command(OUTPUT ${dir}/${stem}.o
COMMAND ${R4D_EMU_CXX} ${flags} -MD -MF ${dir}/${stem}.o.d ${lang} -c ${src}
-o ${dir}/${stem}.o
DEPENDS ${src}
DEPFILE ${dir}/${stem}.o.d
COMMENT "Building halo_emu ${stem}.o with ${R4D_EMU_CXX}"
VERBATIM)
if(NOT stem MATCHES "^test_")
list(APPEND objs ${dir}/${stem}.o)
endif()
endforeach()
# test_lora, test_kda and test_ref open libref with dlopen.
set(dl "")
foreach(l ${CMAKE_DL_LIBS})
list(APPEND dl -l${l})
endforeach()
set(exes "")
foreach(t ${HALO_EMU_TESTS})
set(exe ${CMAKE_BINARY_DIR}/tests/halo_emu_${t})
add_custom_command(OUTPUT ${exe}
COMMAND ${R4D_EMU_CXX} ${dir}/test_${t}.o ${objs} ${dl} -o ${exe}
DEPENDS ${dir}/test_${t}.o ${objs}
COMMENT "Linking halo_emu_${t}"
VERBATIM)
list(APPEND exes ${exe})
endforeach()
add_custom_target(halo_emu ALL DEPENDS ${exes})
set(HALO_EMU_BUILT ON)
endif()
if(HALO_EMU_BUILT)
foreach(t gemm norm escale pick qsa lora f32 mhc fp8f32 kda mla moefuse kvres dsa ref paged)
add_test(NAME halo_emu_${t} COMMAND ${CMAKE_BINARY_DIR}/tests/halo_emu_${t})
set_tests_properties(halo_emu_${t} PROPERTIES LABELS "halo_emu;fast" TIMEOUT ${RAD_TEST_TIMEOUT})
endforeach()
# As r4d_emu: the LoRA pair and KDA are held to libref itself when the test can load it.
set_tests_properties(halo_emu_lora halo_emu_kda halo_emu_ref PROPERTIES
ENVIRONMENT "RADIANCE_HOME=${CMAKE_BINARY_DIR}/radiance_home")
# As r4d_emu_attn: three shards of the fixed cases, and the seeded sweep as `slow`.
foreach(k 0 1 2)
add_test(NAME halo_emu_attn_shard${k} COMMAND ${CMAKE_BINARY_DIR}/tests/halo_emu_attn --shard ${k}/3)
set_tests_properties(halo_emu_attn_shard${k} PROPERTIES LABELS "halo_emu;fast"
TIMEOUT ${RAD_TEST_TIMEOUT})
endforeach()
# libhalo's one MXFP4 expert kernel takes about 160 s here (libr4d's shape-specialised forms 30 s).
add_test(NAME halo_emu_moemx COMMAND ${CMAKE_BINARY_DIR}/tests/halo_emu_moemx)
set_tests_properties(halo_emu_moemx PROPERTIES LABELS "halo_emu;slow" TIMEOUT 900)
add_test(NAME halo_emu_attn_sweep COMMAND ${CMAKE_BINARY_DIR}/tests/halo_emu_attn sweep 40)
set_tests_properties(halo_emu_attn_sweep PROPERTIES LABELS "halo_emu;slow" TIMEOUT 900)
endif()
# ================================================================== the document as a test
#
# docs/OPS.md is the authoritative op table, so this test checks it against what the plugins dump