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.
Files changed (157) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/README.md +14 -3
  3. package/bin/aiinfra.mjs +5 -2
  4. package/bin/report.mjs +177 -0
  5. package/fleetops/README.md +33 -1
  6. package/fleetops/deploy/shadow-gate/argo-analysistemplate.yaml +34 -0
  7. package/fleetops/deploy/shadow-gate/argo-rollout-example.yaml +38 -0
  8. package/fleetops/deploy/shadow-gate/flagger-canary.yaml +34 -0
  9. package/fleetops/deploy/shadow-gate/judge.yaml +51 -0
  10. package/fleetops/deploy/shadow-gate/llmd-canary-example.yaml +35 -0
  11. package/fleetops/deploy/shadow-gate/podmonitor-vllm.yaml +20 -0
  12. package/fleetops/deploy/shadow-live/README.md +33 -0
  13. package/fleetops/deploy/shadow-live/kit.yaml +121 -0
  14. package/fleetops/deploy/shadow-live/load-canary.yaml +26 -0
  15. package/fleetops/deploy/shadow-live/run.sh +48 -0
  16. package/fleetops/docs/ADMISSION.md +9 -9
  17. package/fleetops/docs/FABRIC-STORAGE.md +1 -1
  18. package/fleetops/docs/SERVING.md +11 -1
  19. package/fleetops/docs/SHADOW.md +250 -0
  20. package/fleetops/docs/SIGNALS.md +5 -2
  21. package/fleetops/docs/WORKLOADS.md +1 -1
  22. package/fleetops/package.json +7 -4
  23. package/fleetops/src/adapters/fabric.mjs +19 -7
  24. package/fleetops/src/adapters/live.mjs +38 -5
  25. package/fleetops/src/adapters/logs.mjs +10 -7
  26. package/fleetops/src/adapters/nvsentinel.mjs +95 -0
  27. package/fleetops/src/adapters/topology.mjs +53 -1
  28. package/fleetops/src/admission.mjs +26 -18
  29. package/fleetops/src/api.mjs +2 -1
  30. package/fleetops/src/bundle.mjs +3 -0
  31. package/fleetops/src/calibrate.mjs +1 -1
  32. package/fleetops/src/detect.mjs +1 -1
  33. package/fleetops/src/export.mjs +5 -1
  34. package/fleetops/src/goodput.mjs +0 -2
  35. package/fleetops/src/incidents.mjs +1 -2
  36. package/fleetops/src/ingest.mjs +1 -1
  37. package/fleetops/src/inject.mjs +2 -2
  38. package/fleetops/src/live.mjs +2 -1
  39. package/fleetops/src/llmd.mjs +7 -3
  40. package/fleetops/src/optimize.mjs +1 -1
  41. package/fleetops/src/power.mjs +7 -7
  42. package/fleetops/src/procure.mjs +67 -0
  43. package/fleetops/src/rca.mjs +1 -1
  44. package/fleetops/src/rollout.mjs +1 -1
  45. package/fleetops/src/schema.mjs +3 -2
  46. package/fleetops/src/security.mjs +1 -1
  47. package/fleetops/src/serving.mjs +21 -9
  48. package/fleetops/src/shadow-canary.mjs +74 -0
  49. package/fleetops/src/shadow-gate.mjs +49 -0
  50. package/fleetops/src/shadow-prom.mjs +205 -0
  51. package/fleetops/src/shadow-replay.mjs +147 -0
  52. package/fleetops/src/shadow.mjs +291 -0
  53. package/fleetops/src/stats.mjs +14 -0
  54. package/fleetops/src/traces.mjs +0 -5
  55. package/fleetops/tests/fixtures/real/README.md +5 -0
  56. package/fleetops/tools/admit-node.sh +51 -16
  57. package/fleetops/tools/amd-admit.py +111 -0
  58. package/fleetops/tools/cmd/calibrate.mjs +61 -0
  59. package/fleetops/tools/cmd/capacity.mjs +116 -0
  60. package/fleetops/tools/cmd/common.mjs +32 -0
  61. package/fleetops/tools/cmd/data.mjs +343 -0
  62. package/fleetops/tools/cmd/help.mjs +243 -0
  63. package/fleetops/tools/cmd/incidents.mjs +216 -0
  64. package/fleetops/tools/cmd/rollout.mjs +122 -0
  65. package/fleetops/tools/cmd/server.mjs +122 -0
  66. package/fleetops/tools/cmd/serving.mjs +95 -0
  67. package/fleetops/tools/cmd/shadow.mjs +204 -0
  68. package/fleetops/tools/cmd/training.mjs +79 -0
  69. package/fleetops/tools/collect.sh +6 -1
  70. package/fleetops/tools/fleetops.mjs +18 -1308
  71. package/fleetops/tools/loop-demo.mjs +1 -1
  72. package/fleetops/tools/workload-profile.mjs +0 -1
  73. package/fleetscope/README.md +5 -1
  74. package/fleetscope/build.mjs +1 -0
  75. package/fleetscope/dist/index.html +295 -26
  76. package/fleetscope/docs/AGENTIC.md +89 -0
  77. package/fleetscope/docs/PLANNING.md +4 -2
  78. package/fleetscope/docs/VALIDATION-AGENTIC.md +37 -0
  79. package/fleetscope/package.json +4 -3
  80. package/fleetscope/src/agentic.js +288 -0
  81. package/fleetscope/src/ask.js +0 -1
  82. package/fleetscope/src/cluster-ui.js +1 -0
  83. package/fleetscope/src/engine.js +10 -11
  84. package/fleetscope/src/index.src.html +9 -5
  85. package/fleetscope/src/inference-ui.js +1 -0
  86. package/fleetscope/src/ingest.js +89 -3
  87. package/fleetscope/src/optimize.js +11 -5
  88. package/fleetscope/src/plan.js +1 -1
  89. package/fleetscope/src/training-ui.js +1 -0
  90. package/fleetscope/tools/agentic.mjs +148 -0
  91. package/fleetscope/tools/tracelab-data.mjs +27 -0
  92. package/gpu-health/README.md +13 -2
  93. package/gpu-health/docs/CONFIG.md +29 -1
  94. package/gpu-health/package.json +7 -4
  95. package/gpu-health/src/actions.mjs +16 -3
  96. package/gpu-health/src/analyze.mjs +3 -0
  97. package/gpu-health/src/config.mjs +3 -0
  98. package/gpu-health/src/executors.mjs +9 -4
  99. package/gpu-health/src/health.mjs +1 -1
  100. package/gpu-health/src/ingest.mjs +27 -3
  101. package/gpu-health/src/platforms.mjs +109 -0
  102. package/gpu-health/src/vendors.mjs +12 -5
  103. package/gpu-health/tools/gpu-health.mjs +6 -4
  104. package/gpu-ledger/README.md +3 -1
  105. package/gpu-ledger/package.json +12 -4
  106. package/gpu-ledger/src/adapters.mjs +3 -2
  107. package/gpu-ledger/src/cloud.mjs +104 -0
  108. package/gpu-ledger/src/core.mjs +12 -10
  109. package/gpu-ledger/tools/ledger.mjs +8 -2
  110. package/harness-ledger/README.md +152 -0
  111. package/harness-ledger/docs/FORMATS.md +114 -0
  112. package/harness-ledger/docs/METHOD.md +133 -0
  113. package/harness-ledger/docs/VALIDATION-ECONOMICS.md +59 -0
  114. package/harness-ledger/docs/VALIDATION-SWEBENCH.md +26 -0
  115. package/harness-ledger/docs/VALIDATION-TRACELAB.md +56 -0
  116. package/harness-ledger/package.json +19 -0
  117. package/harness-ledger/src/demo.mjs +115 -0
  118. package/harness-ledger/src/economics.mjs +184 -0
  119. package/harness-ledger/src/gpu.mjs +80 -0
  120. package/harness-ledger/src/html.mjs +63 -0
  121. package/harness-ledger/src/importers.mjs +247 -0
  122. package/harness-ledger/src/ledger.mjs +128 -0
  123. package/harness-ledger/src/opencost.mjs +55 -0
  124. package/harness-ledger/src/outcomes.mjs +67 -0
  125. package/harness-ledger/src/prices.mjs +75 -0
  126. package/harness-ledger/src/record.mjs +52 -0
  127. package/harness-ledger/src/waste.mjs +136 -0
  128. package/harness-ledger/tools/harness-ledger.mjs +199 -0
  129. package/harness-ledger/tools/validate-economics.mjs +69 -0
  130. package/harness-ledger/tools/validate-swebench.mjs +57 -0
  131. package/harness-ledger/tools/validate-tracelab.mjs +74 -0
  132. package/hybrid-tracing/package.json +4 -3
  133. package/hybrid-tracing/tools/fix-skew.mjs +1 -1
  134. package/inference-sizer/README.md +5 -1
  135. package/inference-sizer/build.mjs +1 -0
  136. package/inference-sizer/dist/index.html +205 -22
  137. package/inference-sizer/docs/ACCELERATORS.md +62 -0
  138. package/inference-sizer/docs/VALIDATION-INFERENCEX.md +37 -0
  139. package/inference-sizer/package.json +4 -3
  140. package/inference-sizer/src/accelerators.js +172 -0
  141. package/inference-sizer/src/catalog.js +7 -20
  142. package/inference-sizer/src/fit-ui.js +1 -1
  143. package/inference-sizer/src/index.src.html +3 -0
  144. package/inference-sizer/src/model.js +22 -1
  145. package/inference-sizer/tools/validate-agentx.mjs +110 -0
  146. package/inference-sizer/tools/validate-inferencex.mjs +132 -0
  147. package/mcp/README.md +6 -1
  148. package/mcp/server.mjs +34 -0
  149. package/package.json +9 -4
  150. package/schemas/README.md +3 -0
  151. package/schemas/aiinfra.report.schema.json +474 -0
  152. package/schemas/commands.mjs +14 -0
  153. package/schemas/fleetops.shadow.canary.schema.json +96 -0
  154. package/schemas/fleetops.shadow.compare.schema.json +266 -0
  155. package/schemas/fleetops.shadow.prom.schema.json +354 -0
  156. package/schemas/harness-ledger.economics.schema.json +567 -0
  157. package/schemas/sizer.list.schema.json +15 -2
