The views table is a read-write lock: list recorders only read it #18

Open
Daayben wants to merge 1 commit from upstream-pr/18 into main
Daayben commented 2026-11-25 18:38:22 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Daayben on 2026-11-25T18:38:22Z.


descriptor::VIEWS becomes a RwLock. List recorders read it for every descriptor they bind. Belobug's PIX timing capture showed the title's five recording threads taking turns on the mutex, at 6,600 context switches a second each.

Read lock: view, view_at (table entries and placed_of), views_kept, and the two lookups in the tests.
Write lock: words_for (shape() may add a shape, entry() an entry) and forget.

Adapted from Belobug/VIctory-Belobug-AMD ff920f2 (beloooo, credited as co-author). This tree's table has shapes and placed views that the original did not, so the patch does not apply as is.

Measured effect: Belobug saw no frame-time change from this alone (4.2 to 5.8 fps either way). The submit thread is the limit there. I have not measured it in the game.

Checked on Windows 11, RTX 4090, i9-10900F:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean
  • cargo test --workspace --locked: 634 passed, 0 failed, 11 ignored
  • cargo test --locked --release -p victory-gpu: 188 passed, including the 23 descriptor tests

🤖 Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5497047049 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/18). Originally posted by [Daayben](https://github.com/Daayben) on 2026-11-25T18:38:22Z. --- `descriptor::VIEWS` becomes a `RwLock`. List recorders read it for every descriptor they bind. Belobug's PIX timing capture showed the title's five recording threads taking turns on the mutex, at 6,600 context switches a second each. Read lock: `view`, `view_at` (table entries and `placed_of`), `views_kept`, and the two lookups in the tests. Write lock: `words_for` (`shape()` may add a shape, `entry()` an entry) and `forget`. Adapted from Belobug/VIctory-Belobug-AMD ff920f2 (beloooo, credited as co-author). This tree's table has shapes and placed views that the original did not, so the patch does not apply as is. **Measured effect:** Belobug saw no frame-time change from this alone (4.2 to 5.8 fps either way). The submit thread is the limit there. I have not measured it in the game. Checked on Windows 11, RTX 4090, i9-10900F: - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and the same with `--all-features`: clean - `cargo test --workspace --locked`: 634 passed, 0 failed, 11 ignored - `cargo test --locked --release -p victory-gpu`: 188 passed, including the 23 `descriptor` tests 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewDoing commented 2026-11-26 23:17:59 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T23:17:59Z.


Independent native Windows release benchmark at a9990fd versus base 2e01ab4, Ryzen 7 5700X3D: 500,000 real view() lookups against 2,048 table-backed sampler descriptors per sample. Median of three process medians, each with five measured samples after warm-up: one reader 6.675 → 6.867 ms; five readers 74.663 → 30.751 ms (about 2.43×); five readers with one also calling words_for every 128 of its own reads 73.195 → 31.865 ms (about 2.30×). This isolates CPU lock paths; no GPU, gameplay or frame-time result.

Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7205424519 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/18#issuecomment-7205424519). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-26T23:17:59Z. --- Independent native Windows release benchmark at `a9990fd` versus base `2e01ab4`, Ryzen 7 5700X3D: 500,000 real `view()` lookups against 2,048 table-backed sampler descriptors per sample. Median of three process medians, each with five measured samples after warm-up: one reader 6.675 → 6.867 ms; five readers 74.663 → 30.751 ms (about 2.43×); five readers with one also calling `words_for` every 128 of its own reads 73.195 → 31.865 ms (about 2.30×). This isolates CPU lock paths; no GPU, gameplay or frame-time result. Verification was AI-assisted with GPT-6.2 Astra.
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/18:upstream-pr/18'
git switch 'upstream-pr/18'

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 'main'
git merge --no-ff 'upstream-pr/18'
git switch 'upstream-pr/18'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/18'
git switch 'upstream-pr/18'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/18'
git switch 'main'
git merge --squash 'upstream-pr/18'
git switch 'main'
git merge --ff-only 'upstream-pr/18'
git switch 'main'
git merge 'upstream-pr/18'
git push origin 'main'
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
DexNom/VIctory!18
No description provided.