Textures never uploaded are served before re-checks of ones already on the card (VICTORY_TEXTURE_FAST_QUEUE) #4757

Closed
github-bot wants to merge 2 commits from github-bot/gh-4756 into main AGit
Owner

@⁠henriazz10 on GitHub · 2026-12-01 05:25 UTC · original
henriazz10:perf/texture-fast-queue → main · +201 −12 · 5 files · 2 commits · closed without merging

What it changes

Textures picked by index that were never uploaded waited behind re-checks of textures that already had a copy on the card. While the queue is long, that is visible in play as surfaces that stay low-detail or late for many seconds.

VICTORY_TEXTURE_FAST_QUEUE=1 (turned on in play.rs, off elsewhere):

  • Due::ordered_with_mode (descriptor/host.rs) now serves, in order: hot → retries that never uploaded → fresh never-uploaded → speculative re-checks only with the budget left.
  • draw.rs: catch-up and the above-12 GiB texture-pass cap are blocked only by critical commit pressure (residency::critical_commit(): below 1.5 GiB of commit or a recent E_OUTOFMEMORY) instead of ordinary pressured(). !room, admit_texture_pass() and prefetch_limit(pressured) are unchanged, so it does not ask for more VRAM or RAM.
  • texture::unchanged() (texture.rs, resource.rs): above 48 KiB it first compares a 3×16 KiB fingerprint kept next to the digest in Holds. If that differs, the texture changed and the full digest is skipped. If it matches, the full digest still runs, so a texture is never kept by mistake.

The submit thread does no extra work: the reordering happens where the queue is already sorted.

How it was tested

  • GPU and profile: RTX 5080 16 GB, Ryzen 9 5950X, 32 GB RAM, Windows 11; Series X profile, 1706×960 scene → 2560×1440 output, DLSS Quality, frame generation off, ray tracing off.
  • Game results were measured on v2026.11.30.03 with this change and the other changes of this set (fills and journal, refresh no-ops, sub-range copy-back; each in its own pull request) applied, read from victory.log; fps = 1000 / median frame time.
  • Real play, same player, same route (on foot and by car through town, bridge and military base; about 6.5 min of 3D each):
v2026.11.30.03 with this change
textures waiting to upload (mean of the 5 s queue lines) 5,209 1,560 (−70 %)
oldest texture not uploaded yet (mean) ~3,863 frames ~135 frames (−96 %)
frame time at matched load (42–56k thin calls) 75.3 ms 70.6 ms
  • Bench, fixed route, 120 s, same build with and without the switch (one run each): textures due 9,433 → 2,951 (−69 %); preparation time at matched load +3.8 %, within the run-to-run noise of that bench (±5 %).
  • Not fixed by this: at full speed in a car with VRAM full (14.1 / 14.2 GB) the queue still reaches ~5,200 textures. That needs work on eviction, not ordering.
  • Checks on Windows with the repo's toolchain (1.98.1), same commands as ci.yml: cargo build --release passes. cargo clippy --workspace --all-targets --locked -- -D warnings gives no new finding (it already fails on main, in the same 3 files). cargo test --workspace --locked: 2489 pass; modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it fails on every branch of this set and on none of the files they touch in the full parallel run, and each passes when run alone (--exact); main itself fails host::refresh_tests::chunked_nothing_new_with_matches_individual in the same run. cargo fmt --check already reports hundreds of hunks per file on main; the new code follows the style of the code around it.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related, not duplicates: #4644 (re-checks textures picked by index sooner: complementary, it shortens the time to notice a change, this one changes what is served first), #4161, #3832, #3730, #4581.

AI-assisted. Neon (Gemini) wrote the change; Claude Code reviewed it, rebased it on main, built it, ran the checks and measured it with the player.

🤖 Generated with Claude Code

