Skip to content

feat(inference): add perf ruler to GPU/date comparison chart / 推理图表:为多日期多芯片对比图添加性能标尺 - #968

Merged
functionstackx merged 1 commit into
masterfrom
feat/gpu-graph-perf-ruler
Sep 1, 2026
Merged

feat(inference): add perf ruler to GPU/date comparison chart / 推理图表:为多日期多芯片对比图添加性能标尺#968
functionstackx merged 1 commit into
masterfrom
feat/gpu-graph-perf-ruler

Conversation

@functionstackx

@functionstackx functionstackx commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

The Perf Ruler toggle only existed on the single-date scatter chart (ScatterGraph). When /inference compares multiple dates and/or chip configs it renders GPUGraph, whose Advanced legend menu had no ruler, so there was no way to measure the multiple between two comparison curves at a given x.

This ports the ruler wiring into GPUGraph on top of the shared, already-tested lib/d3-chart/layers/perf-ruler module.

What changed

  • Legend: new Advanced switch Perf Ruler (with info tooltip) and a Clear rulers (n) action shown while rulers exist.
  • Any two curves can be paired: two dates of the same chip config, two chip configs on the same date, or a mix. Curves are identified by the roofline class token roofline-<date>_<hwKey>_<precision>.
  • Curve hit strokes: this chart renders rooflines straight into the zoom group (no .rooflines-layer wrapper), so the invisible hit layer is inserted directly after the last roofline path — above the visible strokes, below the dot-groups.
  • Point clicks in ruler mode measure the point's curve at its x instead of pinning the tooltip.
  • Custom perf-ruler layer redraws on data/metric passes and onZoom; a layout effect redraws when mode/state/data change. Iso-x is stored in data space so rulers survive zoom, metric switches and log-scale toggles.
  • Pruning by data, not DOM: a series hidden via the legend drops its path in this chart (roofline isVisible) but keeps its roofline entry, so its rulers come back when re-shown and are only removed when the date/chip/precision actually leaves the comparison.
  • Analytics: gpu_timeseries_perf_ruler_toggled / _curve_clicked / _deleted / _cleared, and perfRuler: true on gpu_timeseries_data_point_clicked.

Verification

  • bun run fmt, bun run lint, bun run typecheck pass locally.
  • perf-ruler.test.ts (78 tests) and tooltip-utils.test.ts pass.
  • No behavior change when the toggle is off: the layer draws nothing and the hit layer is removed.

中文说明

性能标尺开关此前只存在于单日期散点图表(ScatterGraph)。当 /inference 比较多个日期和/或芯片配置时渲染的是 GPUGraph,其高级图例菜单没有标尺,因此无法在指定横坐标下测量两条对比曲线之间的倍数。

本 PR 基于共享且已有测试覆盖的 lib/d3-chart/layers/perf-ruler 模块,将标尺逻辑移植到 GPUGraph

  • 图例:新增高级开关"性能标尺"(带说明提示),并在存在标尺时显示"清除标尺(n)"操作。
  • 任意两条曲线均可配对:同一芯片配置的两个日期、同一日期的两个芯片配置,或二者混合。曲线通过 roofline 类名 roofline-<date>_<hwKey>_<precision> 标识。
  • 曲线命中区域:本图表将 roofline 直接渲染到缩放组中(没有 .rooflines-layer 包裹层),因此透明的命中图层直接插入到最后一条 roofline 路径之后——位于可见曲线之上、数据点之下。
  • 标尺模式下点击数据点会在该点横坐标处测量其所属曲线,而不是固定工具提示。
  • 自定义 perf-ruler 图层在数据/指标渲染和缩放时重绘;布局效应在模式/状态/数据变化时重绘。iso-x 以数据坐标存储,因此标尺在缩放、指标切换和对数刻度切换后保持不变。
  • 按数据而非 DOM 清理:通过图例隐藏的序列在本图表中会移除其路径(roofline isVisible)但保留 roofline 数据项,因此重新显示后标尺会恢复,只有当日期/芯片/精度真正离开对比时才会移除。