@@ -58,7 +58,7 @@ function steps1to4(dir) {
58
58
  head(3, 'Simulate', 'what each change should give back, before anyone makes it');
59
59
  out.simulate = T.recommendations.map(r => ({ id: r.id, title: r.title, gpuHoursPerWeek: r.impact.gpuHoursPerWeek, basis: r.impact.basis, confidence: r.confidence }));
60
60
  for (const r of out.simulate) say(` → ${r.title}: up to ${n0(r.gpuHoursPerWeek)} GPU-hours a week (${r.basis}).`);
61
- const C = run('optimize candidates', ['optimize', 'candidates', '--from', String(FROM), '--to', String(TO), '--store', S, '--out', path.join(dir, 'candidates.json')]);
61
+ run('optimize candidates', ['optimize', 'candidates', '--from', String(FROM), '--to', String(TO), '--store', S, '--out', path.join(dir, 'candidates.json')]);
62
62
  const P = run('optimize plan', ['optimize', 'plan', '--candidates', path.join(dir, 'candidates.json'), '--out', path.join(dir, 'plan.json'), '--store', S]);
63
63
  const plan = P.plan || JSON.parse(fs.readFileSync(path.join(dir, 'plan.json'), 'utf8'));
64
64
  out.plan = { id: plan.id, weekly: plan.totalWeekly, stages: plan.stages.map(s => s.title) };
@@ -9,7 +9,6 @@ const require=createRequire(import.meta.url);
9
9
  const {parseTrace}=require("../../fleetscope/src/ingest.js");
10
10
  const args=process.argv.slice(2), cmd=args[0]||"help";
11
11
  function opt(name,fallback){const i=args.indexOf("--"+name);return i<0?fallback:args[i+1];}
12
- function flag(name){return args.includes("--"+name);}
13
12
  function save(out,data){if(!out)throw new Error("--out is required");fs.mkdirSync(path.dirname(path.resolve(out)),{recursive:true});fs.writeFileSync(out,data);}
14
13
  function readInput(file) {
15
14
  // Offset limit permits normal trace windows beyond FleetScope's browser truncation.
@@ -58,6 +58,10 @@ Upload a log to the Trace replay node: vLLM OpenTelemetry spans, gateway JSON lo
58
58
 
59
59
  ![Trace import](docs/img/trace-import.png)
60
60
 
61
+ ### Agentic workloads: profiles from real agent sessions
62
+
63
+ `tools/agentic.mjs` fits a profile of how agent sessions behave (context growth, cache reuse, tool-loop pace, human pauses, compactions, subagents) from a real trace, generates sessions from it at any load, and sizes GPUs counting both compute and the KV cache that idle sessions hold between turns. On the public TraceLab trace (8,058 Claude Code and Codex sessions), a profile fitted on 70% of sessions matches replaying the other 30% within 1–8% on cache hit, call rate and prefill and output tokens/s; sizing the same calls from mean ISL/OSL without cache reuse asks for 440 GPUs where 40 do. `size --kv-offload` adds host-memory KV offload (the GPU count with the cold part of the working set in host memory, and the PCIe reload time it costs), and every size reports output tokens/s per megawatt. See [docs/AGENTIC.md](docs/AGENTIC.md) and [docs/VALIDATION-AGENTIC.md](docs/VALIDATION-AGENTIC.md).
64
+
61
65
  ### Closed-loop replay of recorded sessions
62
66
 
63
67
  A recorded agent log (150 sessions, 1,516 turns) replayed as sessions: each turn waits for the previous answer and keeps the recorded think time between them, so a slower fleet sees less traffic instead of an impossible backlog. On 4 on-prem H100s, turns run a median 16 s behind the log, and simulated TTFT p99 is 9.6 s against 1.2 s recorded: this fleet is far slower than the one that produced the log. Replaying the same log by timestamps gives a p99 of 34 s. See [docs/TRACES.md](docs/TRACES.md#closed-loop-replay).
@@ -210,7 +214,7 @@ Coding-agent traffic. Each candidate model and reasoning level is right-sized to
210
214
 
211
215
  ```bash
212
216
  cd fleetscope
213
- npm test # engine tests (Node 20+, no dependencies)
217
+ npm test # engine tests (Node 22+, no dependencies)
214
218
  npm run build # inline src/ into dist/index.html
215
219
  ```
216
220
 
@@ -9,6 +9,7 @@ const read = p => readFileSync(join(here, p), 'utf8');
9
9
 
10
10
  const page = read('src/index.src.html');
11
11
  const inlined = {
12
+ '/*ACCELERATORS*/': readFileSync(join(here, '../inference-sizer/src/accelerators.js'), 'utf8'),
12
13
  '/*ENGINE*/': read('src/engine.js'),
13
14
  '/*TEMPLATES*/': read('src/templates.js'),
14
15
  '/*INGEST*/': read('src/ingest.js'),
@@ -385,6 +385,181 @@ button, select, input { font: inherit; color: inherit; }
385
385
  <div class="shell" id="trainingApp" hidden></div>
386
386
  <div class="shell" id="inferenceApp" hidden></div>
387
387
  <script>
388
+ /* The accelerator registry: every chip the tools know, in one place, and what each vendor's stack needs.
389
+ The Inference Sizer's catalog, FleetScope's GPU table, fleetops' power model and serving manifests all read it, so a
390
+ new chip or vendor is one edit here (plus a gpu-health vendor profile if its exporter is new).
391
+
392
+ ACCELERATORS chips with full spec-sheet figures, usable for sizing and simulation
393
+ id, label, vendor (display), vendorKey (key into VENDORS and gpu-health's vendor profiles), kind (gpu | tpu | …)
394
+ hbmGB, hbmTBs, tfBf16, tfFp8, tfFp4 per chip, dense (sparsity figures halved; rack or system totals divided)
395
+ scaleUpGBs chip-to-chip link, per direction (NVLink, Infinity Fabric, ICI); domain: chips per scale-up domain
396
+ nicGbps scale-out network per chip; nodeKW: max power per domain where the vendor publishes it
397
+ tdpW board power on the spec sheet (TBP/TDP; none for cloud-only chips that don't publish it); match: regex
398
+ for the SKU names telemetry, Kubernetes labels and bills report
399
+ gkeAccelerator GKE's cloud.google.com/gke-tpu-accelerator value, for TPU node selectors
400
+ price, onprem placeholder $/chip-hour (rent, and amortized on-prem cost for FleetScope), not quotes
401
+ short FleetScope's key and short label, where it differs from id; source: spec sheet URL
402
+ OTHER_SKUS chips seen in telemetry but not sized (only power and vendor): id, vendorKey, kind, tdpW, match
403
+ VENDORS per vendor: Kubernetes resource and labels, telemetry tools, collective library, serving images
404
+ INSTANCES cloud instance types → { cloud, chip (registry id or SKU), gpus }, for bills and node labels
405
+
406
+ Order matters for match: more specific names first (GB200 before B200, H100 PCIe before H100). */
407
+ (function (root) {
408
+ 'use strict';
409
+
410
+ const VENDORS = {
411
+ nvidia: {
412
+ name: 'NVIDIA', kind: 'gpu', k8sResource: 'nvidia.com/gpu', productLabels: ['nvidia.com/gpu.product', 'cloud.google.com/gke-accelerator'],
413
+ smi: 'nvidia-smi', exporter: 'dcgm-exporter', collectives: 'NCCL', kvBufferDevice: 'cuda',
414
+ images: { vllm: 'vllm/vllm-openai', llmdVllm: 'docker.io/vllm/vllm-openai:v0.31.0' },
415
+ },
416
+ amd: {
417
+ name: 'AMD', kind: 'gpu', k8sResource: 'amd.com/gpu', productLabels: ['amd.com/gpu.product-name'],
418
+ smi: 'amd-smi', exporter: 'device-metrics-exporter', collectives: 'RCCL',
419
+ // NIXL's UCX path on ROCm stages the KV cache through host memory in llm-d's P/D guide
420
+ kvBufferDevice: 'cpu',
421
+ images: { vllm: 'rocm/vllm', llmdVllm: 'docker.io/vllm/vllm-openai-rocm:v0.31.0' },
422
+ },
423
+ // Cloud TPU on GKE: chips requested as google.com/tpu, the slice chosen by accelerator and topology node labels.
424
+ // vLLM on TPU: the vllm/vllm-tpu image (GKE's Trillium tutorial). No llm-d P/D image validated for TPU here.
425
+ tpu: {
426
+ name: 'Google Cloud TPU', kind: 'tpu', k8sResource: 'google.com/tpu', productLabels: ['cloud.google.com/gke-tpu-accelerator'],
427
+ topologyLabel: 'cloud.google.com/gke-tpu-topology', smi: 'tpu-info', exporter: 'Cloud Monitoring (accelerator metrics) or libtpu', collectives: 'XLA collectives over ICI',
428
+ images: { vllm: 'vllm/vllm-tpu' },
429
+ },
430
+ };
431
+
432
+ const A = (o) => Object.assign({ kind: 'gpu', tfFp4: 0 }, o);
433
+ const ACCELERATORS = [
434
+ 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',
435
+ // 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
436
+ source: 'https://www.nvidia.com/en-us/data-center/gb300-nvl72/' }),
437
+ 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',
438
+ source: 'https://www.nvidia.com/en-us/data-center/gb200-nvl72/' }),
439
+ 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',
440
+ source: 'https://www.nvidia.com/en-us/data-center/hgx/' }),
441
+ 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',
442
+ source: 'https://www.nvidia.com/en-us/data-center/dgx-b200/' }),
443
+ 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',
444
+ source: 'https://www.nvidia.com/en-us/data-center/h200/' }),
445
+ 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',
446
+ source: 'https://www.nvidia.com/en-us/data-center/h100/' }),
447
+ 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',
448
+ source: 'https://www.nvidia.com/en-us/data-center/a100/' }),
449
+ 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',
450
+ source: 'https://www.nvidia.com/en-us/data-center/l40s/' }),
451
+ 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',
452
+ // Infinity Fabric: 7 links × 144 GB/s (bidirectional) = 504 GB/s per direction
453
+ source: 'https://www.amd.com/en/products/accelerators/instinct/mi350/mi355x.html' }),
454
+ 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',
455
+ // platform peer-to-peer I/O 896 GB/s bidirectional = 448 GB/s per direction
456
+ source: 'https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html' }),
457
+ // Cloud TPU: per chip, from cloud.google.com/tpu/docs (v6e, tpu7x pages). ICI figures are bidirectional there, halved
458
+ // here. domain = chips per TPU VM host; ICI across hosts in a slice is modelled as the data-center network, so
459
+ // tensor parallelism beyond one host is costed pessimistically. Prices: on-demand $/chip-hour, us-east1/us-central1.
460
+ 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',
461
+ source: 'https://docs.cloud.google.com/tpu/docs/tpu7x' }),
462
+ 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',
463
+ source: 'https://docs.cloud.google.com/tpu/docs/v6e' }),
464
+ 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',
465
+ // 95 GiB HBM per chip
466
+ source: 'https://docs.cloud.google.com/tpu/docs/tpu7x' }),
467
+ 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',
468
+ source: 'https://www.amd.com/en/products/accelerators/instinct/mi300/mi300x.html' }),
469
+ ];
470
+
471
+ const OTHER_SKUS = [
472
+ { id: 'H100-PCIe', vendorKey: 'nvidia', kind: 'gpu', tdpW: 350, match: 'H100.*PCIe' },
473
+ { id: 'H20', vendorKey: 'nvidia', kind: 'gpu', tdpW: 400, match: 'H20\\b' },
474
+ { id: 'A100-PCIe', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'A100.*PCIe' },
475
+ { id: 'A100-40GB', vendorKey: 'nvidia', kind: 'gpu', tdpW: 400, match: 'A100.*40\\s?GB' },
476
+ { id: 'A10G', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'A10G' },
477
+ { id: 'L4', vendorKey: 'nvidia', kind: 'gpu', tdpW: 72, match: 'L4\\b' },
478
+ { id: 'A10', vendorKey: 'nvidia', kind: 'gpu', tdpW: 150, match: 'A10\\b' },
479
+ { id: 'T4', vendorKey: 'nvidia', kind: 'gpu', tdpW: 70, match: 'T4\\b' },
480
+ { id: 'V100', vendorKey: 'nvidia', kind: 'gpu', tdpW: 300, match: 'V100' },
481
+ { id: 'MI350X', vendorKey: 'amd', kind: 'gpu', tdpW: 1000, match: 'MI350' },
482
+ { id: 'MI250', vendorKey: 'amd', kind: 'gpu', tdpW: 560, match: 'MI250' },
483
+ { id: 'TPU-v5e', vendorKey: 'tpu', kind: 'tpu', match: 'v5e|v5-?lite' },
484
+ ];
485
+
486
+ // ---------- cloud instance types ----------
487
+ // AWS: docs.aws.amazon.com/AWSEC2/latest/UserGuide/accelerated-computing-instances.html and aws.amazon.com/ec2/instance-types/p6/
488
+ const INSTANCES = {};
489
+ const add = (cloud, chip, list) => { for (const [type, gpus] of list) INSTANCES[type] = { cloud, chip, gpus }; };
490
+ const sizes = (fam, one, more) => one.map(s => [`${fam}.${s}`, 1]).concat(more.map(([s, n]) => [`${fam}.${s}`, n]));
491
+ add('aws', 'A100-40GB', [['p4d.24xlarge', 8]]);
492
+ add('aws', 'A100', [['p4de.24xlarge', 8]]);
493
+ add('aws', 'H100', [['p5.4xlarge', 1], ['p5.48xlarge', 8]]);
494
+ add('aws', 'H200', [['p5e.48xlarge', 8], ['p5en.48xlarge', 8]]);
495
+ add('aws', 'B200', [['p6-b200.48xlarge', 8]]);
496
+ add('aws', 'B300', [['p6-b300.48xlarge', 8]]);
497
+ add('aws', 'GB200-NVL72', [['p6e-gb200.36xlarge', 4]]); // sold as UltraServers of 36 or 72 GPUs (u-p6e-gb200x36, x72)
498
+ add('aws', 'L40S', sizes('g6e', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
499
+ add('aws', 'L4', sizes('g6', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
500
+ add('aws', 'A10G', sizes('g5', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['24xlarge', 4], ['48xlarge', 8]]));
501
+ add('aws', 'T4', sizes('g4dn', ['xlarge', '2xlarge', '4xlarge', '8xlarge', '16xlarge'], [['12xlarge', 4], ['metal', 8]]));
502
+ // GCP: docs.cloud.google.com/compute/docs/gpus and /compute/docs/tpus/tpu-machines; GKE TPU machine types
503
+ const gpuN = (fam, chip, ns) => add('gcp', chip, ns.map(n => [`${fam}-${n}g`, n]));
504
+ gpuN('a2-highgpu', 'A100-40GB', [1, 2, 4, 8]); add('gcp', 'A100-40GB', [['a2-megagpu-16g', 16]]);
505
+ gpuN('a2-ultragpu', 'A100', [1, 2, 4, 8]);
506
+ gpuN('a3-highgpu', 'H100', [1, 2, 4, 8]); add('gcp', 'H100', [['a3-megagpu-8g', 8], ['a3-edgegpu-8g', 8]]);
507
+ add('gcp', 'H200', [['a3-ultragpu-8g', 8]]);
508
+ add('gcp', 'B200', [['a4-highgpu-8g', 8]]);
509
+ add('gcp', 'GB200-NVL72', [['a4x-highgpu-4g', 4]]);
510
+ 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]]));
511
+ add('gcp', 'TPU-v6e', [['ct6e-standard-1t', 1], ['ct6e-standard-4t', 4], ['ct6e-standard-8t', 8]]);
512
+ add('gcp', 'TPU-v5p', [['ct5p-hightpu-4t', 4]]);
513
+ add('gcp', 'TPU7x', [['tpu7x-standard-4t', 4]]);
514
+ add('gcp', 'TPU-v5e', [['ct5lp-hightpu-1t', 1], ['ct5lp-hightpu-4t', 4], ['ct5lp-hightpu-8t', 8]]);
515
+ const instanceOf = type => INSTANCES[String(type || '').toLowerCase()] || null;
516
+ // TPU slice topology for a chip count: 2D (v5e, v6e) or 3D torus (v4, v5p, 7x), as GKE's node selector wants it
517
+ const TOPO2 = { 1: '1x1', 4: '2x2', 8: '2x4', 16: '4x4', 32: '4x8', 64: '8x8', 128: '8x16', 256: '16x16' };
518
+ const TOPO3 = { 4: '2x2x1', 8: '2x2x2', 16: '2x2x4', 32: '2x4x4', 64: '4x4x4' };
519
+ 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; }
520
+
521
+ // telemetry SKU string ("NVIDIA H100 80GB HBM3", "AMD Instinct MI300X", …) → registry entry, most specific first
522
+ const ORDER = (() => {
523
+ const all = ACCELERATORS.concat(OTHER_SKUS).map(x => ({ x, re: new RegExp(x.match, 'i') }));
524
+ // a PCIe or 40 GB variant before its sibling; otherwise registry order (which lists GB* before B*)
525
+ const first = a => /PCIe|40GB/.test(a.x.id);
526
+ return all.filter(first).concat(all.filter(a => !first(a)));
527
+ })();
528
+ function match(sku) {
529
+ const s = String(sku || '');
530
+ if (!s) return null;
531
+ const exact = ACCELERATORS.concat(OTHER_SKUS).find(x => x.id.toLowerCase() === s.toLowerCase() || (x.short && x.short.toLowerCase() === s.toLowerCase()));
532
+ if (exact) return exact;
533
+ const hit = ORDER.find(a => a.re.test(s));
534
+ return hit ? hit.x : null;
535
+ }
536
+ const byId = id => ACCELERATORS.find(x => x.id === id || x.short === id) || null;
537
+ const tdpOf = sku => { const m = match(sku); return m ? m.tdpW : null; };
538
+ // vendor key for an entry, a SKU string or a display vendor ("AMD"); null when unknown
539
+ function vendorKeyOf(x) {
540
+ if (!x) return null;
541
+ if (typeof x === 'object') return x.vendorKey || vendorKeyOf(x.vendor) || vendorKeyOf(x.id);
542
+ const s = String(x).toLowerCase();
543
+ if (VENDORS[s]) return s;
544
+ const v = Object.keys(VENDORS).find(k => VENDORS[k].name.toLowerCase() === s);
545
+ if (v) return v;
546
+ const m = match(x);
547
+ return m ? m.vendorKey : null;
548
+ }
549
+ // the vendor's deployment adapter; throws with the known vendors when there is none
550
+ function vendor(x) {
551
+ const k = vendorKeyOf(x);
552
+ if (!k || !VENDORS[k]) throw new Error(`no vendor adapter for ${typeof x === 'object' ? (x.id || x.vendor) : x}; known: ${Object.keys(VENDORS).join(', ')}`);
553
+ return Object.assign({ key: k }, VENDORS[k]);
554
+ }
555
+
556
+ const api = { VENDORS, ACCELERATORS, OTHER_SKUS, INSTANCES, instanceOf, tpuTopology, match, byId, tdpOf, vendorKeyOf, vendor };
557
+ if (typeof module !== 'undefined' && module.exports) module.exports = api;
558
+ else root.AIInfraAccelerators = api;
559
+ })(typeof globalThis !== 'undefined' ? globalThis : this);
560
+
561
+ </script>
562
+ <script>
388
563
  /* FleetScope engine: time-stepped fleet simulation for LLM serving and training.
389
564
  Pure functions, no DOM. Deterministic for (workload, scenario, seed).
390
565
  Performance is derived from model and GPU spec-sheet figures with fixed efficiency factors:
@@ -411,17 +586,16 @@ button, select, input { font: inherit; color: inherit; }
411
586
  }
412
587
  const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
413
588
 
414
- // Approximate public spec-sheet figures (dense TFLOPS, HBM GB, HBM TB/s). Prices are placeholders, $/GPU-hour.
415
- const GPUS = {
416
- A100: { label: 'A100 80GB', hbm: 80, bw: 2.0, bf16: 312, fp8: 312, onprem: 0.9, rent: 1.6, tdpW: 400 },
417
- L40S: { label: 'L40S 48GB', hbm: 48, bw: 0.864, bf16: 362, fp8: 733, onprem: 0.7, rent: 1.1, tdpW: 350 },
418
- H100: { label: 'H100 80GB', hbm: 80, bw: 3.35, bf16: 989, fp8: 1979, onprem: 1.4, rent: 2.4, tdpW: 700 },
419
- H200: { label: 'H200 141GB', hbm: 141, bw: 4.8, bf16: 989, fp8: 1979, onprem: 2.0, rent: 3.5, tdpW: 700 },
420
- MI300X: { label: 'MI300X 192GB', hbm: 192, bw: 5.3, bf16: 1307, fp8: 2615, onprem: 1.5, rent: 2.6, tdpW: 750 },
421
- B200: { label: 'B200 180GB', hbm: 180, bw: 8.0, bf16: 2250, fp8: 4500, onprem: 3.2, rent: 5.5, tdpW: 1000 },
422
- B300: { label: 'B300 262GB', hbm: 262, bw: 8.0, bf16: 2250, fp8: 4500, onprem: 4.0, rent: 7.0, tdpW: 1100 },
423
- GB200: { label: 'GB200 186GB (NVL72)', hbm: 186, bw: 8.0, bf16: 2500, fp8: 5000, onprem: 3.6, rent: 6.0, tdpW: 1200 }
424
- };
589
+ // Spec-sheet figures (dense TFLOPS, HBM GB, HBM TB/s) from the shared accelerator registry
590
+ // (inference-sizer/src/accelerators.js). Prices are placeholders, $/GPU-hour.
591
+ const REG = (typeof module !== 'undefined' && module.exports) ? require('../../inference-sizer/src/accelerators.js') : root.AIInfraAccelerators;
592
+ const GPU_ORDER = ['A100', 'L40S', 'H100', 'H200', 'MI300X', 'B200', 'B300', 'GB200', 'GB300', 'MI325X', 'MI355X'];
593
+ const GPUS = {};
594
+ for (const k of GPU_ORDER.concat(REG.ACCELERATORS.map(a => a.short || a.id))) {
595
+ const a = REG.byId(k); if (!a || GPUS[k] || !a.tdpW) continue; // the power model needs board power (cloud TPUs don't publish it)
596
+ GPUS[k] = { label: `${k} ${a.hbmGB}GB${a.domain >= 72 ? ` (NVL${a.domain})` : ''}`, hbm: a.hbmGB, bw: a.hbmTBs, bf16: a.tfBf16, fp8: a.tfFp8 || a.tfBf16,
597
+ onprem: a.onprem, rent: a.price, tdpW: a.tdpW, vendor: a.vendorKey, kind: a.kind };
598
+ }
425
599
  // Approximate architecture figures. kvDim = per-token, per-layer K+V width (2 x kv_heads x head_dim, or MLA latent).
426
600
  const MODELS = {
427
601
  'llama-8b': { label: 'Llama 3.1 8B', params: 8, active: 8, layers: 32, kvHeads: 8, headDim: 128, mla: 0 },
@@ -1948,6 +2122,7 @@ button, select, input { font: inherit; color: inherit; }
1948
2122
  cached prompt tokens served from a prefix cache, when the log records it
1949
2123
  ttft/queue/e2e recorded latencies in seconds, used to compare with the simulation
1950
2124
  session user or session id, when the log records one
2125
+ agent subagent id within a session (agentic traces), gap seconds since the session's previous request ended
1951
2126
  Only timing and token counts are read; prompt and response text are never touched. */
