Panel: a core's CPU counters that step back read as idle, not a panic #325

Manually merged
github merged 1 commit from github-bot/gh-325 into a-publier 2026-11-27 00:57:57 +00:00 AGit
Owner

@⁠alexdeliu on GitHub · 2026-11-26 20:19 UTC · original
alexdeliu:fix/panel-cpu-counter-backwards → a-publier · +32 −3 · 1 files · 1 commits · merged 2026-11-26 22:30 UTC

With VICTORY_PANEL=1 a run on my PC (Ryzen 7 7700, RX 9070, a-publier cd8dfc0) ended about a minute in with:

thread 'victory-submit' panicked at crates\victory-gpu\src\host\panel.rs:409:36:
min > max. min = 0, max = -156250
ERROR victory_gpu::host: the thread that prepares and sends submissions panicked

CpuMeter took each core's busy share as (ni - pi).clamp(0, nt - pt). One core's kernel+user counter stepped back between two reads (by 156,250 × 100 ns), clamp(0, negative) panicked, and it took the submitting thread down with it. Since PortWatch now asks for overlays on clips, more people will run with the panel on.

The share is now a small function, busy_pct: no time passed, or a counter that stepped back, reads 0 %. Otherwise it's the same formula as before. Two tests cover it: busy_is_the_share_of_time_not_idle and counters_that_step_back_do_not_panic.

Tested:

  • cargo test -p victory-gpu --lib busy_tests: 2 passed.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets: 2 warnings, the same as on a-publier.

🤖 Generated with Claude Code

**@⁠alexdeliu** on GitHub · 2026-11-26 20:19 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/325) `alexdeliu:fix/panel-cpu-counter-backwards` → `a-publier` · +32 −3 · 1 files · 1 commits · merged 2026-11-26 22:30 UTC With `VICTORY_PANEL=1` a run on my PC (Ryzen 7 7700, RX 9070, `a-publier` cd8dfc0) ended about a minute in with: ``` thread 'victory-submit' panicked at crates\victory-gpu\src\host\panel.rs:409:36: min > max. min = 0, max = -156250 ERROR victory_gpu::host: the thread that prepares and sends submissions panicked ``` `CpuMeter` took each core's busy share as `(ni - pi).clamp(0, nt - pt)`. One core's kernel+user counter stepped back between two reads (by 156,250 × 100 ns), `clamp(0, negative)` panicked, and it took the submitting thread down with it. Since PortWatch now asks for overlays on clips, more people will run with the panel on. The share is now a small function, `busy_pct`: no time passed, or a counter that stepped back, reads 0 %. Otherwise it's the same formula as before. Two tests cover it: `busy_is_the_share_of_time_not_idle` and `counters_that_step_back_do_not_panic`. Tested: - `cargo test -p victory-gpu --lib busy_tests`: 2 passed. - `cargo clippy -p victory-shader -p victory-gpu --all-targets`: 2 warnings, the same as on `a-publier`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The HUD (VICTORY_PANEL=1) took each core's busy share as
(ni - pi).clamp(0, nt - pt). On a Ryzen 7 7700 a core's kernel+user
counter stepped back between two reads, clamp(0, negative) panicked on
the submitting thread, and the run ended (host GPU failure). The share is
now a small function: no time passed or a step back reads 0, with tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:24:00 +00:00
github manually merged commit b7f6420a2c into a-publier 2026-11-27 00:57:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.