Repository navigation
fix(agc): bind a read-only V# over the cached address space through the region that holds it - #5815
Conversation
…he region that holds it Since the cached address space keeps a read-only V# that only partly overlaps its base regions (readsOverBase), a build's own regions can overlap base regions. UploadPrepare merges overlapping own views, so a merged region can begin before the base region that holds a view's first byte. owner() still took whichever candidate began later, so Descriptor bound such a view through one base region it does not fit: guest buffer view 0x1f0494592c+0x1b2190 exceeds its GPU owner 0x1f04940000-0x1f04950000 (buffer 0, direct 1, mirror 0) owner() now takes the range's end and prefers the candidate that holds the whole range. When both or neither do, it keeps the previous rule. Every caller already knew the end it passes.
…s after UploadPrepare UploadFinish dissolves the cached address space when an import was retired after the space was built. The space's base regions are then merged with the build's own regions, which since readsOverBase may overlap them. owner() searched the merged list for the region with the greatest begin, a base region of one mapping, so a read-only V# merged into an own region that began earlier was bound through it again: guest buffer view 0x1f0390c1c4+0x10c1cc exceeds its GPU owner 0x1f03900000-0x1f03910000 (buffer 0, direct 1, mirror 0) The dissolve now notes when the merged list overlaps, and owner() then looks back for a region that holds the whole range. The test's third build retires the imports between UploadPrepare and UploadFinish.
|
Tested on Ghost of Yōtei (PPSA26344), where the same abort stopped every build since #5596 at the same spot: It fired during presentation about 18 minutes in (around present 833), with the same view and owner on every run. Setup: Windows 11, RTX 4090 (NVIDIA 617.42), i9-13900K. Our tree is
Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Thanks for running it on Ghost of Yōtei. A second title with the same abort, and the same view-against-owner shape, is good to have. I've added it to the description. |
|
I hit this on Ghost of Yōtei (PPSA26344 v1.008) after syncing our game branch with Details
|
|
Thanks for running it on your Yōtei build. Two setups now hit the same abort and pass with the two commits, so I've added your run to the description. |
…overlaps the address space A read-only V# that crosses imports of the cached address space is bound through a copy of its bytes, and that copy can begin inside an import. The BDA table listed the copy and the space's ranges by begin, and a shader takes the last range beginning at or below an address, so the bytes from the copy's begin to the end of that import resolved to the copy. The copy is read-only, so a BDA store or atomic into a writable import faulted with Permission, the GPU side of the rule owner() no longer applies on the CPU. The table now gives every byte one range: the space's ranges, or after a dissolve the direct and mirrored regions, keep the bytes they hold, and a build's copies keep only the bytes nothing live holds.
…the writable import Two writable 64 KiB pieces and a read-only one, one import window each, with a read-only V# across the boundary: through the kept address space, a hit on it and a dissolve after UploadPrepare, the BDA table has no overlapping ranges, stores up to the boundary resolve to the writable import and reads past it find the read-only one.
…, and cross access The test of two read-only V#s merged over three imports now asserts that its second build hits the cached address space without a dissolve and that the third leaves it only for the import change. One crossed piece is writable, so a join of the crossed run cannot erase the overlap the test is about.
… an import A read-only V# across two imports into unregistered memory, a read-only and a written V# in that memory: UploadPrepare merges the three into one copy that begins inside the first import. The written V# maps its own bytes in that copy, counts as a copied write, and WriteBack lands its store on its bytes alone.
|
Tested on a second RE Engine title: Onimusha: Way of the Sword (PPSA27836). Windows 11, RTX 5070 (NVIDIA 617.42). Base: With this PR merged (no conflicts), that stop is gone, and the load reaches later draws. It stops further on, at an unrelated sample-count check. |
|
Thanks for testing it on Onimusha! I've added your run to the description. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Checked on the PR merged onto main: build and ctest for libSceAgcDriver ( |
Main now carries boykopovar#4450, boykopovar#4475 and Pipodi's pointer-in-record table columns (c794273), which replace our copies and our record-pointer columns; boykopovar#5181, boykopovar#5989, boykopovar#5906, boykopovar#5484 (live snapshot mismatches serve live bytes; our retry is dropped), boykopovar#5483, boykopovar#5522, boykopovar#4732, boykopovar#5792. Kept local: the two-lane wave64 hang fixes, boykopovar#5815, option 1 substitutes, image-table stores and set 0 tables, stencil remap, 10_11_11 blending, the VRAM share/spill, block-hash snapshots, diagnostics. Versions: disk FormatVersion 42, RuntimeAbi 17, request serializer v30, BdaAbi UnnormalizedWrap 11 / DirectImage 12. Notes in work/sync-20261013/*-3.md. AI-assisted: yes
Main brings the pipelined-draw stack (boykopovar#1193/boykopovar#1201/boykopovar#1202), boykopovar#6316 after boykopovar#6060, boykopovar#5893, boykopovar#5910 and depth/HTILE work (boykopovar#454, boykopovar#5496, boykopovar#5554, boykopovar#5524, boykopovar#5627, 626cff7). Our SharedSpirv / cold-SPIR-V storage is replaced by main's mapped cache entries (CreateFileMappingW on Windows), so cached variants' words are views into the cache files instead of heap copies; APS5_COLD_SPIRV, APS5_COLD_SPIRV_FILE and APS5_CACHE_SPIRV_BACKING are gone. Kept local: lane hang fixes, boykopovar#5815, boykopovar#6227, table stores and storage tables, option 1 substitutes (.slots), stencil remap and alias path (a written storage view our alias path serves seeds from the depth surface instead of retiring it), 10_11_11 blending next to main's reversed-order blending, VRAM share/spill/fallbacks, diagnostics. Versions: FormatVersion 43, RuntimeAbi 17, request serializer v31. Notes in work/sync-20261013/*-4.md. AI-assisted: yes
What
Resident Evil Village (PPSA01556) stops in a G-buffer draw at the title, and, with that case fixed, again during the first scene load:
Since #5428, the cached address space survives a read-only V# that only partly overlaps its base regions (
readsOverBase). The V# gets a region of its own, so a build's own regions can now overlap base regions. Two overlapping read-only V#s that each cross an import edge are merged byUploadPrepareinto one own region, which can begin before the base region that holds the second V#'s first byte.GuestBufferMemory::owner()takes the region with the greatest begin at or below the address from the build's own regions and from the space's base. It returned the base one when that began later, which was right while the two never overlapped. Here it returned the base region of one 64 KiB mapping, with its own 64 KiB import, for a 1.7 MB view.Descriptorthen refused the view.The second stop takes another path to the same lookup. When an import was retired after the space was built,
UploadFinishdissolves the space afterUploadPrepare. That merges the base regions into the build's sorted list on the assumption that the two never overlap. The space is then gone, soowner()searched only the merged list, where the region with the greatest begin was again a base region of one mapping.The commits:
fix(agc):owner()takes the end of the range it is asked about and returns the candidate that holds the whole range. It keeps the previous rule when both or neither do.Descriptorpasses the view's end, and the write-back paths pass the end of each written range they already loop over.fix(agc): a dissolve afterUploadPreparenotes when the merged list overlaps, andowner()then looks back for a region that holds the range. The usual disjoint list keeps the single binary search.fix(agc): the GPU side of the same lists. A build's BDA table (AddressRanges,CachedAddressTable) still listed its own regions next to the space's base regions they overlap, and the shader's lookup takes the last range whose begin is at or below the address (SpirvBdaLookup.cpp). So a BDA store into a writable import could resolve to the read-only copy of a V# across it. The table is now disjoint:UploadPrepare, the former base regions first, and the copies clipped against them;test(agc): BDA stores under a read-only V# across imports reach the writable import.test(agc): the merged read-only V# test proves the paths it takes, with the address-space counters. The first build must be a space hit with no overlap dissolve, and the second must dissolve on imports. One crossed piece is registered writable, so a join of the run can't take the test's coverage away. It also checks access across the edge.test(agc): a store through a written V# merged with a read-only V# past an import, which goes through the write-back paths commit 1 changed.Scope: read-only V#s that cross imports aren't joined into one region here, which would avoid the overlap in the first place; #5372 and #6197 work on joins. This PR keeps the overlap that #5428 allows and makes the CPU lookup and the BDA table agree on it, so it holds with or without those joins.
Related: #5428, and #5169 (the Village bring-up discussion).
Tested
On GitHub's runners from my fork, on
mainat 872f523:-DANYPS5_ENABLE_SPIRV_TOOLS=ON.spaceReadsAcrossImportsMergedTestsintests/BdaResources.cpp(run byagc_driver_graphics) maps six 64 KiB ranges in a 128 KiB import window, so the space's base has three two-range imports. It then binds two overlapping read-only V#s, one across the first edge and one from inside the second import across the second edge, in three address-based builds with the space cache on. The third build retires the imports betweenUploadPrepareandUploadFinish, so the space dissolves after the regions were prepared.main'sGuestBufferMemory.cppit fails on Linux and Windows with the title's message,guest buffer view ... exceeds its GPU owner ... (buffer 0, direct 1, mirror 0)(run).agc_driver_graphicsand the other tests of its executable pass 20 runs in a row on Linux and Windows, and so does every test undercore/libs/prx/libcandcore/libs/prx/libkernel(70 and 133 on Linux, 91 and 137 on Windows).Commits 3-6, on Linux (Ubuntu 24.04, GCC 13.3, CI's configure flags, lavapipe), on
mainat d92a8da:AGC graphics: the BDA table of a build with a read-only V# across imports has overlapping rangesandAGC graphics: a BDA store into a writable import resolves to the read-only copy of a V# across it. They pass with commit 3.mainwithout this PR, with the title's message (guest buffer view 0x564c68a80200+0x100 exceeds its GPU owner 0x564c68a70000-0x564c68a80000 (buffer 0, direct 1, mirror 0)), and passes with it.agc_driver_graphicsandagc_sparse_buffer_holespass. At the head, the full suite runs 1117 tests, and 5 fail: the IPv6 socket tests (guest_datagram_*andguest_tcp), which fail on that VM without this PR too.maind92a8da: 1253 of 1253 tests pass (run).ANYPS5_REQUIRE_VULKAN=1and only the NVIDIA driver visible:agc_driver_graphics,agc_driver_bda_device,agc_driver_bda_span_readsandagc_sparse_buffer_holespass 5 of 5 each (--repeat until-fail:5). The head was merged with fix(agc): execute the DB's out-of-place depth expand #6146's latest commits for one combined run.tools/check_conventions.py --base origin/mainpasses.Resident Evil Village (PPSA01556, 01.210.000) on Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS, 15.4 GB RAM:
mainthe title doesn't reach this point on this PC by itself. Preparing every shader at registration gives a black screen with private memory heading for the commit limit, and several earlier stops come first. So both runs aremainat 23be5a0 with fix(agc): heap-mirror ranges whose import windows left the write watch #5688 (the 419 MiB copy stop at boot) and fix(libkernel): commit a reserved host stack before protecting it #5703, plus local test commits that aren't part of this PR:APS5_RE8_LAZY_PREPARE=1, withAPS5_NO_GPL=1);[videoout] presentation failed: AGC graphics: guest buffer view 0x1f0494592c+0x1b2190 exceeds its GPU owner 0x1f04940000-0x1f04950000 (buffer 0, direct 1, mirror 0), then an abort. That's the same address as in our own stack's runs.Ghost of Yōtei (PPSA26344), run by Pipodi on Windows 11 with an RTX 4090 (driver 617.42) (comment), on
main9a3e2ac with #4450, #4475 and #5851. The only difference between the two runs is this PR's two commits:guest buffer view 0x912f8c088c+0x27918 exceeds its GPU owner 0x912f8c0000-0x912f8e0000 (buffer 0, direct 1, mirror 0)after 1,124 s, at the same view and owner on every run.Celegans12 hit the same abort on Ghost of Yōtei 1.008 after syncing with
maine34c479, on Windows 11 with an RTX 3080 Laptop GPU (driver 610.62) (comment):guest buffer view 0x9093082f64+0x1dab8 exceeds its GPU owner 0x9093080000-0x90930a0000 (buffer 0, direct 1, mirror 0)at the loading screen, 979 s and 1,859 s in.[address]showsdissolved: overlap 0.teepean hit the same abort on Ghost of Yōtei 02.002.000 on Linux (CachyOS, RTX 3090, NVIDIA 615.78.08), on
mainf785b88 with local workarounds for four earlier stops (report):guest buffer view 0x918017088c+0x27918 exceeds its GPU owner 0x9180170000-0x9180180000 (buffer 0, direct 1, mirror 0), about 6 minutes in.registered program refers to an incompatible shader binary type).simonbronk hit the same abort on a second RE Engine title, Onimusha: Way of the Sword (PPSA27836), on Windows 11 with an RTX 5070 (driver 617.42) (comment), on
main0afa6a6 with the title's PRs (#5907, #5776, #5770, #5703, #5841, #5884, #5915) and local sample-count changes:guest buffer view 0x1d08ee1bc0+0x28b320 exceeds its GPU owner 0x1d08e00000-0x1d09000000 (buffer 0, direct 1, mirror 0)during the New Game scene load.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)