GPU: keep the remap history for every view heap, coalesced and bounded (port of Kamiloj9/victory-dlss 2023d5c8b) #843
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/843"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by CwWwWwW on 2026-11-28T07:34:58Z.
Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1333 (head
6affb2ea2c, author CwWwWwW). The fork's own line was dropped when it rebased onto959dcaf(5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main63b902f.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 onto 3e573d2 and the feature adapted to the new tree's structures (now commit 88efd7e):
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.Verification on this tree (base
63b902f, 2026-11-27)63b902ffailed on those before this change.Hardware verification suggested
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Aniseto on 2026-11-28T08:07:35Z.
Ran the remap-history tests at
6affb2eon an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by
rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.All three tests pass, including
remap_history_delivers_extended_ranges_and_detects_evictionandremapped_memory_makes_its_texture_slots_due. They are CPU-side tests of the per-heap queue; no second view heap was driven on the adapter. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti.Not tested: a session with two view heaps, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.