[textures] How often a guarded texture nothing wrote is hashed, by a switch (VICTORY_TEXTURE_HASH_EVERY; 8 as before) #4530

Closed
AS-AI-DEV wants to merge 1 commit from upstream-pr/4530 into main
AS-AI-DEV commented 2026-11-30 22:00:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by AS-AI-DEV on 2026-11-30T22:00:23Z.


What it changes

A guarded texture that nothing wrote is still hashed every eighth frame, for what its guard cannot see (a write to its pages through another view). The 8 is a constant in crates/victory-gpu/src/texture.rs. On my PC that hash re-reads about 36 MB of texture memory a frame on the submitting thread, in views where almost nothing changes.

This makes the interval a switch: VICTORY_TEXTURE_HASH_EVERY=<n> (1 to 1,024). Unset it is 8, so nothing changes for anyone who does not set it. A larger number hashes less a frame and finds such a change later (n frames at most).

The idea is from Leslie-d-a/victory-nvidia-hwrt, which runs 64; the lines are mine (13 added, 2 removed, one file).

How it was tested

  • GPU and profile: RTX 5060 Ti 16 GB, Ryzen 7 5800X, 32 GB RAM; Series X, 1080p to 1440p, DLSS performance, frame generation 3x, ray tracing off.
  • Walking runs (on 41adb55; the hashing code is the same on e1251c3): a fixed walking route from a save in a house, 3 runs a side, all ended normally, frames of 6,000 draws and more.
  • Before (8): texture bytes read a frame 36.4 MB, the frame line's "preparing" 38.4 ms, the submitting thread 44.1 ms; fps 19.3 / 18.3 / 17.3 / 16.1 at about 7,000 / 8,000 / 9,000 / 10,000 draws.
  • After (64): texture bytes read a frame 6.2 MB, "preparing" 32.4 ms, the submitting thread 40.5 ms; fps equal within the draw bands (-0.7 to +0.5).
  • After (64 with the existing VICTORY_TEXTURE_TURN_SPREAD=1): the submitting thread 38.5 ms; fps 19.6 / 19.5 / 18.0 / 16.5 (+0.3 to +1.2 in each band); the longest frame of a second 64 against 71 ms; seconds with a frame over 100 ms 8 % both. TURN_SPREAD alone gave nothing.
  • Memory and card memory unchanged. Pictures from two places of a run looked right.
  • On e1251c3 I have less: two standing starts a side (texture bytes read a frame 33 against 51 MB; the views differed between starts, so I do not quote fps), and a 35-minute play session at 64 in which I saw no wrong texture.
  • The cost, to be plain about it: a change the guard cannot see shows up to n frames late, about 3.5 s at 64 and 18 fps. That is why the default stays 8.
  • For shader changes, the wave sizes tested: not a shader change.
  • cargo test passed for the crates it touches: yes (victory-gpu). cargo clippy -p victory-gpu --all-targets with and without --all-features reports nothing in the lines this adds (it stops at two lints that are on main already).

A two-minute check on another PC

Nothing changes unless the switch is set, so the default path needs no test. To see what it does on your card:

  1. Start as usual, stand still in any scene for a minute, and note two things in the log's frame line (fps, ms/frame (… preparing: copies … MB, textures … ms … MB; …)): the textures … MB figure and the submitting thread: … ms.
  2. Start again with VICTORY_TEXTURE_HASH_EVERY=64 and VICTORY_TEXTURE_TURN_SPREAD=1, stand in the same place, and compare the same two figures.

