GPU: retry texture staging with smaller blocks after out-of-memory #986

Closed
yumaste wants to merge 1 commit from upstream-pr/986 into main
yumaste commented 2026-11-28 10:37:18 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by yumaste on 2026-11-28T10:37:18Z.


Port of Marvisak/VIctory#3259 to this fork's texture staging pool. The pool already backs off after a refused block, but currently tries only a 64 MiB block. The texture's existing dedicated-buffer fallback can also be deferred after that out-of-memory result.

After E_OUTOFMEMORY, try smaller blocks down to the request rounded to 64 KiB, with bounded retries. Reuse a successful smaller growth size during the 500 ms backoff interval. Account for the actual block size when reusing, reclaiming and reporting staging memory. Keep the existing speculative admission policy. Related to #816, which moves block creation outside the pool lock.

Windows validation: all 11 pool tests passed with cargo test -p victory-gpu --locked --lib pool::tests. The new tests simulate allocation refusals, verify reuse and reclamation, and cover recovery to the normal block size.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539248659 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/986). Originally posted by [yumaste](https://github.com/yumaste) on 2026-11-28T10:37:18Z. --- Port of Marvisak/VIctory#3259 to this fork's texture staging pool. The pool already backs off after a refused block, but currently tries only a 64 MiB block. The texture's existing dedicated-buffer fallback can also be deferred after that out-of-memory result. After `E_OUTOFMEMORY`, try smaller blocks down to the request rounded to 64 KiB, with bounded retries. Reuse a successful smaller growth size during the 500 ms backoff interval. Account for the actual block size when reusing, reclaiming and reporting staging memory. Keep the existing speculative admission policy. Related to #816, which moves block creation outside the pool lock. Windows validation: all 11 pool tests passed with `cargo test -p victory-gpu --locked --lib pool::tests`. The new tests simulate allocation refusals, verify reuse and reclamation, and cover recovery to the normal block size.
trustno1-coder commented 2026-11-28 19:23:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:06Z.


Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244503708 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/986#issuecomment-7244503708). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:23:06Z. --- Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

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