**@⁠henriazz10** on GitHub · 2026-12-01 05:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4756) `henriazz10:perf/texture-fast-queue` → `main` · +201 −12 · 5 files · 2 commits · closed without merging <!-- Thanks for the pull request. Please label it (pr-fix, pr-feature, pr-performance, pr-diagnostics, pr-refactor, pr-docs or pr-tests, plus the area labels), or put the label in the title, like [pr-fix]. --> ## What it changes Textures picked by index that were **never uploaded** waited behind re-checks of textures that already had a copy on the card. While the queue is long, that is visible in play as surfaces that stay low-detail or late for many seconds. `VICTORY_TEXTURE_FAST_QUEUE=1` (turned on in `play.rs`, off elsewhere): - `Due::ordered_with_mode` (`descriptor/host.rs`) now serves, in order: hot → retries that never uploaded → fresh never-uploaded → speculative re-checks only with the budget left. - `draw.rs`: catch-up and the above-12 GiB texture-pass cap are blocked only by critical commit pressure (`residency::critical_commit()`: below 1.5 GiB of commit or a recent `E_OUTOFMEMORY`) instead of ordinary `pressured()`. `!room`, `admit_texture_pass()` and `prefetch_limit(pressured)` are unchanged, so it does not ask for more VRAM or RAM. - `texture::unchanged()` (`texture.rs`, `resource.rs`): above 48 KiB it first compares a 3×16 KiB fingerprint kept next to the digest in `Holds`. If that differs, the texture changed and the full digest is skipped. If it matches, the full digest still runs, so a texture is never kept by mistake. The submit thread does no extra work: the reordering happens where the queue is already sorted. ## How it was tested - GPU and profile: RTX 5080 16 GB, Ryzen 9 5950X, 32 GB RAM, Windows 11; Series X profile, 1706×960 scene → 2560×1440 output, DLSS Quality, frame generation off, ray tracing off. - Game results were measured on `v2026.11.30.03` with this change and the other changes of this set (fills and journal, refresh no-ops, sub-range copy-back; each in its own pull request) applied, read from `victory.log`; fps = 1000 / median frame time. - **Real play, same player, same route** (on foot and by car through town, bridge and military base; about 6.5 min of 3D each): | | v2026.11.30.03 | with this change | |---|---|---| | textures waiting to upload (mean of the 5 s queue lines) | 5,209 | **1,560 (−70 %)** | | oldest texture not uploaded yet (mean) | ~3,863 frames | **~135 frames (−96 %)** | | frame time at matched load (42–56k thin calls) | 75.3 ms | 70.6 ms | - **Bench, fixed route, 120 s, same build with and without the switch** (one run each): textures due 9,433 → 2,951 (−69 %); preparation time at matched load +3.8 %, within the run-to-run noise of that bench (±5 %). - Not fixed by this: at full speed in a car with VRAM full (14.1 / 14.2 GB) the queue still reaches ~5,200 textures. That needs work on eviction, not ordering. - Checks on Windows with the repo's toolchain (1.98.1), same commands as `ci.yml`: `cargo build --release` passes. `cargo clippy --workspace --all-targets --locked -- -D warnings` gives no new finding (it already fails on `main`, in the same 3 files). `cargo test --workspace --locked`: 2489 pass; `modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it` fails on every branch of this set and on none of the files they touch in the full parallel run, and each passes when run alone (`--exact`); `main` itself fails `host::refresh_tests::chunked_nothing_new_with_matches_individual` in the same run. `cargo fmt --check` already reports hundreds of hunks per file on `main`; the new code follows the style of the code around it. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related, not duplicates: #4644 (re-checks textures picked by index sooner: complementary, it shortens the time to notice a change, this one changes what is served first), #4161, #3832, #3730, #4581. AI-assisted. Neon (Gemini) wrote the change; Claude Code reviewed it, rebased it on `main`, built it, ran the checks and measured it with the player. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 05:28:57 +00:00
Author
Owner

@⁠stasadance on GitHub · 2026-12-01 07:43 UTC · original

Tested this on Linux: RTX 4090, 32 GB RAM, NVIDIA 620.73.04, Wine 11.23, vkd3d-proton GE cae8353ed, DLSS + FG 2X, driving through the city. This PR was ported onto a fork build with VICTORY_TEXTURE_FAST_QUEUE=1.

This isn't an isolated A/B. The same build also turned main's VICTORY_CARD_CPU_FILE=1 and VICTORY_TEXTURE_SOFT_MB=3000 defaults back on, which our fork had left off. Compared with the earlier build (v11x → v12c):

  • texture queue's oldest entry: ~30k frames → 8-11 frames
  • process in memory: 22.4 GB → 14.1 GB; private: 10.3 GB → 7.9 GB; free RAM: 2 GB → 8 GB
  • the freezes while driving are gone. There's still an occasional hitch, cause not known yet.

The queue-age drop is the part that's down to this PR. The memory numbers are mostly the two defaults.

**@⁠stasadance** on GitHub · 2026-12-01 07:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4756#issuecomment-7304408304) Tested this on Linux: RTX 4090, 32 GB RAM, NVIDIA 620.73.04, Wine 11.23, vkd3d-proton GE cae8353ed, DLSS + FG 2X, driving through the city. This PR was ported onto a fork build with `VICTORY_TEXTURE_FAST_QUEUE=1`. This isn't an isolated A/B. The same build also turned main's `VICTORY_CARD_CPU_FILE=1` and `VICTORY_TEXTURE_SOFT_MB=3000` defaults back on, which our fork had left off. Compared with the earlier build (v11x → v12c): - texture queue's oldest entry: ~30k frames → 8-11 frames - process in memory: 22.4 GB → 14.1 GB; private: 10.3 GB → 7.9 GB; free RAM: 2 GB → 8 GB - the freezes while driving are gone. There's still an occasional hitch, cause not known yet. The queue-age drop is the part that's down to this PR. The memory numbers are mostly the two defaults.
github-bot closed this pull request 2026-12-01 18:36:41 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:33 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4756#issuecomment-7321129881) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4757
No description provided.