已在本地通过 bun run fmtbun run lintbun run typecheck,以及 perf-ruler.test.ts(78 个测试)和 tooltip-utils.test.ts。开关关闭时行为不变。


Note

Low Risk
Opt-in chart UI wired through the existing tested perf-ruler module; no API, auth, or data-path changes.

Overview
Brings the Perf Ruler from the single-date scatter chart into GPUGraph, so multi-date / multi-chip comparison views can measure performance multiples between two roofline curves at any x.

Users get an Advanced legend toggle (EN/ZH copy + info tooltip) and Clear rulers (n) while rulers exist. In ruler mode they click two curves identified as roofline-<date>_<hwKey>_<precision> (or click points to anchor on that series’ x); invisible widened hit strokes sit above rooflines; rulers drag horizontally, persist iso-x in data space through zoom/metric changes, and prune when a series truly leaves the comparison (legend hide keeps rulers for when paths return). A custom perf-ruler D3 layer redraws on render/zoom; point clicks measure instead of pinning the tooltip. New analytics: gpu_timeseries_perf_ruler_* and perfRuler: true on point clicks. Off by default — no change when the toggle is off.

Reviewed by Cursor Bugbot for commit 543014b. Bugbot is set up for automated code reviews on this repo. Configure here.

The Perf Ruler toggle only existed on the single-date scatter chart. When
/inference compares multiple dates or chip configs it renders GPUGraph,
whose Advanced legend menu had no ruler, so there was no way to measure
the multiple between two comparison curves at a given x.

Port the ScatterGraph ruler wiring into GPUGraph on top of the shared
`layers/perf-ruler` module:

- Advanced legend switch "Perf Ruler" with an info tooltip, plus a
  "Clear rulers (n)" action while rulers exist.
- Rulers pair any two rendered roofline paths (`roofline-<date>_<hwKey>_
  <precision>`) — two dates of one chip config, two chip configs on one
  date, or a mix — and store iso-x in data space so they survive zoom,
  metric, and log-scale changes.
- Curve hit strokes are inserted directly above the last roofline path
  (this chart has no `.rooflines-layer` wrapper); ruler-mode point clicks
  measure instead of pinning the tooltip.
- Custom `perf-ruler` layer redraws on data/metric passes and onZoom; a
  layout effect redraws on state changes.
- Rulers are pruned by data existence rather than DOM presence: a series
  hidden via the legend drops its path in this chart but keeps its
  roofline entry, so its rulers reappear when the series is re-shown and
  are removed only when the date/chip/precision leaves the comparison.

中文:性能标尺开关此前只存在于单日期散点图表中。/inference 在比较多个日期或芯片配置时渲染的是 GPUGraph,其高级图例菜单没有标尺,无法在指定横坐标下测量两条对比曲线之间的倍数。本次基于共享的 `layers/perf-ruler` 模块,将 ScatterGraph 的标尺逻辑移植到 GPUGraph:新增"性能标尺"高级开关(带说明提示)和"清除标尺(n)"操作;标尺可配对任意两条已渲染的 roofline 曲线(同一芯片配置的两个日期、同一日期的两个芯片配置或混合),iso-x 以数据坐标存储,在缩放、指标和对数刻度切换后保持不变;曲线命中区域直接插入到最后一条 roofline 路径之后(本图表没有 `.rooflines-layer` 包裹层);标尺模式下点击数据点执行测量而不是固定工具提示;自定义 `perf-ruler` 图层在数据/指标渲染和缩放时重绘;标尺按数据是否存在而非 DOM 是否存在来清理,因此通过图例临时隐藏的序列重新显示后标尺会恢复,只有当日期/芯片/精度真正离开对比时才会移除。
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
inferencemax-app Ready Ready Preview Sep 1, 2026 8:15pm UTC

Request Review

@functionstackx
functionstackx merged commit 662dd86 into master Sep 1, 2026
24 checks passed
@functionstackx
functionstackx deleted the feat/gpu-graph-perf-ruler branch September 1, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant