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/dashboard_embed.py
T
Deadcode ddcb9c69bb radiance 2.0.0
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.
2026-11-14 22:32:28 +01:00

131 lines
5.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""dashboard_embed.py write|check -- the dashboard's page as the header the engine compiles in.
The page is built from dashboard/ by Node (npm run build -> dashboard/dist/index.html: one document
with its script, style and type inlined). The engine's build has no Node, so the built page is
committed as core/server/dashboard_page.h and this keeps the two together:
write turns dashboard/dist/index.html into the header, records a digest of the sources it was
built from, and copies the build's list of bundled packages and their licences to
dashboard/THIRD-PARTY-LICENSES.txt (`npm run embed` in dashboard/ builds and writes)
check exits 1 if dashboard/'s sources no longer have the recorded digest: someone changed the
page's source and did not rebuild the header (the ctest `dashboard_page`)
"""
import hashlib, os, sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DASH = os.path.join(ROOT, "dashboard")
HEADER = os.path.join(ROOT, "core", "server", "dashboard_page.h")
DELIM = "RADPAGE"
TOP = ["index.html", "package.json", "package-lock.json", "vite.config.ts", "components.json",
"tsconfig.json", "tsconfig.app.json", "tsconfig.node.json"]
def sources():
out = [os.path.join(DASH, f) for f in TOP if os.path.exists(os.path.join(DASH, f))]
for d, _, files in os.walk(os.path.join(DASH, "src")):
out += [os.path.join(d, f) for f in files]
return sorted(out)
def digest():
h = hashlib.sha256()
for p in sources():
h.update(os.path.relpath(p, DASH).replace(os.sep, "/").encode() + b"\0")
h.update(hashlib.sha256(open(p, "rb").read()).digest())
return h.hexdigest()
# The interfaces of dashboard/src/lib/api.ts that describe a route's object, and the name the
# engine's test knows each object by.
READS = [("Stats", "stats"), ("RunningRequest", "requests"), ("DraftPosition", "draft_positions"),
("Experts", "experts"), ("ExpertTier", "tiers"), ("Sessions", "sessions"), ("Session", "session")]
def reads():
"""Every "object.field" the page reads: the members of those interfaces, nested ones aside."""
src = open(os.path.join(DASH, "src", "lib", "api.ts"), encoding="utf-8").read()
out = []
for iface, obj in READS:
at = src.index("export interface %s {" % iface)
i = src.index("{", at) + 1
depth, word, start = 0, "", True
while depth >= 0:
c = src[i]
if c in "{([<":
depth += 1
elif c in "})]>":
depth -= 1
elif depth == 0:
if c in ";\n":
word, start = "", True
elif start and (c.isalnum() or c == "_"):
word += c
elif c in "?:" and start and word:
out.append(obj + "." + word)
word, start = "", False
elif not c.isspace():
start = False if not word else start
i += 1
return out
def recorded():
with open(HEADER, encoding="utf-8") as f:
for line in f:
if "kPageSources" in line and '"' in line:
return line.split('"')[1]
return None
def write():
page = open(os.path.join(DASH, "dist", "index.html"), encoding="utf-8").read()
# The licences of what the page bundles, as the build listed them, go where the header goes.
notices = open(os.path.join(DASH, "dist", "THIRD-PARTY-LICENSES.txt"), encoding="utf-8").read()
with open(os.path.join(DASH, "THIRD-PARTY-LICENSES.txt"), "w", encoding="utf-8") as f:
f.write(notices)
if ")" + DELIM + '"' in page:
sys.exit("the page contains the raw string's closing delimiter")
# A string literal's length is bounded on some compilers; adjacent literals join without one.
step = 12000
parts = [page[i:i + step] for i in range(0, len(page), step)]
body = "\n".join('R"%s(%s)%s"' % (DELIM, p, DELIM) for p in parts)
with open(HEADER, "w", encoding="utf-8") as f:
f.write("""/* core/server/dashboard_page.h -- the dashboard's page: one document with its script, style and
* type inlined, so the engine serves it from memory with no asset directory and no fetch from
* another origin (it runs on machines with no route to one).
*
* GENERATED by tools/dashboard_embed.py from the build of dashboard/; edit the sources there and
* run `npm run embed` in that directory. The ctest `dashboard_page` fails while the sources and
* this file disagree.
*/
#pragma once
/* A digest of dashboard/'s sources as of this build of the page. */
static const char* const kPageSources = "%s";
/* Every field the page reads of a route's object, as "object.field": the members of the
* interfaces in dashboard/src/lib/api.ts, which the page's compiler holds it to. Ends with null. */
static const char* const kPageReads[] = {
%s
nullptr
};
static const char* const kPage =
%s;
""" % (digest(), "\n".join(' "%s",' % r for r in reads()), body))
print("wrote %s: %d bytes of page in %d pieces, sources %s" % (os.path.relpath(HEADER, ROOT), len(page.encode()), len(parts), digest()[:12]))
def check():
have, want = recorded(), digest()
if have != want:
print("core/server/dashboard_page.h was built from other sources than dashboard/ holds now\n"
" recorded %s\n sources %s\nrun `npm run embed` in dashboard/ and commit the header" % (have, want))
sys.exit(1)
print("dashboard_page.h matches dashboard/ (%s)" % want[:12])
if __name__ == "__main__":
{"write": write, "check": check}.get(sys.argv[1] if len(sys.argv) > 1 else "", lambda: sys.exit(__doc__))()