fix(gpu): clear last-use stamp when releasing streamed-out textures #3531

Closed
mrDeShock wants to merge 1 commit from upstream-pr/3531 into main
mrDeShock commented 2026-11-30 00:34:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mrDeShock on 2026-11-30T00:34:19Z.


<html>

Problem

The streamed-out texture release path in resource.rs, inside let_go_idle(), resets host.wanted and releases the host copy but leaves host.used unchanged.

This differs from the existing eviction paths that clear the last-use timestamp when releasing a host resource. A stale timestamp may cause unnecessary consideration of textures that no longer have a host copy during subsequent eviction searches.

Proposed fix

Reset r.host.used to zero under the existing lock before releasing the host copy.

The patch adds a single line and does not introduce new configuration options, locks, or memory thresholds.

Related work

This follows the eviction bookkeeping approach described in:

Credit for the original approach goes to the Foxhound contributors. This PR extends the same bookkeeping invariant to the additional streamed-out release path.

Testing

Test system:

  • Intel Core i7-11700KF (8C/16T)

  • NVIDIA RTX 4070 SUPER 12 GB

  • 32 GB DDR4 RAM

  • Windows 11

  • DLSS Quality, native Frame Generation 2X

The patch was previously compiled and tested locally against f889bb07 as part of an extended performance investigation.

Texture eviction diagnostics | Before patch | Early patched session | Extended patched session -- | -- | -- | -- Eviction searches | 2016 | 123 | 451 Average search time | 59.31 ms | 1.57 ms | 54.09 ms Maximum search time | 166.4 ms | 8.2 ms | 103.3 ms

These were exploratory runs with different session lengths, memory pressure and additional configuration changes, not an isolated A/B benchmark.

The extended patched session completed normally, but eviction search costs still increased under sustained memory pressure. Therefore, this change is proposed as a targeted bookkeeping consistency fix rather than a complete solution to texture eviction slowdown.

Current upstream compatibility

The one-line patch applies cleanly against upstream commit 41adb55167fa778fcaa5dc36fa18a1fa8dacd657.

The PR contains only the timestamp reset in resource.rs. The rebased version has not been separately compiled or benchmarked.

Further investigation of sustained eviction overhead is planned separately.

</html>
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556879041 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3531). Originally posted by [mrDeShock](https://github.com/mrDeShock) on 2026-11-30T00:34:19Z. --- <html> <body> <!--StartFragment--><h2><span>Problem</span></h2><p><span>The streamed-out texture release path in </span><code><span>resource.rs</span></code><span>, inside </span><code><span>let_go_idle()</span></code><span>, resets </span><code><span>host.wanted</span></code><span> and releases the host copy but leaves </span><code><span>host.used</span></code><span> unchanged.</span></p><p><span>This differs from the existing eviction paths that clear the last-use timestamp when releasing a host resource. A stale timestamp may cause unnecessary consideration of textures that no longer have a host copy during subsequent eviction searches.</span></p><h2><span>Proposed fix</span></h2><p><span>Reset </span><code><span>r.host.used</span></code><span> to zero under the existing lock before releasing the host copy.</span></p><p><span>The patch adds a single line and does not introduce new configuration options, locks, or memory thresholds.</span></p><h2><span>Related work</span></h2><p><span>This follows the eviction bookkeeping approach described in:</span></p><ul><li><p><a href="https://github.com/readmet3xt-lab/foxhound/issues/12"><span>https://github.com/readmet3xt-lab/foxhound/issues/12</span></a></p></li><li><p><a href="https://github.com/readmet3xt-lab/foxhound/commit/3d52ac8"><span>https://github.com/readmet3xt-lab/foxhound/commit/3d52ac8</span></a></p></li></ul><p><span>Credit for the original approach goes to the Foxhound contributors. This PR extends the same bookkeeping invariant to the additional streamed-out release path.</span></p><h2><span>Testing</span></h2><p><span>Test system:</span></p><ul><li><p><span>Intel Core i7-11700KF (8C/16T)</span></p></li><li><p><span>NVIDIA RTX 4070 SUPER 12 GB</span></p></li><li><p><span>32 GB DDR4 RAM</span></p></li><li><p><span>Windows 11</span></p></li><li><p><span>DLSS Quality, native Frame Generation 2X</span></p></li></ul><p><span>The patch was previously compiled and tested locally against </span><code><span>f889bb07</span></code><span> as part of an extended performance investigation.</span></p> Texture eviction diagnostics | Before patch | Early patched session | Extended patched session -- | -- | -- | -- Eviction searches | 2016 | 123 | 451 Average search time | 59.31 ms | 1.57 ms | 54.09 ms Maximum search time | 166.4 ms | 8.2 ms | 103.3 ms <p><span>These were exploratory runs with different session lengths, memory pressure and additional configuration changes, not an isolated A/B benchmark.</span></p><p><span>The extended patched session completed normally, but eviction search costs still increased under sustained memory pressure. Therefore, this change is proposed as a targeted bookkeeping consistency fix rather than a complete solution to texture eviction slowdown.</span></p><h2><span>Current upstream compatibility</span></h2><p><span>The one-line patch applies cleanly against upstream commit </span><code><span>41adb55167fa778fcaa5dc36fa18a1fa8dacd657</span></code><span>.</span></p><p><span>The PR contains only the timestamp reset in </span><code><span>resource.rs</span></code><span>. The rebased version has not been separately compiled or benchmarked.</span></p><p><span>Further investigation of sustained eviction overhead is planned separately.</span></p><!--EndFragment--> </body> </html>
trustno1-coder commented 2026-12-01 18:51:21 +00:00 (Migrated from github.com)

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


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:7321680601 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3531#issuecomment-7321680601). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:51:21Z. --- 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!3531
No description provided.