feat(inference): add perf ruler to GPU/date comparison chart / 推理图表:为多日期多芯片对比图添加性能标尺 - #968
Merged
Merged
Conversation
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 是否存在来清理,因此通过图例临时隐藏的序列重新显示后标尺会恢复,只有当日期/芯片/精度真正离开对比时才会移除。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Perf Ruler toggle only existed on the single-date scatter chart (
ScatterGraph). When/inferencecompares multiple dates and/or chip configs it rendersGPUGraph, 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
GPUGraphon top of the shared, already-testedlib/d3-chart/layers/perf-rulermodule.What changed
Perf Ruler(with info tooltip) and aClear rulers (n)action shown while rulers exist.roofline-<date>_<hwKey>_<precision>..rooflines-layerwrapper), so the invisible hit layer is inserted directly after the last roofline path — above the visible strokes, below the dot-groups.perf-rulerlayer redraws on data/metric passes andonZoom; 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.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.gpu_timeseries_perf_ruler_toggled/_curve_clicked/_deleted/_cleared, andperfRuler: trueongpu_timeseries_data_point_clicked.Verification
bun run fmt,bun run lint,bun run typecheckpass locally.perf-ruler.test.ts(78 tests) andtooltip-utils.test.tspass.中文说明
性能标尺开关此前只存在于单日期散点图表(
ScatterGraph)。当/inference比较多个日期和/或芯片配置时渲染的是GPUGraph,其高级图例菜单没有标尺,因此无法在指定横坐标下测量两条对比曲线之间的倍数。本 PR 基于共享且已有测试覆盖的
lib/d3-chart/layers/perf-ruler模块,将标尺逻辑移植到GPUGraph:roofline-<date>_<hwKey>_<precision>标识。.rooflines-layer包裹层),因此透明的命中图层直接插入到最后一条 roofline 路径之后——位于可见曲线之上、数据点之下。perf-ruler图层在数据/指标渲染和缩放时重绘;布局效应在模式/状态/数据变化时重绘。iso-x 以数据坐标存储,因此标尺在缩放、指标切换和对数刻度切换后保持不变。isVisible)但保留 roofline 数据项,因此重新显示后标尺会恢复,只有当日期/芯片/精度真正离开对比时才会移除。已在本地通过
bun run fmt、bun run lint、bun run typecheck,以及perf-ruler.test.ts(78 个测试)和tooltip-utils.test.ts。开关关闭时行为不变。Note
Low Risk
Opt-in chart UI wired through the existing tested
perf-rulermodule; 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 customperf-rulerD3 layer redraws on render/zoom; point clicks measure instead of pinning the tooltip. New analytics:gpu_timeseries_perf_ruler_*andperfRuler: trueon 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.