From b1cc71507731d006c74621d67737b83b93e90c85 Mon Sep 17 00:00:00 2001 From: Z User Date: Thu, 29 Oct 2026 21:16:52 +0000 Subject: [PATCH] fix: add --perf flag for live TPS/TTFT in /slots + v0.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem 'TPS и TPS Prefill как-то слабовато обновляются' — /slots endpoint doesn't return per-slot timings without --perf flag. Without it, the Perf tab shows 'No per-token timings' even during generation. ## Fix Added `perf: boolean` to DashboardConfig (default: true). - buildLlamaExtraArgs: emits `--perf` when enabled - parseLlamaExtraArgs: parses `--perf` / `--no-perf` - mergeConfig: includes perf field - ConfigTab: new 'Perf timings' toggle in Performance flags section with hint 'Per-slot TPS/TTFT in /slots (needed for Perf tab)' With --perf enabled, /slots returns real-time timings: timings: { prompt_n, prompt_ms, prompt_per_second, predicted_n, predicted_ms, predicted_per_second, cache_hit_rate } These update every 1.5s while the Perf tab is polling. ## Version → 0.8.1 --- dashboard/src/app/api/config/route.ts | 1 + dashboard/src/app/api/debug/route.ts | 2 +- dashboard/src/app/page.tsx | 9 +++++++++ dashboard/src/lib/docker.ts | 11 +++++++++++ dashboard/src/lib/version.ts | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dashboard/src/app/api/config/route.ts b/dashboard/src/app/api/config/route.ts index e3d07f9..2f9fe0d 100644 --- a/dashboard/src/app/api/config/route.ts +++ b/dashboard/src/app/api/config/route.ts @@ -41,6 +41,7 @@ function mergeConfig( contBatching: patch.contBatching ?? base.contBatching, embeddings: patch.embeddings ?? base.embeddings, metrics: patch.metrics ?? base.metrics, + perf: patch.perf ?? base.perf, ropeFreqScale: patch.ropeFreqScale ?? base.ropeFreqScale, ropeScale: patch.ropeScale ?? base.ropeScale, yarnExtFactor: patch.yarnExtFactor ?? base.yarnExtFactor, diff --git a/dashboard/src/app/api/debug/route.ts b/dashboard/src/app/api/debug/route.ts index 50c94c9..b4b1c96 100644 --- a/dashboard/src/app/api/debug/route.ts +++ b/dashboard/src/app/api/debug/route.ts @@ -120,7 +120,7 @@ export async function GET() { ok: envError === null, error: envError, }, - version: "0.8.0", + version: "0.8.1", timestamp: new Date().toISOString(), }); } diff --git a/dashboard/src/app/page.tsx b/dashboard/src/app/page.tsx index 090b7a3..326c6f5 100644 --- a/dashboard/src/app/page.tsx +++ b/dashboard/src/app/page.tsx @@ -114,6 +114,7 @@ interface DashboardConfig { contBatching: boolean; embeddings: boolean; metrics: boolean; + perf: boolean; ropeFreqScale: number; ropeScale: number; yarnExtFactor: number; @@ -203,6 +204,7 @@ const DEFAULT_CONFIG: DashboardConfig = { contBatching: true, embeddings: false, metrics: false, + perf: true, ropeFreqScale: 1.0, ropeScale: 1.0, yarnExtFactor: 1.0, @@ -2152,6 +2154,12 @@ function ConfigTab({ checked={config.metrics} onChange={(v) => update("metrics", v)} /> + update("perf", v)} + /> @@ -4892,6 +4900,7 @@ function buildPreviewArgs(cfg: DashboardConfig): string { if (!cfg.contBatching) parts.push("--no-cont-batching"); if (cfg.embeddings) parts.push("--embeddings"); if (cfg.metrics) parts.push("--metrics"); + if (cfg.perf) parts.push("--perf"); if (cfg.ropeFreqScale !== 1.0) parts.push(`--rope-freq-scale ${cfg.ropeFreqScale}`); if (cfg.ropeScale !== 1.0) diff --git a/dashboard/src/lib/docker.ts b/dashboard/src/lib/docker.ts index 0c0d0df..0e9d35c 100644 --- a/dashboard/src/lib/docker.ts +++ b/dashboard/src/lib/docker.ts @@ -240,6 +240,9 @@ export interface DashboardConfig { embeddings: boolean; /** Enable /metrics (Prometheus) endpoint */ metrics: boolean; + /** Enable internal libllama performance timings in /slots responses. + * Without this, /slots doesn't return per-slot timings (TPS, TTFT, etc.) */ + perf: boolean; /** RoPE frequency scale (NTK-aware, 1.0 = default) */ ropeFreqScale: number; /** RoPE context scaling factor (1.0 = default) */ @@ -315,6 +318,7 @@ export const DEFAULT_CONFIG: DashboardConfig = { contBatching: true, embeddings: false, metrics: false, + perf: true, ropeFreqScale: 1.0, ropeScale: 1.0, yarnExtFactor: 1.0, @@ -493,6 +497,12 @@ export function parseLlamaExtraArgs( case "--metrics": cfg.metrics = true; break; + case "--perf": + cfg.perf = true; + break; + case "--no-perf": + cfg.perf = false; + break; case "--rope-freq-scale": cfg.ropeFreqScale = Number(next) || cfg.ropeFreqScale; i++; @@ -646,6 +656,7 @@ export function buildLlamaExtraArgs(cfg: DashboardConfig): string { if (!cfg.contBatching) parts.push("--no-cont-batching"); if (cfg.embeddings) parts.push("--embeddings"); if (cfg.metrics) parts.push("--metrics"); + if (cfg.perf) parts.push("--perf"); // RoPE / YaRN if (cfg.ropeFreqScale !== 1.0) parts.push(`--rope-freq-scale ${cfg.ropeFreqScale}`); diff --git a/dashboard/src/lib/version.ts b/dashboard/src/lib/version.ts index ad1c077..ebbb474 100644 --- a/dashboard/src/lib/version.ts +++ b/dashboard/src/lib/version.ts @@ -4,7 +4,7 @@ * Displayed in the footer and available via /api/debug so the user can * verify the update actually took effect. */ -export const DASHBOARD_VERSION = "0.8.0"; +export const DASHBOARD_VERSION = "0.8.1"; /** * Build timestamp — set at build time by Next.js.