From 9cab1e77a805ef92d59376f0964847a4e3929445 Mon Sep 17 00:00:00 2001
From: Wenyao Gao <105094497+edwingao28@users.noreply.github.com>
Date: Thu, 3 Dec 2026 04:09:02 +0000
Subject: [PATCH 1/3] feat(powerx): add a Sizing to measured power panel under
the headroom table
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Power draw shown as % of TDP gains a panel that sizes a gigawatt of GPU
power at each line's measured P90 draw plus headroom against sizing at the
TDP rating. Bars show the gain per GPU line with the GPU counts; a curve
shows how headroom erodes the gain for the picked GPU, with the rating as a
dashed line and the break-even headroom (TDP / P90 - 1) as an open dot.
Read at (i_szat, default 150 tok/s/user), headroom (i_szhr, default 10%)
and the picked line (i_szgpu) live in the share link. Overlay lines are
drawn in their run color. The inference view serves the same rows with
sizing=true (sizingAt, sizingHeadroom).
中文:在 PowerX 功耗按 TDP 占比视图的余量表下方新增“按实测功耗规划”面板:
按各曲线实测 P90 功耗加余量规划每 GW GPU 功耗可容纳的 GPU 数,并与按 TDP
额定值规划对比。横条显示各 GPU 曲线的增幅与 GPU 数;曲线显示所选 GPU 的
增幅如何随余量下降,额定值为虚线,盈亏平衡余量(TDP / P90 - 1)为空心点。
读取点(i_szat,默认 150 tok/s/user)、余量(i_szhr,默认 10%)与所选曲线
(i_szgpu)写入分享链接;非官方运行以其颜色绘制。inference 视图通过
sizing=true(sizingAt、sizingHeadroom)返回相同数据。
---
docs/powerx-permanent-view.md | 8 +
docs/state-ownership.md | 5 +
.../app/api/v1/views/inference/route.test.ts | 60 ++
.../src/app/api/v1/views/inference/route.ts | 44 +-
.../inference/powerx/PowerXGwSizing.test.ts | 49 ++
.../inference/powerx/PowerXGwSizing.tsx | 533 ++++++++++++++++++
.../inference/powerx/PowerXHeadroomTable.tsx | 2 +
packages/app/src/lib/api/api-route-catalog.ts | 4 +-
packages/app/src/lib/power/gw-sizing.test.ts | 106 ++++
packages/app/src/lib/power/gw-sizing.ts | 144 +++++
packages/app/src/lib/power/headroom.ts | 11 +-
packages/app/src/lib/routing/url-state.ts | 6 +
.../app/src/lib/views-api/docs/inference.ts | 66 ++-
packages/app/src/lib/views-api/registry.ts | 3 +
.../skills/inferencex-api/integrity.json | 2 +-
.../references/dashboard-views.md | 20 +-
16 files changed, 1048 insertions(+), 15 deletions(-)
create mode 100644 packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
create mode 100644 packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
create mode 100644 packages/app/src/lib/power/gw-sizing.test.ts
create mode 100644 packages/app/src/lib/power/gw-sizing.ts
diff --git a/docs/powerx-permanent-view.md b/docs/powerx-permanent-view.md
index 6b6d9a460..b8218b27c 100644
--- a/docs/powerx-permanent-view.md
+++ b/docs/powerx-permanent-view.md
@@ -226,6 +226,14 @@ link still opens that view for locked visitors.
in the label), with a CSV button (`source` column: official / unofficial) and one example
sentence read from the official points. The views API serves the official rows with
`headroom=true`.
+- **Sizing to measured power** (under the headroom table): `PowerXGwSizing` reads each line's
+ P90 W at one interactivity (`i_szat`, default 150 tok/s/user, presets 25 / 50 / 100 / 150 / 300) through `lib/power/gw-sizing.ts` (`buildHeadroomRows` at that one interactivity, so the
+ reading matches the table) and sizes a gigawatt of GPU power at P90 × (1 + headroom)
+ (`i_szhr`, default 10 %, slider 0 to 60 %) against 1 GW ÷ TDP. Left: one bar per line with
+ the gain and the GPU counts, overlay lines in their run color. Right: the picked line's
+ GPUs per GW over headroom (`i_szgpu`, click a bar; GB300 NVL72 by default), the rating as a
+ dashed line and the break-even headroom TDP ÷ P90 − 1 as an open dot. The views API serves
+ the official rows with `sizing=true` (`sizingAt`, `sizingHeadroom`).
- **Load swings** (Over Time, PowerX only): `PowerLoadSwings` computes
`lib/power/load-swing-stats.ts` per visible trace (peak, min, idle floor = P5 before the
window, window mean, P5/P95, max Δ1s / Δ5s in W and % TDP, ramp up/down W/s, volatility =
diff --git a/docs/state-ownership.md b/docs/state-ownership.md
index ca385ad44..f9ae86265 100644
--- a/docs/state-ownership.md
+++ b/docs/state-ownership.md
@@ -336,6 +336,11 @@ tok/s/user), owned by `PowerXSurfaceProvider` context: read once on mount, writt
`writeUrlParams` on an explicit pick, and moving it clears every pin. See
[PowerX Permanent View](./powerx-permanent-view.md#powerx-layout).
+`i_szat`, `i_szhr` and `i_szgpu` (inference scope, default `''`: 150 tok/s/user, 10 %
+headroom, GB300 NVL72 or the top row) are the Sizing to measured power panel's Read at,
+headroom and picked line, owned by `PowerXGwSizing` component state: read once on mount and
+written through `writeUrlParams` on each change.
+
### Staged-result chart links
The staging workflow reads the successfully ingested run's model, workload,
diff --git a/packages/app/src/app/api/v1/views/inference/route.test.ts b/packages/app/src/app/api/v1/views/inference/route.test.ts
index e6e68a7c7..4e291c535 100644
--- a/packages/app/src/app/api/v1/views/inference/route.test.ts
+++ b/packages/app/src/app/api/v1/views/inference/route.test.ts
@@ -1002,6 +1002,66 @@ describe('GET /api/v1/views/inference', () => {
expect(csv.status).toBe(400);
});
+ it('sizes a gigawatt to measured P90 power plus headroom and omits lines off the range', async () => {
+ // B200 covers 150 tok/s/user at 720 W P90; H200 stops at 120.
+ const sweep = [
+ { hardware: 'b200', conc: 64, interactivity: 60, tput: 2400, avg: 800, p90: 880 },
+ { hardware: 'b200', conc: 16, interactivity: 150, tput: 1200, avg: 650, p90: 720 },
+ { hardware: 'b200', conc: 4, interactivity: 320, tput: 500, avg: 500, p90: 560 },
+ { hardware: 'h200', conc: 32, interactivity: 40, tput: 1500, avg: 600, p90: 650 },
+ { hardware: 'h200', conc: 8, interactivity: 120, tput: 700, avg: 450, p90: 520 },
+ ];
+ mockGetLatestBenchmarks.mockResolvedValue(
+ sweep.map(({ hardware, conc, interactivity, tput, avg, p90 }, index) =>
+ makeRow({
+ id: 500 + index,
+ hardware,
+ conc,
+ metrics: {
+ ...makeRow().metrics,
+ median_intvty: interactivity,
+ tput_per_gpu: tput,
+ avg_power_w: avg,
+ p90_power_w: p90,
+ avg_total_gpu_power_w: avg * 8,
+ power_valid: 1,
+ power_metric_schema_version: 2,
+ },
+ }),
+ ),
+ );
+ const res = await GET(
+ request(
+ '/api/v1/views/inference?model=DeepSeek-R1-0528&metric=measuredPowerPercentTdp&sizing=true&sizingHeadroom=25',
+ ),
+ );
+ expect(res.status).toBe(200);
+ const body = await res.json();
+ expect(body.params).toMatchObject({ sizing: true, sizingAt: 150, sizingHeadroom: 25 });
+ expect(body.sizing).toMatchObject({ interactivity: 150, headroomPercent: 25 });
+ expect(body.sizing.rows).toHaveLength(1);
+ const [b200] = body.sizing.rows;
+ expect(b200).toMatchObject({ hwKey: 'b200_trt', tdpWatts: 1000, gpusPerGwAtRating: 1e6 });
+ expect(b200.p90Watts).toBeCloseTo(720, 6);
+ expect(b200.gpusPerGw).toBeCloseTo(1e9 / (720 * 1.25), 3);
+ expect(b200.gainPercent).toBeCloseTo((1000 / 900 - 1) * 100, 6);
+ expect(b200.breakEvenHeadroomPercent).toBeCloseTo((1000 / 720 - 1) * 100, 6);
+ const offResponse = await GET(
+ request('/api/v1/views/inference?model=DeepSeek-R1-0528&metric=tpPerGpu'),
+ );
+ const off = await offResponse.json();
+ expect(off).not.toHaveProperty('sizing');
+ expect(off.params).toMatchObject({ sizing: false, sizingAt: null, sizingHeadroom: null });
+ const csv = await GET(
+ request('/api/v1/views/inference?model=DeepSeek-R1-0528&sizing=true&format=csv'),
+ );
+ expect(csv.status).toBe(400);
+ const bad = await GET(
+ request('/api/v1/views/inference?model=DeepSeek-R1-0528&sizing=true&sizingHeadroom=-5'),
+ );
+ expect(bad.status).toBe(400);
+ });
+
it('canonicalizes list params and applies quick filters', async () => {
const res = await GET(
request(
diff --git a/packages/app/src/app/api/v1/views/inference/route.ts b/packages/app/src/app/api/v1/views/inference/route.ts
index 98f3ac0d3..2e6e36b46 100644
--- a/packages/app/src/app/api/v1/views/inference/route.ts
+++ b/packages/app/src/app/api/v1/views/inference/route.ts
@@ -44,6 +44,11 @@ import {
PERCENTILE_OPTIONS,
Scenario,
} from '@/lib/catalog/data-mappings';
+import {
+ buildSizingRows,
+ SIZING_DEFAULT_HEADROOM,
+ SIZING_DEFAULT_INTERACTIVITY,
+} from '@/lib/power/gw-sizing';
import { buildHeadroomRows, HEADROOM_INTERACTIVITIES } from '@/lib/power/headroom';
import { SYSTEM_POWER_MODEL_REVISION } from '@/lib/power/system-power-categories';
import { ViewsApiParamError, runViewsRoute } from '@/lib/views-api/errors';
@@ -396,6 +401,19 @@ export function GET(request: NextRequest) {
const powerFit = parseBoolParam(search.get('powerFit'), 'powerFit', false);
const powerBreakdown = parseBoolParam(search.get('powerBreakdown'), 'powerBreakdown', false);
const headroom = parseBoolParam(search.get('headroom'), 'headroom', false);
+ const sizing = parseBoolParam(search.get('sizing'), 'sizing', false);
+ const sizingAt = parseNumberParam(
+ search.get('sizingAt'),
+ 'sizingAt',
+ SIZING_DEFAULT_INTERACTIVITY,
+ { min: Number.MIN_VALUE },
+ );
+ const sizingHeadroom = parseNumberParam(
+ search.get('sizingHeadroom'),
+ 'sizingHeadroom',
+ SIZING_DEFAULT_HEADROOM,
+ { min: 0, max: 200 },
+ );
const requestedServiceBaseline = search.get('serviceBaseline');
const requestedServiceComparator = search.get('serviceComparator');
const serviceTarget = search.has('serviceTarget')
@@ -403,10 +421,13 @@ export function GET(request: NextRequest) {
: null;
if (serviceTarget !== null && serviceTarget <= 0)
throw new ViewsApiParamError('serviceTarget', 'serviceTarget must be positive');
- if (format === 'csv' && (serviceCompare || roleShare || powerFit || powerBreakdown || headroom))
+ if (
+ format === 'csv' &&
+ (serviceCompare || roleShare || powerFit || powerBreakdown || headroom || sizing)
+ )
throw new ViewsApiParamError(
'format',
- 'Equal-service, role-share, power-fit, power-breakdown and headroom panels require format=json',
+ 'Equal-service, role-share, power-fit, power-breakdown, headroom and sizing panels require format=json',
);
const tcoBasis = parseTcoBasisParam(search.get('tcoBasis'));
const chipBasis = parseChipBasisParam(search.get('chipBasis'));
@@ -656,6 +677,21 @@ export function GET(request: NextRequest) {
}
: {};
+ // PowerX sizing to measured power: GPUs per GW at P90 × (1 + headroom) against the rating.
+ const sizingPanel = sizing
+ ? {
+ sizing: {
+ interactivity: sizingAt,
+ interactivityField: breakdownInteractivity.field,
+ headroomPercent: sizingHeadroom,
+ rows: buildSizingRows(observedPoints, {
+ interactivity: sizingAt,
+ headroomPercent: sizingHeadroom,
+ }),
+ },
+ }
+ : {};
+
const resolvedParams = {
model: displayName,
engine: drafter,
@@ -696,6 +732,9 @@ export function GET(request: NextRequest) {
powerFit,
powerBreakdown,
headroom,
+ sizing,
+ sizingAt: sizing ? sizingAt : null,
+ sizingHeadroom: sizing ? sizingHeadroom : null,
};
if (format === 'csv') {
@@ -732,6 +771,7 @@ export function GET(request: NextRequest) {
...fitPanel,
...breakdownPanel,
...headroomPanel,
+ ...sizingPanel,
});
});
}
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
new file mode 100644
index 000000000..95a3238fb
--- /dev/null
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
@@ -0,0 +1,49 @@
+import { describe, expect, it } from 'bun:test';
+
+import type { SizingRow } from '@/lib/power/gw-sizing';
+
+import {
+ SIZING_STRINGS,
+ sizingBarAxis,
+ sizingCurveMarks,
+ sizingCurveSpan,
+ sizingHeadline,
+} from './PowerXGwSizing';
+
+const row = (key: string, gainPercent: number, runIndex?: number) =>
+ ({ key, gainPercent, ...(runIndex === undefined ? {} : { runIndex }) }) as SizingRow;
+
+describe('PowerXGwSizing helpers', () => {
+ it('keeps the bar axis at 0 to +50% and widens it for larger gains or losses', () => {
+ expect(sizingBarAxis([row('a', 36), row('b', 9)])).toEqual({
+ min: 0,
+ max: 50,
+ ticks: [0, 10, 20, 30, 40, 50],
+ });
+ expect(sizingBarAxis([row('a', 72), row('b', -5)])).toMatchObject({ min: -10, max: 80 });
+ expect(sizingBarAxis([row('a', 120)]).ticks).toEqual([0, 20, 40, 60, 80, 100, 120]);
+ });
+
+ it('runs the curve to 60% headroom, or past a later break-even point', () => {
+ expect(sizingCurveSpan(43)).toBe(60);
+ expect(sizingCurveSpan(85)).toBe(100);
+ expect(sizingCurveSpan(900)).toBe(200);
+ });
+
+ it('marks 0 / 10 / 25 / 50 and the chosen headroom without stacking labels', () => {
+ expect(sizingCurveMarks(10, 60)).toEqual([0, 10, 25, 50]);
+ expect(sizingCurveMarks(35, 60)).toEqual([0, 10, 25, 35, 50]);
+ expect(sizingCurveMarks(23, 60)).toEqual([0, 10, 23, 50]);
+ });
+
+ it('states the gain range of the official rows', () => {
+ const t = SIZING_STRINGS.en;
+ expect(sizingHeadline([row('a', 36), row('b', 9), row('c', 80, 0)], t)).toBe(
+ 'Sizing to measured power fits 9% to 36% more GPUs into a gigawatt, until headroom eats the gain',
+ );
+ expect(sizingHeadline([row('a', 12)], t)).toContain('fits 12% more GPUs');
+ expect(sizingHeadline([row('a', 20), row('b', -5)], t)).toBe(
+ 'Sizing to measured power changes GPUs per gigawatt by \u22125% to +20% against the rating',
+ );
+ });
+});
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
new file mode 100644
index 000000000..93b097166
--- /dev/null
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
@@ -0,0 +1,533 @@
+'use client';
+
+import { scaleLinear } from 'd3';
+import { useEffect, useMemo, useRef, useState } from 'react';
+
+import type { InferenceData } from '@/components/inference/types';
+import { RangeField } from '@/components/ui/range-field';
+import { SegmentedToggle } from '@/components/ui/segmented-toggle';
+import { track } from '@/lib/analytics/analytics';
+import { overlayRunColor } from '@/lib/charts/overlay-run-style';
+import { useLocale } from '@/lib/i18n/use-locale';
+import {
+ buildSizingRows,
+ defaultSizingRow,
+ formatGain,
+ formatGpuCount,
+ parseSizingAt,
+ parseSizingHeadroom,
+ SIZING_CURVE_MARKS,
+ SIZING_HEADROOM_MAX,
+ SIZING_INTERACTIVITY_PRESETS,
+ sizedGpusPerGw,
+ sizingCurve,
+ type SizingRow,
+} from '@/lib/power/gw-sizing';
+import { readUrlParams, writeUrlParams } from '@/lib/routing/url-state';
+import { useUnofficialRun } from '@/providers/unofficial-run-provider';
+
+import { PowerBasisPill } from './PowerBasisPill';
+
+export const SIZING_STRINGS = {
+ en: {
+ headline: (lo: string, hi: string) =>
+ lo === hi
+ ? `Sizing to measured power fits ${hi} more GPUs into a gigawatt, until headroom eats the gain`
+ : `Sizing to measured power fits ${lo} to ${hi} more GPUs into a gigawatt, until headroom eats the gain`,
+ headlineMixed: (lo: string, hi: string) =>
+ `Sizing to measured power changes GPUs per gigawatt by ${lo} to ${hi} against the rating`,
+ title: 'Sizing to Measured Power',
+ subtitle: (at: number, context: string) =>
+ `Illustrative scenario: each GPU sized at its measured P90 power at ${at} tok/s/user${context ? `, ${context}` : ''}, against sizing at the GPU rating.`,
+ readAt: 'Read at (tok/s/user)',
+ headroom: 'Headroom above P90 (%)',
+ barsTitle: (h: number) => `Sized at measured P90 power + ${h}% headroom`,
+ p90Share: (pct: number) => `P90 = ${pct}% of rating`,
+ barsAxis: 'More GPUs per GW than sizing at the rating',
+ curveTitle: (label: string) => `${label}: the headroom decides the gain`,
+ curveY: (label: string) => `${label} GPUs per GW of GPU power`,
+ curveX: 'Headroom above measured P90 GPU power',
+ noHeadroom: 'No headroom',
+ atHeadroom: (h: number) => `${h}% headroom`,
+ rating: (watts: string, gpus: string) => `Sized at the ${watts} W rating: ${gpus}`,
+ ratingShort: (gpus: string) => `Rating: ${gpus}`,
+ breakEven: (h: number) => `Break-even at ${h}% headroom`,
+ pick: 'Click a bar to follow that GPU on the right.',
+ empty: (at: number) =>
+ `No GPU line in this view was measured at ${at} tok/s/user. Pick another Read at.`,
+ row: (label: string, pct: number, gain: string, from: string, to: string) =>
+ `${label}: P90 ${pct}% of rating, ${gain} GPUs per GW (${from} to ${to}).`,
+ footer: (at: number) =>
+ `Source: SemiAnalysis InferenceX PowerX. P90 = 90th percentile of measured GPU power per GPU across the deployment over the serving window, read at ${at} tok/s/user along each GPU's optimal points. GPU power only; servers, network and cooling excluded. Not a recommendation to oversubscribe without power capping and peak management.`,
+ },
+ zh: {
+ headline: (lo: string, hi: string) =>
+ lo === hi
+ ? `按实测功耗规划,每 GW 可多容纳 ${hi} 的 GPU,直至余量抵消增益`
+ : `按实测功耗规划,每 GW 可多容纳 ${lo} 至 ${hi} 的 GPU,直至余量抵消增益`,
+ headlineMixed: (lo: string, hi: string) =>
+ `按实测功耗规划,每 GW 的 GPU 数相对额定值变化 ${lo} 至 ${hi}`,
+ title: '按实测功耗规划',
+ subtitle: (at: number, context: string) =>
+ `示意场景:每个 GPU 按其在 ${at} tok/s/user 下的实测 P90 功耗规划${context ? `(${context})` : ''},对比按 GPU 额定值规划。`,
+ readAt: '读取点(tok/s/user)',
+ headroom: 'P90 之上余量(%)',
+ barsTitle: (h: number) => `按实测 P90 功耗 + ${h}% 余量规划`,
+ p90Share: (pct: number) => `P90 = 额定值的 ${pct}%`,
+ barsAxis: '相对按额定值规划,每 GW 多容纳的 GPU',
+ curveTitle: (label: string) => `${label}:余量决定增益`,
+ curveY: (label: string) => `每 GW GPU 功耗可容纳的 ${label} 数`,
+ curveX: '实测 P90 GPU 功耗之上的余量',
+ noHeadroom: '无余量',
+ atHeadroom: (h: number) => `${h}% 余量`,
+ rating: (watts: string, gpus: string) => `按 ${watts} W 额定值规划:${gpus}`,
+ ratingShort: (gpus: string) => `额定值:${gpus}`,
+ breakEven: (h: number) => `${h}% 余量时持平`,
+ pick: '点击横条,在右侧查看该 GPU。',
+ empty: (at: number) =>
+ `当前视图中没有 GPU 曲线在 ${at} tok/s/user 处有实测数据,请换一个读取点。`,
+ row: (label: string, pct: number, gain: string, from: string, to: string) =>
+ `${label}:P90 为额定值的 ${pct}%,每 GW GPU 数 ${gain}(${from} 至 ${to})。`,
+ footer: (at: number) =>
+ `来源:SemiAnalysis InferenceX PowerX。P90 = 部署在服务窗口内每 GPU 实测功耗的第 90 百分位,沿各 GPU 最优点在 ${at} tok/s/user 处读取。仅 GPU 功耗,不含服务器、网络与散热。不构成在无功率封顶与峰值管理时超额配置的建议。`,
+ },
+} as const;
+
+type Strings = (typeof SIZING_STRINGS)[keyof typeof SIZING_STRINGS];
+
+/** The bar axis: 0 to +50% at least, widened in steps of 10 to the largest gain or loss. */
+export function sizingBarAxis(rows: readonly Pick[]): {
+ min: number;
+ max: number;
+ ticks: number[];
+} {
+ const gains = rows.map((row) => row.gainPercent);
+ const max = Math.max(50, Math.ceil(Math.max(0, ...gains) / 10) * 10);
+ const min = Math.min(0, Math.floor(Math.min(0, ...gains) / 10) * 10);
+ const step = max - min > 80 ? 20 : 10;
+ const ticks: number[] = [];
+ for (let tick = Math.ceil(min / step) * step; tick <= max; tick += step) ticks.push(tick);
+ return { min, max, ticks };
+}
+
+/** The curve's headroom span: 0 to 60%, or past the break-even point when it lies beyond. */
+export function sizingCurveSpan(breakEvenHeadroomPercent: number): number {
+ if (breakEvenHeadroomPercent < SIZING_HEADROOM_MAX - 5) return SIZING_HEADROOM_MAX;
+ return Math.min(200, Math.ceil(breakEvenHeadroomPercent / 10) * 10 + 10);
+}
+
+/**
+ * Headroom values marked on the curve: 0 / 10 / 25 / 50 and the chosen headroom, inside the
+ * span. A standard mark within 4 points of the chosen one gives way so labels do not stack.
+ */
+export function sizingCurveMarks(headroom: number, span: number): number[] {
+ const marks: number[] = SIZING_CURVE_MARKS.filter(
+ (mark) => mark <= span && (mark === headroom || Math.abs(mark - headroom) >= 4),
+ );
+ if (!marks.includes(headroom)) marks.push(headroom);
+ return marks.toSorted((a, b) => a - b);
+}
+
+/** The headline's gain range over the official rows (all rows when only overlays remain). */
+export function sizingHeadline(rows: readonly SizingRow[], t: Strings): string {
+ const official = rows.filter((row) => row.runIndex === undefined);
+ const gains = (official.length > 0 ? official : rows).map((row) => row.gainPercent);
+ const lo = Math.min(...gains);
+ const hi = Math.max(...gains);
+ if (Math.round(lo) <= 0) return t.headlineMixed(formatGain(lo), formatGain(hi));
+ return t.headline(formatGain(lo).slice(1), formatGain(hi).slice(1));
+}
+
+function useWidth() {
+ const ref = useRef(null);
+ const [width, setWidth] = useState(0);
+ useEffect(() => {
+ const node = ref.current;
+ if (!node) return;
+ const observer = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));
+ observer.observe(node);
+ setWidth(node.getBoundingClientRect().width);
+ return () => observer.disconnect();
+ }, []);
+ return [ref, width] as const;
+}
+
+const rowColor = (row: SizingRow) =>
+ row.runIndex === undefined ? undefined : overlayRunColor(row.runIndex);
+
+function SizingBars({
+ rows,
+ selectedKey,
+ onSelect,
+ t,
+}: {
+ rows: readonly SizingRow[];
+ selectedKey: string | undefined;
+ onSelect: (row: SizingRow) => void;
+ t: Strings;
+}) {
+ const axis = sizingBarAxis(rows);
+ // The right gutter keeps the gain and the GPU counts inside the card.
+ const at = (value: number) =>
+ `calc((100% - 6.5rem) * ${(value - axis.min) / (axis.max - axis.min)})`;
+ const grid = axis.ticks.map((tick) => (
+
+ ));
+ return (
+
+ {rows.map((row) => {
+ const selected = row.key === selectedKey;
+ const color = rowColor(row);
+ const gain = formatGain(row.gainPercent);
+ const from = formatGpuCount(row.gpusPerGwAtRating);
+ const to = formatGpuCount(row.gpusPerGw);
+ const start = Math.min(0, row.gainPercent);
+ const end = Math.max(0, row.gainPercent);
+ return (
+
+ );
+ })}
+
+
+ {axis.ticks.map((tick) => (
+
+ {tick === 0 ? '0' : formatGain(tick)}
+
+ ))}
+
+
+
{t.barsAxis}
+
+ );
+}
+
+const MARGIN = { top: 18, right: 18, bottom: 30, left: 50 };
+
+function SizingCurve({ row, headroom, t }: { row: SizingRow; headroom: number; t: Strings }) {
+ const [ref, width] = useWidth();
+ const height = width < 420 ? 250 : 330;
+ const span = sizingCurveSpan(row.breakEvenHeadroomPercent);
+ const curve = sizingCurve(row.p90Watts, span, span);
+ const rating = row.gpusPerGwAtRating;
+ const lo = Math.min(rating, curve.at(-1)?.gpusPerGw ?? rating) * 0.9;
+ const hi = Math.max(rating, curve[0].gpusPerGw) * 1.06;
+ const plotW = Math.max(0, width - MARGIN.left - MARGIN.right);
+ const plotH = height - MARGIN.top - MARGIN.bottom;
+ const x = scaleLinear().domain([0, span]).range([0, plotW]);
+ const y = scaleLinear().domain([lo, hi]).nice(5).range([plotH, 0]);
+ const color = rowColor(row) ?? 'var(--color-blue-500)';
+ const narrow = plotW < 360;
+ const path = curve
+ .map((p, i) => `${i === 0 ? 'M' : 'L'}${x(p.headroomPercent)},${y(p.gpusPerGw)}`)
+ .join('');
+ const breakEven = row.breakEvenHeadroomPercent;
+ const gainEnd = Math.min(Math.max(0, breakEven), span);
+ const area =
+ gainEnd > 0
+ ? `${curve
+ .filter((p) => p.headroomPercent <= gainEnd)
+ .map((p, i) => `${i === 0 ? 'M' : 'L'}${x(p.headroomPercent)},${y(p.gpusPerGw)}`)
+ .join(
+ '',
+ )}L${x(gainEnd)},${y(sizedGpusPerGw(row.p90Watts, gainEnd))}L${x(gainEnd)},${y(rating)}L${x(0)},${y(rating)}Z`
+ : '';
+ const marks = sizingCurveMarks(headroom, span);
+ const yRating = y(rating);
+ const label = row.label;
+ return (
+
+
{t.curveY(label)}
+
+ {width > 0 && (
+
+ )}
+
+
{t.curveX}
+
+ );
+}
+
+/**
+ * Under the headroom table on Power draw shown as % of TDP: how many more GPUs a gigawatt of
+ * GPU power holds when each GPU is budgeted at its measured P90 draw plus headroom instead of
+ * its rating (bars), and how the headroom erodes the gain for one GPU (curve).
+ */
+export function PowerXGwSizing({
+ points,
+ overlayPoints,
+ contextLabel,
+}: {
+ points: readonly InferenceData[];
+ overlayPoints?: readonly InferenceData[];
+ contextLabel?: string;
+}) {
+ const locale = useLocale();
+ const t = SIZING_STRINGS[locale];
+ const { runIndexByUrl, unofficialRunInfos } = useUnofficialRun();
+ const [at, setAt] = useState(() => parseSizingAt(readUrlParams().i_szat));
+ const [headroom, setHeadroom] = useState(() => parseSizingHeadroom(readUrlParams().i_szhr));
+ const [picked, setPicked] = useState(() => readUrlParams().i_szgpu || undefined);
+ const rows = useMemo(
+ () =>
+ buildSizingRows(
+ points,
+ { interactivity: at, headroomPercent: headroom },
+ overlayPoints && overlayPoints.length > 0
+ ? { points: overlayPoints, runIndexByUrl, runInfos: unofficialRunInfos }
+ : undefined,
+ ),
+ [points, overlayPoints, runIndexByUrl, unofficialRunInfos, at, headroom],
+ );
+ const selected = defaultSizingRow(rows, picked);
+ const changeAt = (next: number) => {
+ setAt(next);
+ writeUrlParams({ i_szat: String(next) });
+ track('inference_powerx_sizing_changed', { control: 'read_at', at: next });
+ };
+ const select = (row: SizingRow) => {
+ setPicked(row.key);
+ writeUrlParams({ i_szgpu: row.key });
+ track('inference_powerx_sizing_changed', { control: 'gpu', gpu: row.hwKey });
+ };
+ return (
+
+
+
+ {rows.length > 0 ? sizingHeadline(rows, t) : t.title}
+
+
+
+ {t.subtitle(at, contextLabel ?? '')}
+
+
+
+
+
{t.readAt}
+
+ value={String(at)}
+ ariaLabel={t.readAt}
+ role="group"
+ testId="powerx-gw-sizing-at"
+ buttonClassName="tabular-nums"
+ onValueChange={(next) => changeAt(Number(next))}
+ options={SIZING_INTERACTIVITY_PRESETS.map((option) => ({
+ value: String(option),
+ label: String(option),
+ }))}
+ />
+
+
+
{t.headroom}
+
{
+ setHeadroom(next);
+ writeUrlParams({ i_szhr: String(next) });
+ }}
+ onSliderCommit={() =>
+ track('inference_powerx_sizing_changed', { control: 'headroom', headroom })
+ }
+ input={{
+ value: String(headroom),
+ max: SIZING_HEADROOM_MAX,
+ onChange: (event) => {
+ const next = parseSizingHeadroom(event.target.value);
+ setHeadroom(next);
+ writeUrlParams({ i_szhr: String(next) });
+ },
+ className: 'tabular-nums',
+ 'data-testid': 'powerx-gw-sizing-headroom-input',
+ }}
+ />
+
+
+ {rows.length === 0 || !selected ? (
+ {t.empty(at)}
+ ) : (
+
+
+
+
{t.barsTitle(headroom)}
+
{t.pick}
+
+
+
+
+
{t.curveTitle(selected.label)}
+
+
+
+ )}
+ {t.footer(at)}
+
+ );
+}
diff --git a/packages/app/src/components/inference/powerx/PowerXHeadroomTable.tsx b/packages/app/src/components/inference/powerx/PowerXHeadroomTable.tsx
index 37c6182e0..986618add 100644
--- a/packages/app/src/components/inference/powerx/PowerXHeadroomTable.tsx
+++ b/packages/app/src/components/inference/powerx/PowerXHeadroomTable.tsx
@@ -21,6 +21,7 @@ import {
import { useUnofficialRun } from '@/providers/unofficial-run-provider';
import { PowerBasisPill } from './PowerBasisPill';
+import { PowerXGwSizing } from './PowerXGwSizing';
import { PowerXRatingRange } from './PowerXRatingRange';
const STRINGS = {
@@ -188,6 +189,7 @@ export function PowerXHeadroomTable({
{t.key} {t.note}
+
>
);
}
diff --git a/packages/app/src/lib/api/api-route-catalog.ts b/packages/app/src/lib/api/api-route-catalog.ts
index c131989a0..ac059b11e 100644
--- a/packages/app/src/lib/api/api-route-catalog.ts
+++ b/packages/app/src/lib/api/api-route-catalog.ts
@@ -155,7 +155,7 @@ export const apiRouteCatalog = [
method: 'GET',
classification: 'published-read',
operationId: 'get-inference-view',
- sourceSha256: '717c96ce9efd0483770dfbcc2f950131f6bd526a5f5b4e36b9a5f18d79aa34f7',
+ sourceSha256: '8a56fdf1a49223a16dc85d057e7edda0e30f289518118992c2d6ae0ade563606',
},
{
source: 'src/app/api/v1/views/options/route.ts',
@@ -1879,7 +1879,7 @@ export const apiContractSourceDigests = [
{
source: 'src/lib/views-api/registry.ts',
- sourceSha256: '39a63c18d5d56266c2d7dffe6a81d55d8f90b432f247d0c873edfa9c40184729',
+ sourceSha256: '54497c3dea2bc16434db40c029ff2abc8f91cfec92cb454e71e2db6c3c80123c',
reviewArea: {
en: 'Dashboard read-only selector and calculation parity.',
zh: '仪表板只读接口的选择项与计算一致性。',
diff --git a/packages/app/src/lib/power/gw-sizing.test.ts b/packages/app/src/lib/power/gw-sizing.test.ts
new file mode 100644
index 000000000..47d222e81
--- /dev/null
+++ b/packages/app/src/lib/power/gw-sizing.test.ts
@@ -0,0 +1,106 @@
+import { describe, expect, it } from 'bun:test';
+
+import type { InferenceData } from '@/components/inference/types';
+
+import {
+ buildSizingRows,
+ defaultSizingRow,
+ formatGain,
+ formatGpuCount,
+ gpusPerGw,
+ parseSizingAt,
+ parseSizingHeadroom,
+ sizedGpusPerGw,
+ sizingCurve,
+} from './gw-sizing';
+
+const metric = (y: number) => ({ y, roof: false });
+
+/** A frontier sweep on one chip: faster per-user serving draws less per GPU. */
+function sweep(hwKey: string, p90s: [number, number, number], xs = [50, 150, 300]) {
+ return xs.map(
+ (x, i) =>
+ ({
+ hwKey,
+ precision: 'fp4',
+ model: 'dsv4',
+ conc: 64 >> i,
+ x,
+ y: p90s[i] - 50,
+ date: '2026-11-01',
+ tpPerGpu: metric(3000 / (i + 1)),
+ measuredAvgPower: metric(p90s[i] - 50),
+ measuredP90Power: metric(p90s[i]),
+ }) as InferenceData,
+ );
+}
+
+describe('gw sizing math', () => {
+ it('matches the GB300 NVL72 figures at a P90 of 70% of its 1,400 W rating', () => {
+ const p90 = 0.7 * 1400;
+ expect(formatGpuCount(gpusPerGw(1400))).toBe('714K');
+ expect(formatGpuCount(sizedGpusPerGw(p90, 0))).toBe('1,020K');
+ expect(formatGpuCount(sizedGpusPerGw(p90, 10))).toBe('928K');
+ expect(formatGain((sizedGpusPerGw(p90, 10) / gpusPerGw(1400) - 1) * 100)).toBe('+30%');
+ expect(formatGain((sizedGpusPerGw(p90, 50) / gpusPerGw(1400) - 1) * 100)).toBe('\u22125%');
+ expect((1400 / p90 - 1) * 100).toBeCloseTo(42.86, 2);
+ });
+
+ it('formats signs and counts', () => {
+ expect(formatGain(0.4)).toBe('0%');
+ expect(formatGain(35.6)).toBe('+36%');
+ expect(formatGpuCount(1_090_909)).toBe('1,091K');
+ });
+
+ it('traces the curve from no headroom down past the rating', () => {
+ const curve = sizingCurve(980, 60, 6);
+ expect(curve).toHaveLength(7);
+ expect(curve[0]).toEqual({ headroomPercent: 0, gpusPerGw: 1e9 / 980 });
+ expect(curve.at(-1)?.headroomPercent).toBe(60);
+ const values = curve.map((point) => point.gpusPerGw);
+ expect(values).toEqual([...values].toSorted((a, b) => b - a));
+ });
+
+ it('parses the share-link params with defaults and limits', () => {
+ expect(parseSizingAt(undefined)).toBe(150);
+ expect(parseSizingAt('-3')).toBe(150);
+ expect(parseSizingAt('80')).toBe(80);
+ expect(parseSizingHeadroom('')).toBe(10);
+ expect(parseSizingHeadroom('99')).toBe(60);
+ expect(parseSizingHeadroom('-1')).toBe(0);
+ expect(parseSizingHeadroom('24.6')).toBe(25);
+ });
+});
+
+describe('buildSizingRows', () => {
+ it('reads P90 at the chosen interactivity, orders by gain and drops lines off the range', () => {
+ const points = [
+ ...sweep('b200_vllm', [950, 830, 700]),
+ ...sweep('mi355x_vllm', [1100, 940, 800]),
+ // Measured only past 150 tok/s/user.
+ ...sweep('h100_vllm', [650, 600, 550], [200, 250, 400]),
+ ];
+ const rows = buildSizingRows(points, { interactivity: 150, headroomPercent: 10 });
+ expect(rows.map((row) => row.hwKey)).toEqual(['mi355x_vllm', 'b200_vllm']);
+ const [mi355x, b200] = rows;
+ expect(mi355x.tdpWatts).toBe(1400);
+ expect(mi355x.p90Watts).toBeCloseTo(940, 6);
+ expect(mi355x.p90PercentTdp).toBeCloseTo((940 / 1400) * 100, 6);
+ expect(mi355x.gpusPerGw).toBeCloseTo(1e9 / (940 * 1.1), 3);
+ expect(mi355x.gainPercent).toBeCloseTo((1400 / (940 * 1.1) - 1) * 100, 6);
+ expect(mi355x.breakEvenHeadroomPercent).toBeCloseTo((1400 / 940 - 1) * 100, 6);
+ expect(b200.gainPercent).toBeLessThan(mi355x.gainPercent);
+ });
+
+ it('picks the share-link row, then GB300 NVL72, then the largest gain', () => {
+ const rows = [
+ { key: 'mi355x|fp4', hwKey: 'mi355x_vllm' },
+ { key: 'gb300|fp4', hwKey: 'gb300_dynamo-trt' },
+ { key: 'gb300|fp4|run0', hwKey: 'gb300_dynamo-trt', runIndex: 0 },
+ ];
+ expect(defaultSizingRow(rows, 'gb300|fp4|run0')?.key).toBe('gb300|fp4|run0');
+ expect(defaultSizingRow(rows, 'gone')?.key).toBe('gb300|fp4');
+ expect(defaultSizingRow(rows.slice(0, 1), undefined)?.key).toBe('mi355x|fp4');
+ expect(defaultSizingRow([], undefined)).toBeUndefined();
+ });
+});
diff --git a/packages/app/src/lib/power/gw-sizing.ts b/packages/app/src/lib/power/gw-sizing.ts
new file mode 100644
index 000000000..935009308
--- /dev/null
+++ b/packages/app/src/lib/power/gw-sizing.ts
@@ -0,0 +1,144 @@
+import type { InferenceData } from '@/components/inference/types';
+
+import { buildHeadroomRows } from './headroom';
+
+/**
+ * Sizing a power budget to measured GPU power (PowerX): how many GPUs a gigawatt of
+ * GPU power holds when each GPU is budgeted at its measured P90 draw plus a headroom
+ * margin, against budgeting each GPU at its TDP rating. GPU power only: servers,
+ * network and cooling are outside the budget.
+ *
+ * GPUs per GW at the rating = 1 GW ÷ TDP
+ * GPUs per GW at measured P90 = 1 GW ÷ (P90 × (1 + headroom))
+ * gain = TDP ÷ (P90 × (1 + headroom)) − 1
+ * break-even headroom = TDP ÷ P90 − 1
+ */
+export const GW_WATTS = 1e9;
+
+export const SIZING_DEFAULT_INTERACTIVITY = 150;
+export const SIZING_DEFAULT_HEADROOM = 10;
+/** Headroom percentages marked on the curve, besides the selected one. */
+export const SIZING_CURVE_MARKS = [0, 10, 25, 50] as const;
+
+export const gpusPerGw = (watts: number) => GW_WATTS / watts;
+
+export interface SizingRow {
+ key: string;
+ hwKey: string;
+ precision: string;
+ label: string;
+ runIndex?: number;
+ tdpWatts: number;
+ /** Measured P90 GPU W per GPU, read at the sizing interactivity. */
+ p90Watts: number;
+ /** P90 ÷ TDP, in percent. */
+ p90PercentTdp: number;
+ gpusPerGwAtRating: number;
+ /** At P90 × (1 + headroom). */
+ gpusPerGw: number;
+ /** More GPUs per GW than sizing at the rating, in percent (negative: fewer). */
+ gainPercent: number;
+ /** The headroom at which sizing to P90 holds as many GPUs as the rating. */
+ breakEvenHeadroomPercent: number;
+}
+
+/** GPUs per GW for a line sized at `p90Watts × (1 + headroomPercent / 100)`. */
+export function sizedGpusPerGw(p90Watts: number, headroomPercent: number): number {
+ return gpusPerGw(p90Watts * (1 + headroomPercent / 100));
+}
+
+/**
+ * One row per chip line covering `interactivity` (P90 read on the chart's own
+ * interpolation, never extrapolated), ordered by gain, largest first. Overlay rows
+ * follow the same order after the official ones.
+ */
+export function buildSizingRows(
+ points: readonly InferenceData[],
+ { interactivity, headroomPercent }: { interactivity: number; headroomPercent: number },
+ overlay?: Parameters[1],
+): SizingRow[] {
+ const rows = buildHeadroomRows(points, overlay, [interactivity]).flatMap((row) => {
+ const cell = row.cells[0];
+ if (!cell) return [];
+ const gpusPerGwAtRating = gpusPerGw(row.tdpWatts);
+ const sized = sizedGpusPerGw(cell.p90Watts, headroomPercent);
+ return [
+ {
+ key: row.key,
+ hwKey: row.hwKey,
+ precision: row.precision,
+ label: row.label,
+ ...(row.runIndex === undefined ? {} : { runIndex: row.runIndex }),
+ tdpWatts: row.tdpWatts,
+ p90Watts: cell.p90Watts,
+ p90PercentTdp: cell.percentTdpP90,
+ gpusPerGwAtRating,
+ gpusPerGw: sized,
+ gainPercent: (sized / gpusPerGwAtRating - 1) * 100,
+ breakEvenHeadroomPercent: (row.tdpWatts / cell.p90Watts - 1) * 100,
+ },
+ ];
+ });
+ return rows.toSorted(
+ (a, b) =>
+ Number(a.runIndex !== undefined) - Number(b.runIndex !== undefined) ||
+ (a.runIndex ?? 0) - (b.runIndex ?? 0) ||
+ b.gainPercent - a.gainPercent,
+ );
+}
+
+/** The Read at presets on the panel; `i_szat` may carry any positive value. */
+export const SIZING_INTERACTIVITY_PRESETS = [25, 50, 100, 150, 300] as const;
+/** The headroom slider span, in percent. */
+export const SIZING_HEADROOM_MAX = 60;
+
+/** `i_szat` → tok/s/user; missing, malformed or non-positive values read as the default. */
+export function parseSizingAt(value: string | undefined): number {
+ const parsed = Number(value);
+ return value && Number.isFinite(parsed) && parsed > 0 ? parsed : SIZING_DEFAULT_INTERACTIVITY;
+}
+
+/** `i_szhr` → whole percent inside the slider span; anything else reads as the default. */
+export function parseSizingHeadroom(value: string | undefined): number {
+ const parsed = Number(value);
+ if (!value || !Number.isFinite(parsed)) return SIZING_DEFAULT_HEADROOM;
+ return Math.min(SIZING_HEADROOM_MAX, Math.max(0, Math.round(parsed)));
+}
+
+/** GPU counts as the chart prints them: 714,286 → `714K`, 1,019,108 → `1,019K`. */
+export const formatGpuCount = (gpus: number) =>
+ `${Math.round(gpus / 1000).toLocaleString('en-US')}K`;
+
+/** A signed whole percent with a true minus sign: `+36%`, `0%`, `−5%`. */
+export function formatGain(percent: number): string {
+ const rounded = Math.round(percent);
+ if (rounded === 0) return '0%';
+ return rounded > 0 ? `+${rounded}%` : `\u2212${-rounded}%`;
+}
+
+/** GPUs per GW from 0 to `maxHeadroom` percent in `steps` even steps. */
+export function sizingCurve(
+ p90Watts: number,
+ maxHeadroom: number = SIZING_HEADROOM_MAX,
+ steps = 60,
+): { headroomPercent: number; gpusPerGw: number }[] {
+ return Array.from({ length: steps + 1 }, (_, i) => {
+ const headroomPercent = (maxHeadroom * i) / steps;
+ return { headroomPercent, gpusPerGw: sizedGpusPerGw(p90Watts, headroomPercent) };
+ });
+}
+
+/**
+ * The row the curve follows: the `i_szgpu` pick when it is on the panel, else GB300 NVL72
+ * (the rack the sizing question is usually asked about), else the largest gain.
+ */
+export function defaultSizingRow>(
+ rows: readonly T[],
+ picked: string | undefined,
+): T | undefined {
+ return (
+ rows.find((row) => row.key === picked) ??
+ rows.find((row) => row.runIndex === undefined && row.hwKey.startsWith('gb300')) ??
+ rows[0]
+ );
+}
diff --git a/packages/app/src/lib/power/headroom.ts b/packages/app/src/lib/power/headroom.ts
index 0bff54dda..14a82272f 100644
--- a/packages/app/src/lib/power/headroom.ts
+++ b/packages/app/src/lib/power/headroom.ts
@@ -46,7 +46,7 @@ interface HeadroomRow {
/** Interactivity range of the measured points the cells are read from. */
interactivityMin: number;
interactivityMax: number;
- /** One cell per `HEADROOM_INTERACTIVITIES` entry; null outside the measured range. */
+ /** One cell per requested interactivity (`HEADROOM_INTERACTIVITIES` by default); null outside the measured range. */
cells: (HeadroomCell | null)[];
rating: RatingShare;
}
@@ -85,6 +85,7 @@ const usable = (point: InferenceData) =>
function headroomRow(
key: string,
group: InferenceData[],
+ interactivities: readonly number[],
overlay?: { runIndex: number; run: OverlayRunIdentity | undefined },
): HeadroomRow | null {
const first = group[0];
@@ -110,7 +111,7 @@ function headroomRow(
tdpWatts,
interactivityMin,
interactivityMax,
- cells: HEADROOM_INTERACTIVITIES.map((interactivity) => cellAt(group, interactivity, tdpWatts)),
+ cells: interactivities.map((interactivity) => cellAt(group, interactivity, tdpWatts)),
rating: ratingShare(group, tdpWatts),
};
}
@@ -124,6 +125,8 @@ function headroomRow(
export function buildHeadroomRows(
points: readonly InferenceData[],
overlay?: HeadroomOverlayInput,
+ /** Where to read the cells; the table's four standard interactivities by default. */
+ interactivities: readonly number[] = HEADROOM_INTERACTIVITIES,
): HeadroomRow[] {
const groups = new Map();
for (const point of observedPoints(points)) {
@@ -133,7 +136,7 @@ export function buildHeadroomRows(
}
const rows: HeadroomRow[] = [];
for (const [key, group] of groups) {
- const row = headroomRow(key, group);
+ const row = headroomRow(key, group, interactivities);
if (row) rows.push(row);
}
rows.sort((a, b) => a.label.localeCompare(b.label) || a.key.localeCompare(b.key));
@@ -149,7 +152,7 @@ export function buildHeadroomRows(
}
const overlayRows: HeadroomRow[] = [];
for (const [key, { runIndex, points: group }] of overlayGroups) {
- const row = headroomRow(key, group, {
+ const row = headroomRow(key, group, interactivities, {
runIndex,
run: overlay?.runInfos[runIndex],
});
diff --git a/packages/app/src/lib/routing/url-state.ts b/packages/app/src/lib/routing/url-state.ts
index b370b9dd8..6d37e8779 100644
--- a/packages/app/src/lib/routing/url-state.ts
+++ b/packages/app/src/lib/routing/url-state.ts
@@ -72,6 +72,9 @@ const URL_STATE_KEYS = [
'i_pcompare',
'i_role',
'i_at',
+ 'i_szat',
+ 'i_szhr',
+ 'i_szgpu',
'i_overview_current',
'i_overview_baseline',
'e_rundate',
@@ -168,6 +171,9 @@ export const PARAM_DEFAULTS: Record = {
i_pcompare: '',
i_role: '',
i_at: '',
+ i_szat: '',
+ i_szhr: '',
+ i_szgpu: '',
i_overview_current: '',
i_overview_baseline: '',
e_rundate: '',
diff --git a/packages/app/src/lib/views-api/docs/inference.ts b/packages/app/src/lib/views-api/docs/inference.ts
index 070665a0d..265dff0e6 100644
--- a/packages/app/src/lib/views-api/docs/inference.ts
+++ b/packages/app/src/lib/views-api/docs/inference.ts
@@ -327,14 +327,50 @@ const parameters: readonly ApiParameter[] = [
schema: { type: 'boolean', default: false },
example: 'true',
},
+ {
+ name: 'sizing',
+ location: 'query',
+ required: false,
+ type: 'boolean',
+ description: text(
+ 'Include sizing: the PowerX sizing-to-measured-power panel. Per hardware line, measured P90 W per GPU read at sizingAt on interactivityField (same interpolation as headroom, never extrapolated), GPUs per GW of GPU power at the registry TDP (1 GW ÷ TDP) and at P90 × (1 + sizingHeadroom ÷ 100), the gain over the rating and the break-even headroom (TDP ÷ P90 − 1). Rows are ordered by gain; lines that do not cover sizingAt are omitted. GPU power only. JSON only.',
+ '返回 sizing:PowerX 按实测功耗规划面板。按硬件曲线给出在 interactivityField 的 sizingAt 处读取的每 GPU 实测 P90 功耗(插值方式同 headroom,不做外推),按注册表 TDP(1 GW ÷ TDP)与按 P90 × (1 + sizingHeadroom ÷ 100) 规划时每 GW GPU 功耗可容纳的 GPU 数、相对额定值的增幅以及盈亏平衡余量(TDP ÷ P90 − 1)。行按增幅排序;未覆盖 sizingAt 的曲线会被省略。仅 GPU 功耗。仅支持 JSON。',
+ ),
+ schema: { type: 'boolean', default: false },
+ example: 'true',
+ },
+ {
+ name: 'sizingAt',
+ location: 'query',
+ required: false,
+ type: 'number',
+ description: text(
+ 'Interactivity (tok/s/user) the sizing panel reads P90 power at. Positive; default 150.',
+ 'sizing 面板读取 P90 功耗的交互性(tok/s/user),须为正数,默认 150。',
+ ),
+ schema: { type: 'number', default: 150, minimum: 0 },
+ example: '150',
+ },
+ {
+ name: 'sizingHeadroom',
+ location: 'query',
+ required: false,
+ type: 'number',
+ description: text(
+ 'Headroom above measured P90 GPU power, in percent, for the sizing panel. 0 to 200; default 10.',
+ 'sizing 面板在实测 P90 GPU 功耗之上预留的余量百分比,范围 0 至 200,默认 10。',
+ ),
+ schema: { type: 'number', default: 10, minimum: 0, maximum: 200 },
+ example: '10',
+ },
{
name: 'format',
location: 'query',
required: false,
type: 'enum',
description: text(
- 'Response encoding. csv returns plotted points, or tableRows for All in Measured with unavailable y cells blank. serviceCompare, roleShare, powerFit, powerBreakdown and headroom analytical results require JSON and return 400 with CSV.',
- '响应编码。csv 返回图表数据点;整体实测指标则导出 tableRows,不可用的 y 留空。serviceCompare、roleShare、powerFit、powerBreakdown 和 headroom 分析结果仅支持 JSON,与 CSV 同用时返回 400。',
+ 'Response encoding. csv returns plotted points, or tableRows for All in Measured with unavailable y cells blank. serviceCompare, roleShare, powerFit, powerBreakdown, headroom and sizing analytical results require JSON and return 400 with CSV.',
+ '响应编码。csv 返回图表数据点;整体实测指标则导出 tableRows,不可用的 y 留空。serviceCompare、roleShare、powerFit、powerBreakdown、headroom 和 sizing 分析结果仅支持 JSON,与 CSV 同用时返回 400。',
),
schema: { type: 'string', enum: ['json', 'csv'], default: 'json' },
example: 'csv',
@@ -771,6 +807,29 @@ const responseSchema = objectSchema(
}),
),
}),
+ sizing: objectSchema({
+ interactivity: numberSchema,
+ interactivityField: { type: 'string' },
+ headroomPercent: numberSchema,
+ rows: arraySchema(
+ objectSchema({
+ key: { type: 'string', description: 'hwKey|precision.' },
+ hwKey: { type: 'string' },
+ precision: { type: 'string' },
+ label: { type: 'string' },
+ tdpWatts: { ...numberSchema, description: 'Rated board TDP per GPU from the registry.' },
+ p90Watts: { ...numberSchema, description: 'Interpolated measured P90 W per GPU.' },
+ p90PercentTdp: { ...numberSchema, description: 'P90 ÷ TDP × 100.' },
+ gpusPerGwAtRating: { ...numberSchema, description: '1 GW ÷ TDP.' },
+ gpusPerGw: { ...numberSchema, description: '1 GW ÷ (P90 × (1 + headroom)).' },
+ gainPercent: {
+ ...numberSchema,
+ description: '(gpusPerGw ÷ gpusPerGwAtRating − 1) × 100.',
+ },
+ breakEvenHeadroomPercent: { ...numberSchema, description: '(TDP ÷ P90 − 1) × 100.' },
+ }),
+ ),
+ }),
pricing: { type: ['object', 'null'], additionalProperties: true },
comparisons: arraySchema({
type: 'object',
@@ -819,6 +878,9 @@ const responseExample = {
powerFit: false,
powerBreakdown: false,
headroom: false,
+ sizing: false,
+ sizingAt: null,
+ sizingHeadroom: null,
},
metric: {
key: 'tpPerGpu',
diff --git a/packages/app/src/lib/views-api/registry.ts b/packages/app/src/lib/views-api/registry.ts
index 7b6eb204b..b24327e24 100644
--- a/packages/app/src/lib/views-api/registry.ts
+++ b/packages/app/src/lib/views-api/registry.ts
@@ -196,6 +196,9 @@ export const VIEW_QUERY_PARAMS = {
'powerFit',
'powerBreakdown',
'headroom',
+ 'sizing',
+ 'sizingAt',
+ 'sizingHeadroom',
],
'model-architectures': ['model'],
operatorx: [
diff --git a/packages/skills/skills/inferencex-api/integrity.json b/packages/skills/skills/inferencex-api/integrity.json
index b69a9e020..04544f6d6 100644
--- a/packages/skills/skills/inferencex-api/integrity.json
+++ b/packages/skills/skills/inferencex-api/integrity.json
@@ -9,7 +9,7 @@
"references/cli-contract.md": "4f070877eeefffad2860c58f79f68432fbe27aa21fc578a1c696f0309a3d7d7b",
"references/cli.md": "11e1183f7ed70d669019e8435ac16a6a9f873de027507b8850a9943f6659bfd9",
"references/collectivex.md": "0399e680c715ab1b6474a42742a59d7862fe8a82d4beff93b79c3c2a70f685de",
- "references/dashboard-views.md": "216dbee386872fbb2ffc2a6dc6389e4084f7f73742fd87001e58444f59f3d95b",
+ "references/dashboard-views.md": "8e56d19f7dc140e0d8e2be6711d61295ddbed54272dde53df9617601e1f0baa4",
"references/offline-exports.md": "95aa565dcd4c9e592159baa560a9a58217bc61e395de1c6daf0576795c7f4ec9",
"references/pareto.md": "8c766d7dff1c82291e1d118135192add7b73114bce623935565d90d6b3c4706c",
"references/powerx.md": "a0cd8548cb3695beb0afbe06fb0a7894f832659feaeae32c40032bc8e25bcbb1",
diff --git a/packages/skills/skills/inferencex-api/references/dashboard-views.md b/packages/skills/skills/inferencex-api/references/dashboard-views.md
index 129a420c4..a350acfd2 100644
--- a/packages/skills/skills/inferencex-api/references/dashboard-views.md
+++ b/packages/skills/skills/inferencex-api/references/dashboard-views.md
@@ -544,7 +544,7 @@ which API selectors belong together.
| View | Selection and calculation |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `options` | Static registries and defaults, JSON only. Data-dependent run/config choices come from their own views. |
-| `inference` | Model, scenario, precisions, date/exact run, GPU/vendor/framework/deployment/spec/power filters; metric, GPU Role (`role`), xmode, xstat, xmetric, percentile, optimal/best/allPoints; API-only equal-service sources/target; roleShare, powerFit, powerBreakdown and headroom panels; TCO, custom costs/powers, pricing, unofficial runs, comparison dates/endpoints. JSON or CSV. |
+| `inference` | Model, scenario, precisions, date/exact run, GPU/vendor/framework/deployment/spec/power filters; metric, GPU Role (`role`), xmode, xstat, xmetric, percentile, optimal/best/allPoints; API-only equal-service sources/target; roleShare, powerFit, powerBreakdown, headroom and sizing panels; TCO, custom costs/powers, pricing, unofficial runs, comparison dates/endpoints. JSON or CSV. |
| `historical` | Model, scenario, target, metric, precisions, GPUs/vendors/frameworks/deployment, start/end, TCO and pricing. `extendToDate` labels synthetic extension, defaults to current UTC date. `chart` is `line`, `waterfall` or `frontier`; frontier adds `groupBy` (`gpu`, `vendor` or `config`) and `compare`. JSON or CSV. |
| `calculator` | Model/scenario/run/date, precisions/GPUs, percentile, target/mode, token type, owning/renting cost, TCO, power budget, cost cap, hide-above-limit and public unofficial runs. JSON or CSV. |
| `first-token` | Benchmark selection plus 1–8 positive TTFT caps in seconds, minimum interactivity, cost provider and token type. Shared dashboard winner selection. |
@@ -920,6 +920,17 @@ is not settled). `date` reads a snapshot; each `unofficialrun` adds an `overlays
pooled the same way, drawn under its GPU type in the run's color.
These are GPU board figures; TDP does not bound IT or facility power.
+`sizing=true` returns `sizing`: GPUs per GW of GPU power when each GPU is budgeted at its
+measured P90 draw plus a margin instead of its rating. Per hardware line, P90 W per GPU is
+read at `sizingAt` tok/s/user (default 150, on `interactivityField`, same interpolation as
+`headroom`, never extrapolated) and `sizingHeadroom` percent (default 10, 0 to 200) is added:
+`gpusPerGwAtRating = 1e9 ÷ tdpWatts`, `gpusPerGw = 1e9 ÷ (p90Watts × (1 + headroom))`,
+`gainPercent` the difference and `breakEvenHeadroomPercent = (tdpWatts ÷ p90Watts − 1) × 100`.
+Rows are ordered by gain; lines that do not cover `sizingAt` are omitted. PowerX draws it as
+the Sizing to measured power panel under the headroom table (`i_szat`, `i_szhr`, `i_szgpu`
+in the share link; overlays are drawn in their run color). It is an illustrative budget,
+not a recommendation to oversubscribe without power capping.
+
A fifth power basis, `it-modeled` (All in Measured IT, no PUE), sits between the GPU and
the facility meter: the measured GPU plus the modeled CPU, server parts, fans and PSU loss
and the network share of `powerBreakdowns`, without the `facility` part. Its `metric`
@@ -952,7 +963,8 @@ Config controls, each shown only on the views where it applies. One GPU Role con
(All GPUs · Prefill · Decode · Prefill vs decode, `i_role=all|prefill|decode|split`, API
`role`, see above) applies to every view, under an Advanced section of Chart Config.
Power Draw shown as % of TDP shades each chip's headroom between its P90 draw and 100 % and
-adds the headroom table (`headroom=true`) with a CSV download. On Breakdown the
+adds the headroom table (`headroom=true`) with a CSV download, then the Sizing to measured
+power panel (`sizing=true`). On Breakdown the
chip comparison stacks IT plus the facility (PUE) part by default; an Include facility switch
(presentation only, no API selector) turns the PUE part off for IT only; the compared chip's across-load drill-down (stacked bars or
stacked area, `i_pbview`, stacked area by default) is open inline under its bar and follows the Compare At slider (`i_at`, tok/s/user, default 80
@@ -976,10 +988,10 @@ measured `metric`, or with a power-tier filter and no `metric`, opens `/pwx` wit
filters (the latter on the Power Draw scatter, `i_metric=y_measuredAvgPower`, as it used to chart power). Historical Trends keeps its measured power and energy metrics.
PowerX 仪表板标签页(`/pwx`、`/zh/pwx`)是 `inference` 视图的另一种呈现,除 `role`(见上文)外不新增选择项;
芯片对比与单芯片下钻读取 `powerBreakdowns`;下钻图与对比横条把十二个部件合并为六层带斜线填充的分层(`gpu`;`measuredCpu`;服务器部件 `cpu` + `memory` + `nic` + `nvswitch` + `storage` + `other`;`fans` + `psuLoss`;`network`;`facility`),图旁的部件列表逐项列出对比点的各部件,API 仍返回十二个部件。没有受支持系统功耗模型的芯片会标注为未显示。
-“功耗边界”控件列出三个实测边界:GPU(`gpu-measured`)、IT(`it-modeled`,不含 PUE)与数据中心(`utility-modeled`),外加“全部”;“全部”(`i_pcompare=boundaries`)在“功耗”或“每 Token 能耗”散点图上按芯片绘制这三条(仅 GPU 实线、IT 虚线、数据中心点划线),图例、提示框、表格与 CSV 也沿用这一叫法;曲线标签沿用推理图表的标签样式,每个芯片一个;页面不再有第二层控件。页面上每个功耗数值都带有 GPU / IT / 数据中心标签,含义见标签自身的提示框。四个视图为图表上方的标签页;“功耗边界”“能耗计量”与“显示为”,以及“统计量”和“预配上限”(关闭 | 整体预配,`i_pcompare=provisioned`:每芯片仅绘制 GPU 实测功耗实线与整体预配功耗虚线两条线)都是图表配置中的普通控件,仅在适用的视图上显示。一个 GPU 角色控件(全部 GPU · 预填充 · 解码 · 预填充 vs 解码,`i_role=all|prefill|decode|split`,API 参数 `role`,见上文)作用于所有视图,位于图表配置的“高级”区域。“功耗”视图按 TDP 占比显示时,会在各芯片 P90 功耗与 100% 之间填充余量,并附带“功耗 vs 额定值”图(每条曲线全部实测点的平均功耗占 TDP 的最低、中位与最高值,以及最高 P90,即 `headroom.rows[].rating`;“所有当前模型”范围改读 `GET /api/v1/views/powerx-rating`:将所有当前(非弃用)模型或 `models` 指定模型的全部实测点按 GPU 类型汇总,先 NVIDIA 后 AMD,字段同为 `rating`,并给出各模型点数与 `excludedGpus`(额定值未定的 VR200);`date` 读取快照,每个 `unofficialrun` 会按同样方式汇总为一条 `overlays`,以该运行的颜色绘于对应 GPU 类型下方)、余量表(`headroom=true`)与 CSV 下载。“功耗构成”中芯片对比默认堆叠 IT 部分与数据中心开销(PUE)部分;关闭“计入数据中心开销”开关(仅为展示,不新增 API 选择项)后只显示 IT 部分;所对比芯片的“随负载变化”下钻图(堆叠柱状图或堆叠面积图,`i_pbview`)默认即在其横条下方内联展开,并随“对比点”滑块切换芯片(`i_at`,单位 tok/s/user,默认 80,并限制在可见芯片共同覆盖的范围内;每个芯片的行取其 `powerBreakdowns` 中按对数距离最接近该值的数据点,1.5 倍以内没有数据点的芯片会标注为未在该交互性附近测试;仅为展示,不新增 API 选择项),该视图本身为 `i_pcompare=breakdown`(不再有功耗边界曲线图;边界对比位于“功耗”视图的“功耗边界:全部”)。芯片行的顺序固定(按硬件注册表顺序,非官方运行的曲线排在其后),不随滑块变化。点击已展开下钻图中的某一列,会把该芯片的对比点固定在该列(`i_pbpoint`,以逗号分隔的 `seriesKey:concurrency`,仅包含已固定的芯片);滑块不会移动,其他芯片仍按滑块取点,移动滑块会清除所有固定点,行上的 `×` 标记可单独取消该芯片的固定。这只是对 API 已返回的 `powerBreakdowns` 数据的展示方式,并非新的选择项。“随时间变化”新增每条曲线的负载波动表(峰值、最小值、空闲底线、均值、P5/P95、最大 1 秒与 5 秒变化、上升/下降速率、波动率)、“×72(每 NVL72 机架)”开关,以及由 `/api/v1/gpu-metrics-point/stats`(`format=csv|json`、`scale=gpu|nvl72`、`role=all|prefill|decode|split`)提供的逐点 CSV / JSON 下载,该接口用同一函数基于同一已存数据桶计算统计;选择 GPU 角色时每条通道只取该池的 GPU 行(`devices[].role`)。除 `role` 外,这些都不新增 `inference` 视图的选择项。分享链接带 `i_pcompare=all`(界面不提供)时,会在三个实测边界之上加入两个额定边界。
+“功耗边界”控件列出三个实测边界:GPU(`gpu-measured`)、IT(`it-modeled`,不含 PUE)与数据中心(`utility-modeled`),外加“全部”;“全部”(`i_pcompare=boundaries`)在“功耗”或“每 Token 能耗”散点图上按芯片绘制这三条(仅 GPU 实线、IT 虚线、数据中心点划线),图例、提示框、表格与 CSV 也沿用这一叫法;曲线标签沿用推理图表的标签样式,每个芯片一个;页面不再有第二层控件。页面上每个功耗数值都带有 GPU / IT / 数据中心标签,含义见标签自身的提示框。四个视图为图表上方的标签页;“功耗边界”“能耗计量”与“显示为”,以及“统计量”和“预配上限”(关闭 | 整体预配,`i_pcompare=provisioned`:每芯片仅绘制 GPU 实测功耗实线与整体预配功耗虚线两条线)都是图表配置中的普通控件,仅在适用的视图上显示。一个 GPU 角色控件(全部 GPU · 预填充 · 解码 · 预填充 vs 解码,`i_role=all|prefill|decode|split`,API 参数 `role`,见上文)作用于所有视图,位于图表配置的“高级”区域。“功耗”视图按 TDP 占比显示时,会在各芯片 P90 功耗与 100% 之间填充余量,并附带“功耗 vs 额定值”图(每条曲线全部实测点的平均功耗占 TDP 的最低、中位与最高值,以及最高 P90,即 `headroom.rows[].rating`;“所有当前模型”范围改读 `GET /api/v1/views/powerx-rating`:将所有当前(非弃用)模型或 `models` 指定模型的全部实测点按 GPU 类型汇总,先 NVIDIA 后 AMD,字段同为 `rating`,并给出各模型点数与 `excludedGpus`(额定值未定的 VR200);`date` 读取快照,每个 `unofficialrun` 会按同样方式汇总为一条 `overlays`,以该运行的颜色绘于对应 GPU 类型下方)、余量表(`headroom=true`)与 CSV 下载,以及其下的“按实测功耗规划”面板(`sizing=true`,参数 `sizingAt` 默认 150 tok/s/user、`sizingHeadroom` 默认 10%:按每 GPU 实测 P90 功耗加余量规划时每 GW GPU 功耗可容纳的 GPU 数 `gpusPerGw = 1e9 ÷ (p90Watts × (1 + 余量))`,对比按额定值的 `gpusPerGwAtRating = 1e9 ÷ tdpWatts`,给出 `gainPercent` 与盈亏平衡余量 `breakEvenHeadroomPercent`;未覆盖 sizingAt 的曲线省略;分享链接参数 `i_szat`、`i_szhr`、`i_szgpu`,非官方运行以其颜色绘制;仅为示意,不构成在无功率封顶时超额配置的建议)。“功耗构成”中芯片对比默认堆叠 IT 部分与数据中心开销(PUE)部分;关闭“计入数据中心开销”开关(仅为展示,不新增 API 选择项)后只显示 IT 部分;所对比芯片的“随负载变化”下钻图(堆叠柱状图或堆叠面积图,`i_pbview`)默认即在其横条下方内联展开,并随“对比点”滑块切换芯片(`i_at`,单位 tok/s/user,默认 80,并限制在可见芯片共同覆盖的范围内;每个芯片的行取其 `powerBreakdowns` 中按对数距离最接近该值的数据点,1.5 倍以内没有数据点的芯片会标注为未在该交互性附近测试;仅为展示,不新增 API 选择项),该视图本身为 `i_pcompare=breakdown`(不再有功耗边界曲线图;边界对比位于“功耗”视图的“功耗边界:全部”)。芯片行的顺序固定(按硬件注册表顺序,非官方运行的曲线排在其后),不随滑块变化。点击已展开下钻图中的某一列,会把该芯片的对比点固定在该列(`i_pbpoint`,以逗号分隔的 `seriesKey:concurrency`,仅包含已固定的芯片);滑块不会移动,其他芯片仍按滑块取点,移动滑块会清除所有固定点,行上的 `×` 标记可单独取消该芯片的固定。这只是对 API 已返回的 `powerBreakdowns` 数据的展示方式,并非新的选择项。“随时间变化”新增每条曲线的负载波动表(峰值、最小值、空闲底线、均值、P5/P95、最大 1 秒与 5 秒变化、上升/下降速率、波动率)、“×72(每 NVL72 机架)”开关,以及由 `/api/v1/gpu-metrics-point/stats`(`format=csv|json`、`scale=gpu|nvl72`、`role=all|prefill|decode|split`)提供的逐点 CSV / JSON 下载,该接口用同一函数基于同一已存数据桶计算统计;选择 GPU 角色时每条通道只取该池的 GPU 行(`devices[].role`)。除 `role` 外,这些都不新增 `inference` 视图的选择项。分享链接带 `i_pcompare=all`(界面不提供)时,会在三个实测边界之上加入两个额定边界。
Inference Performance 不再提供功耗指标:带实测 `metric`,或带功耗等级筛选但未指定 `metric` 的 `/infx/inference` 链接会以相同筛选条件打开 `/pwx`(后者落在“功耗”散点图上,即 `i_metric=y_measuredAvgPower`,与其原先绘制功耗的行为一致)。Historical Trends 仍保留实测功耗与能耗指标。
-These analytical results (`serviceCompare`, `roleShare`, `powerFit`, `powerBreakdown`, `headroom`) require JSON; enabling any with CSV returns 400. CSV exports plotted points except for All in Measured and its IT boundary, which export `tableRows`.
+These analytical results (`serviceCompare`, `roleShare`, `powerFit`, `powerBreakdown`, `headroom`, `sizing`) require JSON; enabling any with CSV returns 400. CSV exports plotted points except for All in Measured and its IT boundary, which export `tableRows`.
同等服务对比与同并发诊断仅通过 API 提供,查询参数为 `serviceCompare`、`serviceBaseline`、
`serviceComparator` 和 `serviceTarget`;仪表板没有对应的服务对比控件、来源选择、目标值输入、
From 91fdc9c666d93eeecbedd6e91b70bcb90231ccf9 Mon Sep 17 00:00:00 2001
From: Wenyao Gao <105094497+edwingao28@users.noreply.github.com>
Date: Thu, 3 Dec 2026 04:19:27 +0000
Subject: [PATCH 2/3] fix(powerx): label the negative end of the sizing bar
axis at every step
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When the span widened the step to 20, the tick loop started at the first
multiple of 20 above the negative bound and left that side unlabeled. Both
ends now snap to the step.
中文:当跨度使刻度步长变为 20 时,刻度循环从负向边界之上的第一个 20 的倍数
开始,负向一侧没有标注。现在两端都对齐到步长。
---
.../inference/powerx/PowerXGwSizing.test.ts | 8 +++++++-
.../components/inference/powerx/PowerXGwSizing.tsx | 11 +++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
index 95a3238fb..ba210526e 100644
--- a/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
@@ -20,8 +20,14 @@ describe('PowerXGwSizing helpers', () => {
max: 50,
ticks: [0, 10, 20, 30, 40, 50],
});
- expect(sizingBarAxis([row('a', 72), row('b', -5)])).toMatchObject({ min: -10, max: 80 });
+ expect(sizingBarAxis([row('a', 32), row('b', -5)])).toMatchObject({ min: -10, max: 50 });
expect(sizingBarAxis([row('a', 120)]).ticks).toEqual([0, 20, 40, 60, 80, 100, 120]);
+ // A wide span steps by 20 and still labels the negative end.
+ expect(sizingBarAxis([row('a', 90), row('b', -5)])).toEqual({
+ min: -20,
+ max: 100,
+ ticks: [-20, 0, 20, 40, 60, 80, 100],
+ });
});
it('runs the curve to 60% headroom, or past a later break-even point', () => {
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
index 93b097166..67fe907b4 100644
--- a/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
@@ -102,11 +102,14 @@ export function sizingBarAxis(rows: readonly Pick[]):
ticks: number[];
} {
const gains = rows.map((row) => row.gainPercent);
- const max = Math.max(50, Math.ceil(Math.max(0, ...gains) / 10) * 10);
- const min = Math.min(0, Math.floor(Math.min(0, ...gains) / 10) * 10);
- const step = max - min > 80 ? 20 : 10;
+ const top = Math.max(50, Math.ceil(Math.max(0, ...gains) / 10) * 10);
+ const bottom = Math.min(0, Math.floor(Math.min(0, ...gains) / 10) * 10);
+ const step = top - bottom > 80 ? 20 : 10;
+ // Both ends land on a tick, so the negative side is labeled whatever the step.
+ const min = Math.floor(bottom / step) * step;
+ const max = Math.ceil(top / step) * step;
const ticks: number[] = [];
- for (let tick = Math.ceil(min / step) * step; tick <= max; tick += step) ticks.push(tick);
+ for (let tick = min; tick <= max; tick += step) ticks.push(tick);
return { min, max, ticks };
}
From e31fda647c9e407cfa52a042e377694a30e4fc18 Mon Sep 17 00:00:00 2001
From: Wenyao Gao <105094497+edwingao28@users.noreply.github.com>
Date: Thu, 3 Dec 2026 04:45:10 +0000
Subject: [PATCH 3/3] fix(powerx): keep the sizing panel off dead ends and keep
typed headroom
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Read at presets that no GPU line covers are disabled. A share-link pick that
no line covers reads at the nearest covered preset with a note. Lines left out
at the chosen Read at are named, the headline counts lines that gain nothing
at the chosen headroom, and the headroom box keeps what you type until blur
or Enter.
中文:没有任何 GPU 线覆盖的读取点预设会被禁用;分享链接中未覆盖的读取点会回退到最近的已覆盖预设并给出提示。面板会列出在该读取点缺失的线,标题会统计在所选余量下没有收益的线数,余量输入框在失焦或回车前保留输入内容。
---
docs/powerx-permanent-view.md | 5 +-
.../inference/powerx/PowerXGwSizing.test.ts | 13 +-
.../inference/powerx/PowerXGwSizing.tsx | 122 ++++++++++++++----
packages/app/src/lib/power/gw-sizing.test.ts | 26 ++++
packages/app/src/lib/power/gw-sizing.ts | 30 +++++
5 files changed, 162 insertions(+), 34 deletions(-)
diff --git a/docs/powerx-permanent-view.md b/docs/powerx-permanent-view.md
index b8218b27c..6dae7fd09 100644
--- a/docs/powerx-permanent-view.md
+++ b/docs/powerx-permanent-view.md
@@ -232,7 +232,10 @@ link still opens that view for locked visitors.
(`i_szhr`, default 10 %, slider 0 to 60 %) against 1 GW ÷ TDP. Left: one bar per line with
the gain and the GPU counts, overlay lines in their run color. Right: the picked line's
GPUs per GW over headroom (`i_szgpu`, click a bar; GB300 NVL72 by default), the rating as a
- dashed line and the break-even headroom TDP ÷ P90 − 1 as an open dot. The views API serves
+ dashed line and the break-even headroom TDP ÷ P90 − 1 as an open dot. Read at presets no line covers are
+ disabled; a share-link pick no line covers reads at the nearest covered preset (log scale)
+ with a note, without rewriting `i_szat`. Lines left out at the Read at are named under the
+ controls, and the headline counts the lines that gain nothing at the chosen headroom. The views API serves
the official rows with `sizing=true` (`sizingAt`, `sizingHeadroom`).
- **Load swings** (Over Time, PowerX only): `PowerLoadSwings` computes
`lib/power/load-swing-stats.ts` per visible trace (peak, min, idle floor = P5 before the
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
index ba210526e..e15a516ff 100644
--- a/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.test.ts
@@ -42,14 +42,17 @@ describe('PowerXGwSizing helpers', () => {
expect(sizingCurveMarks(23, 60)).toEqual([0, 10, 23, 50]);
});
- it('states the gain range of the official rows', () => {
+ it('states the gain range, or the best gain and the lines that gain nothing', () => {
const t = SIZING_STRINGS.en;
- expect(sizingHeadline([row('a', 36), row('b', 9), row('c', 80, 0)], t)).toBe(
+ expect(sizingHeadline([row('a', 36), row('b', 9), row('c', 80, 0)], 10, t)).toBe(
'Sizing to measured power fits 9% to 36% more GPUs into a gigawatt, until headroom eats the gain',
);
- expect(sizingHeadline([row('a', 12)], t)).toContain('fits 12% more GPUs');
- expect(sizingHeadline([row('a', 20), row('b', -5)], t)).toBe(
- 'Sizing to measured power changes GPUs per gigawatt by \u22125% to +20% against the rating',
+ expect(sizingHeadline([row('a', 12)], 10, t)).toContain('fits 12% more GPUs');
+ expect(sizingHeadline([row('a', 40), row('b', 0.3), row('c', -3)], 10, t)).toBe(
+ 'Sizing to measured power fits up to 40% more GPUs into a gigawatt; at 10% headroom, 2 of 3 GPU lines gain nothing',
+ );
+ expect(sizingHeadline([row('a', -2)], 50, t)).toBe(
+ 'At 50% headroom, no GPU line fits more GPUs into a gigawatt than sizing at the rating',
);
});
});
diff --git a/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
index 67fe907b4..f59e48086 100644
--- a/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
+++ b/packages/app/src/components/inference/powerx/PowerXGwSizing.tsx
@@ -16,11 +16,13 @@ import {
formatGpuCount,
parseSizingAt,
parseSizingHeadroom,
+ resolveSizingAt,
SIZING_CURVE_MARKS,
SIZING_HEADROOM_MAX,
SIZING_INTERACTIVITY_PRESETS,
sizedGpusPerGw,
sizingCurve,
+ sizingOmittedLabels,
type SizingRow,
} from '@/lib/power/gw-sizing';
import { readUrlParams, writeUrlParams } from '@/lib/routing/url-state';
@@ -34,8 +36,14 @@ export const SIZING_STRINGS = {
lo === hi
? `Sizing to measured power fits ${hi} more GPUs into a gigawatt, until headroom eats the gain`
: `Sizing to measured power fits ${lo} to ${hi} more GPUs into a gigawatt, until headroom eats the gain`,
- headlineMixed: (lo: string, hi: string) =>
- `Sizing to measured power changes GPUs per gigawatt by ${lo} to ${hi} against the rating`,
+ headlineMixed: (hi: string, losers: number, total: number, h: number) =>
+ `Sizing to measured power fits up to ${hi} more GPUs into a gigawatt; at ${h}% headroom, ${losers} of ${total} GPU lines gain nothing`,
+ headlineNone: (h: number) =>
+ `At ${h}% headroom, no GPU line fits more GPUs into a gigawatt than sizing at the rating`,
+ fellBack: (picked: number, at: number) =>
+ `No GPU line here was measured at ${picked} tok/s/user, so the panel reads at ${at}.`,
+ omitted: (at: number, labels: string) => `Not measured at ${at} tok/s/user: ${labels}.`,
+ notMeasured: (at: number) => `No GPU line here was measured at ${at} tok/s/user`,
title: 'Sizing to Measured Power',
subtitle: (at: number, context: string) =>
`Illustrative scenario: each GPU sized at its measured P90 power at ${at} tok/s/user${context ? `, ${context}` : ''}, against sizing at the GPU rating.`,
@@ -65,8 +73,13 @@ export const SIZING_STRINGS = {
lo === hi
? `按实测功耗规划,每 GW 可多容纳 ${hi} 的 GPU,直至余量抵消增益`
: `按实测功耗规划,每 GW 可多容纳 ${lo} 至 ${hi} 的 GPU,直至余量抵消增益`,
- headlineMixed: (lo: string, hi: string) =>
- `按实测功耗规划,每 GW 的 GPU 数相对额定值变化 ${lo} 至 ${hi}`,
+ headlineMixed: (hi: string, losers: number, total: number, h: number) =>
+ `按实测功耗规划,每 GW 最多可多容纳 ${hi} 的 GPU;在 ${h}% 余量下,${total} 条 GPU 曲线中有 ${losers} 条没有增益`,
+ headlineNone: (h: number) => `在 ${h}% 余量下,没有 GPU 曲线能比按额定值规划多容纳 GPU`,
+ fellBack: (picked: number, at: number) =>
+ `当前没有 GPU 曲线在 ${picked} tok/s/user 处有实测数据,面板改为在 ${at} 处读取。`,
+ omitted: (at: number, labels: string) => `未在 ${at} tok/s/user 处实测:${labels}。`,
+ notMeasured: (at: number) => `当前没有 GPU 曲线在 ${at} tok/s/user 处有实测数据`,
title: '按实测功耗规划',
subtitle: (at: number, context: string) =>
`示意场景:每个 GPU 按其在 ${at} tok/s/user 下的实测 P90 功耗规划${context ? `(${context})` : ''},对比按 GPU 额定值规划。`,
@@ -131,14 +144,24 @@ export function sizingCurveMarks(headroom: number, span: number): number[] {
return marks.toSorted((a, b) => a - b);
}
-/** The headline's gain range over the official rows (all rows when only overlays remain). */
-export function sizingHeadline(rows: readonly SizingRow[], t: Strings): string {
+/**
+ * The headline over the official rows (all rows when only overlays remain): the gain range
+ * when every line gains, else the best gain and how many lines gain nothing.
+ */
+export function sizingHeadline(rows: readonly SizingRow[], headroom: number, t: Strings): string {
const official = rows.filter((row) => row.runIndex === undefined);
- const gains = (official.length > 0 ? official : rows).map((row) => row.gainPercent);
+ const gains = (official.length > 0 ? official : rows).map((row) => Math.round(row.gainPercent));
const lo = Math.min(...gains);
const hi = Math.max(...gains);
- if (Math.round(lo) <= 0) return t.headlineMixed(formatGain(lo), formatGain(hi));
- return t.headline(formatGain(lo).slice(1), formatGain(hi).slice(1));
+ if (hi <= 0) return t.headlineNone(headroom);
+ if (lo <= 0)
+ return t.headlineMixed(
+ `${hi}%`,
+ gains.filter((gain) => gain <= 0).length,
+ gains.length,
+ headroom,
+ );
+ return t.headline(`${lo}%`, `${hi}%`);
}
function useWidth() {
@@ -428,26 +451,59 @@ export function PowerXGwSizing({
const locale = useLocale();
const t = SIZING_STRINGS[locale];
const { runIndexByUrl, unofficialRunInfos } = useUnofficialRun();
- const [at, setAt] = useState(() => parseSizingAt(readUrlParams().i_szat));
+ const [pickedAt, setPickedAt] = useState(() => parseSizingAt(readUrlParams().i_szat));
const [headroom, setHeadroom] = useState(() => parseSizingHeadroom(readUrlParams().i_szhr));
+ const [headroomDraft, setHeadroomDraft] = useState(null);
const [picked, setPicked] = useState(() => readUrlParams().i_szgpu || undefined);
- const rows = useMemo(
+ const overlay = useMemo(
() =>
- buildSizingRows(
- points,
- { interactivity: at, headroomPercent: headroom },
- overlayPoints && overlayPoints.length > 0
- ? { points: overlayPoints, runIndexByUrl, runInfos: unofficialRunInfos }
- : undefined,
- ),
- [points, overlayPoints, runIndexByUrl, unofficialRunInfos, at, headroom],
+ overlayPoints && overlayPoints.length > 0
+ ? { points: overlayPoints, runIndexByUrl, runInfos: unofficialRunInfos }
+ : undefined,
+ [overlayPoints, runIndexByUrl, unofficialRunInfos],
+ );
+ // A Read at no line covers would empty the panel: presets without a line are disabled, and
+ // a pick from a share link or another model reads at the nearest covered preset instead.
+ const covered = useMemo(() => {
+ const cache = new Map();
+ return (x: number) => {
+ let hit = cache.get(x);
+ if (hit === undefined) {
+ hit = buildSizingRows(points, { interactivity: x, headroomPercent: 0 }, overlay).length > 0;
+ cache.set(x, hit);
+ }
+ return hit;
+ };
+ }, [points, overlay]);
+ const { interactivity: at, fellBack } = resolveSizingAt(pickedAt, covered);
+ const rows = useMemo(
+ () => buildSizingRows(points, { interactivity: at, headroomPercent: headroom }, overlay),
+ [points, overlay, at, headroom],
+ );
+ const omitted = useMemo(
+ () => (rows.length > 0 ? sizingOmittedLabels(points, at, overlay) : []),
+ [points, overlay, at, rows.length],
);
const selected = defaultSizingRow(rows, picked);
const changeAt = (next: number) => {
- setAt(next);
+ setPickedAt(next);
writeUrlParams({ i_szat: String(next) });
track('inference_powerx_sizing_changed', { control: 'read_at', at: next });
};
+ const changeHeadroom = (next: number) => {
+ setHeadroom(next);
+ writeUrlParams({ i_szhr: String(next) });
+ };
+ // Typing keeps a draft, so clearing the field to type a new value does not snap it back.
+ const commitHeadroomDraft = () => {
+ if (headroomDraft === null) return;
+ setHeadroomDraft(null);
+ if (headroomDraft.trim() === '' || !Number.isFinite(Number(headroomDraft))) return;
+ const next = parseSizingHeadroom(headroomDraft);
+ if (next === headroom) return;
+ changeHeadroom(next);
+ track('inference_powerx_sizing_changed', { control: 'headroom', headroom: next });
+ };
const select = (row: SizingRow) => {
setPicked(row.key);
writeUrlParams({ i_szgpu: row.key });
@@ -460,7 +516,7 @@ export function PowerXGwSizing({
>
- {rows.length > 0 ? sizingHeadline(rows, t) : t.title}
+ {rows.length > 0 ? sizingHeadline(rows, headroom, t) : t.title}
@@ -480,6 +536,9 @@ export function PowerXGwSizing({
options={SIZING_INTERACTIVITY_PRESETS.map((option) => ({
value: String(option),
label: String(option),
+ disabled: !covered(option),
+ title: covered(option) ? undefined : t.notMeasured(option),
+ testId: `powerx-gw-sizing-at-${option}`,
}))}
/>
@@ -493,19 +552,19 @@ export function PowerXGwSizing({
compact
sliderTestId="powerx-gw-sizing-headroom"
onSliderChange={(next) => {
- setHeadroom(next);
- writeUrlParams({ i_szhr: String(next) });
+ setHeadroomDraft(null);
+ changeHeadroom(next);
}}
onSliderCommit={() =>
track('inference_powerx_sizing_changed', { control: 'headroom', headroom })
}
input={{
- value: String(headroom),
+ value: headroomDraft ?? String(headroom),
max: SIZING_HEADROOM_MAX,
- onChange: (event) => {
- const next = parseSizingHeadroom(event.target.value);
- setHeadroom(next);
- writeUrlParams({ i_szhr: String(next) });
+ onChange: (event) => setHeadroomDraft(event.target.value),
+ onBlur: commitHeadroomDraft,
+ onKeyDown: (event) => {
+ if (event.key === 'Enter') commitHeadroomDraft();
},
className: 'tabular-nums',
'data-testid': 'powerx-gw-sizing-headroom-input',
@@ -513,6 +572,13 @@ export function PowerXGwSizing({
/>
+ {(fellBack || omitted.length > 0) && (
+
+ {fellBack && t.fellBack(pickedAt, at)}
+ {fellBack && omitted.length > 0 && ' '}
+ {omitted.length > 0 && t.omitted(at, omitted.join(', '))}
+
+ )}
{rows.length === 0 || !selected ? (
{t.empty(at)}
) : (
diff --git a/packages/app/src/lib/power/gw-sizing.test.ts b/packages/app/src/lib/power/gw-sizing.test.ts
index 47d222e81..2dfedea64 100644
--- a/packages/app/src/lib/power/gw-sizing.test.ts
+++ b/packages/app/src/lib/power/gw-sizing.test.ts
@@ -10,6 +10,8 @@ import {
gpusPerGw,
parseSizingAt,
parseSizingHeadroom,
+ resolveSizingAt,
+ sizingOmittedLabels,
sizedGpusPerGw,
sizingCurve,
} from './gw-sizing';
@@ -103,4 +105,28 @@ describe('buildSizingRows', () => {
expect(defaultSizingRow(rows.slice(0, 1), undefined)?.key).toBe('mi355x|fp4');
expect(defaultSizingRow([], undefined)).toBeUndefined();
});
+
+ it('names the lines left out because they were not measured at the Read at', () => {
+ const points = [
+ ...sweep('b200_vllm', [950, 830, 700]),
+ ...sweep('h100_vllm', [650, 600, 550], [200, 250, 400]),
+ ];
+ expect(sizingOmittedLabels(points, 150)).toEqual([expect.stringContaining('H100')]);
+ expect(sizingOmittedLabels(points, 250)).toEqual([]);
+ });
+});
+
+const covers = (x: number) => x >= 40 && x <= 120;
+
+describe('resolveSizingAt', () => {
+ it('keeps a covered pick', () => {
+ expect(resolveSizingAt(80, covers)).toEqual({ interactivity: 80, fellBack: false });
+ });
+ it('falls back to the nearest covered preset on a log scale', () => {
+ expect(resolveSizingAt(150, covers)).toEqual({ interactivity: 100, fellBack: true });
+ expect(resolveSizingAt(20, covers)).toEqual({ interactivity: 50, fellBack: true });
+ });
+ it('keeps the pick when no preset is covered', () => {
+ expect(resolveSizingAt(150, () => false)).toEqual({ interactivity: 150, fellBack: false });
+ });
});
diff --git a/packages/app/src/lib/power/gw-sizing.ts b/packages/app/src/lib/power/gw-sizing.ts
index 935009308..9eddf17fa 100644
--- a/packages/app/src/lib/power/gw-sizing.ts
+++ b/packages/app/src/lib/power/gw-sizing.ts
@@ -142,3 +142,33 @@ export function defaultSizingRow[1],
+): string[] {
+ return buildHeadroomRows(points, overlay, [interactivity])
+ .filter((row) => !row.cells[0])
+ .map((row) => row.label);
+}
+
+/**
+ * The Read at the panel draws: the picked value when some line covers it, else the covered
+ * preset nearest to it on a log scale, so a share link or a sparse model never opens on an
+ * empty panel. The pick itself is kept and returns once a line covers it again.
+ */
+export function resolveSizingAt(
+ picked: number,
+ covers: (interactivity: number) => boolean,
+ presets: readonly number[] = SIZING_INTERACTIVITY_PRESETS,
+): { interactivity: number; fellBack: boolean } {
+ if (covers(picked)) return { interactivity: picked, fellBack: false };
+ const nearest = presets
+ .filter(covers)
+ .toSorted((a, b) => Math.abs(Math.log(a / picked)) - Math.abs(Math.log(b / picked)))[0];
+ return nearest === undefined
+ ? { interactivity: picked, fellBack: false }
+ : { interactivity: nearest, fellBack: true };
+}