1952
2127
  (function (root) {
1953
2128
  'use strict';
@@ -1999,12 +2174,15 @@ button, select, input { font: inherit; color: inherit; }
1999
2174
  if (t < 0) continue;
2000
2175
  if (t > opt.maxSeconds) { notes.push('kept the first ' + Math.round(opt.maxSeconds / 60) + ' minutes'); break; }
2001
2176
  if (trace.length >= opt.maxRows) { notes.push('kept the first ' + opt.maxRows.toLocaleString('en-US') + ' requests'); break; }
2002
- const row = { t, isl: Math.min(Math.round(r.isl), 200000), osl: Math.max(1, Math.min(Math.round(r.osl), 16000)) };
2177
+ const row = { t, isl: Math.min(Math.round(r.isl), opt.maxIsl || 200000), osl: Math.max(1, Math.min(Math.round(r.osl), opt.maxOsl || 16000)) };
2003
2178
  if (isFinite(r.cached) && r.cached >= 0) row.cached = Math.min(Math.round(r.cached), row.isl - 1);
2004
2179
  if (isFinite(r.ttft) && r.ttft >= 0) row.ttft = r.ttft;
2005
2180
  if (isFinite(r.queue) && r.queue >= 0) row.queue = r.queue;
2006
2181
  if (isFinite(r.e2e) && r.e2e >= 0) row.e2e = r.e2e;
2007
2182
  if (r.session != null && r.session !== '') row.session = String(r.session);
2183
+ if (r.agent != null && r.agent !== '') row.agent = String(r.agent);
2184
+ if (isFinite(r.api) && r.api >= 0) row.api = r.api;
2185
+ if (isFinite(r.tools)) row.tools = r.tools;
2008
2186
  trace.push(row);
2009
2187
  }
2010
2188
  if (bad) notes.push(bad + ' unreadable record' + (bad > 1 ? 's' : '') + ' skipped');
@@ -2163,6 +2341,84 @@ button, select, input { font: inherit; color: inherit; }
2163
2341
  return out;
2164
2342
  }
