Repository navigation
ROCMAI-861: fix the dash Home hero's -0 throughput and empty short-terminal card - #914
Conversation
…served
The Home hero summed instance gen_tps with Iterator::sum, which returns
-0.0 for an empty iterator, and `{:.0}` rendered that as "-0". It was
visible whenever no instance reports throughput: always on Windows, where
the in-process collectors never send instances, and on Linux when nothing
is served.
Show "—" when no instance contributes a finite gen_tps, matching the
hero's other unmeasured values and the Observe tab's aggregate. An
instance reporting 0 tok/s still shows "0".
Covered by unit tests in home.rs and a new step on dash-37.
Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
The hero card drew its contents only when it had six inner rows. In a terminal of about 22 rows (for example the VS Code panel) the Home tab squeezes the hero to five, so the card rendered as an empty box with just its title, even with live GPU telemetry arriving. Lay each hero column out row by row and drop the rows that do not fit, bottom first (legends, then T/S), instead of skipping the whole hero. At 72x14 the hero now shows utilization, VRAM, temperature and power. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
Relaxing the hero's height gate let the T/S and tok/W rows render in a terminal too short for the legend row beneath them, so a held value showed a bare "*" with nothing on screen to define it. At 24 rows -- the default terminal size -- the hero read "T/S 300*" and no legend. Suppress the marker whenever its legend row is unavailable. The reading itself still shows: a held value is real and measured, just from the prior scrape window, so losing the annotation is a smaller cost than an unexplained glyph, and a smaller one still than dropping the reading to make room for the legend. Guarded by hero_never_shows_a_held_marker_without_its_legend, which sweeps the heights rather than pinning the one that happens to break. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
The hero's tok/W aggregate gated its label on `tpw > 0.0`, so an instance genuinely reporting 0.0 tok/W rendered as "—", the same thing shown when nothing reports at all. This is the conflation just fixed on the T/S side, in the aggregate directly beside it. Both aggregates now go through `instance_aggregate`, which returns None only when no instance contributed a finite sample. That makes the distinction expressible, keeps the NaN/Infinity guard in one place, and drops the per-frame Vec the T/S side was allocating only to ask whether any sample existed. Avoiding Iterator::sum is now load-bearing rather than incidental: its f64 identity is -0.0, which is where the original "-0" came from. home_tpw_shows_a_measured_zero_rather_than_a_dash replaces a test that pinned the old behaviour; its setup reported 0.0 tok/W and expected the unmeasured dash. home_tpw_legend_absent_when_no_instance_reports_a_ finite_value keeps the invariant that test was really guarding. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
"the hero reports no generation throughput" read the screen immediately and relied on the step before it having called use_wide_size(). Cucumber matches step text globally, so written into any other scenario it would race the first render and panic with "no T/S row on screen". Resize and wait for the T/S row inside the step, as both sibling steps in this file already do. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
The hero's row dropping is ratatui layout with no platform gate, but the check sat under "4b. Dashboard Live GPU/CPU/Memory On Windows", where a Linux or WSL tester would not look for it. The e2e scenario resizes to 45 rows precisely so it never exercises a short terminal, so manual testing is the only coverage this behaviour has. New platform-neutral 4c, extended to cover the held marker and its legend appearing and disappearing together. The T/S bullet left in 4b is genuinely Windows-specific. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
hero_keeps_its_readings_in_a_short_terminal swept heights 12..=18 but asserted only GPU UTILIZATION, VRAM and TEMP -- the three rows that survive at 12. POWER first appears at 13 and T/S at 15, so neither was covered anywhere, even though the commit message, docs 4c and ROCMAI-861's acceptance criteria all promise power survives the squeeze. A regression confined to the POWER slot stayed green. Assert the invariant instead: the visible rows must form a prefix of the top-down list, so a row is missing only when every row below it is too. That covers POWER and T/S without naming the height each appears at, which would drift as the layout changes. A roomy-hero check keeps it from passing on a card that renders nothing. Verified by zeroing hero_rows' slot 3: the new test fails with "dropped POWER but kept a row below it", where the old assertions passed. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
jussielo-amd
left a comment
There was a problem hiding this comment.
Thanks @r0x0r, nice fix. Returning Option<f64> so "nothing reported" and "measured zero" are distinct is the right shape, and the prefix-style drop-order test is a good choice over per-row thresholds. I couldn't find a code defect in the diff.
Blocking
- Red CI on this head:
E2E tests (Strix Halo, Ubuntu, release, current)and(…, nightly, current)fail with one unexpected failure,serve-stop-leaves-no-background-helper(279/287 pass, no dash scenario fails;dash-37isn't among them). It looks unrelated to this change (it's a serve-stop scenario, and the two jobs ran at the same time on the same runner), so a green re-run or a note that main fails the same way should be enough. The MI300X and W7900 lanes are still queued.
Non-blocking (details inline)
- The new step's "wait for the redraw" is probably already satisfied before the resize at the default 24 rows.
- Redundant
tpw.is_some() &&in the legend gate. - Manual-test 4c tells the tester to use 22-24 rows, where the marker/legend can't appear.
- No scenario for the short-terminal hero or measured-zero tok/W, or a line in the description on why not.
Questions (UX, your call): at the default 80x24 a held reading now shows with no staleness cue (marker hidden with its legend), and T/S is the first row dropped, with no hint that rows are missing. Both look deliberate and are better than the empty card before, just confirm they're intended.
I read the diff only and didn't run the tests or the CLI.
🤖 by agenthub on AMD AgentHub
| .unwrap_or_else(|e| panic!("failed to enlarge the dashboard: {e}")); | ||
| tui.wait_for_screen_where( | ||
| "the hero's T/S row", | ||
| |screen| screen.contains("T/S"), |
There was a problem hiding this comment.
Non-blocking: with this PR the hero draws T/S from about 23 rows (your table), and the default pty is 24 rows, so this predicate is probably already true before the resize lands and the wait no longer waits for the redraw. The same goes for the VRAM wait at ~1408, whose comment is now stale. Harmless here since the value is — either way, but it's a latent flake. Consider waiting on something only the resized layout shows (or the screen size changing), or adjusting the comments.
| // `tpw_label` above so an unmeasured aggregate (which prints | ||
| // "tokens / watt —" with no marker) never shows an unexplained legend. | ||
| if tpw > 0.0 && any_tpw_held { | ||
| if tpw.is_some() && any_tpw_held { |
There was a problem hiding this comment.
Non-blocking nit: any_tpw_held already requires tokens_per_watt.is_some_and(f64::is_finite), so tpw.is_some() && can't change the outcome, and the "legend absent when nothing finite" test can't fail on that term. Either drop it (and the comment claiming it mirrors the label gate) or derive both from one helper so the invariant is structural.
| **Any platform.** The hero's row dropping is terminal layout, not a | ||
| Windows-specific path, so this reproduces on Linux and WSL too. | ||
|
|
||
| Open a terminal about 22 to 24 rows tall — the VS Code panel is one — and |
There was a problem hiding this comment.
Non-blocking: by the PR's own table the * marker and legend only appear at ~25+ rows (suppressed at 23-24, and T/S isn't drawn at 22 and below), so a tester opening "about 22 to 24 rows" never sees the marker/legend bullet below. Maybe name the rough thresholds (T/S from ~23, marker+legend from ~25, layout-dependent) so the sweep range is clear.
| let title = node_throughput_title(state); | ||
| let hero = card(f, area, &title, BoxRole::Secondary, theme); | ||
| if hero.width >= 8 && hero.height >= 6 { | ||
| if hero.width >= 8 && hero.height >= 1 { |
There was a problem hiding this comment.
Non-blocking: two user-visible changes are covered by unit tests only: the hero now rendering at ~23-24 rows (the default pty size) and a measured-zero tok/W showing 0.0 instead of —. The repo's testing guidance asks for a scenario for observable behaviour, or a line in the PR text on why there isn't one. A dash scenario at the default size asserting the hero rows looks feasible with the existing driver.
…unnable Review round on #914. - `tpw.is_some() &&` in the held-legend gate was unreachable-false: `any_tpw_held` already requires an instance with a finite `tokens_per_watt`, and `instance_aggregate` folds exactly those over the same `state.instances` set. Removed rather than left reading as a real second condition. - Manual-test 4c asked the tester to watch the held marker and its legend appear and disappear together, at 22 to 24 rows. The legend is the first row the hero drops and the marker is gated on the legend fitting, so at that height neither is on screen and there is nothing to compare. The step now starts tall and shrinks past the drop. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
|
Fixed the two code/doc points and merged Your blocking item: the red lanes are not this PR's, and The evidence, since you asked for exactly this: the same scenario fails on This branch touches The redundant Manual-test 4c — you are right that it was unrunnable as written. The step asked the tester to watch the marker and legend appear and disappear together at 22 to 24 rows, but the legend is the first row the hero drops and the marker is gated on the legend fitting, so at that height neither is on screen. It now says to start around 30 rows, confirm both are present, then shrink past the drop — which is the only way to observe the "together" property it is actually testing. The remaining points
Your two UX questions — both intended
Verification on a Linux MI300X box with the merged tree: |
Addressed in c3d56a6. The red lanes are not this PR's: serve-stop-leaves-no-background-helper fails identically on main's own Strix Halo lanes (run 41982405007) and on another PR's MI300X lane, with the consolidated report downstream of the dead lane; this branch is dash-only. The tpw.is_some() term was unreachable-false and is removed with the implication documented, and manual-test 4c now starts tall and shrinks, since at 22-24 rows neither the marker nor its legend can appear. Both UX questions confirmed intended; the two coverage gaps are stated rather than closed. Re-requesting your review.
jussielo-amd
left a comment
There was a problem hiding this comment.
Approving. My earlier blocker (red Strix Halo lanes) no longer applies: nothing is red on this head, and the failed main run you cite is a real failure on main too. The tpw.is_some() term is gone and 4c now says to start tall and shrink, both as described. I found no correctness defect: instance_aggregate handles empty/NaN/Inf/zero correctly (the fold starts at +0.0), hero_rows cannot overflow, and the marker is shown only when its legend row exists on each side. This was a static read; I did not run the tests. Four E2E lanes (W7900, MI300X, Strix Halo Ubuntu release and nightly) were still queued, so please let them finish before merging.
Non-blocking, three of them inline, plus:
dash_steps.rs~1636-1637: the comment inhome_view_displayedsays the "GPU UTILIZATION" hero "is not" drawn at any size. With the>= 6gate gone (nowheight >= 1) that is no longer true; reword it, keeping the point that the summary cards are the size-independent marker.- The verification table and "fails at height 12 / 15" mix two units: the table is in terminal rows and the tests render the Home area alone. By my count the offset is 8 rows (header, footer, tab-panel chrome), which matches your table, but it is not stated anywhere; one sentence in the description would save the next reader the arithmetic.
widgets.rs::node_efficiencystill gates ontps > 0.0 && power > 0.0, so Observe shows—for a measured 0. That is outside this PR, but "—now means only that nothing reported" is true only for the Home hero.
🤖 by agenthub on AMD AgentHub
| .unwrap_or_else(|e| panic!("failed to enlarge the dashboard: {e}")); | ||
| tui.wait_for_screen_where( | ||
| "the hero's T/S row", | ||
| |screen| screen.contains("T/S"), |
There was a problem hiding this comment.
Non-blocking: besides the wait being satisfied at the default 24 rows (discussed earlier), this waits only for the T/S label and then re-reads screen_text(). mini_spark draws the label first and the value in a separate widget, so a frame can have the label and not yet the value, and the assert_eq!(value, "—") would read an empty string. The wait_for_frame doc in this file warns about exactly that ("a step that waits on one marker and then reads the screen again can read a frame that is still being drawn"), and the neighbouring step already uses it. Suggest wait_for_frame with a predicate that reports a lack until the text after T/S on its row is —; that also drops the duplicated label split.
| total stays unmeasured and shows `—` in the Home hero and in the GPU wall | ||
| sidebar, never `0.0%`. | ||
| - The hero's `T/S` row reads `—`, never `0` or `-0`: Windows has no | ||
| serving-instance view, so no throughput is ever measured there. |
There was a problem hiding this comment.
Non-blocking: by the PR's own table T/S is not drawn at 22 rows or fewer, so a tester running 4b in a short window (the VS Code panel again) sees no T/S row and may file it as a bug. Worth adding "in a terminal of about 25 rows or more (see 4c)" here. In 4c, "the held legend first, then T/S" is also incomplete: the left column drops its tokens / watt row and legend the same way.
| /// than allowed to poison the total, as `gen_tps_cell` does per instance. | ||
| /// `Iterator::sum` is deliberately avoided — its `f64` identity is `-0.0`, so | ||
| /// an empty iterator sums to `-0.0` and renders as `"-0"`. | ||
| fn instance_aggregate<F>(state: &AppState, pick: F) -> Option<f64> |
There was a problem hiding this comment.
Non-blocking, possible duplicated code: "sum the finite per-instance values, None if none" now exists three times: here, hand-rolled with has_tps in observe.rs (~line 190), and as .filter_map(..).filter(is_finite).sum() in widgets.rs::node_efficiency. Consider putting this helper next to them (widgets.rs or format.rs) so Observe can use it too, and the held-marker plus — handling in the tps_str match below overlaps with format::gen_tps_aggregate. Fine as a follow-up.
nowycondro
left a comment
There was a problem hiding this comment.
🤖 Automated review · review-code · head c3d56a6
Outcome: needs work — two findings worth fixing before merge; the aggregation fix itself (Option<f64> distinguishing "nothing reported" from "measured zero") is sound and well-tested.
Blocking
- No BDD/e2e scenario for the short-terminal row-dropping or held-marker/legend pairing —
tests/e2e-cucumber/features/dash.featureonly gains a step for the-0.0→—throughput fix (dash-37). The row-dropping (home.rs::hero_rows, ~L329) and the marker/legend-pairing gate (legend_fits, ~L382/L518) are new, user-observable TUI behavior covered only by Rust unit tests plus a manual-testing doc section (4c). This repo's ownAGENTS.mdrequires a Gherkin scenario for user-observable behavior changes, or an explicit stated reason why not — neither exists here for these two behaviors. Fix: add a resize-driven scenario, or state in the PR description why unit tests substitute. - New step's "holds wherever it is written" claim doesn't hold —
tests/e2e-cucumber/tests/e2e/dash_steps.rs::hero_reports_no_generation_throughput(~L1703) waits only for theT/Ssubstring to appear. Its siblinghero_reports_no_gpu_telemetry(~L1646) explicitly waits for the connected-daemon header first, with a comment explaining why: a client that never reached the daemon shows the same—placeholders. The new step skips that wait, so its own "self-contained ... has to hold wherever it is written" comment is false — it only passes today because it's always run right after its sibling in the one scenario that uses it. Fix: add the same connected-header wait, or drop the self-containment claim and document the ordering dependency instead.
Non-blocking
widgets.rs::node_efficiencystill gates ontps > 0.0 && power > 0.0— pre-existing, same bug class this PR fixes for the Home hero elsewhere; worth a follow-up.- Author's call: suppressing the held marker whenever its legend doesn't fit silently drops the staleness cue at the default 80x24 size; the hand-rolled None/zero/held formatting for the hero aggregate duplicates the shape
format.rs::gen_tps_cellalready provides per-instance — worth sharing if a third case shows up.
CI is green on this head; one W7900 e2e lane is still queued, not failing.
What this covered: full diff (4 files, base 17f655d→head c3d56a6) read completely with surrounding context (widgets.rs, panel.rs, scroll.rs, format.rs), fanned out across independent workers for the production code and the test/doc changes, plus history and impact-analysis passes.
Not a human review. This is an automated code review; please verify findings independently before acting on them.
Brings the branch up to date after 53 commits, and clears the stale gitleaks failure: its three findings are all in d027ff8 (ROCm#914), which landed in main on 2026-11-10 just after this PR was last scanned. Every other open PR carries that commit and passes the scan, because it now sits on the base side of the comparison rather than looking like a commit this PR introduces. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
Why
On a native Windows host (Ryzen 7 4700U, Vega 7 iGPU, Adrenalin 26.5.2)
rocm dashshowed a Home tab whose hero card was an empty box, and whose throughput row read-0. Both are layout and formatting faults in the hero itself, not in the Windows collectors, and each also reproduces on Linux.The
-0isIterator::sum's identity. Forf64that identity is-0.0, not0.0, so summing an empty iterator yields-0.0and{:.0}renders it-0. The hero summed instancegen_tpsdirectly, so the value appeared whenever no instance reported throughput: always on Windows, which has no serving-instance view, and on any idle Linux host.The empty card is a height gate.
draw_hero_banddrew its contents only when the card had at least six inner rows. A terminal of about 22 rows leaves the hero five, so it rendered its title and nothing else even while live telemetry was arriving.The same aggregate could not express "nothing measured". A bare sum collapses "no instance reported a value" and "every reporter measured zero" into the same
0.0, so the tok/W side gated its label ontpw > 0.0and showed an instance genuinely reporting0.0 tok/Was the unmeasured—.What changes
Both hero aggregates now go through one helper returning
Option<f64>, which isNoneonly when no instance contributed a finite sample. That makes the distinction expressible, keeps the NaN/Infinity guard in one place, and removes the reliance onIterator::sum. A reported0still renders as0;—now means only that nothing reported.The hero lays each column out a row at a time and drops the rows that do not fit, bottom first, rather than skipping the whole card. Dropping from the bottom would otherwise let the held-data
*marker render while the legend defining it fell off the card, so the marker is suppressed together with that legend: the reading itself still shows, since a held value is real and measured, just from the prior scrape window.dash-37gains a step asserting the throughput placeholder, written to resize and wait for its own row so it holds wherever it is used.docs/manual-testing.mdgains a platform-neutral section for the short-terminal behaviour, which is ratatui layout with no platform gate and so was not discoverable under the Windows-only section.Verification
Behaviour of the hero's T/S row, by terminal height, with one instance reporting held throughput:
*marker* = heldlegendEach fix is pinned by a test that fails without it. Reverting the aggregate so zero samples count as unmeasured fails both the T/S and the tok/W zero tests; restoring the
>= 6height gate fails the short-terminal test at height 12; removing either side's marker guard fails the marker/legend test at height 15; zeroing the layout helper's fourth slot fails the drop-order test with "dropped POWER but kept a row below it".The drop-order test asserts that the visible rows form a prefix of the top-down list, rather than naming the height each row appears at — POWER appears at 13 and T/S at 15, and those thresholds would drift silently as the layout changes.
Run locally on macOS:
cargo test -p rocm-dash-tui(1000 unit plus 33 integration),cargo clippy -p rocm-dash-tui -p e2e-cucumber --all-targets -- -D warnings, andcargo test -p e2e-cucumber --test feature_naming. The same tests and clippy were re-run against a temporary merge of currentmain, sincemainhas touched all four of these files since this branch's base.Not run
The
tests/e2e-cucumbersuite is Linux-only and was not run locally, so the newdash-37step has not executed anywhere; CI carries it. The full workspace build was not run on macOS —rocm-engine-lemonadedoes not compile there onmaineither, becausest_modeisu16on that platform andu32on Linux.The Windows host above was used to confirm the original two symptoms and their fixes. The marker/legend and tok/W behaviour is platform-independent layout and formatting, exercised by unit tests rather than on hardware.
Scope
Rendering only, inside the Home tab's hero card. No daemon, collector or metrics change, so the figures reaching the hero are the same ones as before.
Two known Windows gaps are deliberately left alone, as neither is a hero fault: the dashboard never shows served models there, because no
rocmdashdsocket exists on Windows, and the header still prints aunix:socket path on a platform where nothing connects to it.