Avoid clearing texture read buffers before a checked read #4057

Open
github-bot wants to merge 1 commit from github-bot/gh-4057 into main AGit
Owner

@⁠ghptc on GitHub · 2026-11-30 15:18 UTC · original
ghptc:perf/read-there-single-initialization → main · +2 −1 · 1 files · 1 commits · open

A texture comparison calls host::read_there to read the current contents of title memory. The reader first clears the destination slice. On a fully readable range, the checked read immediately overwrites every byte.

This change removes that initial write. Since FIocker’s #2062, the reader visits both the registered physical views and every gap, including ordinary committed memory before, between or after the views. A successful read writes its complete extent. A failed read may have copied a prefix, so the existing fallback clears the piece before retrying at 64 KiB and 4 KiB granularity. Each permanently unreadable leaf ends up zero. The readable-byte count follows the same checked reads.

This applies to the common read_there helper. Texture digests, upload and residency decisions, synchronization and the alias lookup use their existing paths. #4031 is a separate caller-side fix for retaining staged pixels and their digest across unreadable memory.

Validation

An MSVC build of the equivalent integration change passed eight selected Proton tests, including the #2062 regression for committed pages around registered views. The patched function body on this PR head matches the tested function byte for byte.

A CPU-only Proton fixture compared the post-#2062 baseline and this change in the same binary. It used independently populated Win32 reservations and the production read and digest functions. Both readers produced the expected bytes and readable-byte counts. The sparse case included a decommitted 4 KiB page in each region’s first 64 KiB block and in each subsequent MiB. Each scenario ran six pairs in alternating AB/BA order. The last two columns are median wall times for the listed number of calls, including the digest and its equality check.

Scenario Calls per arm per pair Baseline (ms) This change (ms)
Repeated 64 KiB read 128 0.411 0.375
Repeated 4 MiB read 4 1.418 1.192
Rotating mixed sizes 8 1.670 1.426
Sparse mixed sizes 4 0.538 0.473

All six pairs per scenario improved on this machine. End-to-end frame-time impact remains unmeasured.

**@⁠ghptc** on GitHub · 2026-11-30 15:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4057) `ghptc:perf/read-there-single-initialization` → `main` · +2 −1 · 1 files · 1 commits · open A texture comparison calls `host::read_there` to read the current contents of title memory. The reader first clears the destination slice. On a fully readable range, the checked read immediately overwrites every byte. This change removes that initial write. Since FIocker’s #2062, the reader visits both the registered physical views and every gap, including ordinary committed memory before, between or after the views. A successful read writes its complete extent. A failed read may have copied a prefix, so the existing fallback clears the piece before retrying at 64 KiB and 4 KiB granularity. Each permanently unreadable leaf ends up zero. The readable-byte count follows the same checked reads. This applies to the common `read_there` helper. Texture digests, upload and residency decisions, synchronization and the alias lookup use their existing paths. #4031 is a separate caller-side fix for retaining staged pixels and their digest across unreadable memory. ### Validation An MSVC build of the equivalent integration change passed eight selected Proton tests, including the #2062 regression for committed pages around registered views. The patched function body on this PR head matches the tested function byte for byte. A CPU-only Proton fixture compared the post-#2062 baseline and this change in the same binary. It used independently populated Win32 reservations and the production read and digest functions. Both readers produced the expected bytes and readable-byte counts. The sparse case included a decommitted 4 KiB page in each region’s first 64 KiB block and in each subsequent MiB. Each scenario ran six pairs in alternating AB/BA order. The last two columns are median wall times for the listed number of calls, including the digest and its equality check. | Scenario | Calls per arm per pair | Baseline (ms) | This change (ms) | |---|---:|---:|---:| | Repeated 64 KiB read | 128 | 0.411 | 0.375 | | Repeated 4 MiB read | 4 | 1.418 | 1.192 | | Rotating mixed sizes | 8 | 1.670 | 1.426 | | Sparse mixed sizes | 4 | 0.538 | 0.473 | All six pairs per scenario improved on this machine. End-to-end frame-time impact remains unmeasured.
(cherry picked from commit 590abc3ecbb01c6de8b1fd2fdabcf6ba807c0557)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 15:23:39 +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 origin '+refs/pull/4057/head:github-bot/gh-4057'
git switch 'github-bot/gh-4057'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4057'
git switch 'github-bot/gh-4057'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4057'
git switch 'github-bot/gh-4057'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4057'
git switch 'main'
git merge --squash 'github-bot/gh-4057'
git switch 'main'
git merge --ff-only 'github-bot/gh-4057'
git switch 'main'
git merge 'github-bot/gh-4057'
git push origin 'main'
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!4057
No description provided.