2165
2343
 
2344
+ // ---------- agentic traces ----------
2345
+ // Prefix reuse from block hashes: each request lists the hashes of its prompt's fixed-size blocks, chained so a block's
2346
+ // hash depends on everything before it. The cached part of a request is the longest run of leading blocks some earlier
2347
+ // request in the same scope already had: what an unbounded prefix cache would serve. scope 'session' (AgentX: hashes are
2348
+ // session-scoped) or 'global' (Mooncake: one hash space for the whole trace).
2349
+ function prefixReuse(rows, blockTokens, scope) {
2350
+ const seen = new Map();
2351
+ for (const r of rows) {
2352
+ const key = scope === 'global' ? '' : (r.session || ''), set = seen.get(key) || new Set();
2353
+ seen.set(key, set);
2354
+ let n = 0; const h = r.hashes || [];
2355
+ while (n < h.length && set.has(h[n])) n++;
2356
+ for (const x of h) set.add(x);
2357
+ r.cached = Math.min(r.isl, n * blockTokens);
2358
+ delete r.hashes;
2359
+ }
2360
+ return rows;
2361
+ }
2362
+ // SemiAnalysis AgentX ("weka" traces, Apache-2.0): one JSON object per session { id, requests: [ { t, type, model, in,
2363
+ // out, hash_ids, api_time, think_time? } | { type: 'subagent', agent_id, requests: [...] } ] }; t in seconds from the
2364
+ // session start; in = 64-token hash blocks × 64. Sessions are laid end to end unless opt.sessionGapS spaces them.
2365
+ function parseAgentX(docs, opt) {
2366
+ opt = opt || {};
2367
+ const rows = [];
2368
+ let offset = 0;
2369
+ const sessions = docs.map(d => (Array.isArray(d) ? { id: null, requests: d } : d)).filter(d => d && Array.isArray(d.requests));
2370
+ sessions.forEach((d, i) => {
2371
+ const id = String(d.id != null ? d.id : 'session-' + i), start = offset;
2372
+ let end = start;
2373
+ const add = (q, agent) => {
2374
+ const t = start + (+q.t || 0), api = +q.api_time || 0;
2375
+ rows.push({ t, isl: +q.in || 0, osl: +q.out || 1, session: id, agent, api, hashes: q.hash_ids || [], e2e: api || NaN });
2376
+ end = Math.max(end, t + api);
2377
+ };
2378
+ for (const q of d.requests) {
2379
+ if (q && q.type === 'subagent') for (const x of q.requests || []) add(x, String(q.agent_id || 'subagent'));
2380
+ else if (q) add(q, null);
2381
+ }
2382
+ offset = opt.sessionGapS != null ? start + opt.sessionGapS : end;
2383
+ });
2384
+ rows.sort((a, b) => a.t - b.t);
2385
+ prefixReuse(rows, opt.blockTokens || 64, 'session');
2386
+ const out = finish(rows, 'AgentX agentic trace', [], Object.assign({ maxIsl: 2e6, maxOsl: 64000 }, opt));
2387
+ out.stats.sessions = sessions.length;
2388
+ out.notes.push('cached tokens: what an unbounded prefix cache would serve, from 64-token block hashes (within a session)');
2389
+ return out;
2390
+ }
2391
+ // Mooncake (Kimi) traces: one request per line { timestamp (ms), input_length, output_length, hash_ids } with 512-token
2392
+ // blocks in one hash space.
2393
+ function parseMooncake(docs, opt) {
2394
+ opt = opt || {};
2395
+ const rows = docs.filter(d => d && d.input_length != null).map(d => ({ t: (+d.timestamp || 0) / 1000, isl: +d.input_length, osl: +d.output_length || 1, hashes: d.hash_ids || [] }));
2396
+ rows.sort((a, b) => a.t - b.t);
2397
+ prefixReuse(rows, opt.blockTokens || 512, 'global');
2398
+ const out = finish(rows, 'Mooncake trace', [], Object.assign({ maxIsl: 2e6 }, opt));
2399
+ out.notes.push('cached tokens: what an unbounded prefix cache would serve, from 512-token block hashes');
2400
+ return out;
2401
+ }
2402
+ // TraceLab (UW SyFI coding-agent trace, CC BY 4.0): one model call per line, from Claude Code and Codex, with the
2403
+ // provider's own cache accounting, timing events and tool calls.
2404
+ function tracelabRow(o) {
2405
+ const ev = o.timing_events || [], ts = ev.map(e => toSeconds(e.timestamp)).filter(isFinite);
2406
+ if (!ts.length) return null;
2407
+ const isClaude = o.claude_cache_read_input_tokens != null || o.provider === 'claude';
2408
+ const cached = isClaude ? (+o.claude_cache_read_input_tokens || 0) : (+o.prefix_tokens || 0);
2409
+ // the call starts at its input (user message or last tool result) and ends at its last model event
2410
+ const inEv = ev.filter(e => /user_message|tool_result/.test(e.event_type)).map(e => toSeconds(e.timestamp)).filter(isFinite);
2411
+ const outEv = ev.filter(e => /text|tool_call|reasoning|usage_report/.test(e.event_type)).map(e => toSeconds(e.timestamp)).filter(isFinite);
2412
+ const t = inEv.length ? Math.max(...inEv) : Math.min(...ts), endT = outEv.length ? Math.max(...outEv) : t;
2413
+ return { t, isl: +o.input_tokens_total || 0, osl: Math.max(1, (+o.output_tokens || 0)), cached, session: o.session_id, api: Math.max(0, endT - t), tools: (o.tools || []).length, model: o.model };
2414
+ }
2415
+ function parseTraceLab(docs, opt) {
2416
+ const rows = docs.map(tracelabRow).filter(Boolean);
2417
+ const out = finish(rows, 'TraceLab coding-agent trace', [], Object.assign({ maxIsl: 2e6, maxOsl: 64000 }, opt || {}));
2418
+ out.notes.push('cached tokens as each provider reported them (Claude cache reads, Codex cached prefix)');
2419
+ return out;
2420
+ }
2421
+
2166
2422
  // ---------- detection ----------
