Repository navigation
Conversation
…ll its views The title writes physical pages through one view (a pool) while the GPU reads them through another (map_alias). A read-only guard on one view did not see writes through the other, so its host copy kept what it first took (seen as stale mesh data in the world, before the page faults). xmem keeps an index of the views showing each physical page; guarding a block also guards its aliases, and a write to one opens them all. Only blocks with guarded aliases are looked up on a write, so a huge kernel write range costs no more than before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GPU: a write through one view of physical pages opens the guards of all its views (Marvisak#1122)
DenRakEiw
left a comment
There was a problem hiding this comment.
Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):
cargo test -p victory-gpu(RTX 5090): 51 passed, 0 failed, 1 ignoredVICTORY_D3D12_WARP=1 cargo test -p victory-gpu(WARP): 51 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets: 0 warningscargo xtask policy: ok
Clean guard-opening fix across aliased physical-page views, verified on Blackwell hardware and WARP. Approving.
AI-assisted (Gemini 4 Neon).
|
Reviewed on Windows 11 / Rust 1.98.1, The test pins the fix. With the lookup suppressed ( Green as pushed: Why the shape is right. The scenario in the comment really is tracked. Lock order is acyclic, but it is now three locks and one of them is on the fault path. The edges are Two things I would tighten.
I cannot measure what this costs at runtime — it adds a hash probe per 64 KiB guarded and per block opened with aliases — and I have no title to check the pool/tiled-heap pattern against. The bug it closes is real on the mapping scheme it describes, so this is a correctness fix whose cost is bounded by the number of aliased blocks, which is the right place to spend it. |
|
In-game A/B on current Setup: RX 9070, Windows 11, Adrenalin 26.11.2,
So on today's What remains is the correctness case: a guard on one view of physical pages does not see writes through another view of them. The unit test AI-assisted (Claude Code); the runs and the hardware are mine. |
|
@tightfall I reproduced a late-alias case on exact |
|
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 9ed6093: Tested with AI assistance (Claude). |
…e guards of all its views BTP 6 writes physical pages through one view (a pool) while the GPU reads them through another (its tiled heap, map_alias). The write watch guarded view memory block by block, so a read-only guard on one view did not see writes through the other, and the host copy kept what it first took (stale mesh data). xmem keeps an index of the addresses showing each physical page and answers the GPU side's range lookups (xtp_gpu::set_alias_lookup). Guarding a block guards the other views of its page, a write to any of them opens them all, and a report of a change to one view opens the others. Ported from Marvisak/VIctory#1122 (head 9ed6093) by tightfall, adapted to XTP's watch (run-merged opening, GUARDED, title_memory_remapped), with: - the late view aycow found on #1122 (fa2de5f): a view mapped after a copy guarded another one was never guarded. xmem notes a view before it reports it, and the report opens the page's other views from the index; - adamdotpy's review there: links are pruned exactly (opening a page's views unlinks them all) and the comments say a block is a page; - a page with a view that cannot be made read-only is left open, not clean; the fault handler keeps the title's last error; - one index lookup per run guarded, and pages shown once cost nothing to look up (a set of shared addresses).
|
Automated triage for the maintainers. Closing because this change is already in Already in main: the runtime reports where physical pages are mapped (watch::title_memory_aliased) and a write through one mapping marks the trackers of all. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
The title shows one physical page at several addresses. A copy taken through one of them was guarded at that address only, so a write through another left the copy as it was for the rest of the run. On one machine the first room's walls and a face's shading came back in two runs out of two; the walls also came back by themselves in some earlier runs, so this is not proof. Code of victory-fork Marvisak#115 by Spexivus (the index of the views of each page, the guard over all of them), with joroyt's correction of it (another view is made read-only, not noted clean) and the set of aliased blocks of VIctory Marvisak#1122 by tightfall. Added here: a page of more than 64 views is guarded one view at a time, a switch (VICTORY_VIEW_GUARD=0), counts in the diagnostics log, and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ported onto this fork's own-write settling (own_write_begin and own_write_end open and guard through the same paths). Claude-Session: https://claude.ai/code/session_01DnmJgv1UMusjz7uG9bKMA7
Support unaligned 12-byte typed views while retaining their backing heaps. Track writes across views of physical pages and keep DirectStorage kernel destinations writable until the read completes. Include the Wave64 lowering, indirect scratch, readback and diagnostic changes from the RTX build used for the apartment and prison captures. Physical-page handling adapted from myokex/victory-amd@c6dc4d8, incorporating Marvisak#1122 and fxceless/victory-fork#115. Other incorporated changes include fxceless/victory-fork#220, Marvisak#253 and Marvisak#260. Verified on RTX 5070 Ti. The apartment capture shows restored clothing and interior surfaces. Prison lighting and gameplay performance remain incomplete.
…rites counted; levels on demand (off); warm-up; card memory numbers Memory sync: - The guard over every view of a physical page (code by myokex, victory-amd c6dc4d8, after pull request Marvisak#115 by Spexivus, its correction by joroyt and a part of VIctory Marvisak#1122 by tightfall): the title shows one page at several addresses and a copy was guarded at one only. 0.8 to 1.0 million writes through another view in a five-minute run on the test machine. VICTORY_VIEW_GUARD=0 turns it off. - Kernel reads into title memory are read beside and copied in (Joshua Odom, 10ea38e). - Writes of the storage layer into physical pages are counted where the title has the pages mapped and can open the guards there (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads are retried. Card memory: - Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the title fills takes card memory for the levels the title holds; held levels get memory only while the card has room and are asked for again. Its test runs on the software adapter; not run on a card yet. - Refused texture slots are held back so a pass reaches the slots behind them; room can be kept for card copies of title buffers (off). Tools: translate --warm all; the shader cache is keyed on the translator's source; counters for copy-back races, page writes and the copies the texture sweep never lets go; a walls trace. Game runs of these changes on an RTX 4070: five five-minute runs without a device loss or a failed request. This merged tree was built; its test suites were run on the tree the changes come from (gpu 129, hle 97). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rites counted; levels on demand (off); warm-up; card memory numbers Memory sync: - The guard over every view of a physical page (code by myokex, victory-amd c6dc4d8, after pull request JMAN730#115 by Spexivus, its correction by joroyt and a part of VIctory Marvisak#1122 by tightfall): the title shows one page at several addresses and a copy was guarded at one only. 0.8 to 1.0 million writes through another view in a five-minute run on the test machine. VICTORY_VIEW_GUARD=0 turns it off. - Kernel reads into title memory are read beside and copied in (Joshua Odom, 10ea38e). - Writes of the storage layer into physical pages are counted where the title has the pages mapped and can open the guards there (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads are retried. Card memory: - Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the title fills takes card memory for the levels the title holds; held levels get memory only while the card has room and are asked for again. Its test runs on the software adapter; not run on a card yet. - Refused texture slots are held back so a pass reaches the slots behind them; room can be kept for card copies of title buffers (off). Tools: translate --warm all; the shader cache is keyed on the translator's source; counters for copy-back races, page writes and the copies the texture sweep never lets go; a walls trace. Game runs of these changes on an RTX 4070: five five-minute runs without a device loss or a failed request. This merged tree was built; its test suites were run on the tree the changes come from (gpu 129, hle 97). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…rites counted; levels on demand (off); warm-up; card memory numbers Memory sync: - The guard over every view of a physical page (code by myokex, victory-amd c6dc4d8, after pull request Marvisak#115 by Spexivus, its correction by joroyt and a part of VIctory Marvisak#1122 by tightfall): the title shows one page at several addresses and a copy was guarded at one only. 0.8 to 1.0 million writes through another view in a five-minute run on the test machine. VICTORY_VIEW_GUARD=0 turns it off. - Kernel reads into title memory are read beside and copied in (Joshua Odom, 10ea38e). - Writes of the storage layer into physical pages are counted where the title has the pages mapped and can open the guards there (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads are retried. Card memory: - Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the title fills takes card memory for the levels the title holds; held levels get memory only while the card has room and are asked for again. Its test runs on the software adapter; not run on a card yet. - Refused texture slots are held back so a pass reaches the slots behind them; room can be kept for card copies of title buffers (off). Tools: translate --warm all; the shader cache is keyed on the translator's source; counters for copy-back races, page writes and the copies the texture sweep never lets go; a walls trace. Game runs of these changes on an RTX 4070: five five-minute runs without a device loss or a failed request. This merged tree was built; its test suites were run on the tree the changes come from (gpu 129, hle 97).
The title shows one physical page at several addresses. A copy taken through one of them was guarded at that address only, so a write through another left the copy as it was for the rest of the run. On one machine the first room's walls and a face's shading came back in two runs out of two; the walls also came back by themselves in some earlier runs, so this is not proof. Code of victory-fork Marvisak#115 by Spexivus (the index of the views of each page, the guard over all of them), with joroyt's correction of it (another view is made read-only, not noted clean) and the set of aliased blocks of VIctory Marvisak#1122 by tightfall. Added here: a page of more than 64 views is guarded one view at a time, a switch (VICTORY_VIEW_GUARD=0), counts in the diagnostics log, and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
The title maps the same physical pages at more than one address: it writes them through one view (a pool) and the
GPU reads them through another (
map_alias).watch.rsguards view memory block by block, and the read-only guardsits only on the view a copy was taken from. So a write through the other view never faulted, and the host copy kept
what it first took. In the world this showed up as stale mesh data: one page was copied once and never again. After
that came page faults that look like the freed-texture/root-view faults in #59 and #597.
Change
xmemkeeps an index of the views that show each physical page (map_aliasand pool mappings) and answers"which other addresses show this page" through
watch::set_alias_lookup.watch::protectmakes a block's aliases read-only too. They are not marked clean, because no copy of an aliashas taken them yet.
watch::open(fault handler and announced kernel writes) also opens the aliases of a written block. Only blocksthat have guarded aliases get looked up, so a huge announced write range (the
freadcase that ec0d155 tests)costs the same as before.
a_write_through_an_alias_view_is_seen_by_a_guard_on_the_othermaps one pagefile section twice and checksboth directions (a faulting write through either view, and a kernel write announced through
writing).Tested
cargo test --workspaceonffe310e+ this commit: all pass.cargo clippy --workspace --all-targetsclean.older stack (d2a4bae + GPU: keep replaced host resources for 6 frames; bigger dynamic descriptor pool, no fallback to stale tables #135 + local diagnostics), not this exact rebase:
17:32 with TdrDelay=10, past the intro into the prologue.
This PR was AI-assisted (Claude Code). The hardware runs and the logs are mine.
🤖 Generated with Claude Code