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/scripts/sycl/bench_report.sh
T
claudeandClaude Opus 5.5 5da5c1ba05 libxe2: the DSpark drafter's ops -- speculative decoding on the B65, greedy-identical
Every op MiniCPM5-2B bf16's DSpark drafter issues now has a libxe2 row, each libref's arithmetic in
libref's order: gemm_nt_q over fp8a8 block-scaled codes (quant_dot per output, the scale grids
worked out on the host as make_scales does), gemm_nt_q_gated with the gated fp8 epilogue, the w2a8
vocabulary head (gemm_zp; b_scale in libref's joined planes form through a copy of libref's layout
hook, so both libraries ask for the same stored bytes, its planes found on the device),
quant_act_i8, silu_mul, row_topk and dflash_select.

rad-kbench: MiniCPM5-2B 191/191 at rel_l2 0. The fixture found the gated GEMM refusing a 27B
geometry its row accepted (it held the whole N-wide row in local memory); it now keeps the n gated
values and declares N <= 57344. The engine oracle with speculation on: 1500/1500 issues
bit-identical, the w2a8 head included. Greedy with speculation on matches libref's greedy without
it on all eight prompts.

Install and oot: a SYCL build installs librad_sycl.so and libxe2.so, its executables find the
backend through $ORIGIN/../lib, and tests/oot_plugins.sh rebuilds libxe2 out of tree with icpx when
RAD_OOT_ICPX is set; it passes in build-sycl.

scripts/sycl/bench_report.sh: the report's screenshot is a JPEG, rendered with fonts (this host has
none, and the first post had no text). docs/SYCL_PROGRESS.md: the first quick benchmark (4.2 tok/s
decode, 17.3 tok/s prefill at 2000 tokens), Milestone B part 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 19:31:29 +02:00

130 lines
6.6 KiB
Bash
Executable File