2167
2423
  function parseJsonLines(text) {
2168
2424
  const out = [];
@@ -2175,14 +2431,18 @@ button, select, input { font: inherit; color: inherit; }
2175
2431
  return { docs: out, bad };
2176
2432
  }
2177
2433
  function parseTrace(text, opt) {
2178
- const s = text.replace(/^/, '').trimStart();
2434
+ const s = text.replace(/^\uFEFF/, '').trimStart();
2179
2435
  if (s[0] === '{' || s[0] === '[') {
2180
2436
  let docs, bad = 0;
2181
2437
  try { const whole = JSON.parse(s); docs = Array.isArray(whole) ? whole : [whole]; }
2182
2438
  catch (e) { const jl = parseJsonLines(s); docs = jl.docs; bad = jl.bad; }
2183
2439
  if (!docs.length) throw new Error('The file looks like JSON but no record could be parsed.');
2184
2440
  let res;
2441
+ const d0 = docs.find(d => d && typeof d === 'object');
2185
2442
  if (docs.some(d => d && (d.resourceSpans || d.batches))) res = parseOTLP(docs, opt);
2443
+ else if (d0 && (Array.isArray(d0.requests) || (Array.isArray(d0) && d0[0] && d0[0].hash_ids))) res = parseAgentX(docs, opt);
2444
+ else if (d0 && d0.input_length != null && d0.hash_ids) res = parseMooncake(docs, opt);
2445
+ else if (d0 && d0.timing_events && d0.input_tokens_total != null) res = parseTraceLab(docs, opt);
2186
2446
  else if (docs.length === 1 && docs[0] && Array.isArray(docs[0].data) && docs[0].data.some(x => x && x.spans)) res = parseJaeger(docs[0], opt);
2187
2447
  else {
2188
2448
  const records = docs.length === 1 && docs[0] && Array.isArray(docs[0].data) ? docs[0].data : docs;
@@ -2202,7 +2462,7 @@ button, select, input { font: inherit; color: inherit; }
2202
2462
  return lines.join('\n') + '\n';
2203
2463
  }
2204
2464
 
2205
- const api = { parseTrace, parseCSV, toCSV, toSeconds, LIMITS };
2465
+ const api = { parseTrace, parseCSV, toCSV, toSeconds, LIMITS, parseAgentX, parseMooncake, parseTraceLab, tracelabRow, prefixReuse, finish };
2206
2466
  if (typeof module !== 'undefined' && module.exports) module.exports = api;
2207
2467
  else root.FleetIngest = api;
2208
2468
  })(typeof window !== 'undefined' ? window : this);
