GPU/VRAM: transient texture allocation failures can permanently suppress resource creation and bindless retries #256
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#256
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@FunWithFlagsDev on GitHub · 2026-11-26 13:24 UTC · original
<html>Summary
While investigating memory residency and recovery on NVIDIA GPUs with limited VRAM, I identified a potential texture recovery defect involving three interacting mechanisms:
Permanent resource refusal after a transient allocation failure.
Premature completion of a pending bindless texture request.
Descriptor caching that may retain a null descriptor as an already prepared view.
A temporary
E_OUTOFMEMORYfailure can permanently prevent the same live resource from obtaining its host texture, even after memory becomes available again.This appears complementary to the ongoing VRAM eviction, memory trimming and mip-clamping work. Preventing memory exhaustion is important, but recovering correctly after an allocation failure is a separate correctness requirement.
The attached archive contains a source audit, an executable synthetic differential model, regression tests and a proposed native fault-injection test plan.
1. Affected revision
Repository:
avatarmanz/VIctory-7900XTXCommit:
c9c932cbcc38defd8f1683d62dd298187f565031Affected components:
crates/victory-gpu/src/resource.rscrates/victory-gpu/src/draw.rscrates/victory-gpu/src/residency.rscrates/victory-gpu/src/descriptor.rscrates/victory-gpu/src/descriptor/host.rs2. Permanent refusal after temporary allocation failure
resource.rs:1229–1230The creation path checks this flag before making a host texture:
resource.rs:1562–1572However, the final creation failure sets the same flag regardless of the reason:
resource.rs:1635–1643At this point, the caller cannot distinguish between:
An invalid or unsupported resource description.
A temporary memory allocation failure.
A failed residency operation.
A device failure.
The creation helper receives an HRESULT from D3D12, but ultimately returns an
Option<ID3D12Resource>.See
resource.rs:2550–2605.Consequently, a transient failure may be converted into a permanent refusal for the lifetime of that guest resource.
3. Existing memory recovery does not clear this state
The residency module already recognizes
E_OUTOFMEMORYand establishes a temporary upload backoff:residency.rs:38–43This establishes a 500 ms retry delay for uploads.
However, when that delay expires, the resource's permanent
refusedflag remains set.A possible sequence is therefore:
The same live resource remains unavailable even though the original allocation constraint may no longer exist.
There is also a related distinction in the residency failure path: an error from
resident()ormapped()clears the newly created texture but does not call the sameallocation_errorhook.4. Pending bindless texture requests may be lost
Removing the permanent refusal alone would not necessarily recover textures accessed through bindless descriptors.
In the texture preparation path:
draw.rs:2554–2594When
host_resource()returnsNonebecause creation failed,title_fillsbecomes false.This potentially conflates two different conditions:
A successfully created resource that does not require a title-memory upload.
A resource that could not be created and may need another attempt.
For an eligible title-filled texture reaching this branch, the pending request can be marked complete despite the failed allocation.
The existing staging failure protection appears later in the function:
draw.rs:2653–2664That protection is not reached when the earlier branch completes the request.
The queue's completion operation removes a matching write generation:
descriptor/host.rs:1148–1161The existing
later()mechanism already provides a bounded frame-based retry path that may be suitable for recovery.5. Descriptor caching introduces another recovery requirement
The descriptor mirroring path may record a descriptor key as prepared even when the actual resource could not be created and a null descriptor was installed.
See:
descriptor/host.rs:3274–3290descriptor/host.rs:3394–3414The existing implementation of
texture_slot_made_from()explicitly acknowledges that a slot can be marked as made while holding no actual host resource:descriptor/host.rs:2141–2158Therefore, a complete recovery mechanism needs to coordinate resource creation, queue state and descriptor validity.
A successful allocation retry alone is insufficient if a previously failed descriptor can still take the cached fast path.
The existing waiting-descriptor mechanism should be preserved:
descriptor.rs:1355–1456In particular, successful creation already calls
texture_made(), allowing waiting descriptors to be updated.6. Asset-free differential validation
I prepared a synthetic Python model comparing four recovery policies:
Current permanent refusal and queue completion behavior.
Retryable resource creation only.
Preserved queue requests and descriptor recovery only.
Coordinated resource, queue and descriptor recovery.
The matrix contains 96 evaluations:
Four injected failure outcomes.
Two descriptor rewrite conditions.
Three memory recovery timings.
Four policies.
All 16 Python unit tests passed.
All 96 modeled outcomes matched the final explicit expectations.
Recovery results
Each policy includes 12 deliberately constructed OOM recovery scenarios.
Additional controls should cover repeated OOM, resource release during backoff, reserved-to-committed allocation fallback, previous valid mip retention and unrelated queue progress.
The test should exercise the actual production paths, not a duplicate of their logic.
Testing on WARP and physical NVIDIA hardware would be useful. An unconsumed injector, failed setup or native compilation failure must not be reported as reproduction.
9. Relationship to existing memory work
The following PRs are relevant:
#119 — Adaptive texture pool spare-block retention.
#72 — Fence-tracked VRAM garbage collection.
#180 — Card-buffer headroom and demotion.
#198 — Idle texture sweep cursor recovery.
#205 — Host RAM trimming.
#206 — Idle texture reclamation under memory pressure.
#212 — Fence-safe texture LRU eviction and budget-aware mip clamping.
#92 — Memory relief and retry mechanisms for smaller PCs.
These are complementary to the proposed recovery invariant.
I also inspected the following candidate revisions:
#212:
1e710c4bbeb03ce24bd3f2398621c0cb1c572702#92:
36ec45cdd2bdea049b80f6a16ecb76430c3b3e8fBoth retain permanent resource refusal when final texture creation returns
None.This report therefore focuses on final-failure recovery rather than introducing another eviction policy.
The duplicate search was limited to selected issues, PRs and source paths. It was not an exhaustive review of every development branch.
10. Relevance to limited-VRAM NVIDIA configurations
The existing reports in #182 and #75 illustrate memory constraints on GPUs with 8–10 GB of VRAM, although they do not establish this specific failure mechanism.
On such configurations, successful memory reclamation is particularly valuable.
A possible resource recovery defect could reduce the benefit of eviction if resources rejected during earlier pressure cannot subsequently be recreated.
This investigation does not claim that the identified mechanism explains the missing textures reported in those issues.
That relationship requires native diagnostics and independent runtime validation.
Attachment
avatar_texture_retry_audit.zipContents:
README.mdnative_test_plan.mdmodel.pytest_model.pymatrix.csvresults.txtReproduction:
No external Python dependencies are required.
Requested verification
Could an independent contributor validate the predicted permanent-refusal behavior through a controlled native allocation failure?
If reproduced, I suggest integrating the smallest coordinated correction that preserves resource lifetime, queue generations and descriptor publication ordering.
The existing memory-management PRs may provide useful integration points.
Credits and limitations
AI-assisted source investigation, synthetic modeling and test design using ChatGPT.
Only public repository source and invented test data were used.
No proprietary game files, executable files, shader dumps, console SDK material or game captures are included.
The Python tests were executed successfully. No production Rust patch, native D3D12 test or game benchmark has been completed by this investigation.
The proposed native test is a design plan, not an executable Rust regression.
No FPS improvement, VRAM reduction or visual correction is claimed.
</html>## SummaryWhile investigating memory residency and recovery on NVIDIA GPUs with limited VRAM, I identified a potential texture recovery defect involving three interacting mechanisms:
A temporary
E_OUTOFMEMORYfailure can permanently prevent the same live resource from obtaining its host texture, even after memory becomes available again.This appears complementary to the ongoing VRAM eviction, memory trimming and mip-clamping work. Preventing memory exhaustion is important, but recovering correctly after an allocation failure is a separate correctness requirement.
The attached archive contains a source audit, an executable synthetic differential model, regression tests and a proposed native fault-injection test plan.
1. Affected revision
Repository:
avatarmanz/VIctory-7900XTXCommit:
c9c932cbcc38defd8f1683d62dd298187f565031Affected components:
crates/victory-gpu/src/resource.rscrates/victory-gpu/src/draw.rscrates/victory-gpu/src/residency.rscrates/victory-gpu/src/descriptor.rscrates/victory-gpu/src/descriptor/host.rs2. Permanent refusal after temporary allocation failure
[resource.rs:1229–1230](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/resource.rs#L1229-L1230)The creation path checks this flag before making a host texture:
[resource.rs:1562–1572](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/resource.rs#L1562-L1572)However, the final creation failure sets the same flag regardless of the reason:
[resource.rs:1635–1643](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/resource.rs#L1635-L1643)At this point, the caller cannot distinguish between:
The creation helper receives an HRESULT from D3D12, but ultimately returns an
Option<ID3D12Resource>.See
[resource.rs:2550–2605](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/resource.rs#L2550-L2605).Consequently, a transient failure may be converted into a permanent refusal for the lifetime of that guest resource.
3. Existing memory recovery does not clear this state
The residency module already recognizes
E_OUTOFMEMORYand establishes a temporary upload backoff:[residency.rs:38–43](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/residency.rs#L38-L43)This establishes a 500 ms retry delay for uploads.
However, when that delay expires, the resource's permanent
refusedflag remains set.A possible sequence is therefore:
The same live resource remains unavailable even though the original allocation constraint may no longer exist.
There is also a related distinction in the residency failure path: an error from
resident()ormapped()clears the newly created texture but does not call the sameallocation_errorhook.4. Pending bindless texture requests may be lost
Removing the permanent refusal alone would not necessarily recover textures accessed through bindless descriptors.
In the texture preparation path:
[draw.rs:2554–2594](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/draw.rs#L2554-L2594)When
host_resource()returnsNonebecause creation failed,title_fillsbecomes false.This potentially conflates two different conditions:
For an eligible title-filled texture reaching this branch, the pending request can be marked complete despite the failed allocation.
The existing staging failure protection appears later in the function:
[draw.rs:2653–2664](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/draw.rs#L2653-L2664)That protection is not reached when the earlier branch completes the request.
The queue's completion operation removes a matching write generation:
[descriptor/host.rs:1148–1161](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/descriptor/host.rs#L1148-L1161)The existing
later()mechanism already provides a bounded frame-based retry path that may be suitable for recovery.5. Descriptor caching introduces another recovery requirement
The descriptor mirroring path may record a descriptor key as prepared even when the actual resource could not be created and a null descriptor was installed.
See:
[descriptor/host.rs:3274–3290](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/descriptor/host.rs#L3274-L3290)[descriptor/host.rs:3394–3414](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/descriptor/host.rs#L3394-L3414)The existing implementation of
texture_slot_made_from()explicitly acknowledges that a slot can be marked as made while holding no actual host resource:[descriptor/host.rs:2141–2158](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/descriptor/host.rs#L2141-L2158)Therefore, a complete recovery mechanism needs to coordinate resource creation, queue state and descriptor validity.
A successful allocation retry alone is insufficient if a previously failed descriptor can still take the cached fast path.
The existing waiting-descriptor mechanism should be preserved:
[descriptor.rs:1355–1456](https://github.com/avatarmanz/VIctory-7900XTX/blob/c9c932cb/crates/victory-gpu/src/descriptor.rs#L1355-L1456)In particular, successful creation already calls
texture_made(), allowing waiting descriptors to be updated.6. Asset-free differential validation
I prepared a synthetic Python model comparing four recovery policies:
The matrix contains 96 evaluations:
All 16 Python unit tests passed.
All 96 modeled outcomes matched the final explicit expectations.
Recovery results
Each policy includes 12 deliberately constructed OOM recovery scenarios.
The resource-only policy recovers in selected cases where another descriptor write provides a subsequent opportunity after the cooldown.
It does not recover all stable-generation bindless requests.
The model also checks:
These results validate the modeled state transitions. They are not native D3D12 results, measured gameplay recovery rates or evidence of a specific visual defect.
7. Proposed correction
I suggest separating the creation outcome into distinct states.
Conceptually:
This is a design proposal, not a required public API or an implemented Rust enum.
A. Preserve the final failure reason
Propagate enough information from the texture creation helper to distinguish temporary OOM from permanent rejection.
Preserve existing allocation fallbacks. An earlier failed reserved allocation must not override a later successful committed allocation.
Classify the final failure after applicable fallbacks.
Include errors from residency operations in the review.
B. Bound resource-level retries
For retryable failures:
Do not retry invalid descriptions or device loss indefinitely.
C. Preserve pending texture requests
A texture that could not be created due to temporary memory pressure should not be recorded as a completed upload.
Retain its existing write generation and use the queue's retry mechanism where appropriate.
Do not allow a permanently unsupported resource to block the rest of the texture queue.
D. Preserve descriptor correctness
A temporarily failed allocation should not create a descriptor-cache state that prevents successful recovery.
The correction must:
A retry queue containing unowned raw resource pointers would introduce a separate lifetime hazard and should be avoided.
8. Proposed native fault-injection regression
The attached
native_test_plan.mddescribes a proposed asset-free regression.Instead of deliberately exhausting physical VRAM, inject a single
E_OUTOFMEMORYat the final allocation result of a small synthetic texture.Use the same live resource object throughout the test.
Suggested sequence:
Expected distinctions:
Additional controls should cover repeated OOM, resource release during backoff, reserved-to-committed allocation fallback, previous valid mip retention and unrelated queue progress.
The test should exercise the actual production paths, not a duplicate of their logic.
Testing on WARP and physical NVIDIA hardware would be useful. An unconsumed injector, failed setup or native compilation failure must not be reported as reproduction.
9. Relationship to existing memory work
The following PRs are relevant:
These are complementary to the proposed recovery invariant.
I also inspected the following candidate revisions:
1e710c4bbeb03ce24bd3f2398621c0cb1c57270236ec45cdd2bdea049b80f6a16ecb76430c3b3e8fBoth retain permanent resource refusal when final texture creation returns
None.This report therefore focuses on final-failure recovery rather than introducing another eviction policy.
The duplicate search was limited to selected issues, PRs and source paths. It was not an exhaustive review of every development branch.
10. Relevance to limited-VRAM NVIDIA configurations
The existing reports in #182 and #75 illustrate memory constraints on GPUs with 8–10 GB of VRAM, although they do not establish this specific failure mechanism.
On such configurations, successful memory reclamation is particularly valuable.
A possible resource recovery defect could reduce the benefit of eviction if resources rejected during earlier pressure cannot subsequently be recreated.
This investigation does not claim that the identified mechanism explains the missing textures reported in those issues.
That relationship requires native diagnostics and independent runtime validation.
Attachment
avatar_texture_retry_audit.zipContents:
README.mdnative_test_plan.mdmodel.pytest_model.pymatrix.csvresults.txtReproduction:
No external Python dependencies are required.
Requested verification
Could an independent contributor validate the predicted permanent-refusal behavior through a controlled native allocation failure?
If reproduced, I suggest integrating the smallest coordinated correction that preserves resource lifetime, queue generations and descriptor publication ordering.
The existing memory-management PRs may provide useful integration points.
Credits and limitations
avatar_texture_retry_audit.zip
Only public repository source and invented test data were used.
No proprietary game files, executable files, shader dumps, console SDK material or game captures are included.
The Python tests were executed successfully. No production Rust patch, native D3D12 test or game benchmark has been completed by this investigation.
The proposed native test is a design plan, not an executable Rust regression.
No FPS improvement, VRAM reduction or visual correction is claimed.