Every run records GPUs (PCIe link under load and maximum, ReBAR, P2P), runtime image/tag/digest and the engine version the server reports, model, quant, KV cache, context and concurrency, plus a whitelisted system summary and a description. Shown on the run page, compare and sweep views; passed to BetterBench as notes and to the launch80 preview as sections. Settings -> Hardware for manual values. Also: scripts/intel-probe.sh (read-only diagnostics for Intel hosts), and --quick is no longer passed together with --passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
981c4170fc
commit
ee6c623e2a
45 files changed
+4627
-60
No files matched your search
@@ -33,7 +33,8 @@ import { Input } from "@/components/ui/input";
|
||||
import { reportSummary, weightsLabel } from "@/lib/benchmark-report";
|
||||
import { CONFIG_ROWS, describeSettings } from "@/lib/benchmark-view";
|
||||
import type { ListRow } from "../benchmark-list";
|
||||
import { cancelBenchmark, deleteBenchmark, renameBenchmark } from "../actions";
|
||||
import { RunMetaCard } from "@/components/run-meta";
|
||||
import { cancelBenchmark, deleteBenchmark, describeBenchmark, renameBenchmark } from "../actions";
|
||||
import { AbReport } from "./ab-report";
|
||||
import { BenchmarkReport } from "./benchmark-report";
|
||||
import { PublishCard } from "./publish-card";
|
||||
@@ -58,6 +59,7 @@ export function BenchmarkDetail({ initial }: { initial: ListRow }) {
|
||||
const [r, setR] = useState(initial);
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
const [label, setLabel] = useState(initial.label ?? "");
|
||||
const [description, setDescription] = useState(initial.description ?? "");
|
||||
const active = r.state === "queued" || r.state === "running";
|
||||
|
||||
useEffect(() => {
|
||||
@@ -81,6 +83,7 @@ export function BenchmarkDetail({ initial }: { initial: ListRow }) {
|
||||
deploymentId: r.deploymentId,
|
||||
deploymentBId: r.kind === "ab" ? r.deploymentBId : null,
|
||||
label: r.label,
|
||||
description: r.description,
|
||||
...r.settings,
|
||||
}),
|
||||
});
|
||||
@@ -318,6 +321,30 @@ export function BenchmarkDetail({ initial }: { initial: ListRow }) {
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card size="sm">
|
||||
<CardHeader>
|
||||
<CardTitle>Description</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-1.5">
|
||||
<textarea
|
||||
value={description}
|
||||
maxLength={4000}
|
||||
rows={3}
|
||||
placeholder="What this run tries out, e.g. q8_0 KV cache to fit 64k context"
|
||||
className="w-full rounded-md border bg-transparent px-2.5 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
onBlur={async () =>
|
||||
description !== (r.description ?? "") &&
|
||||
(await describeBenchmark(r.id, description || null)) &&
|
||||
setR({ ...r, description: description.trim() || null })
|
||||
}
|
||||
/>
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
Passed to BetterBench (when set before the run starts) and to the launch80 preview, together with the system summary.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<RunMetaCard meta={r.meta} metaB={r.metaB} system={r.system} />
|
||||
{r.kind === "run" && (
|
||||
<Card size="sm">
|
||||
<CardHeader>
|
||||
|
||||
@@ -190,6 +190,12 @@ export function PublishCard({ runId, defaultTitle, defaultSummary }: { runId: st
|
||||
</span>
|
||||
))}
|
||||
</dd>
|
||||
{p.sections.map((s) => (
|
||||
<div key={s.heading} className="contents">
|
||||
<dt className="text-muted-foreground">{s.heading}</dt>
|
||||
<dd className="whitespace-pre-line">{s.body}</dd>
|
||||
</div>
|
||||
))}
|
||||
<dt className="text-muted-foreground">Data</dt>
|
||||
<dd>{p.phases.join(", ")} · every raw sample</dd>
|
||||
<dt className="text-muted-foreground">Removed</dt>
|
||||
|
||||
@@ -13,3 +13,4 @@ async function call(url: string, method: string, body?: unknown): Promise<boolea
|
||||
export const cancelBenchmark = (id: string) => call(`/api/benchmarks/${id}/cancel`, "POST");
|
||||
export const deleteBenchmark = (id: string) => call(`/api/benchmarks/${id}`, "DELETE");
|
||||
export const renameBenchmark = (id: string, label: string | null) => call(`/api/benchmarks/${id}`, "PATCH", { label });
|
||||
export const describeBenchmark = (id: string, description: string | null) => call(`/api/benchmarks/${id}`, "PATCH", { description });
|
||||
@@ -4,6 +4,7 @@ import { BenchmarkStateBadge } from "@/components/benchmark-state";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { getBenchmarks } from "@/lib/benchmarks";
|
||||
import { metaRows } from "@/lib/benchmark-meta";
|
||||
import { CONFIG_ROWS, deltaPct, describeSettings, headline } from "@/lib/benchmark-view";
|
||||
import type { BenchmarkSummary } from "@/lib/db/schema";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -62,6 +63,7 @@ export default async function ComparePage({ searchParams }: PageProps<"/benchmar
|
||||
{
|
||||
group: "Headline",
|
||||
rows: [
|
||||
{ label: "Prefill (deepest prompt)", unit: "t/s", higherIsBetter: true, digits: 0, get: (s) => headline(s).prefill?.tps ?? null },
|
||||
{ label: "Decode (weighted)", unit: "t/s", higherIsBetter: true, digits: 1, get: (s) => headline(s).decode },
|
||||
{ label: "Time to first token", unit: "ms", higherIsBetter: false, digits: 0, get: (s) => headline(s).ttftMs },
|
||||
],
|
||||
@@ -87,6 +89,10 @@ export default async function ComparePage({ searchParams }: PageProps<"/benchmar
|
||||
];
|
||||
const metrics = groups.filter((g) => g.rows.length > 0);
|
||||
|
||||
// Hardware, runtime version, model/quant/KV, context and concurrency as recorded at the start of each run.
|
||||
const metaByRun = runs.map((r) => (r.meta ? metaRows(r.meta) : null));
|
||||
const metaKeys = [...new Map(metaByRun.flatMap((rows) => rows ?? []).map((x) => [x.key, x.label])).entries()];
|
||||
const metaTable = metaKeys.map(([key, label]) => ({ key, label, values: metaByRun.map((rows) => (rows ? (rows.find((x) => x.key === key)?.value ?? null) : null)) }));
|
||||
const configRows = CONFIG_ROWS.map((row) => ({ row, values: runs.map((r) => row.value(r.snapshot)) })).filter((x) => x.values.some((v) => v != null));
|
||||
const corpora = new Set(sums.map((s) => s?.corpusVersion).filter(Boolean));
|
||||
const anyQuick = runs.some((r) => r.summary?.quick);
|
||||
@@ -122,6 +128,28 @@ export default async function ComparePage({ searchParams }: PageProps<"/benchmar
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{metaTable.length > 0 && (
|
||||
<>
|
||||
<TableRow className="bg-muted/40 hover:bg-muted/40">
|
||||
<TableCell colSpan={runs.length + 1} className="text-xs font-medium tracking-wide text-muted-foreground uppercase">
|
||||
Hardware & runtime
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{metaTable.map(({ key, label, values }) => {
|
||||
const differs = new Set(values.map((v) => v ?? "")).size > 1;
|
||||
return (
|
||||
<TableRow key={`meta-${key}`} className={cn(differs && "bg-amber-500/5")}>
|
||||
<TableCell className={cn("text-xs", differs ? "font-medium" : "text-muted-foreground")}>{label}</TableCell>
|
||||
{values.map((v, i) => (
|
||||
<TableCell key={i} className={cn("font-mono text-xs break-all whitespace-normal", differs && i > 0 && v !== values[0] && "text-amber-700 dark:text-amber-300")}>
|
||||
{v ?? <span className="text-muted-foreground">not recorded</span>}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
<TableRow className="bg-muted/40 hover:bg-muted/40">
|
||||
<TableCell colSpan={runs.length + 1} className="text-xs font-medium tracking-wide text-muted-foreground uppercase">
|
||||
Settings
|
||||
|
||||
@@ -9,13 +9,14 @@ import { BarChart } from "@/components/bar-chart";
|
||||
import { BenchmarkStateBadge } from "@/components/benchmark-state";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { metaRows } from "@/lib/benchmark-meta";
|
||||
import { describeSettings, headline } from "@/lib/benchmark-view";
|
||||
import type { benchmarkSweeps, BenchmarkSummary, ResourceStats, SweepVariant } from "@/lib/db/schema";
|
||||
import type { benchmarkSweeps, BenchmarkSummary, ResourceStats, RunMeta, SweepVariant } from "@/lib/db/schema";
|
||||
import { formatBytes } from "@/lib/format";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Sweep = typeof benchmarkSweeps.$inferSelect;
|
||||
type Run = { id: string; state: string; summary: BenchmarkSummary | null; resources: ResourceStats | null; phase: string | null; error: string | null };
|
||||
type Run = { id: string; state: string; summary: BenchmarkSummary | null; resources: ResourceStats | null; phase: string | null; error: string | null; meta: RunMeta | null };
|
||||
export type SweepData = { sweep: Sweep; runs: Run[] };
|
||||
|
||||
const VARIANT_STATE: Record<SweepVariant["state"], string> = {
|
||||
@@ -59,6 +60,20 @@ function rowsOf(data: SweepData): Row[] {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Recorded setup (GPU, PCIe, engine version, quant, KV cache, context, concurrency): values shared by
|
||||
* every variant go above the table, the ones that differ become columns.
|
||||
*/
|
||||
function setupOf(rows: Row[]) {
|
||||
const per = rows.map((r) => (r.run?.meta ? metaRows(r.run.meta).filter((x) => x.key !== "image" && x.key !== "digest") : null));
|
||||
const keys = [...new Map(per.flatMap((x) => x ?? []).map((x) => [x.key, x.label])).entries()];
|
||||
const recorded = per.filter((x) => x != null);
|
||||
const value = (i: number, key: string) => per[i]?.find((x) => x.key === key)?.value ?? null;
|
||||
const differs = keys.filter(([key]) => new Set(recorded.map((x) => x.find((y) => y.key === key)?.value ?? "")).size > 1);
|
||||
const shared = keys.filter((k) => !differs.includes(k)).map(([key, label]) => ({ label, value: recorded[0]?.find((y) => y.key === key)?.value ?? null }));
|
||||
return { shared: recorded.length ? shared : [], columns: differs.map(([key, label]) => ({ key, label })), value };
|
||||
}
|
||||
|
||||
/** Best value per column (higher or lower is better), to set it in bold. */
|
||||
function best(rows: Row[], key: keyof Row, higher: boolean): number | null {
|
||||
const vals = rows.map((r) => r[key]).filter((x): x is number => typeof x === "number");
|
||||
@@ -95,6 +110,7 @@ export function SweepDetail({ initial }: { initial: SweepData }) {
|
||||
}
|
||||
|
||||
const rows = rowsOf(data);
|
||||
const setup = setupOf(rows);
|
||||
const finished = rows.filter((r) => r.decode != null);
|
||||
const runIds = rows.map((r) => r.v.runId).filter((x): x is string => !!x && rows.some((r) => r.run?.id === x && r.run.state === "completed"));
|
||||
const bestOf = {
|
||||
@@ -183,6 +199,14 @@ export function SweepDetail({ initial }: { initial: SweepData }) {
|
||||
<CardHeader>
|
||||
<CardTitle>Variants</CardTitle>
|
||||
<CardDescription>Best value per column in bold. Resource figures are averages/peaks over the run.</CardDescription>
|
||||
{setup.shared.length > 0 && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{setup.shared
|
||||
.filter((x) => x.value)
|
||||
.map((x) => `${x.label}: ${x.value}`)
|
||||
.join(" · ")}
|
||||
</p>
|
||||
)}
|
||||
</CardHeader>
|
||||
<CardContent className="overflow-x-auto px-0">
|
||||
<table className="w-full text-sm">
|
||||
@@ -190,6 +214,11 @@ export function SweepDetail({ initial }: { initial: SweepData }) {
|
||||
<tr className="border-b">
|
||||
<th className="px-3 py-2 text-left font-medium">Variant</th>
|
||||
<th className="px-3 py-2 text-left font-medium">State</th>
|
||||
{setup.columns.map((c) => (
|
||||
<th key={c.key} className="px-3 py-2 text-left font-medium">
|
||||
{c.label}
|
||||
</th>
|
||||
))}
|
||||
<th className="px-3 py-2 text-right font-medium">Decode t/s</th>
|
||||
<th className="px-3 py-2 text-right font-medium">TTFT ms</th>
|
||||
<th className="px-3 py-2 text-right font-medium">Prefill t/s</th>
|
||||
@@ -200,7 +229,7 @@ export function SweepDetail({ initial }: { initial: SweepData }) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((r) => (
|
||||
{rows.map((r, i) => (
|
||||
<tr key={r.v.index} className="border-b last:border-0">
|
||||
<td className="px-3 py-2 font-mono text-xs">
|
||||
{r.v.runId ? (
|
||||
@@ -216,6 +245,11 @@ export function SweepDetail({ initial }: { initial: SweepData }) {
|
||||
{r.v.state === "benchmarking" && r.run?.phase ? ` · ${r.run.phase}` : ""}
|
||||
{(r.v.error || r.run?.error) && r.v.state === "failed" ? ` · ${(r.v.error ?? r.run?.error ?? "").slice(0, 60)}` : ""}
|
||||
</td>
|
||||
{setup.columns.map((c) => (
|
||||
<td key={c.key} className="px-3 py-2 font-mono text-xs">
|
||||
{setup.value(i, c.key) ?? "–"}
|
||||
</td>
|
||||
))}
|
||||
{cell(r.decode, bestOf.decode, (x) => x.toFixed(1))}
|
||||
{cell(r.ttft, bestOf.ttft, (x) => x.toFixed(0))}
|
||||
{cell(r.prefill, bestOf.prefill, (x) => x.toFixed(0))}
|
||||
|
||||
@@ -34,6 +34,7 @@ export function BenchmarkCard({ deploymentId, modelId, running, initial }: { dep
|
||||
const [passes, setPasses] = useState("10");
|
||||
const [phases, setPhases] = useState<BenchmarkPhase[]>(["decode", "prefill", "concurrency"]);
|
||||
const [label, setLabel] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [runs, setRuns] = useState(initial);
|
||||
const [peers, setPeers] = useState<Peer[] | null>(null);
|
||||
@@ -73,7 +74,7 @@ export function BenchmarkCard({ deploymentId, modelId, running, initial }: { dep
|
||||
async function start(body: Record<string, unknown>) {
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await fetch("/api/benchmarks", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ deploymentId, label: label.trim() || null, ...body }) });
|
||||
const res = await fetch("/api/benchmarks", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ deploymentId, label: label.trim() || null, description: description.trim() || null, ...body }) });
|
||||
const json = await res.json().catch(() => ({}));
|
||||
if (!res.ok) return toast.error(json.error?.message ?? `Could not start (${res.status})`);
|
||||
router.push(`/benchmarks/${json.id}`);
|
||||
@@ -138,6 +139,7 @@ export function BenchmarkCard({ deploymentId, modelId, running, initial }: { dep
|
||||
))}
|
||||
</div>
|
||||
<Input value={label} onChange={(e) => setLabel(e.target.value)} maxLength={120} placeholder="Label, e.g. q8_0 KV cache (optional)" />
|
||||
<Input value={description} onChange={(e) => setDescription(e.target.value)} maxLength={4000} placeholder="Description: what this run tries out (optional, published with it)" />
|
||||
<Button
|
||||
onClick={() =>
|
||||
start({ quick: mode === "quick", passes: mode === "custom" ? Number(passes) || 10 : null, phases: phases.length === PHASES.length ? [] : phases })
|
||||
@@ -195,6 +197,7 @@ export function BenchmarkCard({ deploymentId, modelId, running, initial }: { dep
|
||||
</label>
|
||||
</div>
|
||||
<Input value={label} onChange={(e) => setLabel(e.target.value)} maxLength={120} placeholder="Label, e.g. f16 vs q8_0 KV (optional)" />
|
||||
<Input value={description} onChange={(e) => setDescription(e.target.value)} maxLength={4000} placeholder="Description: what this run tries out (optional, published with it)" />
|
||||
<Button
|
||||
onClick={() => start({ deploymentBId: peerId, mdePct: Number(mde) || 1, maxPairs: Math.max(12, Number(maxPairs) || 200) })}
|
||||
disabled={!running || busy || !peer || peer.state !== "running"}
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { LocalTime } from "@/components/local-time";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { NativeSelect } from "@/components/ui/native-select";
|
||||
import type { HardwareOverrides, HostHardware } from "@/lib/db/schema";
|
||||
import { formatBytes } from "@/lib/format";
|
||||
import { formatLink, onOff } from "@/lib/hardware";
|
||||
|
||||
type GpuForm = { name: string; vramMb: string; linkCurrent: string; linkMax: string; rebar: "" | "on" | "off" };
|
||||
|
||||
const toForm = (o: NonNullable<HardwareOverrides["gpus"]>[string] | undefined): GpuForm => ({
|
||||
name: o?.name ?? "",
|
||||
vramMb: o?.vramMb != null ? String(o.vramMb) : "",
|
||||
linkCurrent: o?.linkCurrent ?? "",
|
||||
linkMax: o?.linkMax ?? "",
|
||||
rebar: o?.rebar == null ? "" : o.rebar ? "on" : "off",
|
||||
});
|
||||
|
||||
const STORAGE_KIND: Record<string, string> = { nvme: "NVMe", ssd: "SSD", hdd: "HDD", virtual: "virtual disk" };
|
||||
|
||||
/** What Kaname detected on the Docker host, with manual values for what it can't see. */
|
||||
export function HardwareSettings({
|
||||
detected,
|
||||
overrides,
|
||||
summary,
|
||||
dockerConnected,
|
||||
}: {
|
||||
detected: HostHardware | null;
|
||||
overrides: HardwareOverrides;
|
||||
summary: string[];
|
||||
dockerConnected: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [gpus, setGpus] = useState<Record<string, GpuForm>>(() => Object.fromEntries((detected?.gpus ?? []).map((g) => [g.pciAddress, toForm(overrides.gpus?.[g.pciAddress])])));
|
||||
const [p2p, setP2p] = useState(overrides.p2p ?? "");
|
||||
const [storage, setStorage] = useState(overrides.storage ?? "");
|
||||
const [hypervisor, setHypervisor] = useState(overrides.hypervisor ?? "");
|
||||
const [passthrough, setPassthrough] = useState(overrides.gpuPassthrough == null ? "" : overrides.gpuPassthrough ? "yes" : "no");
|
||||
const [gpuDriver, setGpuDriver] = useState(overrides.gpuDriver ?? "");
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
const setGpu = (addr: string, patch: Partial<GpuForm>) => setGpus((g) => ({ ...g, [addr]: { ...g[addr], ...patch } }));
|
||||
|
||||
async function save() {
|
||||
setBusy(true);
|
||||
try {
|
||||
const body: HardwareOverrides = {
|
||||
gpus: Object.fromEntries(
|
||||
Object.entries(gpus).map(([addr, g]) => [
|
||||
addr,
|
||||
{
|
||||
name: g.name || undefined,
|
||||
vramMb: g.vramMb ? Number(g.vramMb) : undefined,
|
||||
linkCurrent: g.linkCurrent || undefined,
|
||||
linkMax: g.linkMax || undefined,
|
||||
rebar: g.rebar ? g.rebar === "on" : undefined,
|
||||
},
|
||||
]),
|
||||
),
|
||||
p2p: (p2p || undefined) as HardwareOverrides["p2p"],
|
||||
storage: storage || undefined,
|
||||
hypervisor: hypervisor || undefined,
|
||||
gpuPassthrough: passthrough ? passthrough === "yes" : undefined,
|
||||
gpuDriver: gpuDriver || undefined,
|
||||
};
|
||||
const res = await fetch("/api/settings/hardware", { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
||||
const out = await res.json().catch(() => ({}));
|
||||
if (!res.ok) return void toast.error(out.error?.message ?? `Could not save (${res.status})`);
|
||||
toast.success("Saved; new benchmark runs use these values");
|
||||
router.refresh();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!detected) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Hardware</CardTitle>
|
||||
<CardDescription>
|
||||
{dockerConnected ? "The worker hasn't reported its hardware yet (it checks every few minutes)." : "Hardware is detected by the worker once Docker is connected (Settings → Runtimes)."}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
const v = detected.virtualization;
|
||||
return (
|
||||
<form
|
||||
className="flex flex-col gap-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
void save();
|
||||
}}
|
||||
>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>GPUs</CardTitle>
|
||||
<CardDescription>
|
||||
Recorded with every benchmark run. Detected from sysfs as the worker sees it; in a VM the PCIe link is the one the VM sees, which may not be the physical
|
||||
slot. Fill in a field to replace the detected value (empty = detected).
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-4">
|
||||
{detected.gpus.length === 0 && <p className="text-sm text-muted-foreground">No NVIDIA, Intel or AMD GPU found.</p>}
|
||||
{detected.gpus.map((g) => {
|
||||
const f = gpus[g.pciAddress];
|
||||
return (
|
||||
<div key={g.pciAddress} className="flex flex-col gap-3 rounded-lg border p-3">
|
||||
<div className="text-sm">
|
||||
<span className="font-medium">{g.name ?? "Unknown GPU"}</span>
|
||||
<span className="text-muted-foreground">
|
||||
{" "}
|
||||
· {g.pciAddress} · {g.driver ?? "no driver"}
|
||||
{g.driverVersion ? ` ${g.driverVersion}` : ""}
|
||||
</span>
|
||||
</div>
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<Field id={`n-${g.pciAddress}`} label="Name" detected={g.name} value={f.name} onChange={(x) => setGpu(g.pciAddress, { name: x })} />
|
||||
<Field
|
||||
id={`v-${g.pciAddress}`}
|
||||
label="VRAM (MiB)"
|
||||
detected={g.vramMb != null ? String(g.vramMb) : null}
|
||||
value={f.vramMb}
|
||||
onChange={(x) => setGpu(g.pciAddress, { vramMb: x.replace(/\D/g, "") })}
|
||||
/>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor={`r-${g.pciAddress}`}>ReBAR</Label>
|
||||
<NativeSelect id={`r-${g.pciAddress}`} value={f.rebar} onChange={(e) => setGpu(g.pciAddress, { rebar: e.target.value as GpuForm["rebar"] })}>
|
||||
<option value="">Detected: {onOff(g.rebar)}</option>
|
||||
<option value="on">on</option>
|
||||
<option value="off">off</option>
|
||||
</NativeSelect>
|
||||
<p className="text-xs text-muted-foreground">Largest BAR {g.barMb != null ? formatBytes(g.barMb * 2 ** 20) : "unknown"}</p>
|
||||
</div>
|
||||
<Field
|
||||
id={`lc-${g.pciAddress}`}
|
||||
label="PCIe link (current)"
|
||||
detected={formatLink(g.linkCurrent)}
|
||||
value={f.linkCurrent}
|
||||
placeholderHint="e.g. Gen4 x8"
|
||||
onChange={(x) => setGpu(g.pciAddress, { linkCurrent: x })}
|
||||
/>
|
||||
<Field
|
||||
id={`lm-${g.pciAddress}`}
|
||||
label="PCIe link (maximum)"
|
||||
detected={formatLink(g.linkMax)}
|
||||
value={f.linkMax}
|
||||
placeholderHint="e.g. Gen5 x16"
|
||||
onChange={(x) => setGpu(g.pciAddress, { linkMax: x })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{detected.gpus.length > 1 && (
|
||||
<div className="flex max-w-xs flex-col gap-1.5">
|
||||
<Label htmlFor="hw-p2p">Peer-to-peer between GPUs</Label>
|
||||
<NativeSelect id="hw-p2p" value={p2p} onChange={(e) => setP2p(e.target.value as typeof p2p)}>
|
||||
<option value="">Detected: {detected.p2p ?? "unknown"}</option>
|
||||
<option value="on">on</option>
|
||||
<option value="partial">partial</option>
|
||||
<option value="off">off</option>
|
||||
</NativeSelect>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>System</CardTitle>
|
||||
<CardDescription>Part of the system summary recorded with each run, passed to BetterBench and shown in the launch80 preview.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-4">
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
<Field
|
||||
id="hw-storage"
|
||||
label="Models disk"
|
||||
detected={detected.storage ? [detected.storage.model, detected.storage.kind && STORAGE_KIND[detected.storage.kind]].filter(Boolean).join(", ") : null}
|
||||
value={storage}
|
||||
onChange={setStorage}
|
||||
/>
|
||||
<Field
|
||||
id="hw-virt"
|
||||
label="Virtualization"
|
||||
detected={v.vm == null ? null : v.vm ? `VM${v.hypervisor ? ` (${v.hypervisor})` : ""}` : "bare metal"}
|
||||
value={hypervisor}
|
||||
placeholderHint="e.g. Proxmox VE 9 (KVM)"
|
||||
onChange={setHypervisor}
|
||||
/>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="hw-pt">GPU passthrough</Label>
|
||||
<NativeSelect id="hw-pt" value={passthrough} onChange={(e) => setPassthrough(e.target.value)}>
|
||||
<option value="">Detected: {v.vm ? (detected.gpus.length ? "yes" : "no") : v.vm === false ? "no (bare metal)" : "unknown"}</option>
|
||||
<option value="yes">yes</option>
|
||||
<option value="no">no</option>
|
||||
</NativeSelect>
|
||||
</div>
|
||||
<Field
|
||||
id="hw-driver"
|
||||
label="GPU driver"
|
||||
detected={[...new Set(detected.gpus.map((g) => [g.driver, g.driverVersion].filter(Boolean).join(" ")))].join(", ") || null}
|
||||
value={gpuDriver}
|
||||
placeholderHint="e.g. xe, compute runtime 25.35"
|
||||
onChange={setGpuDriver}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Button type="submit" disabled={busy}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>System summary</CardTitle>
|
||||
<CardDescription>
|
||||
Exactly what runs record and publish (after saving). Never the hostname, IP addresses, users or paths. Checked <LocalTime value={detected.checkedAt} />.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul className="flex flex-col gap-1 text-sm">
|
||||
{summary.map((l) => (
|
||||
<li key={l}>{l}</li>
|
||||
))}
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function Field({
|
||||
id,
|
||||
label,
|
||||
detected,
|
||||
value,
|
||||
onChange,
|
||||
placeholderHint,
|
||||
}: {
|
||||
id: string;
|
||||
label: string;
|
||||
detected: string | null;
|
||||
value: string;
|
||||
onChange: (v: string) => void;
|
||||
placeholderHint?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor={id}>{label}</Label>
|
||||
<Input id={id} value={value} onChange={(e) => onChange(e.target.value)} placeholder={detected ?? placeholderHint ?? "unknown"} maxLength={120} />
|
||||
<p className="text-xs text-muted-foreground">Detected: {detected ?? "unknown"}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { Metadata } from "next";
|
||||
import { kanameVersion } from "@/lib/benchmark-snapshot";
|
||||
import { applyOverrides, systemSummary, systemSummaryLines } from "@/lib/hardware";
|
||||
import { getDockerInfo } from "@/lib/runtimes";
|
||||
import { getHardwareOverrides } from "@/lib/settings";
|
||||
import { HardwareSettings } from "./hardware-settings";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const metadata: Metadata = { title: "Hardware · Settings" };
|
||||
|
||||
export default async function HardwareSettingsPage() {
|
||||
const [docker, overrides] = await Promise.all([getDockerInfo(), getHardwareOverrides()]);
|
||||
const hardware = docker?.hardware ?? null;
|
||||
const effective = applyOverrides(hardware, overrides);
|
||||
return (
|
||||
<HardwareSettings
|
||||
detected={hardware}
|
||||
overrides={overrides}
|
||||
summary={systemSummaryLines(systemSummary(effective, docker?.os ?? null, kanameVersion()))}
|
||||
dockerConnected={!!docker?.connected}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BotIcon, BoxesIcon, DownloadIcon, KeyRoundIcon, TagIcon, TagsIcon } from "lucide-react";
|
||||
import { BotIcon, BoxesIcon, CpuIcon, DownloadIcon, KeyRoundIcon, TagIcon, TagsIcon } from "lucide-react";
|
||||
import { SettingsNav } from "./settings-nav";
|
||||
|
||||
const SECTIONS = [
|
||||
@@ -6,6 +6,7 @@ const SECTIONS = [
|
||||
{ href: "/settings/tags", label: "Tags", icon: <TagsIcon className="size-4" /> },
|
||||
{ href: "/settings/downloads", label: "Downloads", icon: <DownloadIcon className="size-4" /> },
|
||||
{ href: "/settings/runtimes", label: "Runtimes", icon: <BoxesIcon className="size-4" /> },
|
||||
{ href: "/settings/hardware", label: "Hardware", icon: <CpuIcon className="size-4" /> },
|
||||
{ href: "/settings/api-keys", label: "Runtime API keys", icon: <KeyRoundIcon className="size-4" /> },
|
||||
{ href: "/settings/api-tokens", label: "API tokens", icon: <BotIcon className="size-4" /> },
|
||||
];
|
||||
|
||||
@@ -37,6 +37,7 @@ export function RuntimeForm({
|
||||
const [accelerator, setAccelerator] = useState<RuntimeAccelerator>(initial.accelerator ?? "cpu");
|
||||
const [image, setImage] = useState(initial.image);
|
||||
const [description, setDescription] = useState(initial.description ?? "");
|
||||
const [engineName, setEngineName] = useState(initial.engineName ?? "");
|
||||
const [envText, setEnvText] = useState(formatEnvLines(initial.env ?? {}));
|
||||
const [argRows, setArgRows] = useState(() => argsToRows(initial.extraArgs ?? []));
|
||||
const [devicesText, setDevicesText] = useState((initial.devices ?? []).join(", "));
|
||||
@@ -55,6 +56,7 @@ export function RuntimeForm({
|
||||
accelerator,
|
||||
image,
|
||||
description,
|
||||
engineName,
|
||||
env: parseEnvLines(envText),
|
||||
extraArgs: rowsToArgs(argRows),
|
||||
devices: devicesText.split(/[,\s]+/),
|
||||
@@ -151,6 +153,12 @@ export function RuntimeForm({
|
||||
<Input id="rt-desc" value={description} onChange={(e) => setDescription(e.target.value)} maxLength={2000} />
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="rt-engine-name">Engine name</Label>
|
||||
<Input id="rt-engine-name" value={engineName} onChange={(e) => setEngineName(e.target.value)} maxLength={60} placeholder={engine} spellCheck={false} />
|
||||
<p className="text-xs text-muted-foreground">For forks: recorded with every benchmark next to the version the server reports, e.g. vllm-radiance.</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="rt-env">Environment</Label>
|
||||
<textarea
|
||||
|
||||
@@ -66,6 +66,7 @@ const toInput = (r: Runtime): RuntimeInput => ({
|
||||
accelerator: r.accelerator,
|
||||
image: r.image,
|
||||
description: r.description,
|
||||
engineName: r.engineName,
|
||||
env: r.env,
|
||||
extraArgs: r.extraArgs,
|
||||
devices: r.devices,
|
||||
@@ -279,6 +280,12 @@ function ImageState({ r }: { r: Runtime }) {
|
||||
· built <LocalTime value={r.imageCreated} />
|
||||
</span>
|
||||
)}
|
||||
{r.imageDigest && (
|
||||
<span className="font-mono text-muted-foreground" title={r.imageDigest}>
|
||||
{" "}
|
||||
· {r.imageDigest.slice(0, 19)}…
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { withAuth } from "@/lib/api-auth";
|
||||
import { apiError, handleApiError } from "@/lib/api-errors";
|
||||
import { BenchmarkError, deleteBenchmark, getBenchmark, updateBenchmarkLabel } from "@/lib/benchmarks";
|
||||
import { BenchmarkError, DESCRIPTION_MAX, deleteBenchmark, getBenchmark, updateBenchmark } from "@/lib/benchmarks";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -11,12 +11,12 @@ export const GET = withAuth<RouteContext<"/api/benchmarks/[id]">>(async (_req, {
|
||||
return run ? NextResponse.json(run) : apiError(404, "not_found", "Benchmark not found.");
|
||||
});
|
||||
|
||||
const Patch = z.object({ label: z.string().max(120).nullable() });
|
||||
const Patch = z.object({ label: z.string().max(120).nullable().optional(), description: z.string().max(DESCRIPTION_MAX).nullable().optional() });
|
||||
|
||||
/** Rename (label) a run. */
|
||||
/** Rename (label) a run or change its description. */
|
||||
export const PATCH = withAuth<RouteContext<"/api/benchmarks/[id]">>(async (req, { params }) => {
|
||||
try {
|
||||
await updateBenchmarkLabel((await params).id, Patch.parse(await req.json()).label);
|
||||
await updateBenchmark((await params).id, Patch.parse(await req.json()));
|
||||
return new NextResponse(null, { status: 204 });
|
||||
} catch (err) {
|
||||
if (err instanceof BenchmarkError) return apiError(err.status, err.code, err.message);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { withAuth } from "@/lib/api-auth";
|
||||
import { apiError, handleApiError } from "@/lib/api-errors";
|
||||
import { getHardwareOverrides, saveHardwareOverrides, SettingsError } from "@/lib/settings";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
/** Manual hardware values for benchmark records (Settings → Hardware). */
|
||||
export const GET = withAuth(async () => NextResponse.json(await getHardwareOverrides()));
|
||||
|
||||
export const PUT = withAuth(async (req) => {
|
||||
try {
|
||||
return NextResponse.json(await saveHardwareOverrides(await req.json()));
|
||||
} catch (err) {
|
||||
if (err instanceof SettingsError) return apiError(err.status, err.code, err.message);
|
||||
return handleApiError(err);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user