@@ -4536,10 +4796,10 @@ function renderPlanPanel() {
4536
4796
  num('target', 'SLO attainment target (%)', PL.target, 50, 99.9, 0.5) + num('n1', 'N-1 floor: SLO with the largest pool down (%, 0 = off)', PL.n1, 0, 99, 1) +
4537
4797
  '<div class="ctl check"><label><input type="checkbox" data-pl="gpuSwap"' + (PL.gpuSwap ? ' checked' : '') + '>Try other GPU types (H100, H200, B200)</label></div>' + num('evals', 'Simulation budget', PL.evals, 10, 200, 10) +
4538
4798
  '<div class="btnrow"><button class="btn primary" type="button" data-act="plOpt">Find the cheapest setup</button></div>';
4539
- else if (PL.tab === 'cap') { const c = PL.cap; h += '<div class="sub">Costs three ways to supply growing GPU demand over ' + c.months + ' months: rent on demand, reserve the base load, or buy on-prem for the base load (with a lead time) and rent the peaks.</div>' +
4799
+ else if (PL.tab === 'cap') { const c = PL.cap; h += '<div class="sub">Costs five ways to supply growing GPU demand over ' + c.months + ' months: rent on demand; reserve the base load and rent the peaks on demand, as capacity blocks (EC2 Capacity Blocks, GCP calendar-mode reservations) or on spot; or buy on-prem for the base load (with a lead time) and rent the peaks.</div>' +
4540
4800
  num('gpusNow', 'Peak GPUs needed today', c.gpusNow, 1, 100000, 1, 'cap') + num('growthPct', 'Growth per month (%)', c.growthPct, -10, 50, 0.5, 'cap') + num('baseShare', 'Base load as a share of peak', c.baseShare, 0.1, 1, 0.05, 'cap') + num('peakHoursShare', 'Share of hours above base', c.peakHoursShare, 0.05, 1, 0.05, 'cap') +
4541
4801
  num('gpuCapex', 'On-prem $ per GPU (with server share)', c.gpuCapex, 1000, 200000, 500, 'cap') + num('leadMonths', 'Lead time (months)', c.leadMonths, 0, 18, 1, 'cap') + num('amortMonths', 'Depreciation (months)', c.amortMonths, 12, 84, 6, 'cap') + num('kwhPrice', 'Power $/kWh', c.kwhPrice, 0.01, 1, 0.01, 'cap') +
4542
- num('reservedPerGpuH', 'Reserved $/GPU-hour', c.reservedPerGpuH, 0.1, 20, 0.05, 'cap') + num('onDemandPerGpuH', 'On-demand $/GPU-hour', c.onDemandPerGpuH, 0.1, 20, 0.05, 'cap') + num('months', 'Horizon (months)', c.months, 6, 60, 6, 'cap') +
4802
+ num('reservedPerGpuH', 'Reserved $/GPU-hour', c.reservedPerGpuH, 0.1, 20, 0.05, 'cap') + num('onDemandPerGpuH', 'On-demand $/GPU-hour', c.onDemandPerGpuH, 0.1, 20, 0.05, 'cap') + num('blockPerGpuH', 'Capacity block $/GPU-hour', c.blockPerGpuH, 0.1, 20, 0.05, 'cap') + num('spotPerGpuH', 'Spot $/GPU-hour', c.spotPerGpuH, 0.1, 20, 0.05, 'cap') + num('spotRework', 'Spot hours redone after interruptions', c.spotRework, 0, 1, 0.05, 'cap') + num('months', 'Horizon (months)', c.months, 6, 60, 6, 'cap') +
4543
4803
  '<div class="btnrow"><button class="btn primary" type="button" data-act="plCap">Compare</button></div>'; }
4544
4804
  else h += '<div class="sub">Packs small models onto MIG slices instead of whole GPUs. Each line: name, GPU memory in GB, replicas. Memory gets 30% headroom for KV cache.</div>' +
4545
4805
  '<div class="ctl"><textarea data-pl="migText" rows="6" style="width:100%;font-family:var(--font-mono);font-size:12px">' + esc(PL.migText) + '</textarea></div>' +
@@ -4582,9 +4842,10 @@ function optCard(A) {
4582
4842
  function capCard(A) {
4583
4843
  const r = A.res, M = r.months, W = 980, H = 190, L = 56, k = 1000;
4584
4844
  const cum = key => { let c = 0; return M.map(x => (c += x[key])); };
4585
- const series = { rent: cum('rent'), reserved: cum('reserved'), hybrid: cum('hybrid') };
4845
+ const series = { rent: cum('rent'), reserved: cum('reserved'), blocks: cum('blocks'), spot: cum('spot'), hybrid: cum('hybrid') };
4586
4846
  const vmax = Math.max(...Object.values(series).map(a => a[a.length - 1])) * 1.05, X = m => L + (W - L - 10) * m / (M.length - 1), Y = v => 8 + (H - 30) * (1 - v / vmax);
4587
- const col = { rent: 'var(--crit)', reserved: 'var(--warn)', hybrid: 'var(--accent)' }, lab = { rent: 'Rent on demand', reserved: 'Reserve the base', hybrid: 'Buy the base, rent the peaks' };
4847
+ const col = { rent: 'var(--crit)', reserved: 'var(--warn)', blocks: 'var(--neo)', spot: 'var(--muted)', hybrid: 'var(--accent)' },
4848
+ lab = { rent: 'Rent on demand', reserved: 'Reserve the base', blocks: 'Reserve the base, capacity blocks for the peaks', spot: 'Reserve the base, spot for the peaks', hybrid: 'Buy the base, rent the peaks' };
4588
4849
  let svg = '<svg viewBox="0 0 ' + W + ' ' + H + '" style="width:100%;height:auto" role="img" aria-label="Cumulative cost by strategy">';
4589
4850
  for (const key in series) svg += '<path d="' + series[key].map((v, i) => (i ? 'L' : 'M') + X(i).toFixed(1) + ' ' + Y(v).toFixed(1)).join('') + '" fill="none" stroke="' + col[key] + '" stroke-width="2"/>';
4590
4851
  for (let m = 0; m < M.length; m += 6) svg += '<text x="' + X(m) + '" y="' + (H - 6) + '" font-size="10" fill="var(--muted)" text-anchor="middle">month ' + m + '</text>';
@@ -4594,7 +4855,7 @@ function capCard(A) {
4594
4855
  (r.best === 'hybrid' ? 'Buying pays back against renting by month ' + (r.breakEven == null ? '—' : r.breakEven) + ', and leaves ' + fInt(r.ownedEnd) + ' GPUs worth about ' + fUsd(r.residual) + ' after depreciation.' : 'At these prices and growth, owning does not pay back within the horizon.') + '</p>' + svg +
4595
4856
  '<div class="glegend">' + Object.keys(series).map(key => '<span><i style="background:' + col[key] + '"></i>' + lab[key] + ': ' + fUsd(r.totals[key] / 1) + (key === 'hybrid' ? ' net of residual value (' + fUsd(r.totals.hybridCash) + ' cash)' : '') + '</span>').join('') + '</div>' +
4596
4857
  (orders.length ? '<h3 class="sec">On-prem orders</h3><ul class="plain">' + orders.map(o => '<li>' + o + '</li>').join('') + '</ul>' : '') +
4597
- '<div class="sub">Rough model: average utilisation from base and peak shares, power at ' + r.opt.kwPerGpu + ' kW per GPU and PUE ' + r.opt.pue + ', operations ' + fUsd(r.opt.opsPerGpuMonth) + ' per GPU-month. Not financial advice.</div>';
4858
+ '<div class="sub">Rough model: average utilisation from base and peak shares; capacity blocks bought in whole days (' + M[0].blockDays + ' a month), spot hours plus ' + fPct(r.opt.spotRework) + ' redone after interruptions; power at ' + r.opt.kwPerGpu + ' kW per GPU and PUE ' + r.opt.pue + ', operations ' + fUsd(r.opt.opsPerGpuMonth) + ' per GPU-month. Not financial advice.</div>';
4598
4859
  }
4599
4860
  function migCard(A) {
4600
4861
  const r = A.res;
@@ -5334,6 +5595,7 @@ window.addEventListener('resize', () => {});
5334
5595
 
5335
5596
  </script>
5336
5597
  <script>
5598
+ /* global FleetScenario */ // set by scenario.js, loaded first on the page
5337
5599
  /* FleetScope cluster view: GPU allocation grid, scheduler policy what-ifs, workload timeline. Browser only. */
5338
5600
  (function () {
5339
5601
  'use strict';
@@ -5994,7 +6256,7 @@ window.addEventListener('resize', () => {});
5994
6256
  const arr = [];
5995
6257
  while (i < lines.length && indent(lines[i]) === ind && lines[i].trim().startsWith('- ')) {
5996
6258
  const rest = lines[i].trim().slice(2);
5997
- if (/^[\w.\/-]+:(\s|$)/.test(rest)) { lines[i] = ' '.repeat(ind + 2) + rest; arr.push(block(ind + 2)); }
6259
+ if (/^[\w./-]+:(\s|$)/.test(rest)) { lines[i] = ' '.repeat(ind + 2) + rest; arr.push(block(ind + 2)); }
5998
6260
  else { arr.push(scalar(rest)); i++; }
5999
6261
  }
6000
6262
  return arr;
@@ -6243,11 +6505,14 @@ window.addEventListener('resize', () => {});
6243
6505
  // rent on demand, rent reserved (1-year commitments) with on-demand burst, and hybrid (buy on-prem for the
6244
6506
  // base load with a lead time, reserve nothing, burst the rest on demand). On-prem cost: capex (paid at
6245
6507
  // delivery), power at PUE, and operations; hardware keeps its residual value at the end.
6246
- const CAP_DEFAULTS = { months: 24, gpusNow: 64, growthPct: 4, baseShare: 0.6, peakHoursShare: 0.35, gpuCapex: 32000, amortMonths: 48, kwPerGpu: 1.1, pue: 1.3, kwhPrice: 0.09, opsPerGpuMonth: 120, leadMonths: 3, reservedPerGpuH: 2.2, onDemandPerGpuH: 3.5, onPremStart: 0 };
6508
+ // Two cloud ways to buy the peak on top of a reserved base: short-term blocks (AWS EC2 Capacity Blocks for ML,
6509
+ // GCP calendar-mode reservations), bought in whole days, so the peak hours are assumed to come as one run of days;
6510
+ // and spot, with a share of the spot hours redone after interruptions. Prices are placeholders: set your own.
6511
+ const CAP_DEFAULTS = { months: 24, gpusNow: 64, growthPct: 4, baseShare: 0.6, peakHoursShare: 0.35, gpuCapex: 32000, amortMonths: 48, kwPerGpu: 1.1, pue: 1.3, kwhPrice: 0.09, opsPerGpuMonth: 120, leadMonths: 3, reservedPerGpuH: 2.2, onDemandPerGpuH: 3.5, onPremStart: 0, blockPerGpuH: 2.8, spotPerGpuH: 1.9, spotRework: 0.1 };
6247
6512
  function capacityPlan(o) {
6248
6513
  o = Object.assign({}, CAP_DEFAULTS, o || {});
6249
6514
  const H = 730, months = [];
6250
- const strat = { demand: [], rent: [], reserved: [], hybrid: [], owned: [] };
6515
+ const DAYS = H / 24;
6251
6516
  let owned = o.onPremStart;
6252
6517
  const deliveries = [];
6253
6518
  for (let m = 0; m < o.months; m++) {
@@ -6256,6 +6521,9 @@ window.addEventListener('resize', () => {});
6256
6521
  const avgUse = base + (peak - base) * o.peakHoursShare;
6257
6522
  const rent = avgUse * H * o.onDemandPerGpuH;
6258
6523
  const reserved = base * H * o.reservedPerGpuH + (peak - base) * o.peakHoursShare * H * o.onDemandPerGpuH;
6524
+ const blockDays = Math.min(DAYS, Math.ceil(o.peakHoursShare * DAYS - 1e-9));
6525
+ const blocks = base * H * o.reservedPerGpuH + (peak - base) * blockDays * 24 * o.blockPerGpuH;
6526
+ const spot = base * H * o.reservedPerGpuH + (peak - base) * o.peakHoursShare * H * o.spotPerGpuH * (1 + o.spotRework);
6259
6527
  // hybrid: order on-prem GPUs so that, after the lead time, owned capacity covers the base load
6260
6528
  const futureBase = o.gpusNow * Math.pow(1 + o.growthPct / 100, m + o.leadMonths) * o.baseShare;
6261
6529
  const pipeline = deliveries.filter(d => d.at >= m).reduce((a, d) => a + d.n, 0);
@@ -6266,12 +6534,12 @@ window.addEventListener('resize', () => {});
6266
6534
  const onprem = owned * (o.kwPerGpu * o.pue * H * o.kwhPrice + o.opsPerGpuMonth);
6267
6535
  const uncovered = Math.max(0, base - owned) * H + (peak - Math.max(base, Math.min(owned, peak))) * o.peakHoursShare * H;
6268
6536
  const hybrid = capex + onprem + Math.max(0, uncovered) * o.onDemandPerGpuH;
6269
- months.push({ m, peak, base, owned, order, capex, rent, reserved, hybrid });
6537
+ months.push({ m, peak, base, owned, order, capex, rent, reserved, hybrid, blocks, spot, blockDays });
6270
6538
  }
6271
6539
  const residual = owned => owned * o.gpuCapex * Math.max(0, 1 - o.months / o.amortMonths);
6272
6540
  const sum = k => months.reduce((a, x) => a + x[k], 0);
6273
- const totals = { rent: sum('rent'), reserved: sum('reserved'), hybrid: sum('hybrid') - residual(owned), hybridCash: sum('hybrid') };
6274
- const ranked = Object.entries({ rent: totals.rent, reserved: totals.reserved, hybrid: totals.hybrid }).sort((a, b) => a[1] - b[1]);
6541
+ const totals = { rent: sum('rent'), reserved: sum('reserved'), hybrid: sum('hybrid') - residual(owned), hybridCash: sum('hybrid'), blocks: sum('blocks'), spot: sum('spot') };
6542
+ const ranked = Object.entries({ rent: totals.rent, reserved: totals.reserved, hybrid: totals.hybrid, blocks: totals.blocks, spot: totals.spot }).sort((a, b) => a[1] - b[1]);
6275
6543
  // break-even: first month where cumulative hybrid cash spend falls below cumulative renting
6276
6544
  let cr = 0, ch = 0, breakEven = null;
6277
6545
  for (const x of months) { cr += x.rent; ch += x.hybrid; if (breakEven == null && x.owned > 0 && ch <= cr) breakEven = x.m; }
@@ -6318,7 +6586,6 @@ window.addEventListener('resize', () => {});
6318
6586
  'use strict';
6319
6587
  const node = typeof module !== 'undefined' && module.exports;
6320
6588
  const E = node ? require('./engine.js') : root.FleetEngine;
6321
- const SC = node ? require('./scenario.js') : root.FleetScenarioLib;
6322
6589
 
6323
6590
  const EXAMPLES = [
6324
6591
  'What if coding agents move to H200 and the cloud link drops to 100 Gbps?',
@@ -6453,6 +6720,7 @@ window.addEventListener('resize', () => {});
6453
6720
 
6454
6721
  </script>
6455
6722
  <script>
6723
+ /* global FleetScenario */ // set by scenario.js, loaded first on the page
6456
6724
  /* FleetScope Training view: one job seen four ways (GPUs, phases, scheduling, full). Browser only. */
6457
6725
  (function () {
6458
6726
  'use strict';
@@ -6867,6 +7135,7 @@ window.addEventListener('resize', () => {});
6867
7135
 
6868
7136
  </script>
6869
7137
  <script>
7138
+ /* global FleetScenario */ // set by scenario.js, loaded first on the page
6870
7139
  /* FleetScope Inference view: serving deployments as pods — replicas wanted vs ready, start-up time,
6871
7140
  and contention with training and batch work for GPUs. Browser only. */
6872
7141
  (function () {