On my PC the textures figure falls to about a sixth and the submitting thread by about 5 ms. If the card is the limit on yours, the frame rate may not move; the thread time and the bytes still should.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: none found for this constant.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5574536273 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4530). Originally posted by [AS-AI-DEV](https://github.com/AS-AI-DEV) on 2026-11-30T22:00:23Z. --- ## What it changes A guarded texture that nothing wrote is still hashed every eighth frame, for what its guard cannot see (a write to its pages through another view). The 8 is a constant in `crates/victory-gpu/src/texture.rs`. On my PC that hash re-reads about 36 MB of texture memory a frame on the submitting thread, in views where almost nothing changes. This makes the interval a switch: `VICTORY_TEXTURE_HASH_EVERY=<n>` (1 to 1,024). Unset it is 8, so nothing changes for anyone who does not set it. A larger number hashes less a frame and finds such a change later (n frames at most). The idea is from Leslie-d-a/victory-nvidia-hwrt, which runs 64; the lines are mine (13 added, 2 removed, one file). ## How it was tested - GPU and profile: RTX 5060 Ti 16 GB, Ryzen 7 5800X, 32 GB RAM; Series X, 1080p to 1440p, DLSS performance, frame generation 3x, ray tracing off. - Walking runs (on 41adb55; the hashing code is the same on e1251c3): a fixed walking route from a save in a house, 3 runs a side, all ended normally, frames of 6,000 draws and more. - Before (8): texture bytes read a frame 36.4 MB, the frame line's "preparing" 38.4 ms, the submitting thread 44.1 ms; fps 19.3 / 18.3 / 17.3 / 16.1 at about 7,000 / 8,000 / 9,000 / 10,000 draws. - After (64): texture bytes read a frame 6.2 MB, "preparing" 32.4 ms, the submitting thread 40.5 ms; fps equal within the draw bands (-0.7 to +0.5). - After (64 with the existing `VICTORY_TEXTURE_TURN_SPREAD=1`): the submitting thread 38.5 ms; fps 19.6 / 19.5 / 18.0 / 16.5 (+0.3 to +1.2 in each band); the longest frame of a second 64 against 71 ms; seconds with a frame over 100 ms 8 % both. `TURN_SPREAD` alone gave nothing. - Memory and card memory unchanged. Pictures from two places of a run looked right. - On e1251c3 I have less: two standing starts a side (texture bytes read a frame 33 against 51 MB; the views differed between starts, so I do not quote fps), and a 35-minute play session at 64 in which I saw no wrong texture. - The cost, to be plain about it: a change the guard cannot see shows up to n frames late, about 3.5 s at 64 and 18 fps. That is why the default stays 8. - For shader changes, the wave sizes tested: not a shader change. - `cargo test` passed for the crates it touches: yes (`victory-gpu`). `cargo clippy -p victory-gpu --all-targets` with and without `--all-features` reports nothing in the lines this adds (it stops at two lints that are on main already). ## A two-minute check on another PC Nothing changes unless the switch is set, so the default path needs no test. To see what it does on your card: 1. Start as usual, stand still in any scene for a minute, and note two things in the log's frame line (`fps, ms/frame (… preparing: copies … MB, textures … ms … MB; …)`): the `textures … MB` figure and `the submitting thread: … ms`. 2. Start again with `VICTORY_TEXTURE_HASH_EVERY=64` and `VICTORY_TEXTURE_TURN_SPREAD=1`, stand in the same place, and compare the same two figures. On my PC the `textures` figure falls to about a sixth and the submitting thread by about 5 ms. If the card is the limit on yours, the frame rate may not move; the thread time and the bytes still should. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: none found for this constant. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DoubleD17 commented 2026-12-01 14:04:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by DoubleD17 on 2026-12-01T14:04:42Z.


A measurement of VICTORY_TEXTURE_HASH_EVERY=64 against 8 with this branch. It also measures #4493, which sets the same interval to 64 in code.

Setup

  • Hardware: RTX 5070 12 GB (driver 621.40), Ryzen 7 5800X (8 cores, 16 threads), 64 GB RAM, Windows 11.
  • Build: one release build, main 5fabb46e with this PR and #4396 merged (no conflict). #4396's switch was at 0 in both arms.
  • Arms: --set VICTORY_TEXTURE_HASH_EVERY=8 (as main) against =64.
  • Profile: Series X, 2560x1440 DLAA, frame generation off, ray tracing off.
  • Runs: idle camera from the same starting point, 150 s from the first world frame, four runs per arm, alternated.
  • Caveat: someone used the PC during two runs of each arm (64: runs 3 and 4; 8: runs 3 and 4). The texture figure below holds in all of them; the frame-rate figures are best read from runs 1 and 2.

Texture refreshes, all threads, per frame (the "texture refreshes per frame, all threads" line, mean of each run's 150 s):

HASH_EVERY run 1 run 2 run 3 run 4
8 17.85 ms 18.44 ms 19.81 ms 18.06 ms
64 9.63 ms 11.01 ms 10.49 ms 11.60 ms

That is about 8 ms a frame less across all threads (-45 %), in every run. It is more than the "about 3 ms" in #4493.

Submitting thread and frame rate

  • "In its submissions", the runs with no one at the PC: 54.8 and 56.0 ms at 8, against 51.7 and 52.2 ms at 64.
  • Light view (the seconds where the idle camera's heavier view is not on screen):
    • runs 1 and 2: preparation -0.4 and -2.7 ms, fps +1.8 and +2.6 %;
    • over all four: -1.6 ms and +1.8 %, inside the spread of the controls in that batch.

Picture: 80 frames per run; we looked at every frame a frame-to-frame check flagged.

  • At 64, two frames were flagged. Both are the one-frame kind we also see on main and in the 8 runs here: the whole picture briefly from a slightly different camera position.
  • The risk the doc names, a write through another view seen up to 64 frames late, cannot show with an idle camera. It is not covered here.

Not tested: movement, textures written through another view, Series S, frame generation on, other cards.

AI Assisted

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7313656495 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4530#issuecomment-7313656495). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-12-01T14:04:42Z. --- A measurement of `VICTORY_TEXTURE_HASH_EVERY=64` against `8` with this branch. It also measures #4493, which sets the same interval to 64 in code. **Setup** - **Hardware:** RTX 5070 12 GB (driver 621.40), Ryzen 7 5800X (8 cores, 16 threads), 64 GB RAM, Windows 11. - **Build:** one release build, main 5fabb46e with this PR and #4396 merged (no conflict). #4396's switch was at `0` in both arms. - **Arms:** `--set VICTORY_TEXTURE_HASH_EVERY=8` (as main) against `=64`. - **Profile:** Series X, 2560x1440 DLAA, frame generation off, ray tracing off. - **Runs:** idle camera from the same starting point, 150 s from the first world frame, four runs per arm, alternated. - **Caveat:** someone used the PC during two runs of each arm (`64`: runs 3 and 4; `8`: runs 3 and 4). The texture figure below holds in all of them; the frame-rate figures are best read from runs 1 and 2. **Texture refreshes, all threads, per frame** (the "texture refreshes per frame, all threads" line, mean of each run's 150 s): | `HASH_EVERY` | run 1 | run 2 | run 3 | run 4 | |---|---|---|---|---| | 8 | 17.85 ms | 18.44 ms | 19.81 ms | 18.06 ms | | 64 | **9.63 ms** | **11.01 ms** | **10.49 ms** | **11.60 ms** | That is about 8 ms a frame less across all threads (-45 %), in every run. It is more than the "about 3 ms" in #4493. **Submitting thread and frame rate** - **"In its submissions", the runs with no one at the PC:** 54.8 and 56.0 ms at `8`, against 51.7 and 52.2 ms at `64`. - **Light view** (the seconds where the idle camera's heavier view is not on screen): - runs 1 and 2: preparation -0.4 and -2.7 ms, fps +1.8 and +2.6 %; - over all four: -1.6 ms and +1.8 %, inside the spread of the controls in that batch. **Picture:** 80 frames per run; we looked at every frame a frame-to-frame check flagged. - At `64`, two frames were flagged. Both are the one-frame kind we also see on main and in the `8` runs here: the whole picture briefly from a slightly different camera position. - The risk the doc names, a write through another view seen up to 64 frames late, cannot show with an idle camera. It is not covered here. **Not tested:** movement, textures written through another view, Series S, frame generation on, other cards. AI Assisted
trustno1-coder commented 2026-12-01 18:38:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:38:22Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321259353 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4530#issuecomment-7321259353). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:38:22Z. --- 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

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!4530
No description provided.