This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/tools/ops_doc_check.sh
T
Deadcode 1e968f6e1d radiance 1.7.0
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves
  every shipped container
- Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime
- /v1/messages works with Claude Code as it ships (gearwave00001)
- a long agent conversation keeps its cached history when the client rewrites its last turn
  (manueloverride)
- a stream's first event goes out with the first token, so llama-benchy measures prefill right
- opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42)
- four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b)
- NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA
  adapters (baKon)
- many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool
  arguments and the CPU's vision and audio encoders
- plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
2026-10-16 18:25:18 +02:00

90 lines
4.9 KiB
Bash
Executable File

#!/bin/sh
# ops_doc_check.sh -- hold docs/OPS.md to the schemas the plugins actually declare.
#
# OPS.md is the authority for the ops it defines, and architecture plugins are written against it,
# so its drift is caught here: a dropped optional operand, a missing `:inout` marker, a parameter
# that moved into an operand, a parameter no plugin declares.
#
# tools/ops_doc_check.sh docs/OPS.md build/bin/rad-schemas build/radiance_home/kernels/*.so
#
# A row with a fourth column (a proposal) is exempt and its marker is printed. Exit 1 on any
# disagreement; exit 77 (ctest's SKIP_RETURN_CODE) when a plugin will not dump. A return code, not
# a " SKIP " line: ctest evaluates SKIP_REGULAR_EXPRESSION before the return code, so a skip line
# would mask a disagreement found later in the same run.
set -e
[ $# -ge 3 ] || { echo "usage: $0 <docs/OPS.md> <rad-schemas> <plugin.so>..." >&2; exit 2; }
doc=$1; schemas=$2; shift 2
[ -r "$doc" ] || { echo " SKIP no $doc"; exit 77; }
[ -x "$schemas" ] || { echo " SKIP no rad-schemas at $schemas"; exit 77; }
dump=$(mktemp); trap 'rm -f "$dump"' EXIT
for so in "$@"; do
[ -r "$so" ] || { echo " SKIP no plugin at $so"; exit 77; }
"$schemas" "$so" >> "$dump" 2>/dev/null || { echo " SKIP $so would not dump"; exit 77; }
done
awk -v doc="$doc" '
# ---- tool notation: name:type[/optional|/derived], name:role[?] ----------------------------
function t_param(t, f,o) {
if (sub(/\/optional$/, "", t)) o = "/opt"; else if (sub(/\/derived$/, "", t)) o = "/der"
f = (t ~ /:f64$/) ? ":f64" : ""; sub(/:(int|str|f64)$/, "", t); return t f o }
function t_opd(t, q,w,io) {
if (sub(/\?$/, "", t)) q = "?"
# A weight table is a weight operand whose issue names a run of handles, annotated apart:
# `w`wt in the document. See docs/OPS.md and RAD_WTAB in abi/rad_runtime.h.
if (sub(/:wtab$/, "", t)) w = "wt"
if (sub(/:weight$/, "", t)) w = "w"
if (sub(/:inout$/, "", t)) io = ":inout"
sub(/:(in|out)$/, "", t); return t w io q }
# ---- doc notation: `name` followed by its annotations -------------------------------------
function d_name(t, a) { a = index(substr(t, 2), "`"); return substr(t, 2, a - 1) }
function d_rest(t, a) { a = index(substr(t, 2), "`"); return substr(t, a + 2) }
function d_param(t, n,r,f,o) {
if (substr(t, 1, 1) != "`") return ""
n = d_name(t); r = d_rest(t); sub(/\(range\)/, "", r)
f = (r ~ /:f64/) ? ":f64" : ""
if (r ~ /\/opt/) o = "/opt"; else if (r ~ /\/der/) o = "/der"
return n f o }
function d_opd(t, n,r,w,io,q) {
if (substr(t, 1, 1) != "`") return ""
n = d_name(t); r = d_rest(t)
if (substr(r, 1, 2) == "wt") w = "wt"; else if (substr(r, 1, 1) == "w") w = "w"
if (r ~ /:inout/) io = ":inout"
if (r ~ /\?/) q = "?"
return n w io q }
# ---- the dump: the first declarer fixes the schema, as in the loader (spec 2.3) -------------
FILENAME != doc {
if ($0 ~ /^ [a-z]/) { op = $1; seen[op] = 1; next }
if ($0 ~ /^ params /) { s = ""; for (i = 2; i <= NF; i++) s = s (i > 2 ? " " : "") t_param($i)
if (!(op in P)) P[op] = s; next }
if ($0 ~ /^ operands /) { s = ""; for (i = 2; i <= NF; i++) s = s (i > 2 ? " " : "") t_opd($i)
if (!(op in O)) O[op] = s; next }
next }
# ---- the doc rows --------------------------------------------------------------------------
/^\| `/ {
n = split($0, c, "|")
op = d_name(gensub(/^ +| +$/, "", "g", c[2])); documented[op] = 1
if (n > 5) { exempt++; printf "exempt %-24s line %d -- %s\n", op, FNR,
gensub(/^ +| +$/, "", "g", c[5]); next }
pc = c[3]; oc = c[4]; gsub(/[,;]/, " ", pc); gsub(/[,;]|→/, " ", oc)
ps = ""; np = split(pc, pa, /[ \t]+/)
for (i = 1; i <= np; i++) { v = d_param(pa[i]); if (v != "") ps = ps (ps == "" ? "" : " ") v }
os = ""; no = split(oc, oa, /[ \t]+/)
for (i = 1; i <= no; i++) { v = d_opd(oa[i]); if (v != "") os = os (os == "" ? "" : " ") v }
rows++
# An op no loaded plugin declares is a row this configuration cannot check, not a
# disagreement: a host-only build (spec 18) loads no device library. It is counted and named.
if (!(op in P)) { unchecked++; u_list = u_list (u_list == "" ? "" : " ") op; next }
ok = 1
if (ps != P[op]) { ok = 0; printf "PARAMS %-24s line %d\n doc %s\n real %s\n", op, FNR, ps, P[op] }
if (os != O[op]) { ok = 0; printf "OPERAND %-24s line %d\n doc %s\n real %s\n", op, FNR, os, O[op] }
if (!ok) bad++ }
END {
for (op in seen) if (!(op in documented)) {
bad++; printf "UNDOCUMENTED %-20s declared by a plugin, in no table\n", op }
if (unchecked) printf "\n%d op(s) no loaded plugin declares, so unchecked here: %s\n",
unchecked, u_list
printf "\n%s: %d rows, %d exempt, %d unchecked, %d disagree\n", doc, rows, exempt, unchecked, bad
exit bad ? 1 : 0 }
' "$dump" "$doc"