gpu(texture): back off guarded texture hashing after 4 quiet turns (DARNER_TEXTURE_HASH_BACKOFF) #509

Open
hingeowl wants to merge 1 commit from hingeowl/Darner:pr/texture-hash-backoff into Main
Contributor

What it changes

  • The problem on main: guarded textures that never receive blind writes are re-hashed every 64 frames indefinitely.
  • Adapted from Lesloo/longroad (a66080bf3a47f7e750e81aad1fd9542cb28c4ba7):
    • Tracks consecutive unchanged blind-hash turns (Last::quiet) for guarded textures in crates/darner-gpu/src/texture.rs.
    • After 4 quiet turns, backs off the hash interval 8x (64 -> 512 frames) until a blind write is detected, which resets quiet to 0 and marks the texture hot as before.
    • Controlled by DARNER_TEXTURE_HASH_BACKOFF (on unless =0).

How it was tested

  • Tested revision: e58ae4f (based on main c8258f9)
  • Commands and results:
    • cargo xtask policy — pass
    • cargo clippy --workspace --all-targets --locked -- -D warnings — pass
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — pass
    • cargo test -p darner-gpu --locked — pass
  • Changes a default: yes (on unless DARNER_TEXTURE_HASH_BACKOFF=0; can be made opt-in if maintainers prefer).
  • A/B result: not yet benchmarked standalone in isolation; validated in-game on cam-city60 (RTX 4090 + Ryzen 9 7950X3D, Series X, HW RT) as part of our integration branch with clean visual output and no texture staleness.
  • Gates run on that revision: cargo xtask policy, both workspace clippy gates, cargo test -p darner-gpu --locked.
  • Hardware dependence: likely general (CPU-side texture hashing).
  • Coverage gaps: standalone A/B cam-city60 run not yet recorded for this commit in isolation.

Checklist

  • I ran this change in the game.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found
  • Replaces or overlaps: none found
## What it changes - The problem on main: guarded textures that never receive blind writes are re-hashed every 64 frames indefinitely. - Adapted from `Lesloo/longroad` (`a66080bf3a47f7e750e81aad1fd9542cb28c4ba7`): - Tracks consecutive unchanged blind-hash turns (`Last::quiet`) for guarded textures in `crates/darner-gpu/src/texture.rs`. - After 4 quiet turns, backs off the hash interval 8x (`64 -> 512` frames) until a blind write is detected, which resets `quiet` to 0 and marks the texture hot as before. - Controlled by `DARNER_TEXTURE_HASH_BACKOFF` (on unless `=0`). ## How it was tested - Tested revision: `e58ae4f` (based on `main` `c8258f9`) - Commands and results: - `cargo xtask policy` — pass - `cargo clippy --workspace --all-targets --locked -- -D warnings` — pass - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — pass - `cargo test -p darner-gpu --locked` — pass - Changes a default: yes (on unless `DARNER_TEXTURE_HASH_BACKOFF=0`; can be made opt-in if maintainers prefer). - A/B result: not yet benchmarked standalone in isolation; validated in-game on `cam-city60` (RTX 4090 + Ryzen 9 7950X3D, Series X, HW RT) as part of our integration branch with clean visual output and no texture staleness. - Gates run on that revision: `cargo xtask policy`, both workspace `clippy` gates, `cargo test -p darner-gpu --locked`. - Hardware dependence: likely general (CPU-side texture hashing). - Coverage gaps: standalone A/B `cam-city60` run not yet recorded for this commit in isolation. ## Checklist - [x] I ran this change in the game. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found - Replaces or overlaps: none found
Adapted from Lesloo/longroad a66080bf3a47f7e750e81aad1fd9542cb28c4ba7:
- Track consecutive unchanged blind hash turns (Last::quiet) for guarded
  textures; after 4 quiet turns, back off the hash interval 8x (64 -> 512
  frames) until a blind write is found, which resets quiet to 0 and marks
  the texture hot as before.
- Enabled by default unless DARNER_TEXTURE_HASH_BACKOFF=0.

