GPU: prototype idle mip reclamation with retained texture versions #1153
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1153
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1153"
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?
@ilyaux on GitHub · 2026-11-25 21:50 UTC · original
ilyaux:fix/reclaim-mip-levels→main· +638 −23 · 7 files · 2 commits · draftProblem and proposal
Draft for design feedback, related to #898. Validation of the new reclamation path is limited to synthetic textures on WARP; native NVIDIA and retail-title runs are pending.
Levels-on-demand copies retain backing for mip levels the title no longer holds until the entire host copy is destroyed. This adds an opt-in
VICTORY_LEVELS_RECLAIM=1path, alongsideVICTORY_LEVELS_ON_DEMAND=1, which replaces eligible idle copies while keeping old readers valid.The sweep follows the existing idle grace for borrowed
host_resourcereferences. Reclamation can be delayed by old readers or insufficient reusable pool space. The feature is off by default.Dependency and attribution
This draft carries LeonardoS11's #795 as its first commit, reapplied from
32772d93ea1ec529a8508d08e980c3867c2701ffwith the original author metadata and message preserved:bf41d7a12528b8fad5ad2093d4813b04f62f8319: #795's backing-lifetime fix.b472041c778420d2d4397957d18d65ab62624464: reclamation, pool reuse, regressions and documentation.The native RTX 3080 Ti results in the carried commit message belong to the original author's report. They are not validation performed for this draft. The second commit contains the new work; the dependency commit can be dropped once #795 lands.
Validation
Tested head:
b472041c778420d2d4397957d18d65ab62624464, based onmainat9c184b35b43de3455b74ac1770e1c8734a047810.Windows 11; rustc/cargo 1.98.1; WARP, tiled resources tier 3. The D3D12 debug layer is not installed.
With
VICTORY_D3D12_WARP=1andVICTORY_TILES_TEST_CARD=0:cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1 --skip depth_bounds_pipeline_loads_and_filters_draws --skip warp_budget_saturates_without_wraparound_and_preserves_draw_fieldscargo test --locked -p victory-gpu --features diagnostics tiles::tests -- --include-ignored --nocapture --test-threads=1cargo check --locked -p victory --features diagnosticscargo xtask policyThe two excluded tests were each run separately on unmodified
mainat9c184b3and failed there too. A fullcargo test --workspace --lockedattempt stops at the existing indirect-budget test: the GPU package reports 185 passed, 1 failed, 5 ignored. A fully passing workspace run is not claimed.Both strict workspace Clippy commands from CI were attempted locally and fail on
nonminimal_boolin unchangedvictory-shaderfiles. The locally available Clippy reports 0.1.93 despite the 1.98.1 rustc/cargo toolchain, so strict CI validation remains open.For each synthetic BC7/BC3 texture, assigned backing changes from 1856 KiB to 512 KiB after old readers release it. The test checks old-reader contents, heap size without growth, and reintroduced fine-mip contents by readback. These are per-texture tile bytes, not whole-process VRAM or gameplay FPS.
The production sweep and actual
Host::executeretirement boundary have a regression. During development, replacing deferred retirement with an immediate drop made the fence-publication assertion fail; that mutation was reverted.Pending validation and feedback
AI use: Codex developed the reclamation changes and synthetic tests, ran local validation and drafted this description. The carried dependency retains its original credits.
@fladit123 on GitHub · 2026-11-25 23:10 UTC · original
Independent native hardware validation of HEAD
b472041c778420d2d4397957d18d65ab62624464.Environment
Results
Five successful test executions, no skips, no timeouts and no detected device removal.
Assigned backing per synthetic BC7/BC3 texture
Both adapters released 1344 KiB of assigned backing per texture.
The reclamation regression verified retained old-reader contents, no pool growth during replacement, and correct restoration of fine mip contents.
No D3D12 errors were reported. The native levels-on-demand fixture emitted one warning, ID 1328, concerning the initial UAV state of a buffer being treated as COMMON. The corresponding fixture code is unchanged from the original base, although I did not rerun that base to reproduce the warning.
Executable SHA256:
F827851C759D8B9D146EBC0FA228DB04AB559D9EB5BC840F210C6CC2F9CB52F9Limitations
The native fixture selects the default D3D12 hardware adapter. The system reports an RTX 4060 and two virtual display adapters; the fixture did not print the selected adapter's LUID.
Validation used a source-only copy with verified Git blob hashes and the unrelated BCPack module excluded locally. No game data was used.
These results measure assigned texture backing, not total physical VRAM savings or gameplay performance. Integration with current main remains untested.
The synthetic native hardware results are encouraging, particularly for memory-constrained GPUs.
AI-assisted validation with ChatGPT; all tests executed locally.
@fladit123 on GitHub · 2026-11-26 01:59 UTC · original
Following up on my earlier hardware validation, I investigated the admission and upload boundary more closely.
I reproduced a case where
reclaimed_on()checks available pool capacity, but another texture consumes that capacity before the replacement's first upload. With growth disabled, the replacement initially received zero backing. With growth enabled, the pool grew from 64 to 128 MiB.An experimental reservation-based complement prevented this growth and guaranteed backing for the retained mip groups. However, further qualification exposed important trade-offs:
0x00before initialization and0x22after a subsequent successful upload.The experiments also identified and corrected two accounting issues in the experimental complement: stale logical-budget admission and transient double counting during reservation conversion.
The qualified reservation implementation passed 17 WARP controls and two RTX 4060 tests, but I do not recommend integrating it as-is because of the demonstrated progress regression.
A possible alternative would be:
The main complication is that recorded D3D12 commands already reference concrete resources. Changing
madeat submission time cannot redirect those commands.I therefore stopped at the design boundary rather than introducing a broader production change without coordination.
Would this private-initialization and deferred-promotion model fit your intended architecture? I can share the synthetic reproductions, accounting fixes and experimental patches separately if useful.
These experiments used synthetic data only. Gameplay performance and total process VRAM savings remain unmeasured.
AI-assisted investigation with ChatGPT and Codex; tests executed locally.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.