Diagnostics: copies up and back by the title's memory protection (VICTORY_WC_STATS=1) #476

Open
icecreammule277-dot wants to merge 2 commits from upstream-pr/476 into a-publier
icecreammule277-dot commented 2026-11-27 05:19:31 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by icecreammule277-dot on 2026-11-27T05:19:31Z.


AI-assisted (Claude Code). Numbers and log lines only.

Diagnostics only, off by default (VICTORY_WC_STATS=1): copies up to the card and back into title memory, split by the memory protection the title asked for. The split is write-combined (0x400), uncached (0x200) or cached. The console's CPU writes write-combined memory but doesn't read it back, so this shows how much of the copy traffic goes to memory the title never reads.

What it does

  • XMem's note_protection reports every protection the title asks for (victory_gpu::title_memory_protection). wc.rs keeps an interval map of them, where the newest request wins.
  • Copy-ups (refreshes, copies, fills, batch updates) and copy-backs (relay, hand-back, plan ranges, card merges) are counted by the title address they start at.
  • A line next to the frame-rate line gives MB per frame by kind, and how much address space of each kind was noted. Counters are taken every second, over the same frames as the frame-rate line.
  • Off, every hook returns at once. On, a copy costs a read lock and one map lookup.

What it showed

In a heavy scene (about 67 ms a frame), copy-back was 46.2 MB a frame, 100% of it into write-combined memory. Copy-up was 79 MB, 85% write-combined. That's the basis for the follow-up PR, which leaves shaders' writes to such memory on the card.

Tests

cargo test -p victory-gpu --lib -- wc:: covers the newest request cutting older ranges, and the protection bits picking the kind. Built with --profile diag --features diagnostics.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5521633085 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/476). Originally posted by [icecreammule277-dot](https://github.com/icecreammule277-dot) on 2026-11-27T05:19:31Z. --- *AI-assisted (Claude Code). Numbers and log lines only.* **Diagnostics only, off by default (`VICTORY_WC_STATS=1`):** copies up to the card and back into title memory, split by the memory protection the title asked for. The split is write-combined (0x400), uncached (0x200) or cached. The console's CPU writes write-combined memory but doesn't read it back, so this shows how much of the copy traffic goes to memory the title never reads. ## What it does - XMem's `note_protection` reports every protection the title asks for (`victory_gpu::title_memory_protection`). `wc.rs` keeps an interval map of them, where the newest request wins. - Copy-ups (refreshes, copies, fills, batch updates) and copy-backs (relay, hand-back, plan ranges, card merges) are counted by the title address they start at. - A line next to the frame-rate line gives MB per frame by kind, and how much address space of each kind was noted. Counters are taken every second, over the same frames as the frame-rate line. - Off, every hook returns at once. On, a copy costs a read lock and one map lookup. ## What it showed In a heavy scene (about 67 ms a frame), copy-back was 46.2 MB a frame, **100% of it into write-combined memory**. Copy-up was 79 MB, 85% write-combined. That's the basis for the follow-up PR, which leaves shaders' writes to such memory on the card. ## Tests `cargo test -p victory-gpu --lib -- wc::` covers the newest request cutting older ranges, and the protection bits picking the kind. Built with `--profile diag --features diagnostics`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MamaLeVrai commented 2026-11-27 07:01:48 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by MamaLeVrai on 2026-11-27T07:01:48Z.


Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At a78f788: victory-gpu 398 passed, 0 failed, 34 ignored; victory-hle 162 passed, 0 failed, 2 ignored.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7212072899 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/476#issuecomment-7212072899). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-27T07:01:48Z. --- Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At `a78f788`: `victory-gpu` 398 passed, 0 failed, 34 ignored; `victory-hle` 162 passed, 0 failed, 2 ignored. AI-assisted (Claude Code); no game data.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/476:upstream-pr/476'
git switch 'upstream-pr/476'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'a-publier'
git merge --no-ff 'upstream-pr/476'
git switch 'upstream-pr/476'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'upstream-pr/476'
git switch 'upstream-pr/476'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'upstream-pr/476'
git switch 'a-publier'
git merge --squash 'upstream-pr/476'
git switch 'a-publier'
git merge --ff-only 'upstream-pr/476'
git switch 'a-publier'
git merge 'upstream-pr/476'
git push origin 'a-publier'
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!476
No description provided.