aiinfra-tools 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +210 -0
- package/README.md +14 -3
- package/bin/aiinfra.mjs +5 -2
- package/bin/report.mjs +177 -0
- package/fleetops/README.md +33 -1
- package/fleetops/deploy/shadow-gate/argo-analysistemplate.yaml +34 -0
- package/fleetops/deploy/shadow-gate/argo-rollout-example.yaml +38 -0
- package/fleetops/deploy/shadow-gate/flagger-canary.yaml +34 -0
- package/fleetops/deploy/shadow-gate/judge.yaml +51 -0
- package/fleetops/deploy/shadow-gate/llmd-canary-example.yaml +35 -0
- package/fleetops/deploy/shadow-gate/podmonitor-vllm.yaml +20 -0
- package/fleetops/deploy/shadow-live/README.md +33 -0
- package/fleetops/deploy/shadow-live/kit.yaml +121 -0
- package/fleetops/deploy/shadow-live/load-canary.yaml +26 -0
- package/fleetops/deploy/shadow-live/run.sh +48 -0
- package/fleetops/docs/ADMISSION.md +9 -9
- package/fleetops/docs/FABRIC-STORAGE.md +1 -1
- package/fleetops/docs/SERVING.md +11 -1
- package/fleetops/docs/SHADOW.md +250 -0
- package/fleetops/docs/SIGNALS.md +5 -2
- package/fleetops/docs/WORKLOADS.md +1 -1
- package/fleetops/package.json +7 -4
- package/fleetops/src/adapters/fabric.mjs +19 -7
- package/fleetops/src/adapters/live.mjs +38 -5
- package/fleetops/src/adapters/logs.mjs +10 -7
- package/fleetops/src/adapters/nvsentinel.mjs +95 -0
- package/fleetops/src/adapters/topology.mjs +53 -1
- package/fleetops/src/admission.mjs +26 -18
- package/fleetops/src/api.mjs +2 -1
- package/fleetops/src/bundle.mjs +3 -0
- package/fleetops/src/calibrate.mjs +1 -1
- package/fleetops/src/detect.mjs +1 -1
- package/fleetops/src/export.mjs +5 -1
- package/fleetops/src/goodput.mjs +0 -2
- package/fleetops/src/incidents.mjs +1 -2
- package/fleetops/src/ingest.mjs +1 -1
- package/fleetops/src/inject.mjs +2 -2
- package/fleetops/src/live.mjs +2 -1
- package/fleetops/src/llmd.mjs +7 -3
- package/fleetops/src/optimize.mjs +1 -1
- package/fleetops/src/power.mjs +7 -7
- package/fleetops/src/procure.mjs +67 -0
- package/fleetops/src/rca.mjs +1 -1
- package/fleetops/src/rollout.mjs +1 -1
- package/fleetops/src/schema.mjs +3 -2
- package/fleetops/src/security.mjs +1 -1
- package/fleetops/src/serving.mjs +21 -9
- package/fleetops/src/shadow-canary.mjs +74 -0
- package/fleetops/src/shadow-gate.mjs +49 -0
- package/fleetops/src/shadow-prom.mjs +205 -0
- package/fleetops/src/shadow-replay.mjs +147 -0
- package/fleetops/src/shadow.mjs +291 -0
- package/fleetops/src/stats.mjs +14 -0
- package/fleetops/src/traces.mjs +0 -5
- package/fleetops/tests/fixtures/real/README.md +5 -0
- package/fleetops/tools/admit-node.sh +51 -16
- package/fleetops/tools/amd-admit.py +111 -0
- package/fleetops/tools/cmd/calibrate.mjs +61 -0
- package/fleetops/tools/cmd/capacity.mjs +116 -0
- package/fleetops/tools/cmd/common.mjs +32 -0
- package/fleetops/tools/cmd/data.mjs +343 -0
- package/fleetops/tools/cmd/help.mjs +243 -0
- package/fleetops/tools/cmd/incidents.mjs +216 -0
- package/fleetops/tools/cmd/rollout.mjs +122 -0
- package/fleetops/tools/cmd/server.mjs +122 -0
- package/fleetops/tools/cmd/serving.mjs +95 -0
- package/fleetops/tools/cmd/shadow.mjs +204 -0
- package/fleetops/tools/cmd/training.mjs +79 -0
- package/fleetops/tools/collect.sh +6 -1
- package/fleetops/tools/fleetops.mjs +18 -1308
- package/fleetops/tools/loop-demo.mjs +1 -1
- package/fleetops/tools/workload-profile.mjs +0 -1
- package/fleetscope/README.md +5 -1
- package/fleetscope/build.mjs +1 -0
- package/fleetscope/dist/index.html +295 -26
- package/fleetscope/docs/AGENTIC.md +89 -0
- package/fleetscope/docs/PLANNING.md +4 -2
- package/fleetscope/docs/VALIDATION-AGENTIC.md +37 -0
- package/fleetscope/package.json +4 -3
- package/fleetscope/src/agentic.js +288 -0
- package/fleetscope/src/ask.js +0 -1
- package/fleetscope/src/cluster-ui.js +1 -0
- package/fleetscope/src/engine.js +10 -11
- package/fleetscope/src/index.src.html +9 -5
- package/fleetscope/src/inference-ui.js +1 -0
- package/fleetscope/src/ingest.js +89 -3
- package/fleetscope/src/optimize.js +11 -5
- package/fleetscope/src/plan.js +1 -1
- package/fleetscope/src/training-ui.js +1 -0
- package/fleetscope/tools/agentic.mjs +148 -0
- package/fleetscope/tools/tracelab-data.mjs +27 -0
- package/gpu-health/README.md +13 -2
- package/gpu-health/docs/CONFIG.md +29 -1
- package/gpu-health/package.json +7 -4
- package/gpu-health/src/actions.mjs +16 -3
- package/gpu-health/src/analyze.mjs +3 -0
- package/gpu-health/src/config.mjs +3 -0
- package/gpu-health/src/executors.mjs +9 -4
- package/gpu-health/src/health.mjs +1 -1
- package/gpu-health/src/ingest.mjs +27 -3
- package/gpu-health/src/platforms.mjs +109 -0
- package/gpu-health/src/vendors.mjs +12 -5
- package/gpu-health/tools/gpu-health.mjs +6 -4
- package/gpu-ledger/README.md +3 -1
- package/gpu-ledger/package.json +12 -4
- package/gpu-ledger/src/adapters.mjs +3 -2
- package/gpu-ledger/src/cloud.mjs +104 -0
- package/gpu-ledger/src/core.mjs +12 -10
- package/gpu-ledger/tools/ledger.mjs +8 -2
- package/harness-ledger/README.md +152 -0
- package/harness-ledger/docs/FORMATS.md +114 -0
- package/harness-ledger/docs/METHOD.md +133 -0
- package/harness-ledger/docs/VALIDATION-ECONOMICS.md +59 -0
- package/harness-ledger/docs/VALIDATION-SWEBENCH.md +26 -0
- package/harness-ledger/docs/VALIDATION-TRACELAB.md +56 -0
- package/harness-ledger/package.json +19 -0
- package/harness-ledger/src/demo.mjs +115 -0
- package/harness-ledger/src/economics.mjs +184 -0
- package/harness-ledger/src/gpu.mjs +80 -0
- package/harness-ledger/src/html.mjs +63 -0
- package/harness-ledger/src/importers.mjs +247 -0
- package/harness-ledger/src/ledger.mjs +128 -0
- package/harness-ledger/src/opencost.mjs +55 -0
- package/harness-ledger/src/outcomes.mjs +67 -0
- package/harness-ledger/src/prices.mjs +75 -0
- package/harness-ledger/src/record.mjs +52 -0
- package/harness-ledger/src/waste.mjs +136 -0
- package/harness-ledger/tools/harness-ledger.mjs +199 -0
- package/harness-ledger/tools/validate-economics.mjs +69 -0
- package/harness-ledger/tools/validate-swebench.mjs +57 -0
- package/harness-ledger/tools/validate-tracelab.mjs +74 -0
- package/hybrid-tracing/package.json +4 -3
- package/hybrid-tracing/tools/fix-skew.mjs +1 -1
- package/inference-sizer/README.md +5 -1
- package/inference-sizer/build.mjs +1 -0
- package/inference-sizer/dist/index.html +205 -22
- package/inference-sizer/docs/ACCELERATORS.md +62 -0
- package/inference-sizer/docs/VALIDATION-INFERENCEX.md +37 -0
- package/inference-sizer/package.json +4 -3
- package/inference-sizer/src/accelerators.js +172 -0
- package/inference-sizer/src/catalog.js +7 -20
- package/inference-sizer/src/fit-ui.js +1 -1
- package/inference-sizer/src/index.src.html +3 -0
- package/inference-sizer/src/model.js +22 -1
- package/inference-sizer/tools/validate-agentx.mjs +110 -0
- package/inference-sizer/tools/validate-inferencex.mjs +132 -0
- package/mcp/README.md +6 -1
- package/mcp/server.mjs +34 -0
- package/package.json +9 -4
- package/schemas/README.md +3 -0
- package/schemas/aiinfra.report.schema.json +474 -0
- package/schemas/commands.mjs +14 -0
- package/schemas/fleetops.shadow.canary.schema.json +96 -0
- package/schemas/fleetops.shadow.compare.schema.json +266 -0
- package/schemas/fleetops.shadow.prom.schema.json +354 -0
- package/schemas/harness-ledger.economics.schema.json +567 -0
- package/schemas/sizer.list.schema.json +15 -2
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/* The accelerator registry: every chip the tools know, in one place, and what each vendor's stack needs.
|
|
2
|
+
The Inference Sizer's catalog, FleetScope's GPU table, fleetops' power model and serving manifests all read it, so a
|
|
3
|
+
new chip or vendor is one edit here (plus a gpu-health vendor profile if its exporter is new).
|
|
4
|
+
|
|
5
|
+
ACCELERATORS chips with full spec-sheet figures, usable for sizing and simulation
|
|
6
|
+
id, label, vendor (display), vendorKey (key into VENDORS and gpu-health's vendor profiles), kind (gpu | tpu | …)
|
|
7
|
+
hbmGB, hbmTBs, tfBf16, tfFp8, tfFp4 per chip, dense (sparsity figures halved; rack or system totals divided)
|
|
8
|
+
scaleUpGBs chip-to-chip link, per direction (NVLink, Infinity Fabric, ICI); domain: chips per scale-up domain
|
|
9
|
+
nicGbps scale-out network per chip; nodeKW: max power per domain where the vendor publishes it
|
|
10
|
+
tdpW board power on the spec sheet (TBP/TDP; none for cloud-only chips that don't publish it); match: regex
|
|
11
|
+
for the SKU names telemetry, Kubernetes labels and bills report
|
|
12
|
+
gkeAccelerator GKE's cloud.google.com/gke-tpu-accelerator value, for TPU node selectors
|
|
13
|
+
price, onprem placeholder $/chip-hour (rent, and amortized on-prem cost for FleetScope), not quotes
|
|
14
|
+
short FleetScope's key and short label, where it differs from id; source: spec sheet URL
|
|
15
|
+
OTHER_SKUS chips seen in telemetry but not sized (only power and vendor): id, vendorKey, kind, tdpW, match
|
|
16
|
+
VENDORS per vendor: Kubernetes resource and labels, telemetry tools, collective library, serving images
|
|
17
|
+
INSTANCES cloud instance types → { cloud, chip (registry id or SKU), gpus }, for bills and node labels
|
|
18
|
+
|
|
19
|
+
Order matters for match: more specific names first (GB200 before B200, H100 PCIe before H100). */
|
|
20
|
+
(function (root) {
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
const VENDORS = {
|
|
24
|
+
nvidia: {
|
|
25
|
+
name: 'NVIDIA', kind: 'gpu', k8sResource: 'nvidia.com/gpu', productLabels: ['nvidia.com/gpu.product', 'cloud.google.com/gke-accelerator'],
|
|
26
|
+
smi: 'nvidia-smi', exporter: 'dcgm-exporter', collectives: 'NCCL', kvBufferDevice: 'cuda',
|
|
27
|
+
images: { vllm: 'vllm/vllm-openai', llmdVllm: 'docker.io/vllm/vllm-openai:v0.31.0' },
|
|
28
|
+
},
|
|
29
|
+
amd: {
|
|
30
|
+
name: 'AMD', kind: 'gpu', k8sResource: 'amd.com/gpu', productLabels: ['amd.com/gpu.product-name'],
|
|
31
|
+
smi: 'amd-smi', exporter: 'device-metrics-exporter', collectives: 'RCCL',
|
|
32
|
+
// NIXL's UCX path on ROCm stages the KV cache through host memory in llm-d's P/D guide
|
|
33
|
+
kvBufferDevice: 'cpu',
|
|
34
|
+
images: { vllm: 'rocm/vllm', llmdVllm: 'docker.io/vllm/vllm-openai-rocm:v0.31.0' },
|
|
35
|
+
},
|
|
36
|
+
// Cloud TPU on GKE: chips requested as google.com/tpu, the slice chosen by accelerator and topology node labels.
|
|
37
|
+
// vLLM on TPU: the vllm/vllm-tpu image (GKE's Trillium tutorial). No llm-d P/D image validated for TPU here.
|
|
38
|
+
tpu: {
|
|
39
|
+
name: 'Google Cloud TPU', kind: 'tpu', k8sResource: 'google.com/tpu', productLabels: ['cloud.google.com/gke-tpu-accelerator'],
|
|
40
|
+
topologyLabel: 'cloud.google.com/gke-tpu-topology', smi: 'tpu-info', exporter: 'Cloud Monitoring (accelerator metrics) or libtpu', collectives: 'XLA collectives over ICI',
|
|
41
|
+
images: { vllm: 'vllm/vllm-tpu' },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const A = (o) => Object.assign({ kind: 'gpu', tfFp4: 0 }, o);
|
|
46
|
+
const ACCELERATORS = [
|
|
47
|
+
A({ id: 'GB300-NVL72', short: 'GB300', label: 'NVIDIA GB300 NVL72 (72-GPU rack)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 278, hbmTBs: 8, tfBf16: 2500, tfFp8: 5000, tfFp4: 15000, scaleUpGBs: 900, domain: 72, nicGbps: 800, tdpW: 1400, price: 7.5, onprem: 4.4, match: 'GB300',
|
|
48
|
+
// rack figures ÷ 72: 20 TB HBM, 576 TB/s, 360/720/1080 PFLOPS BF16 (sparse)/FP8 (sparse)/FP4 (dense); board power from InferenceX's chip page
|
|
49
|
+
source: 'https://www.nvidia.com/en-us/data-center/gb300-nvl72/' }),
|
|
50
|
+
A({ id: 'GB200-NVL72', short: 'GB200', label: 'NVIDIA GB200 NVL72 (72-GPU rack)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 186, hbmTBs: 8, tfBf16: 2500, tfFp8: 5000, tfFp4: 10000, scaleUpGBs: 900, domain: 72, nicGbps: 400, nodeKW: 120, tdpW: 1200, price: 6.0, onprem: 3.6, match: 'GB200',
|
|
51
|
+
source: 'https://www.nvidia.com/en-us/data-center/gb200-nvl72/' }),
|
|
52
|
+
A({ id: 'B300', label: 'NVIDIA B300 (HGX, 8-GPU)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 262, hbmTBs: 8, tfBf16: 2250, tfFp8: 4500, tfFp4: 13500, scaleUpGBs: 900, domain: 8, nicGbps: 800, nodeKW: 14.5, tdpW: 1100, price: 7.0, onprem: 4.0, match: 'B300',
|
|
53
|
+
source: 'https://www.nvidia.com/en-us/data-center/hgx/' }),
|
|
54
|
+
A({ id: 'B200', label: 'NVIDIA B200 (HGX, 8-GPU)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 180, hbmTBs: 8, tfBf16: 2250, tfFp8: 4500, tfFp4: 9000, scaleUpGBs: 900, domain: 8, nicGbps: 400, nodeKW: 14.3, tdpW: 1000, price: 5.5, onprem: 3.2, match: 'B200',
|
|
55
|
+
source: 'https://www.nvidia.com/en-us/data-center/dgx-b200/' }),
|
|
56
|
+
A({ id: 'H200', label: 'NVIDIA H200 SXM (8-GPU)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 141, hbmTBs: 4.8, tfBf16: 989, tfFp8: 1979, scaleUpGBs: 450, domain: 8, nicGbps: 400, nodeKW: 10.2, tdpW: 700, price: 3.5, onprem: 2.0, match: 'H200',
|
|
57
|
+
source: 'https://www.nvidia.com/en-us/data-center/h200/' }),
|
|
58
|
+
A({ id: 'H100', label: 'NVIDIA H100 SXM (8-GPU)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 80, hbmTBs: 3.35, tfBf16: 989, tfFp8: 1979, scaleUpGBs: 450, domain: 8, nicGbps: 400, nodeKW: 10.2, tdpW: 700, price: 2.4, onprem: 1.4, match: 'H100(?!.*PCIe)|H800',
|
|
59
|
+
source: 'https://www.nvidia.com/en-us/data-center/h100/' }),
|
|
60
|
+
A({ id: 'A100', label: 'NVIDIA A100 80GB SXM (8-GPU)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 80, hbmTBs: 2.0, tfBf16: 312, tfFp8: 0, scaleUpGBs: 300, domain: 8, nicGbps: 200, nodeKW: 6.5, tdpW: 400, price: 1.6, onprem: 0.9, match: 'A100(?!.*PCIe)|A800',
|
|
61
|
+
source: 'https://www.nvidia.com/en-us/data-center/a100/' }),
|
|
62
|
+
A({ id: 'L40S', label: 'NVIDIA L40S (PCIe, 8 per server)', vendor: 'NVIDIA', vendorKey: 'nvidia', hbmGB: 48, hbmTBs: 0.864, tfBf16: 362, tfFp8: 733, scaleUpGBs: 32, domain: 8, nicGbps: 200, nodeKW: 5, tdpW: 350, price: 1.1, onprem: 0.7, match: 'L40S',
|
|
63
|
+
source: 'https://www.nvidia.com/en-us/data-center/l40s/' }),
|
|
64
|
+
A({ id: 'MI355X', label: 'AMD Instinct MI355X (8-GPU)', vendor: 'AMD', vendorKey: 'amd', hbmGB: 288, hbmTBs: 8, tfBf16: 2516.6, tfFp8: 5033.2, tfFp4: 10066.3, scaleUpGBs: 504, domain: 8, nicGbps: 400, tdpW: 1400, price: 4.5, onprem: 2.6, match: 'MI355',
|
|
65
|
+
// Infinity Fabric: 7 links × 144 GB/s (bidirectional) = 504 GB/s per direction
|
|
66
|
+
source: 'https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html' }),
|
|
67
|
+
A({ id: 'MI325X', label: 'AMD Instinct MI325X (8-GPU)', vendor: 'AMD', vendorKey: 'amd', hbmGB: 256, hbmTBs: 6, tfBf16: 1307.4, tfFp8: 2614.9, scaleUpGBs: 448, domain: 8, nicGbps: 400, tdpW: 1000, price: 2.9, onprem: 1.7, match: 'MI325',
|
|
68
|
+
// platform peer-to-peer I/O 896 GB/s bidirectional = 448 GB/s per direction
|
|
69
|
+
source: 'https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html' }),
|
|
70
|
+
// Cloud TPU: per chip, from cloud.google.com/tpu/docs (v6e, tpu7x pages). ICI figures are bidirectional there, halved
|
|
71
|
+
// here. domain = chips per TPU VM host; ICI across hosts in a slice is modelled as the data-center network, so
|
|
72
|
+
// tensor parallelism beyond one host is costed pessimistically. Prices: on-demand $/chip-hour, us-east1/us-central1.
|
|
73
|
+
A({ id: 'TPU7x', label: 'Google TPU7x (Ironwood), 4 per host', vendor: 'Google', vendorKey: 'tpu', kind: 'tpu', hbmGB: 192, hbmTBs: 7.37, tfBf16: 2307, tfFp8: 4614, scaleUpGBs: 600, domain: 4, nicGbps: 100, price: 12.0, gkeAccelerator: 'tpu7x', match: 'tpu7x|ironwood|TpuV7',
|
|
74
|
+
source: 'https://docs.cloud.google.com/tpu/docs/tpu7x' }),
|
|
75
|
+
A({ id: 'TPU-v6e', short: 'v6e', label: 'Google TPU v6e (Trillium), 8 per host', vendor: 'Google', vendorKey: 'tpu', kind: 'tpu', hbmGB: 32, hbmTBs: 1.64, tfBf16: 918, tfFp8: 918, scaleUpGBs: 400, domain: 8, nicGbps: 100, price: 2.7, gkeAccelerator: 'tpu-v6e-slice', match: 'v6e|trillium',
|
|
76
|
+
source: 'https://docs.cloud.google.com/tpu/docs/v6e' }),
|
|
77
|
+
A({ id: 'TPU-v5p', short: 'v5p', label: 'Google TPU v5p, 4 per host', vendor: 'Google', vendorKey: 'tpu', kind: 'tpu', hbmGB: 102, hbmTBs: 2.765, tfBf16: 459, tfFp8: 459, scaleUpGBs: 600, domain: 4, nicGbps: 50, price: 4.2, gkeAccelerator: 'tpu-v5p-slice', match: 'v5p',
|
|
78
|
+
// 95 GiB HBM per chip
|
|
79
|
+
source: 'https://docs.cloud.google.com/tpu/docs/tpu7x' }),
|
|
80
|
+
A({ id: 'MI300X', label: 'AMD Instinct MI300X (8-GPU)', vendor: 'AMD', vendorKey: 'amd', hbmGB: 192, hbmTBs: 5.3, tfBf16: 1307, tfFp8: 2615, scaleUpGBs: 448, domain: 8, nicGbps: 400, nodeKW: 10, tdpW: 750, price: 2.6, onprem: 1.5, match: 'MI300X',
|
|
81
|
+
source: 'https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html' }),
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const OTHER_SKUS = [
|
|
85
|
+
{ id: 'H100-PCIe', vendorKey: 'nvidia', kind: 'gpu', tdpW: 350, match: 'H100.*PCIe' },
|
|
86
|
+
{ id: 'H20', vendorKey: 'nvidia', kind: 'gpu', tdpW: 400, match: 'H20\\b' },
|
|
87
|
+
{ id: 'A100-PCIe', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'A100.*PCIe' },
|
|
88
|
+
{ id: 'A100-40GB', vendorKey: 'nvidia', kind: 'gpu', tdpW: 400, match: 'A100.*40\\s?GB' },
|
|
89
|
+
{ id: 'A10G', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'A10G' },
|
|
90
|
+
{ id: 'L4', vendorKey: 'nvidia', kind: 'gpu', tdpW: 72, match: 'L4\\b' },
|
|
91
|
+
{ id: 'A10', vendorKey: 'nvidia', kind: 'gpu', tdpW: 150, match: 'A10\\b' },
|
|
92
|
+
{ id: 'T4', vendorKey: 'nvidia', kind: 'gpu', tdpW: 70, match: 'T4\\b' },
|
|
93
|
+
{ id: 'V100', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'V100' },
|
|
94
|
+
{ id: 'MI350X', vendorKey: 'amd', kind: 'gpu', tdpW: 1000, match: 'MI350' },
|
|
95
|
+
{ id: 'MI250', vendorKey: 'amd', kind: 'gpu', tdpW: 560, match: 'MI250' },
|
|
96
|
+
{ id: 'TPU-v5e', vendorKey: 'tpu', kind: 'tpu', match: 'v5e|v5-?lite' },
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
// ---------- cloud instance types ----------
|
|
100
|
+
// AWS: docs.aws.amazon.com/AWSEC2/latest/UserGuide/accelerated-computing-instances.html and aws.amazon.com/ec2/instance-types/p6/
|
|
101
|
+
const INSTANCES = {};
|
|
102
|
+
const add = (cloud, chip, list) => { for (const [type, gpus] of list) INSTANCES[type] = { cloud, chip, gpus }; };
|
|
103
|
+
const sizes = (fam, one, more) => one.map(s => [`${fam}.${s}`, 1]).concat(more.map(([s, n]) => [`${fam}.${s}`, n]));
|
|
104
|
+
add('aws', 'A100-40GB', [['p4d.24xlarge', 8]]);
|
|
105
|
+
add('aws', 'A100', [['p4de.24xlarge', 8]]);
|
|
106
|
+
add('aws', 'H100', [['p5.4xlarge', 1], ['p5.48xlarge', 8]]);
|
|
107
|
+
add('aws', 'H200', [['p5e.48xlarge', 8], ['p5en.48xlarge', 8]]);
|
|
108
|
+
add('aws', 'B200', [['p6-b200.48xlarge', 8]]);
|
|
109
|
+
add('aws', 'B300', [['p6-b300.48xlarge', 8]]);
|
|
110
|
+
add('aws', 'GB200-NVL72', [['p6e-gb200.36xlarge', 4]]); // sold as UltraServers of 36 or 72 GPUs (u-p6e-gb200x36, x72)
|
|
111
|
+
add('aws', 'L40S', sizes('g6e', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
|
|
112
|
+
add('aws', 'L4', sizes('g6', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
|
|
113
|
+
add('aws', 'A10G', sizes('g5', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
|
|
114
|
+
add('aws', 'T4', sizes('g4dn', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['metal', 8]]));
|
|
115
|
+
// GCP: docs.cloud.google.com/compute/docs/gpus and /compute/docs/tpus/tpu-machines; GKE TPU machine types
|
|
116
|
+
const gpuN = (fam, chip, ns) => add('gcp', chip, ns.map(n => [`${fam}-${n}g`, n]));
|
|
117
|
+
gpuN('a2-highgpu', 'A100-40GB', [1, 2, 4, 8]); add('gcp', 'A100-40GB', [['a2-megagpu-16g', 16]]);
|
|
118
|
+
gpuN('a2-ultragpu', 'A100', [1, 2, 4, 8]);
|
|
119
|
+
gpuN('a3-highgpu', 'H100', [1, 2, 4, 8]); add('gcp', 'H100', [['a3-megagpu-8g', 8], ['a3-edgegpu-8g', 8]]);
|
|
120
|
+
add('gcp', 'H200', [['a3-ultragpu-8g', 8]]);
|
|
121
|
+
add('gcp', 'B200', [['a4-highgpu-8g', 8]]);
|
|
122
|
+
add('gcp', 'GB200-NVL72', [['a4x-highgpu-4g', 4]]);
|
|
123
|
+
add('gcp', 'L4', [4, 8, 12, 16, 32].map(n => [`g2-standard-${n}`, 1]).concat([['g2-standard-24', 2], ['g2-standard-48', 4], ['g2-standard-96', 8]]));
|
|
124
|
+
add('gcp', 'TPU-v6e', [['ct6e-standard-1t', 1], ['ct6e-standard-4t', 4], ['ct6e-standard-8t', 8]]);
|
|
125
|
+
add('gcp', 'TPU-v5p', [['ct5p-hightpu-4t', 4]]);
|
|
126
|
+
add('gcp', 'TPU7x', [['tpu7x-standard-4t', 4]]);
|
|
127
|
+
add('gcp', 'TPU-v5e', [['ct5lp-hightpu-1t', 1], ['ct5lp-hightpu-4t', 4], ['ct5lp-hightpu-8t', 8]]);
|
|
128
|
+
const instanceOf = type => INSTANCES[String(type || '').toLowerCase()] || null;
|
|
129
|
+
// TPU slice topology for a chip count: 2D (v5e, v6e) or 3D torus (v4, v5p, 7x), as GKE's node selector wants it
|
|
130
|
+
const TOPO2 = { 1: '1x1', 4: '2x2', 8: '2x4', 16: '4x4', 32: '4x8', 64: '8x8', 128: '8x16', 256: '16x16' };
|
|
131
|
+
const TOPO3 = { 4: '2x2x1', 8: '2x2x2', 16: '2x2x4', 32: '2x4x4', 64: '4x4x4' };
|
|
132
|
+
function tpuTopology(chip, chips) { const a = byId(chip) || match(chip); if (!a) return null; return (/v6e|v5e/i.test(a.id) ? TOPO2 : TOPO3)[chips] || null; }
|
|
133
|
+
|
|
134
|
+
// telemetry SKU string ("NVIDIA H100 80GB HBM3", "AMD Instinct MI300X", …) → registry entry, most specific first
|
|
135
|
+
const ORDER = (() => {
|
|
136
|
+
const all = ACCELERATORS.concat(OTHER_SKUS).map(x => ({ x, re: new RegExp(x.match, 'i') }));
|
|
137
|
+
// a PCIe or 40 GB variant before its sibling; otherwise registry order (which lists GB* before B*)
|
|
138
|
+
const first = a => /PCIe|40GB/.test(a.x.id);
|
|
139
|
+
return all.filter(first).concat(all.filter(a => !first(a)));
|
|
140
|
+
})();
|
|
141
|
+
function match(sku) {
|
|
142
|
+
const s = String(sku || '');
|
|
143
|
+
if (!s) return null;
|
|
144
|
+
const exact = ACCELERATORS.concat(OTHER_SKUS).find(x => x.id.toLowerCase() === s.toLowerCase() || (x.short && x.short.toLowerCase() === s.toLowerCase()));
|
|
145
|
+
if (exact) return exact;
|
|
146
|
+
const hit = ORDER.find(a => a.re.test(s));
|
|
147
|
+
return hit ? hit.x : null;
|
|
148
|
+
}
|
|
149
|
+
const byId = id => ACCELERATORS.find(x => x.id === id || x.short === id) || null;
|
|
150
|
+
const tdpOf = sku => { const m = match(sku); return m ? m.tdpW : null; };
|
|
151
|
+
// vendor key for an entry, a SKU string or a display vendor ("AMD"); null when unknown
|
|
152
|
+
function vendorKeyOf(x) {
|
|
153
|
+
if (!x) return null;
|
|
154
|
+
if (typeof x === 'object') return x.vendorKey || vendorKeyOf(x.vendor) || vendorKeyOf(x.id);
|
|
155
|
+
const s = String(x).toLowerCase();
|
|
156
|
+
if (VENDORS[s]) return s;
|
|
157
|
+
const v = Object.keys(VENDORS).find(k => VENDORS[k].name.toLowerCase() === s);
|
|
158
|
+
if (v) return v;
|
|
159
|
+
const m = match(x);
|
|
160
|
+
return m ? m.vendorKey : null;
|
|
161
|
+
}
|
|
162
|
+
// the vendor's deployment adapter; throws with the known vendors when there is none
|
|
163
|
+
function vendor(x) {
|
|
164
|
+
const k = vendorKeyOf(x);
|
|
165
|
+
if (!k || !VENDORS[k]) throw new Error(`no vendor adapter for ${typeof x === 'object' ? (x.id || x.vendor) : x}; known: ${Object.keys(VENDORS).join(', ')}`);
|
|
166
|
+
return Object.assign({ key: k }, VENDORS[k]);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const api = { VENDORS, ACCELERATORS, OTHER_SKUS, INSTANCES, instanceOf, tpuTopology, match, byId, tdpOf, vendorKeyOf, vendor };
|
|
170
|
+
if (typeof module !== 'undefined' && module.exports) module.exports = api;
|
|
171
|
+
else root.AIInfraAccelerators = api;
|
|
172
|
+
})(typeof globalThis !== 'undefined' ? globalThis : this);
|
|
@@ -45,26 +45,13 @@
|
|
|
45
45
|
];
|
|
46
46
|
|
|
47
47
|
// ---------- built-in GPUs ----------
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{ id: 'GB200-NVL72', label: 'NVIDIA GB200 NVL72 (72-GPU rack)', vendor: 'NVIDIA', hbmGB: 186, hbmTBs: 8, tfBf16: 2500, tfFp8: 5000, tfFp4: 10000, scaleUpGBs: 900, domain: 72, nicGbps: 400, nodeKW: 120, price: 6.0,
|
|
56
|
-
source: 'https://www.nvidia.com/en-us/data-center/gb200-nvl72/' },
|
|
57
|
-
{ id: 'H200', label: 'NVIDIA H200 SXM (8-GPU)', vendor: 'NVIDIA', hbmGB: 141, hbmTBs: 4.8, tfBf16: 989, tfFp8: 1979, tfFp4: 0, scaleUpGBs: 450, domain: 8, nicGbps: 400, nodeKW: 10.2, price: 3.5,
|
|
58
|
-
source: 'https://www.nvidia.com/en-us/data-center/h200/' },
|
|
59
|
-
{ id: 'H100', label: 'NVIDIA H100 SXM (8-GPU)', vendor: 'NVIDIA', hbmGB: 80, hbmTBs: 3.35, tfBf16: 989, tfFp8: 1979, tfFp4: 0, scaleUpGBs: 450, domain: 8, nicGbps: 400, nodeKW: 10.2, price: 2.4,
|
|
60
|
-
source: 'https://www.nvidia.com/en-us/data-center/h100/' },
|
|
61
|
-
{ id: 'A100', label: 'NVIDIA A100 80GB SXM (8-GPU)', vendor: 'NVIDIA', hbmGB: 80, hbmTBs: 2.0, tfBf16: 312, tfFp8: 0, tfFp4: 0, scaleUpGBs: 300, domain: 8, nicGbps: 200, nodeKW: 6.5, price: 1.6,
|
|
62
|
-
source: 'https://www.nvidia.com/en-us/data-center/a100/' },
|
|
63
|
-
{ id: 'L40S', label: 'NVIDIA L40S (PCIe, 8 per server)', vendor: 'NVIDIA', hbmGB: 48, hbmTBs: 0.864, tfBf16: 362, tfFp8: 733, tfFp4: 0, scaleUpGBs: 32, domain: 8, nicGbps: 200, nodeKW: 5, price: 1.1,
|
|
64
|
-
source: 'https://www.nvidia.com/en-us/data-center/l40s/' },
|
|
65
|
-
{ id: 'MI300X', label: 'AMD Instinct MI300X (8-GPU)', vendor: 'AMD', hbmGB: 192, hbmTBs: 5.3, tfBf16: 1307, tfFp8: 2615, tfFp4: 0, scaleUpGBs: 448, domain: 8, nicGbps: 400, nodeKW: 10, price: 2.6,
|
|
66
|
-
source: 'https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html' },
|
|
67
|
-
];
|
|
48
|
+
// From the shared accelerator registry (accelerators.js): per-GPU dense figures, HGX/DGX system totals divided by 8
|
|
49
|
+
// (or 72 for NVL72), "with sparsity" figures halved. Prices are placeholder on-demand rents, not quotes.
|
|
50
|
+
const REG = (typeof module !== 'undefined' && module.exports) ? require('./accelerators.js') : root.AIInfraAccelerators;
|
|
51
|
+
const ORDER = ['B200', 'B300', 'GB200-NVL72', 'GB300-NVL72', 'H200', 'H100', 'A100', 'L40S', 'MI300X', 'MI325X', 'MI355X', 'TPU7x', 'TPU-v6e', 'TPU-v5p'];
|
|
52
|
+
const KEEP = ['id', 'kind', 'vendorKey', 'gkeAccelerator', 'tdpW'].concat(GPU_FIELDS.map(f => f.k)); // tdpW: board power, for tokens per MW
|
|
53
|
+
const GPUS = REG.ACCELERATORS.slice().sort((a, b) => (ORDER.indexOf(a.id) + 1 || 99) - (ORDER.indexOf(b.id) + 1 || 99))
|
|
54
|
+
.map(g => Object.fromEntries(KEEP.filter(k => g[k] !== undefined).map(k => [k, g[k]])));
|
|
68
55
|
|
|
69
56
|
// ---------- built-in models ----------
|
|
70
57
|
const MLA = { attn: 'mla', kvHeads: 1, headDim: 128, mlaLatent: 512, mlaRope: 64, mlaNope: 128, mlaV: 128 };
|
|
@@ -83,7 +83,7 @@ function detailHTML() {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function schedule() { clearTimeout(timer); timer = setTimeout(() => { save(st); run(); }, 120); }
|
|
86
|
-
function onInput(e) { const k = e.target.dataset.k; if (!k) return; st[k] = e.target.type === 'number' ? (e.target.value === '' ? '' : +e.target.value) : e.target.value;
|
|
86
|
+
function onInput(e) { const k = e.target.dataset.k; if (!k) return; st[k] = e.target.type === 'number' ? (e.target.value === '' ? '' : +e.target.value) : e.target.value; schedule(); }
|
|
87
87
|
function pick(m) { st.pick = st.pick === m ? null : m; save(st); render(); const d = document.getElementById('fit-detail'); if (st.pick && d) d.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); }
|
|
88
88
|
|
|
89
89
|
function show(view) {
|
|
@@ -291,6 +291,27 @@
|
|
|
291
291
|
return { rows, best };
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
// The operating point of one fixed layout at a fixed concurrency: what an engine running config c with B sequences
|
|
295
|
+
// in flight delivers, by the same physics sizeAgg uses (each step carries the decode batch plus prefill chunks; the
|
|
296
|
+
// prefill share fp slows the compute part). For checking the model against measured runs (e.g. InferenceX):
|
|
297
|
+
// returns TPOT, TTFT, and output tokens/s per GPU.
|
|
298
|
+
function operatingPoint(s, md, c, B) {
|
|
299
|
+
const st = decodeStep(s, md, c, B), ps = prefillStats(s, md, c), osl = s.avgOut, isl = Math.min(s.avgIn, s.ctx);
|
|
300
|
+
let tpot = st.t, ttft = ps.Sbatch, fp = 0;
|
|
301
|
+
for (let i = 0; i < 50; i++) {
|
|
302
|
+
const lam = B / (osl * tpot + ttft); // requests/s through this instance
|
|
303
|
+
fp = Math.min(0.95, lam * isl / ps.cap); // share of compute spent on prefill
|
|
304
|
+
const t = Math.max(st.tm, st.tc / (1 - fp)) * 1.1 + st.comm + st.ovh;
|
|
305
|
+
// a new prompt is prefilled in chunks between decode steps: its share of each step is what decode leaves
|
|
306
|
+
const free = Math.max(0.05, 1 - Math.max(st.tm, st.tc) / t);
|
|
307
|
+
const tt = prefillTime(s, md, c, isl, 0, 1) / free + mdWait(Math.min(0.85, fp), isl / ps.cap) + t;
|
|
308
|
+
if (Math.abs(t - tpot) < 1e-7 && Math.abs(tt - ttft) < 1e-6) { tpot = t; ttft = tt; break; }
|
|
309
|
+
tpot = t; ttft = tt;
|
|
310
|
+
}
|
|
311
|
+
const outPerGpu = B * osl / (osl * tpot + ttft) / c.g;
|
|
312
|
+
return { tpot, ttft, outPerGpu, prefillShare: fp, bound: st.bound, step: st };
|
|
313
|
+
}
|
|
314
|
+
|
|
294
315
|
// Nodes (scale-up domains) needed: instances that span domains take whole domains; smaller ones pack first-fit-decreasing.
|
|
295
316
|
function packNodes(pools, D) {
|
|
296
317
|
const items = [];
|
|
@@ -355,6 +376,6 @@
|
|
|
355
376
|
return res;
|
|
356
377
|
}
|
|
357
378
|
|
|
358
|
-
const api = { SETTINGS, plan, derive, kvBytes, decodeStep, memInfo, prefillStats, configs, computeLoad, decodeLabel, prefillLabel, decodeCap, packNodes };
|
|
379
|
+
const api = { SETTINGS, plan, derive, kvBytes, decodeStep, memInfo, prefillStats, prefillTime, configs, computeLoad, decodeLabel, prefillLabel, decodeCap, packNodes, operatingPoint };
|
|
359
380
|
if (typeof module !== 'undefined' && module.exports) module.exports = api; else root.SizerModel = api;
|
|
360
381
|
})(this);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The Inference Sizer against SemiAnalysis AgentX: agentic multi-turn traffic (long contexts, ~95% prefix-cache hits,
|
|
3
|
+
// subagent bursts) measured on real GPUs. For each AgentX result the sizer predicts the same layout at the same load
|
|
4
|
+
// (calls in flight from the measured rate and latency, Little's law), with the prompt, output and cache hit the run
|
|
5
|
+
// recorded, and is scored on TPOT and output tokens/s per GPU. With --fit it also fits the sizer's efficiencies per GPU
|
|
6
|
+
// on one part of the results and scores the rest.
|
|
7
|
+
//
|
|
8
|
+
// node tools/validate-agentx.mjs --results DIR|FILE… [--models map.json] [--hf-config ID=config.json] [--fit] [--markdown|--json]
|
|
9
|
+
//
|
|
10
|
+
// Results: AgentX aggregate JSON as InferenceX writes it (infx/results/agentic: hw, model, framework, precision, conc,
|
|
11
|
+
// tp, ep, dp_attention, num_gpus, disagg, request_metrics.{tokens, latency, throughput.per_gpu, qps, cache},
|
|
12
|
+
// server_metrics.cache), one per file or as an array. They are not in this repository: download them from InferenceX.
|
|
13
|
+
// Models: AgentX names models by prefix (dsv4, glm5.3, kimi-k3…). --models maps a prefix to a sizer model id; a model
|
|
14
|
+
// the catalog lacks can be added from its Hugging Face config.json with --hf-config ID=path.
|
|
15
|
+
import fs from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { createRequire } from 'node:module';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
import { GPU, summary } from './validate-inferencex.mjs';
|
|
20
|
+
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
const C = require('../src/catalog.js'), M = require('../src/model.js');
|
|
23
|
+
|
|
24
|
+
export const MODELS = { dsr1: 'deepseek-v3', dsv3: 'deepseek-v3', 'kimi-k2': 'kimi-k2', 'qwen3-235b': 'qwen3-235b', 'qwen3-coder': 'qwen3-coder-480b', 'gpt-oss-120b': 'gpt-oss-120b', llama4: 'llama4-maverick' };
|
|
25
|
+
const get = (o, p) => p.split('.').reduce((a, k) => (a == null ? undefined : a[k]), o);
|
|
26
|
+
const firstNum = (o, ps) => { for (const p of ps) { const v = get(o, p); const n = typeof v === 'object' && v ? (v.mean ?? v.avg ?? v.median ?? v.p50) : v; if (Number.isFinite(+n) && n !== null && n !== '') return +n; } return null; };
|
|
27
|
+
|
|
28
|
+
// One AgentX result → the fields the sizer needs (null when the result can't be scored)
|
|
29
|
+
export function normalize(r, models = MODELS, catalog = C.MODELS) {
|
|
30
|
+
const hw = String(r.hw || r.hardware || '').toLowerCase().replace(/-(nv|sxm|oam).*$/, '');
|
|
31
|
+
const prefix = String(r.infmax_model_prefix || r.model || '').toLowerCase();
|
|
32
|
+
const key = Object.keys(models).sort((a, b) => b.length - a.length).find(k => prefix.startsWith(k.toLowerCase()));
|
|
33
|
+
const model = key && catalog.find(m => m.id === models[key]), gpu = C.GPUS.find(g => g.id === GPU[hw]);
|
|
34
|
+
const rm = r.request_metrics || r.metrics || {};
|
|
35
|
+
const tpot = firstNum(rm, ['latency.tpot.median', 'latency.tpot.p50', 'latency.tpot', 'median_tpot']);
|
|
36
|
+
const ttft = firstNum(rm, ['latency.ttft.median', 'latency.ttft.p50', 'latency.ttft', 'median_ttft']);
|
|
37
|
+
const e2e = firstNum(rm, ['latency.e2el.mean', 'latency.e2el.median', 'latency.e2el', 'mean_e2el']);
|
|
38
|
+
const qps = firstNum(rm, ['qps.mean', 'qps', 'mean_qps']);
|
|
39
|
+
const isl = firstNum(rm, ['tokens.input', 'tokens.input_tokens', 'mean_isl']), osl = firstNum(rm, ['tokens.output_actual', 'tokens.output', 'mean_osl']);
|
|
40
|
+
const outPerGpu = firstNum(rm, ['throughput.per_gpu.output_tput_tps', 'output_tput_per_gpu']);
|
|
41
|
+
const hit = firstNum(r, ['server_metrics.cache.gpu_cache_hit_rate', 'request_metrics.cache.theoretical_cache_hit_rate', 'cache_hit_rate']);
|
|
42
|
+
const tp = +(r.decode_tp || r.tp || r.num_gpus || 0), why = [];
|
|
43
|
+
if (!gpu) why.push(`GPU ${r.hw || r.hardware}`); if (!model) why.push(`model ${prefix}`); if (r.disagg) why.push('disaggregated'); if (r.is_multinode) why.push('multi-node');
|
|
44
|
+
if (!(tpot > 0 && outPerGpu > 0 && qps > 0 && e2e > 0 && isl > 0 && osl > 0)) why.push('metrics');
|
|
45
|
+
if (why.length) return { skip: why.join(', ') };
|
|
46
|
+
// seconds, unless the value only makes sense in milliseconds (a TPOT over 5 s, a TTFT or call over 10 minutes)
|
|
47
|
+
const tpotS = tpot > 5 ? tpot / 1000 : tpot, ttftS = ttft != null ? (ttft > 60 ? ttft / 1000 : ttft) : null, e2eS = e2e > 600 ? e2e / 1000 : e2e;
|
|
48
|
+
return { hardware: hw, gpu: gpu.id, model: model.id, prefix, framework: r.framework, precision: r.precision || model.wprec, tp: tp || gpu.domain || 8, dpAttention: !!(r.dp_attention || r.decode_dp_attention),
|
|
49
|
+
conc: +r.conc, inflight: Math.max(1, qps * e2eS), isl, osl, prefixHit: hit != null ? 100 * (hit > 1 ? hit / 100 : hit) : 0, metrics: { tpot: tpotS, ttft: ttftS, outPerGpu } };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function predict(x, over, catalog = C.MODELS) {
|
|
53
|
+
const g = C.GPUS.find(v => v.id === x.gpu), m = catalog.find(v => v.id === x.model);
|
|
54
|
+
const s = Object.assign({}, M.SETTINGS, m, g, { wprec: x.precision, kvprec: 'fp8', avgIn: x.isl, peakIn: x.isl, avgOut: x.osl, peakOut: x.osl, ctx: Math.max(x.isl + x.osl, m.maxCtx || 0), prefixHit: x.prefixHit }, over || {});
|
|
55
|
+
// calls in flight per instance: the run's in-flight calls spread over its instances
|
|
56
|
+
const inst = Math.max(1, Math.round((x.numGpus || x.tp) / x.tp));
|
|
57
|
+
return M.operatingPoint(s, M.derive(s), { g: x.tp, kind: x.dpAttention ? 'DPEP' : 'TPEP', pp: 1, tpl: x.tp }, Math.max(1, Math.round(x.inflight / inst)));
|
|
58
|
+
}
|
|
59
|
+
const lerr = (p, m) => Math.log(p / m);
|
|
60
|
+
const score = (xs, over, cat) => xs.map(x => { const p = predict(x, typeof over === 'function' ? over(x) : over, cat); return { x, tpot: lerr(p.tpot, x.metrics.tpot), thr: lerr(p.outPerGpu, x.metrics.outPerGpu), ttft: x.metrics.ttft ? lerr(p.ttft, x.metrics.ttft) : 0 }; });
|
|
61
|
+
const GRID = []; for (const effDecodeBW of [0.4, 0.55, 0.7, 0.85]) for (const effDecodeComp of [0.03, 0.06, 0.1, 0.2, 0.35]) for (const stepMs of [1.5, 4, 8, 14]) for (const effPrefill of [0.05, 0.15, 0.3, 0.5]) GRID.push({ effDecodeBW, effDecodeComp, stepMs, effPrefill });
|
|
62
|
+
export function fit(xs, cat) { let best = null; for (const g of GRID) { const l = score(xs, g, cat).reduce((a, e) => a + e.tpot ** 2 + e.thr ** 2, 0); if (!best || l < best.l) best = { g, l }; } return best && best.g; }
|
|
63
|
+
|
|
64
|
+
export function run(results, opt = {}) {
|
|
65
|
+
const cat = opt.catalog || C.MODELS, models = Object.assign({}, MODELS, opt.models || {});
|
|
66
|
+
const norm = results.map(r => ({ r, x: normalize(r, models, cat) }));
|
|
67
|
+
const xs = norm.filter(n => !n.x.skip).map(n => Object.assign(n.x, { numGpus: +n.r.num_gpus || n.x.tp }));
|
|
68
|
+
const skipped = {}; for (const n of norm) if (n.x.skip) skipped[n.x.skip] = (skipped[n.x.skip] || 0) + 1;
|
|
69
|
+
const res = { results: results.length, scored: xs.length, skipped, overall: xs.length ? { defaults: summary(score(xs, undefined, cat)) } : null, byGpu: {}, byModel: {}, fits: {} };
|
|
70
|
+
for (const gpu of new Set(xs.map(x => x.gpu))) res.byGpu[gpu] = summary(score(xs.filter(x => x.gpu === gpu), undefined, cat));
|
|
71
|
+
for (const m of new Set(xs.map(x => x.model))) res.byModel[m] = summary(score(xs.filter(x => x.model === m), undefined, cat));
|
|
72
|
+
if (opt.fit && xs.length) {
|
|
73
|
+
// fit per GPU on every other concurrency level, score the rest
|
|
74
|
+
const isTrain = x => { const levels = [...new Set(xs.filter(y => y.gpu === x.gpu).map(y => y.conc))].sort((a, b) => a - b); return levels.indexOf(x.conc) % 2 === 0; };
|
|
75
|
+
for (const gpu of new Set(xs.map(x => x.gpu))) { const tr = xs.filter(x => x.gpu === gpu && isTrain(x)); if (tr.length) res.fits[gpu] = fit(tr, cat); }
|
|
76
|
+
const test = xs.filter(x => !isTrain(x) && res.fits[x.gpu]);
|
|
77
|
+
if (test.length) { res.overall.defaultsTest = summary(score(test, undefined, cat)); res.overall.calibratedTest = summary(score(test, x => res.fits[x.gpu], cat)); }
|
|
78
|
+
}
|
|
79
|
+
return res;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const P = x => `${Math.round(x * 100)}%`, B = x => `${x.toFixed(2)}×`;
|
|
83
|
+
export function markdown(R) {
|
|
84
|
+
const row = (n, s) => `| ${n} | ${s.n} | ${P(s.tpot.median)} | ${P(s.tpot.p90)} | ${B(s.tpot.bias)} | ${P(s.thr.median)} | ${P(s.thr.p90)} | ${B(s.thr.bias)} |`;
|
|
85
|
+
const head = '| | Results | TPOT: median error | p90 | predicted ÷ measured | Output tok/s per GPU: median error | p90 | predicted ÷ measured |\n| --- | --- | --- | --- | --- | --- | --- | --- |';
|
|
86
|
+
const L = ['# Inference Sizer against AgentX', '', `${R.scored} of ${R.results} AgentX results scored.${Object.keys(R.skipped).length ? ' Skipped: ' + Object.entries(R.skipped).map(([k, v]) => `${v} (${k})`).join('; ') + '.' : ''}`, '', head];
|
|
87
|
+
if (R.overall) { L.push(row('Sizer defaults', R.overall.defaults)); if (R.overall.calibratedTest) { L.push(row('Defaults, held-out concurrency levels', R.overall.defaultsTest)); L.push(row('**Calibrated per GPU, held-out concurrency levels**', R.overall.calibratedTest)); } }
|
|
88
|
+
L.push('', '| GPU | Results | TPOT error | tok/s error | tok/s predicted ÷ measured |', '| --- | --- | --- | --- | --- |', ...Object.entries(R.byGpu).map(([g, s]) => `| ${g} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`), '');
|
|
89
|
+
return L.join('\n');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function readResults(paths) {
|
|
93
|
+
const out = [];
|
|
94
|
+
const add = j => { if (Array.isArray(j)) j.forEach(add); else if (j && (j.data || j.results) && !j.request_metrics) add(j.data || j.results); else if (j && typeof j === 'object') out.push(j); };
|
|
95
|
+
for (const p of paths) {
|
|
96
|
+
const files = fs.statSync(p).isDirectory() ? fs.readdirSync(p).filter(f => f.endsWith('.json')).map(f => path.join(p, f)) : [p];
|
|
97
|
+
for (const f of files) { try { add(JSON.parse(fs.readFileSync(f, 'utf8'))); } catch (e) { throw new Error(`${f}: ${e.message}`); } }
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
103
|
+
const a = process.argv.slice(2), o = { results: [], hf: [] };
|
|
104
|
+
for (let i = 0; i < a.length; i++) { if (a[i] === '--results') { while (a[i + 1] && !a[i + 1].startsWith('--')) o.results.push(a[++i]); } else if (a[i] === '--hf-config') o.hf.push(a[++i]); else if (a[i] === '--models') o.models = JSON.parse(fs.readFileSync(a[++i], 'utf8')); else o[a[i].replace(/^--/, '')] = true; }
|
|
105
|
+
if (!o.results.length || o.help) { console.log(fs.readFileSync(fileURLToPath(import.meta.url), 'utf8').split('\n').slice(1, 15).map(l => l.replace(/^\/\/ ?/, '')).join('\n')); process.exit(o.results.length ? 0 : 2); }
|
|
106
|
+
const catalog = [...C.MODELS];
|
|
107
|
+
for (const h of o.hf) { const [id, f] = h.split('='); const m = C.fromHFConfig(JSON.parse(fs.readFileSync(f, 'utf8'))).model; catalog.push(Object.assign({}, C.MODEL_DEFAULTS || {}, m, { id })); }
|
|
108
|
+
const R = run(readResults(o.results), { fit: !!o.fit, models: o.models, catalog });
|
|
109
|
+
console.log(o.json ? JSON.stringify(R, null, 1) : o.markdown ? markdown(R) : markdown(R));
|
|
110
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Checks the Inference Sizer against measured runs from InferenceX (SemiAnalysis's open, continuous inference
|
|
3
|
+
// benchmark): for each aggregated, single-node run of a GPU the sizer knows, the sizer predicts time per output token
|
|
4
|
+
// and output tokens/s per GPU for the same layout and concurrency, and compares with what was measured.
|
|
5
|
+
//
|
|
6
|
+
// node inference-sizer/tools/validate-inferencex.mjs [--data benchmarks.json] [--json] [--markdown FILE]
|
|
7
|
+
//
|
|
8
|
+
// Three predictors, so the numbers mean something:
|
|
9
|
+
// roofline the datasheet back-of-envelope: 100% of spec bandwidth and compute, no per-step overhead
|
|
10
|
+
// defaults the sizer as shipped (spec sheet × default efficiencies)
|
|
11
|
+
// calibrated efficiencies fitted per GPU on the 1k-in/1k-out runs, scored only on the 8k/1k and 1k/8k runs
|
|
12
|
+
//
|
|
13
|
+
// Data: a recorded snapshot of the InferenceX public API (the dashboard's test fixture), fetched with git at a pinned
|
|
14
|
+
// commit and checked by SHA-256. It is not copied into this repository (the dashboard repository is GPL-3.0).
|
|
15
|
+
import fs from 'node:fs';
|
|
16
|
+
import os from 'node:os';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import crypto from 'node:crypto';
|
|
19
|
+
import { execFileSync } from 'node:child_process';
|
|
20
|
+
import { createRequire } from 'node:module';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
|
|
23
|
+
const require = createRequire(import.meta.url);
|
|
24
|
+
const C = require('../src/catalog.js'), M = require('../src/model.js');
|
|
25
|
+
|
|
26
|
+
export const SOURCE = {
|
|
27
|
+
repo: 'https://github.com/SemiAnalysisAI/InferenceX-app', commit: '187628924b6ec899b1f3f771617655dd4cd61d8c',
|
|
28
|
+
path: 'packages/app/cypress/fixtures/api/benchmarks.json', sha256: 'f46823a76cb63248705329f327e1494df02b4dfa4df0898b7ee084c75c20bd52',
|
|
29
|
+
};
|
|
30
|
+
export const GPU = { b200: 'B200', b300: 'B300', h200: 'H200', h100: 'H100', mi300x: 'MI300X', mi325x: 'MI325X', mi355x: 'MI355X', gb200: 'GB200-NVL72', gb300: 'GB300-NVL72' };
|
|
31
|
+
const MODEL = { dsr1: 'deepseek-v3' }; // DeepSeek-R1 has DeepSeek-V3's architecture
|
|
32
|
+
|
|
33
|
+
export function fetchData(cache = path.join(os.homedir(), '.cache', 'aiinfra-tools', 'inferencex', SOURCE.commit.slice(0, 12))) {
|
|
34
|
+
const file = path.join(cache, 'benchmarks.json');
|
|
35
|
+
if (!fs.existsSync(file)) {
|
|
36
|
+
const repo = path.join(cache, 'repo'); fs.mkdirSync(repo, { recursive: true });
|
|
37
|
+
const git = (...a) => execFileSync('git', a, { cwd: repo, stdio: 'pipe', env: Object.assign({}, process.env, { GIT_LFS_SKIP_SMUDGE: '1' }), timeout: 600000 });
|
|
38
|
+
if (!fs.existsSync(path.join(repo, '.git'))) { git('init', '-q'); git('remote', 'add', 'origin', SOURCE.repo); }
|
|
39
|
+
git('fetch', '-q', '--depth', '1', '--filter=blob:none', 'origin', SOURCE.commit);
|
|
40
|
+
fs.writeFileSync(file, git('show', `${SOURCE.commit}:${SOURCE.path}`));
|
|
41
|
+
fs.rmSync(repo, { recursive: true, force: true });
|
|
42
|
+
}
|
|
43
|
+
return check(file);
|
|
44
|
+
}
|
|
45
|
+
function check(file) {
|
|
46
|
+
const buf = fs.readFileSync(file), h = crypto.createHash('sha256').update(buf).digest('hex');
|
|
47
|
+
if (h !== SOURCE.sha256) throw new Error(`${file}: SHA-256 ${h} is not the pinned snapshot's ${SOURCE.sha256}`);
|
|
48
|
+
return JSON.parse(buf.toString());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// the same layout and concurrency, predicted by the sizer
|
|
52
|
+
export function predict(r, over) {
|
|
53
|
+
const g = C.GPUS.find(x => x.id === GPU[r.hardware]), m = C.MODELS.find(x => x.id === MODEL[r.model]);
|
|
54
|
+
const s = Object.assign({}, M.SETTINGS, m, g, { wprec: r.precision, kvprec: 'fp8', avgIn: r.isl, peakIn: r.isl, avgOut: r.osl, peakOut: r.osl, ctx: r.isl + r.osl, prefixHit: 0 }, over || {});
|
|
55
|
+
const n = r.decode_tp;
|
|
56
|
+
return M.operatingPoint(s, M.derive(s), { g: n, kind: r.decode_dp_attention ? 'DPEP' : 'TPEP', pp: 1, tpl: n }, r.conc);
|
|
57
|
+
}
|
|
58
|
+
export const usable = rows => rows.filter(r => !r.disagg && !r.is_multinode && GPU[r.hardware] && MODEL[r.model] && r.metrics && r.metrics.median_tpot > 0 && r.metrics.output_tput_per_gpu > 0);
|
|
59
|
+
const ROOF = { effDecodeBW: 1, effDecodeComp: 1, effPrefill: 1, stepMs: 0 };
|
|
60
|
+
const GRID = []; for (const effDecodeBW of [0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) for (const effDecodeComp of [0.02, 0.03, 0.04, 0.06, 0.08, 0.1, 0.15, 0.2, 0.3, 0.45]) for (const stepMs of [1.5, 3, 4.5, 6, 8, 10, 13, 16]) for (const effPrefill of [0.03, 0.05, 0.08, 0.12, 0.2, 0.3, 0.45]) GRID.push({ effDecodeBW, effDecodeComp, stepMs, effPrefill });
|
|
61
|
+
|
|
62
|
+
const lerr = (p, m) => Math.log(p / m); // signed log error: >0 the sizer predicts more than measured
|
|
63
|
+
function score(rs, over) {
|
|
64
|
+
return rs.map(r => { const p = predict(r, typeof over === 'function' ? over(r) : over), m = r.metrics;
|
|
65
|
+
return { r, tpot: lerr(p.tpot, m.median_tpot), thr: lerr(p.outPerGpu, m.output_tput_per_gpu), ttft: lerr(p.ttft, m.median_ttft) }; });
|
|
66
|
+
}
|
|
67
|
+
export function fit(rs) {
|
|
68
|
+
let best = null;
|
|
69
|
+
for (const g of GRID) { const l = score(rs, g).reduce((a, x) => a + x.tpot ** 2 + x.thr ** 2, 0); if (!best || l < best.l) best = { g, l }; }
|
|
70
|
+
return best.g;
|
|
71
|
+
}
|
|
72
|
+
const q = (a, f) => { const s = [...a].sort((x, y) => x - y); return s.length ? s[Math.min(s.length - 1, Math.floor(f * (s.length - 1)))] : NaN; };
|
|
73
|
+
// "off by" as a ratio: exp(|log error|) - 1, so 0.4 means 40% too high or 1.4× too low alike
|
|
74
|
+
export function summary(e) {
|
|
75
|
+
const abs = k => e.map(x => Math.abs(x[k])), sg = k => e.map(x => x[k]);
|
|
76
|
+
const f = x => Math.exp(x) - 1;
|
|
77
|
+
return { n: e.length, tpot: { median: f(q(abs('tpot'), 0.5)), p90: f(q(abs('tpot'), 0.9)), bias: Math.exp(q(sg('tpot'), 0.5)) },
|
|
78
|
+
thr: { median: f(q(abs('thr'), 0.5)), p90: f(q(abs('thr'), 0.9)), bias: Math.exp(q(sg('thr'), 0.5)) }, ttft: { median: f(q(abs('ttft'), 0.5)), bias: Math.exp(q(sg('ttft'), 0.5)) } };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function run(rows) {
|
|
82
|
+
const all = usable(rows), isTrain = r => r.isl === 1024 && r.osl === 1024;
|
|
83
|
+
const train = all.filter(isTrain), test = all.filter(r => !isTrain(r));
|
|
84
|
+
const fits = {}; for (const hw of new Set(train.map(r => r.hardware))) fits[hw] = fit(train.filter(r => r.hardware === hw));
|
|
85
|
+
const cal = r => fits[r.hardware];
|
|
86
|
+
const calTest = test.filter(r => fits[r.hardware]);
|
|
87
|
+
const res = {
|
|
88
|
+
source: SOURCE, rows: rows.length, used: all.length, train: train.length, test: calTest.length,
|
|
89
|
+
dates: [all.map(r => r.date).sort()[0], all.map(r => r.date).sort().pop()],
|
|
90
|
+
overall: { roofline: summary(score(all, ROOF)), defaults: summary(score(all)), defaultsTest: summary(score(calTest)), calibratedTest: summary(score(calTest, cal)), calibratedTrain: summary(score(train, cal)) },
|
|
91
|
+
byGpu: {}, byFramework: {}, byConc: {}, fits,
|
|
92
|
+
};
|
|
93
|
+
for (const hw of new Set(all.map(r => r.hardware))) { const a = all.filter(r => r.hardware === hw), t = calTest.filter(r => r.hardware === hw);
|
|
94
|
+
res.byGpu[hw] = { runs: a.length, defaults: summary(score(a)), calibratedTest: t.length ? summary(score(t, cal)) : null }; }
|
|
95
|
+
for (const fw of new Set(all.map(r => r.framework))) res.byFramework[fw] = summary(score(all.filter(r => r.framework === fw)));
|
|
96
|
+
for (const b of [[1, 8], [16, 32], [64, 1e9]]) res.byConc[`${b[0]}–${b[1] > 1e8 ? '' : b[1]}`] = summary(score(all.filter(r => r.conc >= b[0] && r.conc <= b[1])));
|
|
97
|
+
return res;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const P = x => `${Math.round(x * 100)}%`, B = x => `${x.toFixed(2)}×`;
|
|
101
|
+
export function markdown(R) {
|
|
102
|
+
const row = (name, s) => `| ${name} | ${s.n} | ${P(s.tpot.median)} | ${P(s.tpot.p90)} | ${B(s.tpot.bias)} | ${P(s.thr.median)} | ${P(s.thr.p90)} | ${B(s.thr.bias)} |`;
|
|
103
|
+
const head = '| | Runs | TPOT: median error | p90 | median predicted ÷ measured | Output tok/s per GPU: median error | p90 | median predicted ÷ measured |\n| --- | --- | --- | --- | --- | --- | --- | --- |';
|
|
104
|
+
return [`# Inference Sizer against InferenceX`, '',
|
|
105
|
+
`Generated by \`node inference-sizer/tools/validate-inferencex.mjs --markdown\`. Data: ${R.used} measured runs (aggregated, one node) of DeepSeek-R1 on ${Object.keys(R.byGpu).map(h => GPU[h]).join(', ')}, from a snapshot of the [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) public API (runs dated ${R.dates[0]} to ${R.dates[1]}; [snapshot](${SOURCE.repo}/blob/${SOURCE.commit}/${SOURCE.path}), SHA-256 \`${SOURCE.sha256.slice(0, 16)}…\`). For each run the sizer predicts the same layout (TP, DP-attention) at the same concurrency, input and output lengths and precision.`, '',
|
|
106
|
+
'Error is how far off the prediction is either way, as a ratio: 40% means 1.4× too high or 1.4× too low. "Predicted ÷ measured" says which way: for TPOT, below 1 means the sizer predicts faster tokens than were measured; for throughput, above 1 means it predicts more than was measured. Both are the optimistic direction.', '',
|
|
107
|
+
'## Overall', '', head,
|
|
108
|
+
row('Datasheet roofline (100% of spec, no overhead)', R.overall.roofline),
|
|
109
|
+
row('Sizer defaults', R.overall.defaults),
|
|
110
|
+
row('Sizer defaults, held-out runs only', R.overall.defaultsTest),
|
|
111
|
+
row('**Calibrated per GPU on 1k/1k, scored on 8k/1k and 1k/8k**', R.overall.calibratedTest),
|
|
112
|
+
row('Calibrated, on the runs it was fitted to', R.overall.calibratedTrain), '',
|
|
113
|
+
'## By GPU (sizer defaults; calibrated on held-out runs)', '',
|
|
114
|
+
'| GPU | Runs | Defaults: TPOT error | Defaults: tok/s error | Defaults: tok/s predicted ÷ measured | Calibrated (held out): TPOT error | Calibrated: tok/s error | Fitted efficiencies (decode BW, decode compute, step ms, prefill) |', '| --- | --- | --- | --- | --- | --- | --- | --- |',
|
|
115
|
+
...Object.entries(R.byGpu).map(([h, g]) => { const f = R.fits[h]; return `| ${GPU[h]} | ${g.runs} | ${P(g.defaults.tpot.median)} | ${P(g.defaults.thr.median)} | ${B(g.defaults.thr.bias)} | ${g.calibratedTest ? P(g.calibratedTest.tpot.median) : '–'} | ${g.calibratedTest ? P(g.calibratedTest.thr.median) : '–'} | ${f ? `${f.effDecodeBW}, ${f.effDecodeComp}, ${f.stepMs}, ${f.effPrefill}` : '–'} |`; }), '',
|
|
116
|
+
'## By framework and concurrency (sizer defaults)', '', '| | Runs | TPOT error | tok/s error | tok/s predicted ÷ measured |', '| --- | --- | --- | --- | --- |',
|
|
117
|
+
...Object.entries(R.byFramework).map(([k, s]) => `| ${k} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`),
|
|
118
|
+
...Object.entries(R.byConc).map(([k, s]) => `| concurrency ${k} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`), ''].join('\n');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
122
|
+
const a = process.argv.slice(2), opt = k => { const i = a.indexOf(k); return i >= 0 ? a[i + 1] : undefined; };
|
|
123
|
+
try {
|
|
124
|
+
const rows = opt('--data') ? check(opt('--data')) : fetchData();
|
|
125
|
+
const R = run(rows);
|
|
126
|
+
if (a.includes('--json')) console.log(JSON.stringify(R, null, 1));
|
|
127
|
+
else if (a.includes('--markdown')) { const f = opt('--markdown'); const md = markdown(R); if (f && !f.startsWith('--')) { fs.writeFileSync(f, md); console.log(`wrote ${f}`); } else console.log(md); }
|
|
128
|
+
else { const o = R.overall; const line = (n, s) => console.log(`${n.padEnd(52)} TPOT off by ${P(s.tpot.median)} (p90 ${P(s.tpot.p90)}); tok/s/GPU off by ${P(s.thr.median)} (p90 ${P(s.thr.p90)}); n=${s.n}`);
|
|
129
|
+
console.log(`InferenceX: ${R.used} runs of DeepSeek-R1 on ${Object.keys(R.byGpu).map(h => GPU[h]).join(', ')} (${R.dates[0]} to ${R.dates[1]})`);
|
|
130
|
+
line('datasheet roofline', o.roofline); line('sizer defaults', o.defaults); line('calibrated on 1k/1k, scored on 8k/1k + 1k/8k', o.calibratedTest); }
|
|
131
|
+
} catch (e) { console.error('validate-inferencex: ' + e.message); process.exit(1); }
|
|
132
|
+
}
|
package/mcp/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AIInfraTools as an MCP server
|
|
2
2
|
|
|
3
3
|
Every tool as [Model Context Protocol](https://modelcontextprotocol.io) tools, for any MCP client: Claude Code,
|
|
4
|
-
Claude Desktop, Cursor, VS Code, your own agents. Node.js
|
|
4
|
+
Claude Desktop, Cursor, VS Code, your own agents. Node.js 22+, no dependencies, stdio transport.
|
|
5
5
|
|
|
6
6
|
## Add it
|
|
7
7
|
|
|
@@ -34,6 +34,11 @@ From a clone instead of npm: `"command": "node", "args": ["/path/to/AIInfraTools
|
|
|
34
34
|
| `fleetscope_templates` · `fleetscope_run` · `fleetscope_ask` | simulate a hybrid fleet; plain-English what-ifs | `fleetscope.*` |
|
|
35
35
|
| `gpu_health_analyze` | health problems, idle and underused GPUs, savings; proposals into the approval queue | `gpu-health.analyze` |
|
|
36
36
|
| `ledger_report` · `ledger_insights` | GPU-hours and cost by owner (useful, idle, lost); ranked savings | `ledger.*` |
|
|
37
|
+
| `harness_waste` | where agent harnesses (Claude Code, Codex, OTel, Langfuse) waste tokens and money, by cause, tool and session | – |
|
|
38
|
+
| `infra_report` | plan → verify → account on one page: the sizer's GPU count before and after the store's calibration, the last shadow verdict, canaries awaiting approval, agent economics | `aiinfra.report` |
|
|
39
|
+
| `agent_economics` | cost per resolved agent task, fixes ranked by what they save per resolved task, self-hosting vs the API (break-even GPU-hour price; or OpenCost's measured cost) | `harness-ledger.economics` |
|
|
40
|
+
| `shadow_verdict` | an infra change judged against the baseline at matched load: from store records, or a canary's vLLM metrics in Prometheus; records the verdict, and with a plan refits the sizer's calibration | `fleetops.shadow.compare` / `fleetops.shadow.prom` |
|
|
41
|
+
| `canary_status` | where an llm-d canary stands: share, status, a step waiting for approval (advancing and approving stay with a person) | `fleetops.shadow.canary` |
|
|
37
42
|
| `rca_detect` · `rca_diagnose` | incidents in a window; ranked root causes with evidence | `fleetops.rca.diagnose` |
|
|
38
43
|
| `power_report` · `power_plan` | power against budget; a plan of GPU power caps | `fleetops.power.*` |
|
|
39
44
|
| `fix_trace_skew` | clock offsets and ordering violations in OTLP traces | `fix-skew.demo` |
|
package/mcp/server.mjs
CHANGED
|
@@ -77,6 +77,40 @@ export const TOOLS = [
|
|
|
77
77
|
description: 'Ranked savings (idle timeouts, wrong GPU type, oversized serving, commitments…), each with an owner and how it was worked out.',
|
|
78
78
|
input: { type: 'object', required: ['usage', 'config'], properties: { usage: str('Path to usage.jsonl'), config: str('Path to the ledger config JSON') } },
|
|
79
79
|
cli: i => ['ledger', 'insights', '--usage', i.usage, '--config', i.config, '--json'] },
|
|
80
|
+
{ name: 'harness_waste', title: 'Where agents waste tokens and money', annotations: T,
|
|
81
|
+
description: 'Reads Claude Code transcripts, Codex rollouts, OpenTelemetry GenAI/OpenInference spans or Langfuse exports and reports avoidable tokens and cost by cause (cache misses, oversized and repeated tool output, retry loops, unused tools), harness, tool and session, with fixes. Optional vLLM traces charge self-hosted calls their GPU time. Keeps counts only.',
|
|
82
|
+
input: { type: 'object', required: ['paths'], properties: { paths: str('Files or folders, comma-separated'), prices: str('Price file ($/M tokens per model); examples are used without it'),
|
|
83
|
+
engine: str('vLLM OTLP traces, for GPU time'), replicas: str('Replica GPUs and $/GPU-h (JSON)'), outcomes: str('Session outcomes (JSON or CSV)'), since: str('Only calls after this, e.g. 7d') } },
|
|
84
|
+
cli: i => ['harness-ledger', 'report', ...String(i.paths).split(',').map(s => s.trim()).filter(Boolean)]
|
|
85
|
+
.concat(...[['prices', i.prices], ['engine', i.engine], ['replicas', i.replicas], ['outcomes', i.outcomes], ['since', i.since]].filter(([, v]) => v).map(([k, v]) => [`--${k}`, String(v)]), '--json') },
|
|
86
|
+
{ name: 'agent_economics', title: 'Cost per resolved agent task, and self-host vs API', schema: 'harness-ledger.economics', annotations: T,
|
|
87
|
+
description: 'From agent logs or traces (the same inputs as harness_waste): cost per resolved task, fixes ranked by what they save per resolved task, and, with selfHostModel and gpu, the GPU-hour price under which self-hosting an open model beats the API (sized with the Inference Sizer for the busiest day). opencost uses OpenCost\'s measured cost per token instead. A model, not a purchase recommendation.',
|
|
88
|
+
input: { type: 'object', required: ['paths'], properties: { paths: str('Files or folders, comma-separated'), outcomes: str('Session outcomes (JSON or CSV)'), prices: str('Price file ($/M tokens per model), or "relative"'),
|
|
89
|
+
selfHostModel: str('Open model from the sizer catalog, e.g. deepseek-v3'), gpu: str('GPU from the sizer catalog, e.g. H200'), gpuRate: num('$ per GPU-hour, for the monthly cost and the volume where self-hosting wins'),
|
|
90
|
+
selfHostSuccessRate: num('The open model\'s task success rate (0–1), e.g. from SWE-bench'), opencost: str('OpenCost /inferenceCost/total answer (file) for measured self-host cost'), opencostModel: str('Which OpenCost model to use'),
|
|
91
|
+
calibration: str('Sizer calibration profile (fleetops) for measured efficiencies'), days: num('Days the input covers'), tasksPerDay: num('Volume to plan for') } },
|
|
92
|
+
cli: i => ['harness-ledger', 'economics', ...String(i.paths).split(',').map(s => s.trim()).filter(Boolean)]
|
|
93
|
+
.concat(...[['outcomes', i.outcomes], ['prices', i.prices], ['self-host-model', i.selfHostModel], ['gpu', i.gpu], ['gpu-rate', i.gpuRate], ['self-host-success-rate', i.selfHostSuccessRate],
|
|
94
|
+
['opencost', i.opencost], ['opencost-model', i.opencostModel], ['calibration', i.calibration], ['days', i.days], ['tasks-per-day', i.tasksPerDay]].filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => [`--${k}`, String(v)]), '--json') },
|
|
95
|
+
{ name: 'infra_report', title: 'Plan → verify → account on one page', schema: 'aiinfra.report', annotations: T,
|
|
96
|
+
description: 'One page from what the tools already keep in a fleetops store: the Inference Sizer\'s GPU count for a model on a GPU before and after the store\'s measured calibration, the last shadow verdict (decision, metric effects, prediction vs measurement), the last promotion, each canary\'s share and any step waiting for a person\'s approval, and, with harness (an agent trace, or "demo"), cost per resolved task and self-hosting economics sized with the calibration. Reads only.',
|
|
97
|
+
input: { type: 'object', properties: { store: str('fleetops store folder'), model: str('Model from the sizer catalog, e.g. llama33-70b (defaults to the only calibrated one)'), gpu: str('GPU from the sizer catalog, e.g. H200'),
|
|
98
|
+
harness: str('Agent trace (file or folder) for economics, or "demo"'), outcomes: str('Session outcomes (JSON or CSV)'), gpuRate: num('$ per GPU-hour'), days: num('Days the trace covers'), tasksPerDay: num('Volume to plan for') } },
|
|
99
|
+
cli: i => ['report'].concat(...[['store', i.store], ['model', i.model], ['gpu', i.gpu], ['harness', i.harness], ['outcomes', i.outcomes], ['gpu-rate', i.gpuRate], ['days', i.days], ['tasks-per-day', i.tasksPerDay]]
|
|
100
|
+
.filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => [`--${k}`, String(v)]), '--json') },
|
|
101
|
+
{ name: 'shadow_verdict', title: 'Judge an infra change against the baseline', schema: 'fleetops.shadow.compare', schemaFor: i => (i.prom ? 'fleetops.shadow.prom' : 'fleetops.shadow.compare'), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
102
|
+
description: 'Compares a candidate (new GPUs, engine, config, topology) with the baseline at matched load: promote, roll back or extend, with each metric\'s effect and interval and the naive number beside it. Either request records in a fleetops store (baseline/candidate as field=value selectors), or a canary\'s per-version vLLM metrics in Prometheus (prom with baselineMatchers/candidateMatchers, e.g. llm_isvc_name="chat-v2"). Sends no traffic and changes no rollout; records the verdict in the store, and with plan refits the sizer\'s calibration when the prediction was off.',
|
|
103
|
+
input: { type: 'object', required: ['store'], properties: { store: str('fleetops store folder'),
|
|
104
|
+
baseline: str('Baseline requests in the store, e.g. variant=baseline'), candidate: str('Candidate requests, e.g. variant=candidate'),
|
|
105
|
+
prom: str('Prometheus URL (instead of store records)'), baselineMatchers: str('Prometheus label matchers for the baseline'), candidateMatchers: str('Prometheus label matchers for the candidate'),
|
|
106
|
+
select: str('Matchers both versions share, e.g. namespace="llm"'), lookback: num('Seconds of canary traffic to judge', { default: 3600 }), plan: str('plan.json from shadow plan (prediction vs measurement)') } },
|
|
107
|
+
cli: i => (i.prom
|
|
108
|
+
? opt(opt(opt(['fleetops', 'shadow', 'prom', '--prom', i.prom, '--baseline', i.baselineMatchers || '', '--candidate', i.candidateMatchers || '', '--store', i.store], '--select', i.select), '--lookback', i.lookback), '--plan', i.plan)
|
|
109
|
+
: opt(['fleetops', 'shadow', 'compare', '--baseline', i.baseline || '', '--candidate', i.candidate || '', '--store', i.store], '--plan', i.plan)).concat('--json') },
|
|
110
|
+
{ name: 'canary_status', title: 'Where an llm-d canary stands', schema: 'fleetops.shadow.canary', annotations: T,
|
|
111
|
+
description: 'An llm-d canary driven by the shadow judge: its share of traffic, status, a step waiting for approval, and its history. Read-only: advancing the canary or approving a step is done by a person outside this server.',
|
|
112
|
+
input: { type: 'object', required: ['store', 'name'], properties: { store: str('fleetops store folder'), name: str('Canary name') } },
|
|
113
|
+
cli: i => ['fleetops', 'shadow', 'canary', 'status', '--name', i.name, '--store', i.store, '--json'] },
|
|
80
114
|
{ name: 'rca_diagnose', title: 'Root cause of an incident', schema: 'fleetops.rca.diagnose', annotations: T,
|
|
81
115
|
description: 'Ranks root-cause hypotheses for job failures, a latency regression or device faults in a window, with the evidence for each.',
|
|
82
116
|
input: { type: 'object', required: ['store', 'symptom', 'from', 'to'], properties: { store: str('fleetops store folder'),
|