GPU: keep the remap history for every view heap, coalesced and bounded (port of Kamiloj9/victory-dlss 2023d5c8b) #1330
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1333"
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?
Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T15:53:55Z.
Problem
The ranges of title memory the runtime mapped, unmapped or wrote were kept in one unbounded
static REMAPPED: Mutex<Vec<(u64, u64)>>and the first texture pass took all of them withstd::mem::take. Two consequences:Found by comparing the other forks: Kamiloj9/victory-dlss commit
2023d5c8b(Kamil Ojdana), which adapts PastiiJay/klbf-lab commit74315e7. It is not in this fork,upstream/main, the #653 batch, or any open PR (checked by the fork comparison). This is that fix ported.Change
RemapQueue: sequence-numbered ranges, coalescing consecutive pages,REMAP_LIMIT = 1 << 15entries, the oldest evicted.HostHeap::remap_cursor: each heap takes the ranges recorded after its last pass;texture_slots_remappedis nowrefresh_remapped(&REMAPPED, frame).Nonefromsnapshotand rescans all its placed slots once, instead of silently missing the range.remapped()records and counts evictions; the metrics line says "evicted from history" rather than "dropped".texture_slots_page_writtenstill runs first and is unchanged; slots a draw read through a table still wait for their draw.Tests
remap_history_delivers_extended_ranges_and_detects_eviction: coalescing a page sequence, snapshots after a cursor, an evicted range returningNone, and the empty latest snapshot.remapped_memory_makes_its_texture_slots_dueextended to a second view heap: both heaps make their own slots due from the shared ranges, each cursor advances once, and an evicted history makes both rescan and still leave the draw-table-owned slot for its draw.cargo test -p victory-gpu --lib --locked: 218 passed, 0 failed, 6 ignored.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.Coordination
This touches
descriptor/host.rs, which open #1324 also changes (Heap::drop/dynamic slots, an independent area). Both are needed; whichever lands second should be rebased. It does not depend on #1324.(CI note: the
checkjob on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)Rebased onto the VIctory-NVIDIA tree (origin/main
3e573d2)The fork's main was replaced by the tree of trustno1-coder/VIctory-NVIDIA (
5dbf5ce); this PR was rebased onto3e573d2and the feature adapted to the new tree's structures (now commit88efd7e):REMAPPEDis aMutex<RemapQueue>withREMAP_LIMIT = 1<<15: aVecDeque<(sequence, (start, end))>,latest,evicted,published; consecutive pages are coalesced into the last entry (unless already snapshotted), the oldest entry is evicted at the limit and the metric says so.HostHeaphas its ownremap_cursor, initialised at heap creation to the history'slatestso a late heap does not replay old ranges;refresh_remappedserialises that heap's passes, takes the ranges after the cursor (or, after an eviction, rescans that heap's placed slots once), and advances the cursor.texture_newsreports noted pages from the per-heap cursor; the new tree'sPAGE_WRITTEN/BAKE_PAGE_WRITTENhandling is untouched.remap_history_delivers_extended_ranges_and_detects_eviction, andremapped_memory_makes_its_texture_slots_dueextended to two view heaps with per-heap cursors and an evicted history that forces the rescan.Verification on this host:
cargo check -p victory-gpu --all-targets --lockedclean;cargo test -p victory-gpu --lib remap5 passed; under--features diagnosticswithVICTORY_D3D12_WARP=1,descriptor::host::tests48 passed;cargo clippyclean (--all-targetsand--all-features). No game run; correctness on real hardware with multiple live title heaps remains to be sanity-checked.rustfmt --checkis not meaningful here: origin/main's own files are not rustfmt-clean under the repo config.Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T22:18:12Z.
Rebased onto current main
52ac4ec(which now includes #1324 and #1336). The one conflict, incrates/victory-gpu/src/descriptor/host.rs, is resolved by keeping both the new heap identity fieldid(#1324) and this PR'sremap_cursor; the rest applied cleanly.New head:
42be495(one commit). Local verification after the rebase:cargo test -p victory-gpu --lib --locked -- --test-threads=1-> 224 passed, 0 failed, 6 ignored;cargo clippy -p victory-gpu --all-targets --locked -- -D warningsclean;git diff --checkclean. CI is running.Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T22:23:50Z.
The CI
Testsfailure is not caused by this PR - it is the asset-policy check on currentmain:crates/victory-gpu/src/host.rs(528,953 bytes) andcrates/victory-shader/src/emit/lower.rs(535,587 bytes) exceed the 524,288-byte limit. The same failure is known on main (#1342), and the PR's only change tohost.rsis +13 bytes of diagnostic text.Two open PRs already fix the cause: #1357 (maintainer branch,
mergeable=clean, moves both test modules out) and #1361 (raises the Rust-source ceiling). I am not duplicating that unrelated policy fix inside #1333. Once #1357 lands, this branch can be rebased once more and the check should be green.Imported from fxceless/victory-fork. Originally posted by akimfomin on 2026-11-26T23:39:00Z.
The rebased #1333 still merges cleanly with main
a42b627e78476d691042a2a12e8cd5fcf5e49d77. I merged exact head42be495e772530b6904f850453562ae02c45bcfflocally into tree621ef4d4fd9b6f707399cd14d2eaa9b537e50dd3and rancargo test --locked -p victory-gpu --lib remap -- --test-threads=1 --nocaptureon Windows with WARP requested. Five tests reported passes, including range coalescing/eviction and the two-heap remap fixture. Pinned fixtures.Keep this small test group on the next rebase: it gives a behavior signal even if the unrelated main file-size gate still fails. This is an isolated remap suite without a title or a full CI run. PortBridge · AI-assisted test report.
Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-26T23:45:45Z.
Yes, the failure is due to irrelevant causes from the main branch itself. Also lots of repos are also suffering this. However,it's just a test bug.
Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T01:01:57Z.
Review: COMMENTED
This commit comes with the other fours, urgent and important, please review ASAP. Thanks
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.