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

Merged
alexdeliu merged 1 commit from upstream-pr/325 into a-publier 2026-11-26 22:30:23 +00:00
alexdeliu commented 2026-11-26 20:19:52 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by alexdeliu on 2026-11-26T20:19:52Z.


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

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5516629292 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/325). Originally posted by [alexdeliu](https://github.com/alexdeliu) on 2026-11-26T20:19:52Z. --- 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)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Belobug/VIctory-Belobug-AMD!325
No description provided.