#!/bin/sh
# bench_report.sh -- a BetterBench quick run against a live radiance server, its summary and a
# screenshot of its HTML report posted to the Discord webhook (docs/SYCL_PROGRESS.md, Benchmarks).
#
# Usage:
# scripts/sycl/bench_report.sh TAG [ENDPOINT] [SERVED_MODEL]
# runs `betterbench run --quick --decode --prefill` (the brief's command) into
# $RUNS/<date>-<TAG>-<commit>/, then reports it
# scripts/sycl/bench_report.sh --report RUN_DIR TAG
# reports an existing run (results.json and results.html in RUN_DIR) without running
#
# TAG the model and configuration, e.g. minicpm5-2b-bf16; runs with the same TAG are
# compared (the delta is against the newest earlier run of that TAG)
# ENDPOINT default http://127.0.0.1:8100/v1; SERVED_MODEL default: the server's first model
# BB BetterBench's venv (default ~/tools/betterbench-venv)
# RUNS where runs are kept (default ~/radiance-bench/runs)
# CHROMIUM_LIBS libraries headless Chromium lacks on this host, unpacked without root
# (default ~/tools/chromium-libs/root/usr/lib/x86_64-linux-gnu)
# CHROMIUM_FONTS a fontconfig file naming fonts for it (default ~/tools/chromium-libs/fonts.conf):
# this host has no fonts, and without them the report renders with no text
#
# Quick runs are 1 warmup and 5 passes: for tracking progress, not for publishing, and labelled so.
# The numbers are BetterBench's own (report.combined_score for decode, report.prefill_rows for
# prefill), so they are the ones its HTML report shows. The Discord message is built with jq and
# stays under 2000 characters; the webhook URL comes from ~/.config/radiance-bench.env and is never
# printed. A failed post is reported and the script exits 2; no webhook configured exits 0 after
# saying so (the run itself is kept either way).
set -eu
here=$(cd "$(dirname "$0")" && pwd)
root=$(cd "$here/../.." && pwd)
BB=${BB:-$HOME/tools/betterbench-venv}
RUNS=${RUNS:-$HOME/radiance-bench/runs}
CHROMIUM_LIBS=${CHROMIUM_LIBS:-$HOME/tools/chromium-libs/root/usr/lib/x86_64-linux-gnu}
CHROMIUM_FONTS=${CHROMIUM_FONTS:-$HOME/tools/chromium-libs/fonts.conf}
commit=$(git -C "$root" rev-parse --short HEAD)
if [ "${1:-}" = "--report" ]; then
run=${2:?--report RUN_DIR TAG}
tag=${3:?--report RUN_DIR TAG}
else
tag=${1:?usage: bench_report.sh TAG [ENDPOINT] [SERVED_MODEL]}
endpoint=${2:-http://127.0.0.1:8100/v1}
model=${3:-$(curl -sf "$endpoint/models" | jq -r '.data[0].id')}
run=$RUNS/$(date +%Y%m%d-%H%M%S)-$tag-$commit
mkdir -p "$run"
"$BB/bin/betterbench" run --endpoint "$endpoint" --model "$model" \
--quick --decode --prefill --no-update-check \
--name "sycl-$tag-$commit" --out "$run/results.json" \
--note backend=sycl --note gpu=arc-pro-b65 --note commit="$commit" > "$run/betterbench.log" 2>&1
fi
[ -f "$run/results.json" ] || { echo "bench_report.sh: no $run/results.json" >&2; exit 1; }
# The previous run of the same tag, for the delta.
# Directories start with their date, so string order is time order: the newest one before this.
prev=$(ls -d "$RUNS"/*-"$tag"-* 2>/dev/null | sort | awk -v r="$run" '$0 < r' | tail -n 1 || true)
[ -n "$prev" ] && [ -f "$prev/results.json" ] || prev=
# The summary, from BetterBench's own report functions.
"$BB/bin/python" -I - "$run/results.json" ${prev:+"$prev/results.json"} > "$run/summary.json" <<'EOF'
import json, sys
from betterbench import report
def summ(path):
r = json.load(open(path))
comb = report.combined_score(r) or {}
pre = [d for d in report.prefill_rows(r) if not d.get("skipped")]
deep = pre[-1] if pre else {}
return {"decode_med": comb.get("decode"), "decode_low1": comb.get("itl_low1"),
"prefill_med": deep.get("pp_med"), "prefill_low1": deep.get("pp_low1"),
"prefill_depth": deep.get("target_depth"),
"prefill": [{"depth": d["target_depth"], "med": d["pp_med"], "low1": d["pp_low1"]} for d in pre]}
out = {"now": summ(sys.argv[1])}
if len(sys.argv) > 2:
out["prev"] = summ(sys.argv[2])
print(json.dumps(out))
EOF
# The report's screenshot, the whole page, as JPEG (the user's choice of format).
html=$run/results.html
img=$run/report.jpg
if [ -f "$html" ]; then
LD_LIBRARY_PATH=$CHROMIUM_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} FONTCONFIG_FILE=$CHROMIUM_FONTS \
"$BB/bin/python" -I - "$html" "$img" <<'EOF'
import sys
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
b = p.chromium.launch()
pg = b.new_page(viewport={"width": 1400, "height": 900}, device_scale_factor=1)
pg.goto("file://" + sys.argv[1])
pg.wait_for_timeout(1500)
pg.screenshot(path=sys.argv[2], full_page=True, type="jpeg", quality=88)
b.close()
EOF
fi
# The message.
jq -n --arg tag "$tag" --arg commit "$commit" --slurpfile s "$run/summary.json" '
def f(x): if x == null then "-" else (x * 10 | round / 10 | tostring) end;
def d(a; b): if a == null or b == null or b == 0 then "" else
" (" + (if a >= b then "+" else "" end) + (((a - b) / b * 1000 | round) / 10 | tostring) + "%)" end;
$s[0] as $x | $x.now as $n | ($x.prev // {}) as $p |
{content: ("**radiance-sycl** quick BetterBench run (1 warmup + 5 passes; for tracking, not publishing)\n" +
"model `" + $tag + "` | commit `" + $commit + "` | GPU Arc Pro B65 (SYCL)\n" +
"decode tok/s: median " + f($n.decode_med) + d($n.decode_med; $p.decode_med) +
", 1% low " + f($n.decode_low1) + d($n.decode_low1; $p.decode_low1) + "\n" +
"prefill tok/s @" + ($n.prefill_depth | tostring) + ": median " + f($n.prefill_med) +
d($n.prefill_med; $p.prefill_med) + ", 1% low " + f($n.prefill_low1) +
d($n.prefill_low1; $p.prefill_low1) + "\n" +
(if $x.prev then "delta vs the previous " + $tag + " run" else "first run of this model" end))[0:1990]}' \
> "$run/payload.json"
cat "$run/payload.json" | jq -r .content
echo "run: $run"
[ -r "$HOME/.config/radiance-bench.env" ] && . "$HOME/.config/radiance-bench.env"
if [ -z "${DISCORD_WEBHOOK_URL:-}" ]; then
echo "bench_report.sh: no DISCORD_WEBHOOK_URL; not posted" >&2
exit 0
fi
if [ -f "$img" ]; then
code=$(curl -sS -o "$run/post.out" -w '%{http_code}' -F "payload_json=<$run/payload.json" \
-F "files[0]=@$img;type=image/jpeg" "$DISCORD_WEBHOOK_URL") || code=000
else
code=$(curl -sS -o "$run/post.out" -w '%{http_code}' -H 'Content-Type: application/json' \
-d @"$run/payload.json" "$DISCORD_WEBHOOK_URL") || code=000
fi
case "$code" in
2??) echo "posted to Discord (HTTP $code)" ;;
*) echo "bench_report.sh: the webhook answered HTTP $code: $(head -c 300 "$run/post.out")" >&2; exit 2 ;;
esac