Restart the idle texture sweep when its cursor passes the last texture #198

Open
feanorsun wants to merge 1 commit from upstream-pr/198 into main
feanorsun commented 2026-11-26 11:21:53 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by feanorsun on 2026-11-26T11:21:53Z.


Refs #182

The idle texture sweep visits up to 8,192 addresses per pass when the runtime is keeping textures for minutes. If a full batch ends at the last address, the next cursor is past the end. The old loop only reset the cursor while visiting a texture, so subsequent passes could stay empty indefinitely. Releasing the remaining textures between passes has the same effect.

When the saved cursor has no remaining addresses, restart the batch at the first address. A cursor with a nonempty tail continues from that tail. The age, reference-count and memory-budget checks still govern which resources can be released.

Verified on Windows against 0dec5dcc228b, using ordered sets with three or four integer addresses and a batch size of two. Both regression assertions returned an empty batch before the fix and [1, 3] afterwards.

cargo test --offline --locked -j 1 -p victory-gpu --lib resource::tests::idle_sweep_ -- --list
cargo test --offline --locked -j 1 -p victory-gpu --lib resource::tests::idle_sweep_ -- --test-threads=1

Both cases ran on the CPU, with zero GPU allocations. The same cursor loop exists in the reporter's source revision. Their log does not show that the sweep reached this boundary, and the high-pressure eviction path uses a different traversal.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6625568182 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/198). Originally posted by [feanorsun](https://github.com/feanorsun) on 2026-11-26T11:21:53Z. --- Refs #182 The idle texture sweep visits up to 8,192 addresses per pass when the runtime is keeping textures for minutes. If a full batch ends at the last address, the next cursor is past the end. The old loop only reset the cursor while visiting a texture, so subsequent passes could stay empty indefinitely. Releasing the remaining textures between passes has the same effect. When the saved cursor has no remaining addresses, restart the batch at the first address. A cursor with a nonempty tail continues from that tail. The age, reference-count and memory-budget checks still govern which resources can be released. Verified on Windows against `0dec5dcc228b`, using ordered sets with three or four integer addresses and a batch size of two. Both regression assertions returned an empty batch before the fix and `[1, 3]` afterwards. ```text cargo test --offline --locked -j 1 -p victory-gpu --lib resource::tests::idle_sweep_ -- --list cargo test --offline --locked -j 1 -p victory-gpu --lib resource::tests::idle_sweep_ -- --test-threads=1 ``` Both cases ran on the CPU, with zero GPU allocations. The same cursor loop exists in the reporter's source revision. Their log does not show that the sweep reached this boundary, and the high-pressure eviction path uses a different traversal.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/198:upstream-pr/198'
git switch 'upstream-pr/198'

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 'upstream-pr/198'
git switch 'upstream-pr/198'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/198'
git switch 'upstream-pr/198'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/198'
git switch 'main'
git merge --squash 'upstream-pr/198'
git switch 'main'
git merge --ff-only 'upstream-pr/198'
git switch 'main'
git merge 'upstream-pr/198'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!198
No description provided.