perf(descriptor): batch texture recheck claims in heap_textures pass #2605

Open
qlfu wants to merge 1 commit from upstream-pr/2605 into main
qlfu commented 2026-11-29 14:53:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-29T14:53:55Z.


Summary

Batches speculative texture recheck claims in draw::State::heap_textures instead of acquiring HostHeap::checking and TextureQueue (queue_site::DUE) once per due recheck slot:

  • Adds HostHeap::claim_texture_rechecks(&self, candidates: &[(u32, u64, Checked)], frame: u64) claiming up to Tells::BATCH (64) candidates under one checking lock and one TextureQueue::DUE lock acquisition, with an unwind-safe ReleaseRejected drop guard preserving checking / TextureQueue lock ordering.
  • Adds a lookahead claim_cache in draw::State::heap_textures that refills in batches of up to Tells::BATCH when mark == Some(write) && knew == Some(expected), dropping skipped/unused claims immediately and falling back to single claim_texture_recheck otherwise.

Verification

  • Unit tests: cargo test -p victory-gpu --lib --locked descriptor::host -- --test-threads=1 (79 passed; 0 failed, including new claim_texture_rechecks_batches_valid_busy_and_stale_slots).
  • Full crate tests: cargo test -p victory-gpu --lib --locked -- --test-threads=1 --quiet (926 passed; 0 failed; 57 ignored).
  • cargo clippy -p victory-gpu --lib --tests --locked: 0 new warnings.
  • 90s live release benchmark (1440p DLSS Balanced, RTX 4070 Ti + Ryzen 7 5700X, 0 WARNs / 0 ERRORs):
    • TextureQueue::DUE lock acquisitions per 5s: 8,554 -> 435 (-94.9%)
    • taking the slots due time per 5s: 122 ms -> 28 ms (-77%)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5551889331 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2605). Originally posted by [qlfu](https://github.com/qlfu) on 2026-11-29T14:53:55Z. --- ## Summary Batches speculative texture recheck claims in `draw::State::heap_textures` instead of acquiring `HostHeap::checking` and `TextureQueue` (`queue_site::DUE`) once per due recheck slot: - Adds `HostHeap::claim_texture_rechecks(&self, candidates: &[(u32, u64, Checked)], frame: u64)` claiming up to `Tells::BATCH` (`64`) candidates under one `checking` lock and one `TextureQueue::DUE` lock acquisition, with an unwind-safe `ReleaseRejected` drop guard preserving `checking` / `TextureQueue` lock ordering. - Adds a lookahead `claim_cache` in `draw::State::heap_textures` that refills in batches of up to `Tells::BATCH` when `mark == Some(write) && knew == Some(expected)`, dropping skipped/unused claims immediately and falling back to single `claim_texture_recheck` otherwise. ## Verification - Unit tests: `cargo test -p victory-gpu --lib --locked descriptor::host -- --test-threads=1` (`79 passed; 0 failed`, including new `claim_texture_rechecks_batches_valid_busy_and_stale_slots`). - Full crate tests: `cargo test -p victory-gpu --lib --locked -- --test-threads=1 --quiet` (`926 passed; 0 failed; 57 ignored`). - `cargo clippy -p victory-gpu --lib --tests --locked`: `0` new warnings. - 90s live release benchmark (`1440p DLSS Balanced`, RTX 4070 Ti + Ryzen 7 5700X, `0 WARNs / 0 ERRORs`): - `TextureQueue::DUE` lock acquisitions per 5s: **`8,554 -> 435` (-94.9%)** - `taking the slots due` time per 5s: **`122 ms -> 28 ms` (-77%)**
qlfu commented 2026-11-30 00:12:36 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-30T00:12:36Z.


Rebased cleanly onto main (41adb551), preserving both #2607's remap-history tests and claim_texture_rechecks_batches_valid_busy_and_stale_slots. Verified cargo test -p victory-gpu --lib --locked -- claim_texture_rechecks --test-threads=1 (1 passed) and cargo check -p victory-gpu --features diagnostics --locked.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7265063897 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2605#issuecomment-7265063897). Originally posted by [qlfu](https://github.com/qlfu) on 2026-11-30T00:12:36Z. --- Rebased cleanly onto `main` (`41adb551`), preserving both `#2607`'s remap-history tests and `claim_texture_rechecks_batches_valid_busy_and_stale_slots`. Verified `cargo test -p victory-gpu --lib --locked -- claim_texture_rechecks --test-threads=1` (1 passed) and `cargo check -p victory-gpu --features diagnostics --locked`.
Dukestar69 commented 2026-11-30 05:18:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-30T05:18:32Z.

Review: APPROVED


Tested locally merged onto main (41adb551).

  • Merge: Clean merge across crates/victory-gpu/src/descriptor/host.rs and draw.rs.
  • Tests (RTX 5090): cargo test -p victory-gpu --lib descriptor::host::tests:: passed (73 passed; 0 failed; 1 ignored, including the new claim_texture_rechecks_batches_valid_busy_and_stale_slots test) with 0 new warnings.

Clean batched texture-recheck claiming optimization reducing lock acquisition overhead. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6107202818 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2605#pullrequestreview-6107202818). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-30T05:18:32Z. **Review:** APPROVED --- Tested locally merged onto `main` (`41adb551`). - **Merge**: Clean merge across `crates/victory-gpu/src/descriptor/host.rs` and `draw.rs`. - **Tests (RTX 5090)**: `cargo test -p victory-gpu --lib descriptor::host::tests::` passed (`73 passed; 0 failed; 1 ignored`, including the new `claim_texture_rechecks_batches_valid_busy_and_stale_slots` test) with 0 new warnings. Clean batched texture-recheck claiming optimization reducing lock acquisition overhead. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/2605:upstream-pr/2605'
git switch 'upstream-pr/2605'

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/2605'
git switch 'upstream-pr/2605'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2605'
git switch 'upstream-pr/2605'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2605'
git switch 'main'
git merge --squash 'upstream-pr/2605'
git switch 'main'
git merge --ff-only 'upstream-pr/2605'
git switch 'main'
git merge 'upstream-pr/2605'
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
trustno1-coder/VIctory-NVIDIA!2605
No description provided.