Archived
Radiance becomes a multi-model engine: one process serves several models behind one port, loads each when a request names it, parks it in host memory or restores it from its container, and shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP). Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5, Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B, the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0 serves all of them. Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill reworked, and a reworked adaptive draft window. Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server, each accelerator's memory by model, model states over time. Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410); eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi (#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon (#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and multi-model serving as asked for in #367 and #109. Plugin ABI 39: out-of-tree plugins need to be rebuilt. Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
78 lines
4.0 KiB
Bash
Executable File
78 lines
4.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Qwen3.8-Flash-Next prefill under rocprofv3 kernel tracing, with the link counters beside it.
|
|
#
|
|
# `moe_gemm_q` is the largest item in a prefill step, and it mostly waits on non-resident expert
|
|
# weight, which for a host-pooled unit is read across the link inside the kernel. The trace gives
|
|
# the GEMM's time and /stats the bytes streamed; together they give the achieved streaming rate,
|
|
# which shows whether the kernel reaches the link's ceiling.
|
|
#
|
|
# tsum.sh keys its steady-state window on a once-per-decode-step marker; with max_tokens 1 there is
|
|
# none, so it sums the whole trace and every number is per run. The model load's kernels are in the
|
|
# total, so the prompt must be long enough to make them negligible.
|
|
#
|
|
# N=20000 OUT=<trace dir> scripts/fntrace.sh
|
|
#
|
|
# The default container is the production one, w4nl64-i8lm.rad (see scripts/fnserve.sh).
|
|
P="${P:-8164}"
|
|
M="${M:-$HOME/models/rad/w4nl64-i8lm.rad}"
|
|
N="${N:-20000}"
|
|
BPT="${BPT:-4}"
|
|
OUT="${OUT:-$HOME/traces/fnpf}"
|
|
ROOT="${ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
CORPUS=/dev/shm/fntrace-corpus.txt
|
|
BUILD="${BUILD:-$ROOT/build}"
|
|
cd "$BUILD" || exit 1
|
|
|
|
want=$((N * BPT + 4096))
|
|
if [ "$(wc -c < "$CORPUS" 2>/dev/null || echo 0)" -lt "$want" ]; then
|
|
: > "$CORPUS"
|
|
while [ "$(wc -c < "$CORPUS")" -lt "$want" ]; do
|
|
cat "$ROOT"/spec.md "$ROOT"/docs/*.md >> "$CORPUS" 2>/dev/null || exit 1
|
|
done
|
|
fi
|
|
|
|
pkill -f "bin/radianc[e]"; while pgrep -f "bin/radianc[e]" >/dev/null; do sleep 1; done; sleep 2
|
|
rm -rf "$OUT"; mkdir -p "$OUT"
|
|
env GPU_MAX_ALLOC_PERCENT=100 GPU_MAX_HEAP_SIZE=100 $EXTRA_ENV \
|
|
"$ROOT/libr4d/isa/trace.sh" "$OUT" -- \
|
|
"$ROOT/scripts/radiance-flags" ./bin/radiance --model "$M" \
|
|
--radiance-home radiance_home \
|
|
--host 127.0.0.1 --port "$P" \
|
|
--max-num-seqs ${SEQS:-8} --max-model-len ${MLEN:-200000} \
|
|
--tp ${TP:-2} --placement expert_tiered --host-pool-mib ${HOSTPOOL:-24576} \
|
|
--gpu-headroom-mib ${HR:-96} --kv-cache-dtype ${KVD:-i8} \
|
|
--num-speculative-tokens ${NS:-3} \
|
|
--max-num-batched-tokens ${MNBT:-2048} \
|
|
$EXTRA > "$HOME/fntrace.log" 2>&1 &
|
|
for i in $(seq 1 150); do
|
|
[ "$(curl -s -m 3 -o /dev/null -w %{http_code} http://127.0.0.1:$P/health 2>/dev/null)" = 200 ] && break
|
|
pgrep -f "bin/radianc[e]" >/dev/null || { echo "DIED"; grep -iE "^E |error" "$HOME/fntrace.log" | tail -10; exit 1; }
|
|
sleep 4
|
|
done
|
|
[ "$(curl -s -m 3 -o /dev/null -w %{http_code} http://127.0.0.1:$P/health)" = 200 ] || { echo "DID NOT START"; exit 1; }
|
|
|
|
st() { curl -s -m 5 "http://127.0.0.1:$P/stats" | jq -r ".link.$1 // 0"; }
|
|
s0=$(st stream_bytes); a0=$(st ar_bytes); h0=$(st h2d_bytes)
|
|
{ printf 'trace %s\n\n' "$(date +%s%N)"; head -c $((N * BPT)) "$CORPUS"; } > /dev/shm/fntrace-p.txt
|
|
jq -Rs '{prompt: ., max_tokens: 1, temperature: 0}' < /dev/shm/fntrace-p.txt > /dev/shm/fntrace-b.json
|
|
t0=$(date +%s.%N)
|
|
out=$(curl -s -m 1800 -X POST "http://127.0.0.1:$P/v1/completions" \
|
|
-H 'Content-Type: application/json' --data-binary @/dev/shm/fntrace-b.json)
|
|
t1=$(date +%s.%N)
|
|
s1=$(st stream_bytes); a1=$(st ar_bytes); h1=$(st h2d_bytes)
|
|
pt=$(printf '%s' "$out" | jq -r '.usage.prompt_tokens // 0')
|
|
|
|
# Under rocprofv3 the server can hang in finalisation after SIGTERM (the profiler chains its own
|
|
# handler). The trace CSV is already on disk by then, so escalate to SIGKILL after a bounded wait.
|
|
pkill -f "bin/radianc[e]"
|
|
i=0; while pgrep -f "bin/radianc[e]" >/dev/null && [ $i -lt 30 ]; do sleep 1; i=$((i + 1)); done
|
|
pgrep -f "bin/radianc[e]" >/dev/null && { echo "did not exit on TERM under the profiler, killing"; pkill -9 -f "bin/radianc[e]"; sleep 2; }
|
|
awk -v t0="$t0" -v t1="$t1" -v pt="$pt" -v s="$((s1 - s0))" -v a="$((a1 - a0))" -v h="$((h1 - h0))" 'BEGIN {
|
|
d = t1 - t0;
|
|
printf "\nprefill %d tok in %.3f s = %.1f tok/s\n", pt, d, pt / d;
|
|
printf " streamed %10.2f GB over the request (%.2f GB/s over its wall, ALL ranks)\n", s/1e9, s/1e9/d;
|
|
printf " promotions %10.2f GB all-reduce %8.2f GB\n", h/1e9, a/1e9;
|
|
printf "\nDivide the streamed GB by moe_gemm_q device time below for the rate the read achieves.\n";
|
|
}'
|
|
sh "$ROOT/libr4d/isa/tsum.sh" "$OUT/k_kernel_trace.csv"
|