Upstream-Repository: https://github.com/Lesloo/longroad
Upstream-Commit: a66080bf3a47f7e750e81aad1fd9542cb28c4ba7
Integration-Base: 65b0fe2f6389c3481eb867d4c38c9230590adb51
Validation: pending full darner-gpu test + clippy gate
Contributor

Standalone A/B from a 24-thread Intel PC, with the switch: within noise here.

PC: i7-13700K (8P + 8E), RTX 4080 16 GB (driver 621.40), 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on, Reflex boost (where the card waits on the CPU side, so CPU savings would show), DARNER_ALIAS_SHARE=1, DARNER_D3D12_BACKGROUND=0.
Build: main 9b288a7 + #303 + #457 + this PR (e58ae4f), merged cleanly. B = as built (backoff on), A = the same exe with DARNER_TEXTURE_HASH_BACKOFF=0.
Method: the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; warm pipelines. Order: B, A, B, A.

B (on), run 1 A (off), run 1 B (on), run 2 A (off), run 2
frame time, ms 31.1 / 31.9 / 32.5 31.0 / 33.0 / 33.4 30.8 / 32.6 / 33.6 31.4 / 33.0 / 33.5
submitting thread, ms a frame 20.3 / 20.2 / 20.3 21.4 / 22.6 / 23.1 20.9 / 22.1 / 22.3 21.3 / 22.5 / 22.9

The first B run was a little better in the later windows, the second was the same as A, so I would not read a gain into it; a 2-minute scene in one room may simply not reach the 4-quiet-turns point for many textures. No stale textures seen in the screenshots.

Not tested: longer runs, driving, other CPUs, the gates.

Standalone A/B from a 24-thread Intel PC, with the switch: within noise here. **PC:** i7-13700K (8P + 8E), RTX 4080 16 GB (driver 621.40), 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on, Reflex boost (where the card waits on the CPU side, so CPU savings would show), `DARNER_ALIAS_SHARE=1`, `DARNER_D3D12_BACKGROUND=0`. **Build:** main 9b288a7 + #303 + #457 + this PR (e58ae4f), merged cleanly. B = as built (backoff on), A = the same exe with `DARNER_TEXTURE_HASH_BACKOFF=0`. **Method:** the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; warm pipelines. Order: B, A, B, A. | | B (on), run 1 | A (off), run 1 | B (on), run 2 | A (off), run 2 | |---|---|---|---|---| | frame time, ms | 31.1 / 31.9 / 32.5 | 31.0 / 33.0 / 33.4 | 30.8 / 32.6 / 33.6 | 31.4 / 33.0 / 33.5 | | submitting thread, ms a frame | 20.3 / 20.2 / 20.3 | 21.4 / 22.6 / 23.1 | 20.9 / 22.1 / 22.3 | 21.3 / 22.5 / 22.9 | The first B run was a little better in the later windows, the second was the same as A, so I would not read a gain into it; a 2-minute scene in one room may simply not reach the 4-quiet-turns point for many textures. No stale textures seen in the screenshots. Not tested: longer runs, driving, other CPUs, the gates.
TrustNo1 changed title from [pr-performance][rendering] gpu(texture): back off guarded texture hashing after 4 quiet turns (DARNER_TEXTURE_HASH_BACKOFF) to gpu(texture): back off guarded texture hashing after 4 quiet turns (DARNER_TEXTURE_HASH_BACKOFF) 2026-12-06 03:27:51 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/texture-hash-backoff:hingeowl-pr/texture-hash-backoff'
git switch 'hingeowl-pr/texture-hash-backoff'

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 'hingeowl-pr/texture-hash-backoff'
git switch 'hingeowl-pr/texture-hash-backoff'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'hingeowl-pr/texture-hash-backoff'
git switch 'hingeowl-pr/texture-hash-backoff'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'hingeowl-pr/texture-hash-backoff'
git switch 'Main'
git merge --squash 'hingeowl-pr/texture-hash-backoff'
git switch 'Main'
git merge --ff-only 'hingeowl-pr/texture-hash-backoff'
git switch 'Main'
git merge 'hingeowl-pr/texture-hash-backoff'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!509
No description provided.