Repository navigation
GPU: keep the remap history for every view heap, coalesced and bounded (port of Kamiloj9/victory-dlss 2023d5c8b) - #843
Conversation
The ranges of title memory the runtime mapped, unmapped or wrote were kept in one Vec and the first texture pass took them all with mem::take: a second view heap missed the notifications, and nothing bounded the history when no pass ran. Keep a sequence-numbered RemapQueue with coalescing and a bounded history; give every HostHeap a remap cursor and have each heap take only the ranges after its own last pass; a heap whose cursor is behind the evicted history rescans its placed slots once instead of silently missing ranges. Port of Kamiloj9/victory-dlss 2023d5c8b (Kamil Ojdana), adapting PastiiJay/klbf-lab 74315e7; attribution per the PR body. Ported from fxceless/victory-fork PR #1333 (head 88efd7ea876f5d5771d95ff3b5f22c076f19ea2a). Original author: CwWwWwW <66506837+CwWwWwW@users.noreply.github.com>.
|
Ran the remap-history tests at 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 All three tests pass, including 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. |
Ported to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1333 (head 6affb2e, author CwWwWwW). The fork's own line was dropped when it rebased onto 959dcaf (5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main 63b902f.
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)
Hardware verification suggested