fix(agc): write back BDA stores into writable heap mirrors #12840
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12840"
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 boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-29T12:10:17Z.
What
A shader that stores through a FLAT/GLOBAL address, or through a V# it computed itself, into a writable heap mirror is refused today. sktharunbalaji13-cmd's Ghost of Tsushima Director's Cut (PPSA02225) run stops a compute store this way (I#5166):
On
mainb11c7bf84fthe title still hits this refusal, 7 times per run, each withthe store hit 0x1549750000+0x4eeb0000(instruction 0x1b4, 4 bytes, compute), right after its intro H.264 decoder is created. On this PR's head it runs with none (run; see Tested). Onmain133feb30f0, from a pinned save on Linux, @milescoviello's pair logs no such refusal in either arm, so that pair can't show the fix (see Tested). A probe onmain7c444b77adstill refuses such a store, and the same probe on this PR's head stores it (see Tested).The refusal is deliberate. Granting
Writeto writable mirrors inGuestBufferMemory::addressRangealone would lose the stores silently:WriteBackstores only the build's declared write ranges, so a store elsewhere in the mirror never reaches guest memory.The change. When a build's shaders can store through addresses (
!bdaReadOnly), its writable heap mirror spans are marked writable in the BDA table, and the stores reach guest memory without binding, copying or reading back the span:APS5_BDA_STORE_PAGESsets its size: the default is 1,024 pages, about 4.6 MiB. Pages are found by a 16-probe hash keyed by the page, and a read in the same dispatch finds the store there.StorePageGather.comp) and compared with the resident shadow, which equals the device bytes at upload.APS5_HEAP_MIRROR_MIBis never charged for a store.NoteWrittenBacknotes only the runs that were actually stored, so a completion label inside the span that no thread stores over isn't counted as overwritten.PipelineSpecialization::StorePages, ID 8239). The driver binds that variant only when the build's BDA table carries a store page pool, so every other compute shader compiles as before.The commits:
bf54c5e942: note only the stored runs of address-store spans as written back. This answers question 1 of the review.99f1f37aed,91e4d82e7c: compare only the pages BDA stores hit, and take the reference on the GPU. The next commits supersede these for address stores.fbb103c45f: the shader side, which redirects stores into unbound heap mirror blocks to store pages.bbeb08e9f6: resident mirrors without binding, copying or reading back the span.7e7c81a2aa: copy-backed mirrors by per-byte store masks.425cd9d8b0: store page pools reused across address-based builds.6c6997ec33: unbound blocks written back by their store masks, so a stored zero isn't lost. This answers point 1 of the second review.92409250c8,822a2b879e: tests that pin store page exhaustion, at a small pool's size and at 1,025 pages against the default pool (point 2).1aa803e9d3: a merge ofmain.Cost
Each figure is the extra work of a storing dispatch over a load-only dispatch on the same heap, per dispatch. It's measured on lavapipe (4-vCPU Xeon, Release) as the mean of two runs, at 0, 1 and 16 stored blocks.
91e4d82e7c): wait, ms781dc4525b) added 7.3-80.6 ms of CPU per dispatch for these heaps.APS5_HEAP_MIRROR_MIB=64, with 1 MiB bound and 0.4-1.4 ms of wait.agc_driver_flat_storetakes 73.4 s, against 75.7 s with no store-page code. Theruntime_formatted_storetests take 25.6-27.3 s, against 27.3-29.9 s. Inlining the store-page code into every compute shader, the first try, made them 23-46 % slower, which is why it's specialized.[bda-store-spans]line) to the static menu +15 min.1 ranges (0.6 MiB, 0 writable, 0 heap 0.0 MiB), 294164 address-based builds served.6c6997ec33changes no shader code, so a pair on425cd9d8b0measures this head too.mainebb4075168+425cd9d8b0; A = the samemain. Both arms carry the same three local changes Village needs to boot on that base: a pad fix, #11580 and #10304.aps5-summary.jsonlthat start from menu +5 to +15 min (files, the warm-up boot included). b1's and a1's menu times are logged. a2's and b2's weren't, so their cuts use offsets that reproduce the frame rate logged at the time; it moves by at most 0.004 fps within ±20 s of them.Driver.Packet.draw1,161 against 1,156 ms per frame (+0.4 %) and 1,185 against 1,161 (+2.1 %);Graphics.Draw+0.1 % and +2.7 %;Graphics.Draw.draw_and_resource_release+0.05 % and +2.6 %. They replace the figures first posted here (Driver.Packet.draw+0.5 %,Graphics.Draw+1.1 %,draw_and_resource_release+1.0 %), which didn't say median or mean and don't all reproduce from the files.Driver.Packet.drawis 1,185 and 1,184 ms in the B boots, and 1,103 and 1,223 in the A boots. The A boots differ by 10.8 %, more than the gap between the arms.Tested
agc_driver_bda_store_heap_mirror, also run as_no_space_cache(APS5_NO_ADDRESS_SPACE_CACHE=1) and as_budget(--budget,APS5_HEAP_MIRROR_MIB=64). Each case was run against a tree with its own mutation (red) and on this branch (green):781dc4525b: "a store into one bound block of a 2 GiB heap: the store of thread 0 reached guest memory as 0x0, expected 0x5a000000".(APS5_HEAP_MIRROR_MIB), so a refusal can't pass quietly.LabelTests):[recorder]write-back-over-label counter stays 0;781dc4525b.ZeroStoreTests, resident and copy-backed): the guest block holds non-zero bytes, and 64 threads store zero, as a dword and as a byte. Red: 425cd9d8b0's code with only this test failsagc_driver_bda_store_heap_mirrorand_no_space_cacheon Linux (run 41047122594).agc_driver_bda_store_heap_mirror_store_pages: a small pool takes every slot. A dispatch that needs one more page leaves guest memory untouched._store_pages_default: 1,025 distinct pages against the default pool, resident and copy-backed. It asserts that none of that dispatch's stores landed. It doesn't assert that 1,024 fit.agc_driver_bda_device, shader level: six mutations of the store-page code, each red, e.g. "a read after a store into an unbound heap mirror block in the same dispatch returned 0x77777777" and "a store finding no free store page did not fault". Two more cases check that the store-page pipeline is selected and cached.Linux (lavapipe, Ubuntu 24.04, GCC 13.3, Release, CI's flags), at
425cd9d8b0:ctest -R '^(agc|shader)' --parallel 4: 1,132 tests, 1,059 passed, 73 skipped, 0 failed.GitHub's runners at this head, run 41102347191, ×10: every
^agc_driver_bda_test, including the five heap mirror tests, plusagc_driver_recorderandagc_recorder_command_buffer_release.APS5_SKIP_TIMING_TESTS=1, pass: 198 and 307 tests on Linux, 225 and 327 on Windows.Vulkan validation (Khronos layer,
ANYPS5_NO_SHADER_CACHE=1), on92409250c8(run 41039517488): the heap mirror tests show onlyVUID-VkDeviceCreateInfo-pNext-pNext, from device creation. TechLevelZero's NVIDIA run lists the same ID amongmain's own, in 427 tests. The store-page variant pipelines add none.NVIDIA RTX 2000 Ada Generation, TechLevelZero's NVIDIA GPU test at this head (comment): merged onto
main9f748f4, driver 595.99.02, the Khronos layer. 2,400 passed, 0 new failures, and no new validation IDs in 916 GPU tests.AMD Radeon RX 9070 XT (RDNA 4), by @bunbeans2-arch, at
425cd9d8b0(comment): Windows 11 Pro 10.0.22631, driver 32.0.32015.7029 (amdvlk64), MSYS2 UCRT64 g++ 16.1.0, Release,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1and the Khronos validation layer (the loader inserts it in every run). The head merged ontomainf7f03daf52, 3 runs per side:agc_driver_bda_store_heap_mirror,_budgetand_no_space_cachepass 3 of 3.agc_driver_bda_device,agc_driver_bda_reads_shadowed_results,_per_build,agc_driver_host_import_failure_handles,agc_driver_recorderand theagc_recorder_*tests pass 3 of 3, as onmain.VUID-line on either side.Checks:
check_conventions.pyandcheck_test_registration.pypass.-fsyntax-onlyis clean on the eight changed files that toolchain can parse.GuestBufferMemory.cppandRecorder.cppstop at the sameCpuTopology.hppheader gap asmain's copies.A probe on
mainand on this head, run on fork verify branches only (BdaMirrorStoreProbe.cpp, which isn't part of this PR): 64 threads make a GLOBAL store into a 2 MiB writable guest heap, outside any declared write. The host-import budget is held so that the heap is served by a heap mirror, and the probe checks that it is.main7c444b77ad(run): the store is refused as "read-only in the BDA table", and none of the 64 values reaches guest memory, in 3 of 3 runs.bcc617f141(run): the same probe stores all 64 values with no refusal, in 3 of 3 runs.Ghost of Tsushima Director's Cut (PPSA02225), by @milescoviello, at
bcc617f141onmain133feb30f0(comment): Ubuntu 26.04.1 (kernel 7.0), NVIDIA GeForce RTX 4070 Ti (driver 615.71.09), i7-13700K, Release libraries, 4K output,main's defaults with only the 10 s summary, a 22 GiB cap. One 600 s run per arm, from the same pinned save with scripted presses, both with a cold shader cache.deferred write-back failed: BDA access failed,the store hitorread-only in the BDA table. On this route the store isn't refused onmain, so the pair can't show the fix.main, 1,112 with this PR.b11c7bf84fruns below were on Windows, with a display that stayed black after the "Sony Interactive Entertainment presents" card, and their stores were refused right after the intro decoder was created. This pair's arms create that decoder too, so the difference lies in themaincommit, the OS and GPU, or the save, and one pair can't say which.Ghost of Tsushima Director's Cut (PPSA02225), by @sktharunbalaji13-cmd, at
3fa9852e8c(comment): retail v02.024.000, NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, driver 617.42), 16 GB of RAM, Windows 11, MinGW g++ 15.2, Release. Both arms run the same executable and environment (onlyAPS5_SKIP_REFUSED_DRAWS=1andAPS5_PROFILE_DRAW=1), with only the driver libraries swapped.read-only in the BDA tablefaultsmainb11c7bf84fthe store hit 0x1549750000+0x4eeb0000(instruction 0x1b4, 4 bytes, compute)3fa9852e8cmainthe faults come right after the intro H.264 decoder is created. The 450 s run on this PR goes past that point, with 363 address-based builds and 703 presented frames, and logs nodeferred write-back failed, no store-page refusal and nonot implementedstop. The title was still running at the end of the window.main.vkAllocateMemory of a heap mirror slabwith device heap 0 past its 7,188 MiB budget. The tester traces it to the 16 MiB slabs of the two big heaps' mirrors. With #15295 added, a run didn't abort in 150 s, and the heap mirror budget was lowered 9 times instead. Whethermainalone reaches this in the same conditions wasn't measured.mainb11c7bf84f's relinker, the title aborts at about 1 s on Windows, becauseprospero/steamnetworkingsockets.prxstarts deferred. Their relinker starts it at process start instead (I#5166), and both arms use that executable.Ghost of Tsushima Director's Cut (PPSA02225), by @sktharunbalaji13-cmd, at
425cd9d8b0(comment): retail v02.024.000, NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, a 7,188 MiB budget), 16 GB of RAM.781dc4525bstopped onheap mirror of 0x127c000000+0xa9800000: past the budget (4014 MiB, limit 2816 MiB). On this head that stop doesn't occur, and nothing about store-page exhaustion is logged with the default pool of 1,024 pages.AGC graphics: native multisample stencil or depth format import is not implemented. That's the multisampled depth import #9533 adds, outside this PR.Ghost of Tsushima Director's Cut (PPSA02225), by @milescoviello, at
425cd9d8b0with #9742 (comment):main98ddd9c179+ #12840425cd9d8b0+ #97421c904e29a2(#9533's6eb141ce5finside), merged cleanly; Linux, RTX 4070 Ti (NVIDIA 615.71.09), release libraries, 21 GiB cap, booting from a settings save. The run stops 33 s in on a check outside this PR,native multisample depth sampled identity or format mismatchin compute shader 0x20001ef700, which #9717 takes.e6c85d37f5, a merge ofmaind30e04fb8a, and582e856556, the journal race test (test-only).Why: merged with current
main, this branch failedagc_driver_pipeline_journal3 of 3, at the replay-race assertion from chitters2004's307f2202e7: "a dispatch and the replay both built a compute pipeline: 32 built for 24 replayed". The merge has no textual conflict, so GitHub didn't flag it.The cause: the race records its 32 compute pipelines into the journal that the test binary's earlier cases already use, capped at
APS5_PIPELINE_JOURNAL_MAX_MIB=1.StorePages=1variant is built, and nothing is rejected. The 8 were evicted, not lost.The fix: the test sets the journal aside, records its 32 pipelines into an empty journal (1,022,496 of 1,048,576 bytes), requires all 32 to be journaled before racing, and puts the earlier journal back afterwards. When they don't fit, it now says so instead of reporting a double build. The race check is unchanged. Red: 20 of 20 failures on the merge without the fix; green: 20 of 20 with it (cloud Linux, lavapipe).
The cost: address-writing compute modules are 18.8 % larger in SPIR-V words and 18.4 % larger in journal bytes. On llvmpipe this binary's first run, before Mesa's shader cache holds its pipelines, now takes about two minutes, so its registration sets
TIMEOUT 240, asagc_shader_disk_cache_large_filedoes. On GitHub's Linux runner,--repeat×3, with the first run cold:maind30e04fb8amain+ this PR + the fixThat's +75 % for the cold run and about +53 % warm. It isn't measured on a GPU: TechLevelZero's NVIDIA run of this head (report) passed, but its test selection didn't include
agc_driver_pipeline_journal. The compile growth comes from the store-page branch in each address lookup; it can be narrowed in a follow-up if reviewers want it.×10 on
582e856556(run): this PR's store-heap-mirror, BDA and recorder tests, the^agc_driver_bda_and^agc_bdatests, andagc_driver_pipeline_journal.agc_driver_bda_store_heap_mirror*tests passed every run. The 8 skips are other tests in the set (host-import and unit-shadow cases this runner can't run).agc_driver_pipeline_journaltook 108.3 s on its first run and 8.3 to 8.7 s after.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.6bec085232, the journal watermark test (test-only,tests/execution/PipelineJournal.cpp), for @jotitadev's review.ANYPS5_ENABLE_SPIRV_TOOLS=OFF,agc_driver_pipeline_journalfailed every run atEvictionWatermarkTests: "three consecutive records after a rewrite triggered another rewrite", 92 bytes over the 1 MiB cap. GitHub's Linux runner builds withON, where the modules are smaller, so it passed there.main.EvictionTestsjust rewrote, because an empty journal couldn't trigger a rewrite whatever the target.582e856556withOFFfails 3 of 3 with that message on GitHub's Linux runner (run).OFF(run) and ×10 withON(run), on Windows too:agc_driver_pipeline_journal, the graphics binary'sagc_pipeline_journalandagc_pipeline_journal_long_paths, and every^agc_driver_bdatest.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.VERIFY_VALIDATION=1on GitHub's Linux runner,mainagainst this head, the same tests): both pass. The loader insertedVK_LAYER_KHRONOS_validation98 times onmainand 103 with this head, and neither log haswas not found. Both report onlyVUID-VkDeviceCreateInfo-pNext-pNext, so the change adds none.^agconce withOFF(run):agc_driver_graphicsstops at this PR's own check "a writable heap mirror a program stores to through addresses is not writable in the BDA table" (tests/BdaResources.cpp, from781dc4525b).vkAllocateMemory(−2 and −1000072003) and falling back to copies. The repository's Windows CI job fails the same check at this head (run): it now runs the AGC tests, which its run at582e856556didn't.6bec085232doesn't touch it.d22d9c1a11, below, brings the case up to date.NVIDIA (TechLevelZero's GPU runner, 6546250585):
6bec085232merged onto main73f4f7e, RTX 2000 Ada, driver 595.99.02, Linux. Passed: 2,436 passed, 0 new failures (4 fail on main too), and no new validation IDs against main over 929 GPU tests. Its GPU pass ranagc_driver_graphicsand the fouragc_driver_bda_store_heap_mirrortests it selected (_budget,_no_space_cache,_store_pages,_store_pages_default), all passed. Its selection didn't includeagc_driver_pipeline_journal, andagc_driver_graphics' heap-mirror case skips on Linux (no guest arena), so neither of those is measured there.d22d9c1a11, the Windows heap mirror case (test-only,tests/BdaResources.cpp+77 −41).heapMirrorTestsruns only where the guest arena exists, which is Windows. It runs on the mock context, which has no sparse residency, so every heap mirror in it is copy-backed. Since7e7c81a2aa, a copy-backed writable mirror isRead|Write|Maskedin the BDA table, and its write-back stores only the pages the GPU reports. The case still expectedRead|Writeand reported no stores, so it failed on Windows every time, whatever the GPU. The production code is right; the case was out of date.SetResidentAddressSpaceLimit(1), asBdaStoreHeapMirror.cppdoes), then on the mirror the context gives. Each pass requires one mirror of the expected kind and expects exactlyRead|Write|Maskedfor a copy-backed mirror, orRead|Writefor a resident one with every block bound. It reports its three stores as the BDA does (NoteAddressStores,NoteStorePages) beforeWriteBack. The other checks are unchanged.6bec085232,agc_driver_graphicsfails (run). Atd22d9c1a11it passes 10 runs in a row, with this PR's journal and BDA tests, withOFF(run) and withON(run). Linux: 128 run, 120 pass, 8 skip, 0 fail. Windows: 143 run, 43 pass, 100 skip (no Vulkan device), 0 fail.Writefrom copy-backed mirrors' ranges turnsagc_driver_graphicsred on Windows and four of theagc_driver_bda_store_heap_mirrortests red on Linux (run).^agconce atd22d9c1a11(run): Linux 1,150 run, 1,075 pass, 75 skip, 0 fail. Windows 1,185 run, 357 pass, 828 skip, 0 fail.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.9d2c13fd78, a merge ofmain0836dfdf4f(run withON, run withOFF).CMakeLists.txt, from #12862's split, resolved withtools/agc_test_split.py resolve. This PR's registrations move into a newtests/cmake/agc_driver_bda_store_heap_mirror_tests.cmake(+26) and intoagc_driver_pipeline_journal_tests.cmake(+4, itsTIMEOUT 240). ItsStorePageGather.compbuild rule stays inCMakeLists.txt.Graphics/include/GuestBufferMemory.hpp, where ashwin280802's #13581 (heap mirror eviction) addsHoldsMirror,EvictMirror,WasEvictedandRecordEvictedat the spot where this PR addsAllowAddressStores,NoteAddressStoresand the store span and page types. Both sides are kept, each unchanged.sweepMirrorstakes a writable heap mirror only when the mirror cache holds its one reference. The memory that records store spans for a mirror (writable heap mirrors only, at upload) holds it through its region'sshared_ptruntilWriteBackhas consumed the stores.EvictMirrorandRecordEvictedact only on a memory still being built, which has no spans or pages yet.-DBUILD_TESTING=ON,ctest -Ngives 3080 tests:main's 3075 plus this PR's 5, each listed once, andagc_driver_pipeline_journalwith this PR'sTIMEOUT 240.ONand withOFF: this PR's journal, BDA and store-heap-mirror tests,agc_driver_graphicsand #13581'sagc_driver_resident_heap_mirror. Linux: 17 run, 17 pass, 0 skip, 0 fail. Windows: 18 run, 5 pass, 13 skip (no Vulkan device), 0 fail;agc_driver_graphicspasses. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.ON, this PR's set ×10 (160 runs) andagc_driver_resident_heap_mirror×10 pass, and^agcgives 1,158 run, 1,083 pass, 75 skip, 0 fail. WithOFF, the set and #13581's test pass ×3.a896536714andd28c760af1, from oneandonlydean's review (run withON, run withOFF).a896536714:_store_pages_defaultalready checked that, and_store_pagesnow checks that none of its threads' values reach any of its pages.d28c760af1: a new debt entry, "Store page pool", says what a title gets past the pool. The use's fault check throws that message, none of its stores into heap mirrors reach guest memory, and raisingAPS5_BDA_STORE_PAGESgives a use more pages.ONand withOFF: the same set as above. Linux: 17 run, 17 pass, 0 skip, 0 fail. Windows: 18 run, 5 pass, 13 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.NVIDIA RTX 2000 Ada Generation, TechLevelZero's NVIDIA GPU test at
d28c760af1(comment): merged ontomaind5ec8e6, driver 595.99.02, Linux, the Khronos layer. Passed: 2,494 passed, 0 new failures (3 fail onmaintoo and 1 is unstable there), 45 skipped, and no new validation IDs againstmainover 939 GPU tests.agc_driver_bda_store_heap_mirror(passed, 7.96 s) and, this time,agc_driver_pipeline_journal(passed, 134.0 s with the layer andANYPS5_NO_SHADER_CACHE=1). The report gives nomaintime for the journal test, so this isn't a cost comparison. Its selection didn't include this PR's other four store-heap-mirror tests oragc_driver_graphics.agc_driver_bda_store_heap_mirroris this PR's own test, somain's baseline doesn't have it and its validation wasn't compared.b6f54ac940, a merge ofmain5bae1a4bc2(run withON, run withOFF, validation).main. The previous merge,6f7d8f1277(maind8b60b46ed), had kept #13931'sComputePipelineObjects::binaryLayoutKeyand its fill increateComputePipelinebeside this PR'sstorePagesand SPIR-V scan, inExecution/src/VulkanDevice.cpp, so the revert conflicted there. The merge takesmain's side for #13931's lines and keeps this PR's, so noPipelineBinaryStoreorbinaryLayoutKeyis left in the file.main5bae1a4bc2intod28c760af1, the head before6f7d8f1277, and the changed lines are the same in all 31 files. OnlyPipelineJournal.cpp's context moved, frommain'seb4ec317c0.ONand withOFF: this PR's journal, BDA and store-heap-mirror tests,agc_driver_graphicsand #13581'sagc_driver_resident_heap_mirror. #13931's two pipeline-binary tests leftmainwith the revert. Linux, both builds: 18 run, 18 pass, 0 skipped, 0 fail. Windows, both builds: 19 run, 5 pass, 14 skipped (no Vulkan device), 0 fail. The libc and libkernel suites ran 208 and 309 tests on Linux and 235 and 330 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.VERIFY_VALIDATION=1on GitHub's Linux runner,mainagainst this head, the same tests): the loader insertedVK_LAYER_KHRONOS_validation17 times onmainand 31 with this head, and neither log haswas not found. Both report onlyVUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.agc_display_buffer_dcc_tests,agc_driver_dcc_keys_first_write_tests,agc_pipeline_cache_allocation_tests,agc_driver_recorder_tests). 137 run, 129 pass, 8 skipped (recorder tests that skip on that machine), 0 fail.TechLevelZero's GPU tests at
6f7d8f1277, merged ontomainf2d874c, before the revert:mainand 3 are unstable onmain. No new validation IDs againstmainover 944 GPU tests.main. No new validation IDs againstmainover 944 GPU tests.agc_driver_pipeline_journaltook 183.3 s on the AMD card and 132.6 s on the NVIDIA one. Neither report gives amaintime for it.7af65f5066, a merge ofmain88e804b0a7.mainnow has JJenkx's #8874 (heap mirror reference buffers), Celegans12's #9287 (staged copies inside a dispatch run) and JJenkx's #6959 (layered mesh targets).GuestBufferMemory::takeHeapReferencesandreleaseHeapReferenceskeep both sides. Each reference is taken from #8874'sReferenceStoragepool and returned to it, and this PR's copied path (pendingReferenceCopies) still applies inside a recorded run. Where the mirror is cleared, the references are released before this PR's store-page resets.ShaderResources.cpp, this PR'sRecordStorePageGatherruns after #9287's in-run copy-back block.MeshLayerBaseandMeshLayerCount, soStorePagesmoves to 8239.buildSpecializedModuleinRecompiler.cppthat lists a module's specialization constants. It leaves out only the workgroup offsets and looks every other ID up among the prepared values.StorePagesis supplied at dispatch, not prepared, so that lookup threwmap::at: before the change, nine tests failed on Linux and three on Windows. The merge commit changes that one line fromIsWorkgroupOffset(id)toIsDispatchSupplied(id), the checkspecializeWordsalready uses for the same IDs. It's folded into the merge so that no commit fails its tests.mainis otherwise unchanged.agc_driver_layered_volume_mesh), 0 fail. Windows: 30 run, 12 pass, 18 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agctest, once (run): Linux: 1,223 run, 1,146 pass, 77 skip, 0 fail. Windows: 1,259 run, 379 pass, 880 skip (no Vulkan device), 0 fail.main88e804bon an RTX 2000 Ada (report): 2,560 passed, 5 failed, none new (3 also fail onmain, 2 unstable onmain), 45 skipped, with no new validation IDs (978 tests on the GPU).9fd023a310, a merge ofmain5cb015caaa, which brings Pipodi's #12764 (compute scratch backed by a device buffer slot pool).VulkanDevice.hppandVulkanDevice.cpp, each time one PR's addition next to the other's. The merge keeps both: in the header, #12764'sscratchPoolHeaderdeclaration and this PR'sspecializedComputePipeline; in the source, this PR'sStorePagesscan and #12764's three-elementsetLayoutsfor the scratch pool.mainis otherwise unchanged.agc_driver_layered_volume_mesh), 0 fail. Windows: 30 run, 12 pass, 18 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (279 and 321) and on Windows (306 and 342). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agctest, once (run): Linux: 1,258 run, 1,176 pass, 80 skip, 2 fail. Windows: 1,295 run, 397 pass, 898 skip (no Vulkan device), 0 fail. The two Linux failures:agc_driver_image_sample_lod_clamp_shader_lanefails onmaintoo. #12980 added its bilinear row, and adriadam10's5821b867e7onmainwidens that check aftermain's push builds failed it on lavapipe.agc_driver_pipeline_journalreached its 240-second timeout while the sweep ran four of its 1,258 tests at a time. In the ×10 above, among 29 tests, it passes 10 of 10, in 57 to 185 s.main7feb37ee3e, without this PR (run), its first run reaches the 120-second default timeout;9fd023a310(run), all 3 pass, in 181.4, 65.1 and 64.2 s, under itsTIMEOUT 240.main: it failed in 4 of the last 6mainruns there (report).main's own test already takes longer than 120 s, and this PR adds to that, as the cost note above says.mainf6232fc(report): 2,753 passed, 5 failed, none new (3 also fail onmain, 2 unstable onmain), 49 skipped, with no new validation IDs (943 tests on the GPU). AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8), merged ontomain7feb37e(report): 2,740 passed, 9 failed, none new (8 also fail onmain, 1 unstable onmain), 58 skipped, with no new validation IDs (943 tests on the GPU).a162a98f11, a merge ofmain4f41f4c375, which brings #8963 (shared BDA fault buffers, merged first as planned) and ee6aba54's #6185 (WriteBackkeeping the CPU's bytes only in host-copied write-backs).CMakeLists.txt,Execution/src/GuestMemory.cpp,Graphics/include/BdaResources.hpp,Graphics/src/BdaResources.cpp,Graphics/src/GuestBufferMemory.cppandtests/BdaShader.cpp.SrtGuardWordin a full-size fault buffer, so the merge keeps the arena and changes one thing in it:APS5_NO_SHARED_FAULT_SLOTS=1.faultBytes()and the slot's device address), where it used to use its own buffer.ChangedStorecomposes with this PR's recorded store runs. InGuestBufferMemory.cpp,storeChangedtakes #6185's store function and this PR'sPieces* stored: a heap-mirror write-back passesstoredand writes throughGuestMemory::WriteChanged, recording each run, and every other caller stores with #6185's function. InGuestMemory.cpp, onewriteChangedtakes #6185'skeepGuestand this PR'sstored, behind three wrappers.CMakeLists.txtandBdaShader.cppkeep both sides.maingoes from +1,956 −70 to +1,964 −77, in 31 files. The change is inBdaResources.hpp,BdaResources.cpp,GuestBufferMemory.cppandGuestMemory.cpp.agc_changed_copy,agc_driver_graphics,agc_driver_pipeline_journal,agc_driver_resident_heap_mirrorand every test matching^agc_driver_bda,^agc_bda,^agc_driver_heap_mirroror^agc_shader_bda. Linux: 18 run, 18 pass, 0 skip, 0 fail. Windows: 18 run, 3 pass, 15 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agcandguest_memorytest, once (run): Linux: 1,281 run, 1,197 pass, 83 skip, 1 fail. Windows: 1,317 run, 402 pass, 915 skip (no Vulkan device), 0 fail. The one failure:992/1281 Test #1389: agc_driver_pipeline_journal ...***Timeout 240.07 sec. It passes 10 of 10 in the ×10 above, and it timed out the same way, at 240.06 s, in this PR's sweep before the merge. TechLevelZero's AMD machine lists it as unstable onmain, failed in 6 of the last 8mainruns there (report).main4f41f4c. NVIDIA RTX 2000 Ada (driver 595.99.02; report): 2,772 passed, 6 failed, none new (3 also fail onmain, 3 unstable onmain), 48 skipped, with no new validation IDs (939 tests on the GPU). AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8; report): 2,758 passed, 10 failed, none new (8 also fail onmain, 2 unstable onmain), 58 skipped, with no new validation IDs (939 tests on the GPU). Under the validation layer,agc_driver_pipeline_journaltook 130.4 s on the NVIDIA card and 240.1 s on the AMD one, whose bot lists it as failed in 7 of the last 9mainruns there.c68d814837, a test of the private fault slot (test-only,tests/BdaResources.cpp). The heap-mirror tests now create a build that stores through addresses over each writable heap mirror, copy-backed and resident:|| privateSlotfrom the check inBdaResources' destructor that gives a slot's counts back. On GitHub's Windows runneragc_driver_graphicsthen fails with "a destroyed build that stored through addresses into a copy-backed writable heap mirror left its fault chunk counted in the arena" (run). On GitHub's Linux runner it passes either way: the heap-mirror tests don't run there ("guest arena unavailable or not write-watched: heap mirrors not tested").agc_changed_copy,agc_driver_graphics,agc_driver_pipeline_journal,agc_driver_resident_heap_mirrorand every test matching^agc_driver_bdaor^agc_bda. Linux: 18 run, 18 pass, 0 skip, 0 fail. Windows: 18 run, 3 pass, 15 skip (no Vulkan device), 0 fail;agc_driver_graphics, which holds the new case, passes 10 of 10. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.c4d6d41dff, a merge ofmain04a9eb4fa2(run). The one conflict was inExecution/include/GuestMemory.hpp, where JAB-dev's #13021 declaresWriteChangedIfHeldat the place this PR declares itsWriteChangedoverload that returns the stored ranges. Both stay, and this PR's diff overmainis unchanged.agc_changed_copy,agc_driver_graphics,agc_driver_pipeline_journal,agc_driver_resident_heap_mirrorand every test matching^agc_driver_bdaor^agc_bda, with #13021'sagc_driver_native_depth_publication. Linux: 19 run, 19 pass, 0 skip, 0 fail. Windows: 19 run, 3 pass, 16 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 300 and 324 tests on Linux and 330 and 342 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.c4d6d41dff, this head merged ontomain1c8c0ef, 2,853 of 3,842 tests selected. Of this PR's tests,agc_driver_bda_store_heap_mirrorandagc_driver_resident_heap_mirrorran and passed on both. The four added registrations (agc_driver_bda_store_heap_mirror_budget,_no_space_cache,_store_pagesand_store_pages_default) weren't in either selection.main, 2 unstable onmain), 50 skipped.main, 2 unstable onmain), 61 skipped. No new validation IDs over 960 GPU tests.agc_driver_pipeline_journaltimes include the filler zero-fills #15423 removes.3fa9852e8c, a merge ofmainb11c7bf84f, which brings #13858 (×10, everyagctest).BdaResources.hpp,ShaderResources.hppandBdaResources.cpp. #13858 checks a draw use's fault record throughCheckUse(record), andcheckFault,markWrittenPagesandcheckSrtGuardtake the record whose fault slot the GPU wrote. This PR's store pages live in that slot too, so the merge hascheckFaultcollect the record's store pages, check its overflow, and re-attach its pages after a loop-guard clear.markWrittenPageskeeps this PR's written-page list.BdaResources.cppkeeps #13858'sTableBytesandTableGuardCurrentbeside this PR's store-page functions.SrtGuardWord, so #13858's slot cleaning, which clears the fault head and the SRT guard word, leaves them in place.^agc_driver_bda,^agc_bda,^agc_driver_address_draw_space_reuse,^agc_host_import,^agc_write_trackingor^agc_driver_host_import_proofs, withagc_driver_resident_heap_mirrorandagc_driver_pipeline_journal, which takes in this PR's tests and #13858's. Linux: 28 run, 27 pass, 1 skip (agc_host_import_sparse, no/dev/udmabuf), 0 fail. Windows: 33 run, 8 pass, 25 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 303 and 327 tests on Linux and 334 and 345 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agctest, once: Linux: 1,331 run, 1,246 pass, 85 skip, 0 fail. Windows: 1,370 run, 407 pass, 963 skip (no Vulkan device), 0 fail.3fa9852e8c, this head merged ontomainb11c7bf, 2,915 of 3,894 tests selected. Of this PR's tests,agc_driver_bda_store_heap_mirrorandagc_driver_resident_heap_mirrorran and passed on both, and so did #13858'sagc_driver_address_draw_space_reuse. The four added registrations weren't in either selection.main), 49 skipped. No new validation IDs over 990 GPU tests.main, 1 unstable onmain), 60 skipped. No new validation IDs over 990 GPU tests.agc_driver_pipeline_journaltimes include the filler zero-fills #15423 removes.125faf559e, a merge ofmain090f57166a(×10, #15423's test ×10).tests/cmake/agc_driver_pipeline_journal_tests.cmake, wheremainnow has #15423'sif(BUILD_TESTING)block withagc_driver_pipeline_journal_undecodable_module. This PR'sTIMEOUT 240line foragc_driver_pipeline_journalgoes into that block as its first line, so the file keeps one block. This PR's other lines are unchanged;Recorder.cppanddocs/dev/debt/libSceAgcDriver.mddiffer only in context.3fa9852e8c. Linux: 29 run, 28 pass, 1 skip (agc_host_import_sparse, no/dev/udmabuf), 0 fail;agc_driver_pipeline_journalpassed 10 of 10, the slowest in 102.8 s. Windows: 34 run, 9 pass, 25 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 327 and 344 tests on Linux and 358 and 371 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agc_driver_pipeline_journalexactly, so a second ×10 ranagc_driver_pipeline_journal_undecodable_modulewith this PR's fiveagc_driver_bda_store_heap_mirror*tests. Linux: 6 run, 6 pass, 0 fail, the new test 10 of 10. Windows: 6 run, 6 skip (no Vulkan device).a62b1d7b8d, a merge ofmaindd7c8de5de(×10).GuestMemory.cpp: this PR'swriteChangeddefinition, with itsstoredparameter, takes the[[maybe_unused]]onbyteStoreLimitthat oberonlift's #15797 added tomain's.tests/execution/PipelineJournal.cpp'sReplayRacesDispatchTests: dantdmdarealguy's #15730 builds the race's programs with the sharedReplayedCodes(), 16 programs from salt 8 in place of 32 from salt 16, and drops the function'sPipelines = 32. The merge takesconst auto codes = ReplayedCodes();and keeps this PR's lines: the journal set aside, the raced pipelines recorded into an empty journal and required to be journaled, and the journal put back. SincePipelinesis gone, the count check now readsheld == ReplayedPrograms,main's constant.GuestBufferMemory.hppdiffers in context only.^agc_driver_bda,^agc_bda,^agc_driver_address_draw_space_reuse,^agc_host_import,^agc_write_tracking,^agc_driver_host_import_proofs,^agc_driver_pipeline_journalor^agc_pipeline_journal, withagc_driver_graphicsandagc_driver_resident_heap_mirror. Linux: 34 run, 33 pass, 1 skip (agc_host_import_sparse), 0 fail;agc_driver_pipeline_journal,agc_driver_pipeline_journal_undecodable_module,agc_pipeline_journalandagc_pipeline_journal_long_pathspass 10 of 10. Windows: 40 run, 13 pass, 27 skip, 0 fail. The Windows runner has no Vulkan device, soagc_driver_pipeline_journalandagc_driver_pipeline_journal_undecodable_moduleskip there with the other Vulkan tests; the graphics binary'sagc_pipeline_journal,agc_pipeline_journal_long_pathsandagc_pipeline_journal_extended_pathspass 10 of 10. The libc and libkernel suites run 344 and 346 tests on Linux and 375 and 373 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.a3e3e770e7, a merge ofmain7259cce111(×10, everyagctest).VulkanDevice.cpp'sComputePipelineObjects, where liskeee's #15169 addsbinaryLayoutKeyon the line this PR addsstorePagesto. The merge keeps both. #15169's pipeline binary store arguments reach this PR'sspecializedComputePipelinewithout a conflict, and the store's key covers the specialization data, so theStorePagesvariant gets its own binary. oneandonlydean's #17982 has since reverted #15169 onmain(see7cf8f10403below).a62b1d7b8d, with #15169's^agc_pipeline_binaryand^agc_driver_pipeline_binarytests. Linux: 48 run, 45 pass, 3 skip (agc_host_import_sparse, and #15169'sagc_pipeline_binary_vulkanandagc_driver_pipeline_binary_startup), 0 fail. This PR's fiveagc_driver_bda_store_heap_mirror*tests,agc_driver_graphics,agc_driver_resident_heap_mirrorandagc_driver_pipeline_journalpass 10 of 10, the journal's slowest in 89.9 s. Windows: 56 run, 27 pass, 29 skip (no Vulkan device), 0 fail. #15169's two Vulkan tests skip on both runners, so these runs don't show theStorePagesvariant going through a pipeline binary.agctest, once: Linux: 1,507 run, 1,412 pass, 95 skip, 0 fail. Windows: 1,550 run, 477 pass, 1,073 skip (no Vulkan device), 0 fail.guest_kernel_resident_fmem_exportandguest_kernel_resident_fmem_export_patchedfail in both runs. The same harness fails them onmain7259cce111alone (run), andmain's own Windows job passes them, so they come from the verify harness, not this PR. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.7cf8f10403, a merge ofmain47adcad89a(×10, everyagctest).main, sincemaincrashed at boot inPipelineBinaryStore::queryKey. That takes out thebinaryLayoutKeymember that the merge of7259cce111kept beside this PR'sstorePagesinComputePipelineObjects. The merge dropsbinaryLayoutKeyand keepsstorePages. Nothing in the tree uses #15169's store any more, and this PR's changed lines are the same in all 31 files.a62b1d7b8d, without #15169's 14 tests, which the revert removes. Linux: 34 run, 33 pass, 1 skip (agc_host_import_sparse), 0 fail. This PR's fiveagc_driver_bda_store_heap_mirror*tests,agc_driver_graphics,agc_driver_resident_heap_mirrorandagc_driver_pipeline_journalpass 10 of 10, the journal's slowest in 68.3 s. Windows: 42 run, 15 pass, 27 skip (no Vulkan device), 0 fail.agctest, once: Linux: 1,518 run, 1,425 pass, 93 skip, 0 fail. Windows: 1,561 run, 466 pass, 1,095 skip (no Vulkan device), 0 fail.guest_kernel_resident_fmem_exportandguest_kernel_resident_fmem_export_patchedfail, as ona3e3e770e7. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.af6430b3d4, a merge ofmain884694cf85(×10, everyagctest).vkCmdBindPipelinethroughResolvedorfunction()no longer compiles, and a compute pipeline binds throughcontext.BindComputePipeline, which skips a bind the command buffer already has. Three of this PR's binds move to it:VulkanDevice.cpp, the dispatch's bind, ofspecializedComputePipeline'sStorePagesvariant or the record's pipeline;VulkanDevice.cpp, the bind for each split chunk;Recorder.cpp, the store-page gather's bind ofstorePageGatherPipeline, as #16752 does for the recorder's other compute pipelines.It's
main's API, with this PR's pipelines unchanged. This PR's changed lines are the same in the other 29 of its 31 files.7cf8f10403, with #16752'sagc_command_state,agc_graphics_state_recorderandagc_graphics_state_recorder_unsuppressed. Linux: 38 run, 37 pass, 1 skip (agc_host_import_sparse), 0 fail. This PR's fiveagc_driver_bda_store_heap_mirror*tests,agc_driver_graphics,agc_driver_resident_heap_mirror,agc_driver_pipeline_journaland #16752's three tests pass 10 of 10, the journal's slowest in 67.0 s. Windows: 47 run, 18 pass, 29 skip (no Vulkan device), 0 fail.agctest, once: Linux: 1,651 run, 1,543 pass, 106 skip, 2 fail. Windows: 1,689 run, 495 pass, 1,194 skip (no Vulkan device), 0 fail. The two Linux failures aremain's:agc_driver_global_atomic_csub: "AGC graphics: global atomic csub without glc: wave64 byte 644 is 146, expected 0";agc_driver_coherent_atomic_loads_enabled: a 60-second timeout.main's own Linux job fails both, with the same message and the same timeout, atd2949cd806(job) and at67ec0f7d8c(job), covered by #19332.guest_timed_wait_cpufailed on its overshoot limits.sceKernelUsleep(500 us)reached a P99 overshoot of 4,303 µs, against a limit of 2,500 µs, andksem_timedwait(500 us)3,248 and 3,012 µs. This PR doesn't change libkernel. In theagcrun on the same head, the Windows libkernel suite ran 402 tests with 0 failed,guest_timed_wait_cpuamong them.guest_timed_wait_cpuamong them.APS5_SKIP_TIMING_TESTS=1, which relaxes onlyprecise_wait's median bounds on GitHub's hosted runners.agc_shader_memoryin upstream's Windows job (job): upstream CI merged this head ontomainb6717527ce, andagc_shader_memoryexited with 0xc0000374 after "read of 0xffffffff00000008". Thatmainsits between #18827 (04:46Z on 14 Nov) and #19893 (08:20Z), andmainalone crashes in the same test binary there:main's own push run at6f6d066c7e(job) exitsagc_shader_memorywith 0xc0000374;mainb6717527cealone on GitHub's Windows runner (run) passesagc_shader_memory10 of 10, andagc_shader_memory_coherent_atomic_loadscrashes in its 10th run with the same fault address;b6717527ce(run) crashes both tests in their 3rd run, at the same instruction as upstream's job (agc_shader_memory_tests.exe+0x522829).On
mainf0c9b11f91, after #19893, neither test crashes: in 3 runs of 10 per arm, this head merged onto it andmainalone each passagc_shader_memoryandagc_shader_memory_coherent_atomic_loads30 of 30 (this head: 1, 2, 3;main: 1, 2, 3). The Windows trees of these runs had #19899's_putenv_stest fix on top.3704189764, a merge ofmain11992f9695(×10, ×10 with the Windows test fix, everyagctest), which brings adam25136's #17850 (CPU reads of indirect draw records wait for address-based writers).docs/dev/debt/libSceAgcDriver.mdonly. #17850 rewrote the "CPU reads behind an address-based build" entry, right before this PR's two entries. The file merges withmerge=union, which would keep the old copy of that entry next to the new one, so the merge takes #17850's entry and keeps this PR's two after it.mainstays +1,996 −77. Only context lines moved, in that debt entry and indocs/dev/ENVIRONMENT.md.GuestBufferMemory.cpp, which #17850 also changes, merged without a conflict.af6430b3d4run, with #17850's fouragc_driver_indirect_draw_pending_producer*tests. Linux: 45 run, 44 pass, 1 skip (agc_host_import_sparse), 0 fail; #17850's four tests pass 10 of 10. Windows: 57 run, 21 pass, 36 skip (no Vulkan device; #17850's four tests are among them), 0 fail. The libc and libkernel suites run 388 and 384 tests on Linux and 418 and 412 on Windows, with 0 failed. They ran withAPS5_SKIP_TIMING_TESTS=1, which relaxes onlyprecise_wait's median bounds on GitHub's hosted runners.agctest, once, on Linux: 1,809 run, 1,686 pass, 114 skip, 9 fail.main's own Linux job at3e1b183e43(job):agc_driver_global_atomic_csub,agc_driver_stencil_copy_draw,agc_driver_coherent_atomic_loads_enabled,agc_driver_image_table_packed_guards,agc_driver_recorder,agc_draw_input_mirrorsandagc_draw_input_reuse.agc_driver_runtime_buffer_spans_x3_spansand_x4_spanstimeouts, passed there. Over 10 runs ofmain790e9a371cwith #19899's test-only commit on top (run), both time out too.main's Windows test build stops at "'setenv' was not declared" inUploadCacheReadOnlyFlush.cpp(from #18037). It isn't on this branch. The Windows builds of the first ×10 and of theagcrun, on this head alone, stopped at that error.3704189764.bcc617f141, a merge ofmain0173f20a5f(×10, everyagctest), which brings Ketz7's #20870 (a BDA fault recorded with one atomic claim).Graphics/src/BdaResources.cpp, at theRequirethat a fault record without a publication holds no data. #20870 changes its last check fromreport.otherFaults == 0toreport.claim == 0, and this PR adds itspagesOverflowedRequireon the next line. The merge keeps #20870's line, with this PR's after it.mainstays +1,996 −77. Its patch-id changed, since the line before this PR'sRequireis now #20870's.BdaAbi::Faultfrom 32 to 40 bytes (otherFaultsbecomesclaim,discardandreserved). This PR's store-page words follow the fault record and chain fromWrittenOverflowWord = sizeof(Fault) / 4, so they move with it, andFaultBufferBytesgrows to match. In the merged code, the host side, the SPIR-V emitter (SpirvBdaLookup.cpp,SpirvMemoryInstructions.cpp) and the tests address these words through theBdaAbiconstants, and the store-page gather shader gets its word indices as push constants fromRecorder.cpp, so no word index is written out by hand.3704189764run. Linux: 45 run, 44 pass, 1 skip (agc_host_import_sparse), 0 fail;agc_driver_bda_deviceandagc_shader_memory, whose tests #20870 changes, pass 10 of 10. Windows: 57 run, 22 pass, 35 skip (no Vulkan device), 0 fail.guest_multibyte_locale, which checks thatwcstombsfills the capacity mid-character, fails on both. That comes frommain: gurtgg's #21244 (merged 08:27Z on 16 Nov) stopswcstombsbefore a character that doesn't fit,main's own push run atdcf3d15978fails the test on Linux and Windows, and oneandonlydean's open #21515 reverts #21244. This PR changes no libc file. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxes onlyprecise_wait's median bounds on GitHub's hosted runners.agctest, once: Linux: 1,876 run, 1,746 pass, 123 skip, 7 fail. Windows: 1,918 run, 559 pass, 1,359 skip, 0 fail.agc_driver_graphics, which holds #20870'sBdaResourcestest changes, passes on both.main's own Linux job atdcf3d15978(job):agc_hook_clear_access,agc_hook_clear_access_off,agc_driver_recorder, and theagc_driver_runtime_buffer_spans_x2_spans,_x3_spansand_x4_spanstimeouts.agc_driver_image_table_packed_guards, fails the same way inmain's own Linux job ate249fc47b5(job): three identical "stage 4 pc 0x68" records, then "unrecoverable packed table format was not poisoned". fernandomcrsilva's #21255 changes that test.guest_multibyte_localeon both, as above. On Linux, libkernel'sguest_thermal_sensorsalso reached its 20 s timeout. It times out in every run I have on GitHub's Intel Xeon 6975P-C runners,main0694c4cbd6alone included (run), and passes in 0.01 to 0.02 s on GitHub's AMD EPYC runners and inmain's own job. This PR changes no libkernel file._putenv_stest fix on top; it isn't on this branch.bcc617f141: @domx4q's RTX 4090 run with the validation layer (below).NVIDIA GeForce RTX 4090, by @domx4q, with the Khronos validation layer (comment): Arch Linux (kernel 7.3.4), GCC 16.2.1 Release, driver 620.70.06, Vulkan 1.4.357, validation layer 1.4.363.1, with
ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1. This headbcc617f141merged ontomaine4caa07950(a clean merge), againstmaine4caa07950alone,ctest -R '^agc_(driver_bda|bda|driver_resident_heap_mirror|driver_pipeline_journal|pipeline_journal|host_import_sparse|shader_memory)'.main: 19 of 19 run pass, 3 skip. This PR: 24 of 24 run pass, 3 skip, including the fiveagc_driver_bda_store_heap_mirror*testsmaindoesn't have. The same three skip on both sides:agc_driver_bda_reads_shadowed_resultsand_per_build(the device reports watched host memory written when it imports or reads it) andagc_host_import_sparse(udmabuf'ssize_limit_mbis above 1024). NoVUID-line on either side, and every device test selected the RTX 4090.a96efaa504, a merge ofmain8bb7635fe0(×10, everyagctest), which brings atinseau's #18842 (64-bit image and buffer atomics emulated on devices without them).core/shader/recompiler/PipelineSpecialization.hpp: #18842 addsIsAtomicLockTable(the two words of its lock table's address, ids 8244 and 8245) where this PR addsIsDispatchSupplied(the workgroup offsets andStorePages). The merge keeps both functions.core/shader/recompiler/Recompiler.cpp: both change the condition that leaves such a constant out of a module's build-time specialization. The merge leaves out both sets:!PipelineSpecialization::IsDispatchSupplied(id) && !PipelineSpecialization::IsAtomicLockTable(id).VulkanDevice.cpp,specializedComputePipeline: #18842'sPipelineSpecializationconstructor takes the lock table's address. The merge keeps this PR's version of the function (its four-word key withstorePages, and thereplacedlist withStorePages) and builds it as #18842 does:PipelineSpecialization(shader, context.atomicLockTable, replaced).mainstays +1,996 −77. InRecompiler.cppandVulkanDevice.cpp, its one changed line in each now carries #18842's addition, so its patch-id changed.bcc617f141run, with #18842'sagc_driver_buffer_atomics,_float,_inc_dec64,_or_swap64andagc_driver_image_atomics64, andagc_placeholder_images, whose tests #18842 changes. Linux: 51 run, 50 pass, 1 skip (agc_host_import_sparse), 0 fail; this PR's fiveagc_driver_bda_store_heap_mirror*tests and #18842's five pass 10 of 10. Windows: 63 run, 23 pass, 40 skip (no Vulkan device), 0 fail.guest_multibyte_localepasses again on both. They ran withAPS5_SKIP_TIMING_TESTS=1, which relaxes onlyprecise_wait's median bounds on GitHub's hosted runners.agctest, once: Linux: 1,876 run, 1,744 pass, 123 skip, 9 fail. Windows: 1,918 run, 559 pass, 1,359 skip, 0 fail. The libc and libkernel suites ran with 0 failed on both.main's own Linux job atdcf3d15978(job):agc_hook_clear_access,agc_hook_clear_access_off,agc_driver_recorder, and theagc_driver_runtime_buffer_spans_x2_spans,_x3_spans,_x4_spansand_x4_referencetimeouts.agc_driver_runtime_buffer_spans_x3_reference, passed in that job in 27.60 s, against its 30 s limit, and timed out at 30.06 s onmain0694c4cbd6on GitHub's Linux runner (AMD EPYC 7763; run, with only #19899's Windows test fix on top).agc_driver_image_table_packed_guards, fails the same way inmain's own Linux job ate249fc47b5(job): three identical "stage 4 pc 0x68" records, then "unrecoverable packed table format was not poisoned". fernandomcrsilva's #21255 changes that test.main8bb7635fe0alone on GitHub's Linux runner (Intel Xeon 6975P-C; run): 42 tests, theagc_driver_runtime_buffer*andagc_driver_image_table*tests with the hook pair andagc_driver_recorder, each run up to 3 times and stopped at its first failure. Seven fail the same way in their first run:agc_driver_image_table_packed_guards,agc_hook_clear_access,agc_hook_clear_access_off,agc_driver_recorder, and the_x2_spans,_x3_spansand_x4_spanstimeouts._x3_referenceand_x4_referencepass 3 of 3 there: 21.44 and 20.80 s in their first run, beside the three_spanstests timing out, and 1.5 to 2.0 s in the next two. Theagcrun above had 1,876 tests in parallel. That run's libkernel suite also hit theguest_thermal_sensorstimeout of that CPU, and its Windows build stops atmain's "'setenv' was not declared" error, since its tree didn't have #19899's test fix._putenv_stest fix on top; it isn't on this branch.a96efaa504: @nydal91's Marvel's Wolverine (PPSA03671) A/B on an AMD Radeon RX 6950 XT (below).Marvel's Wolverine (PPSA03671 v01.001.005), by @nydal91, at
a96efaa504(comment): Linux (PikaOS 4, kernel 7.3.3), AMD Radeon RX 6950 XT (RADV, Mesa 26.3.0). An A/B onmainf15df3256cwith the prerequisites they carry, 300 s runs atAPS5_HOST_IMPORT_MIB=5000:deferred write-back failed: BDA access failed ... read-only in the BDA tablerefusals, 4-byte compute stores into a 1.1 GiB unaligned descriptor view of a 2.5 GiB registered heap, thenVK_ERROR_DEVICE_LOSTatvkQueueSubmit.a96efaa504merged withf15df3256c): 0 refusals, 0 deferred write-back failures and 0 store-page exhaustion faults; 656 frames presented and a clean exit, with the intro rendering through the subway and street scenes.2687eec5fd, a merge ofmain2b31f86019(×10, everyagctest), which brings ashwin280802's #17796 (storage-image results published into resident heap mirrors), merged first, as planned.GuestBufferMemory.cpp,UploadFinish: #17796 addspublishIntoMirrors()where this PR addsaddAddressStoreSpans(), both beforetakeHeapReferences(). The merge callsaddAddressStoreSpans()first, as planned in the merge-order note, so a writable mirror that a draw may store into through an address takes #17796'sWrittenfallback.ShaderResources.cpp: relativespace2K's #19131 adds aconst DrawBindings* bindingsparameter toMarkGpuWrites, which follows this PR'sStorePages(). The merge keepsStorePages()and #19131's signature.mainstays +1,996 −77. Its patch-id changed, since the lines next to two of its additions are now #17796's and #19131's.a96efaa504run, with #17796'sagc_driver_resident_heap_mirrorandagc_driver_resident_heap_mirror_no_publish. Linux: 53 run, 52 pass, 1 skip (agc_host_import_sparse), 0 fail. Windows: 65 run, 23 pass, 42 skip (no Vulkan device), 0 fail.guest_thermal_sensorson Linux, which reached its 20 s timeout on one of GitHub's Intel Xeon 6975P-C runners, as in every run I have on those runners. They ran withAPS5_SKIP_TIMING_TESTS=1, which relaxes onlyprecise_wait's median bounds on GitHub's hosted runners.agctest, once: Linux (AMD EPYC 7763): 1,963 run, 1,827 pass, 126 skip, 10 fail. Windows: 2,005 run, 568 pass, 1,437 skip, 0 fail. The libc and libkernel suites ran with 0 failed on both.main2b31f86019alone in the same harness, on an Intel Xeon 6975P-C runner (run):agc_driver_image_gather_lod,agc_driver_image_table_packed_guards, and theagc_driver_runtime_buffer_spans_x2_spans,_x3_spansand_x4_spanstimeouts.agc_driver_fault_check_dedupandagc_driver_oracle_runnerat 120 s, andagc_driver_image_table,agc_driver_runtime_buffer_spans_x3_referenceand_x4_referenceat 30 s. That run's EPYC 7763 runner took 1,016 s for the Linux pass, against 601 s formain's pass on the Xeon runner. On a Xeon 6975P-C runner, this head runs them 3 times each with theagc_driver_runtime_buffer_spansfamily and this PR's heap mirror tests (run), and all five pass every time. Their first, cold runs take 75.2, 42.4, 21.3, 21.2 and 20.6 s, against 72.5, 33.8, 17.6, 17.3 and 28.6 s inmain's full pass. The_spanstimeouts there aremain's three._putenv_stest fix on top; it isn't on this branch.Overlaps
main88e804b0a7keeps both (see Tested). This PR no longer takes whole-span references for address stores, so #8874's pool serves only the declared writes' references.main4f41f4c375gives a build that stores through addresses a private slot in its arena for the store-page words (see Tested).GuestBufferMemory.cpp's resident write-back. #12827 stores from the readback buffer without copying it, and this PR copies each written piece's readback into a vector, so on rebase it takes a span over the piece's slice instead. Merge order: #12827 first, this one second (note).GuestBufferMemory.hppand.cpp. #15296 removes the resident host copies (ResidentBuffer::Read,StoreandBlock), which this PR's resident write-back compares the declared writes and the gathered store pages with, and takes resident references from device copies (RecordReference). Copy-backed mirrors keep this PR's device reference copies. Merge order: #15296 first (it lands after #15295 and #12827), this one second, rebased off the host copies (note).Context.hpp, is withmain, and this PR doesn't change that file. sktharunbalaji13-cmd ran the two together on Ghost of Tsushima Director's Cut (see Tested).WriteBackkeeping the CPU's bytes): #6185 has merged, and the merge ofmain4f41f4c375composes itsChangedStorewith the store-mask write-back (see Tested). #6186, which also conflicts withmain, conflicts with this branch only intests/Recorder.cppandtests/cmake/agc_driver_recorder_tests.cmake.ShaderResources.cpp, besidesCMakeLists.txtandDraw.cpp.main5cb015caaabrings them without a conflict.mainb11c7bf84fcomposes its per-use fault records with this PR's store pages (see Tested).if(BUILD_TESTING)block at the end oftests/cmake/agc_driver_pipeline_journal_tests.cmake, and the merge ofmain090f57166aputs this PR'sTIMEOUT 240line, which covers this PR's own cold compile, into #15423's block (see Tested).maincrashed at boot inPipelineBinaryStore::queryKey. The merge ofmain47adcad89adrops itsbinaryLayoutKeyand keeps this PR'sstorePages(see Tested). If #15169 comes back, the two are again neighbouring members ofComputePipelineObjects, and keeping both resolves it.GuestBufferMemory.cpp'sUploadFinishbeforetakeHeapReferences(). The merge ofmain2b31f86019calls this PR'saddAddressStoreSpans()before #17796'spublishIntoMirrors(), so a writable mirror that a draw may store into through an address takes #17796'sWrittenfallback, and its ×10 runs #17796'sagc_driver_resident_heap_mirrorand_no_publishwith this PR's tests (see Tested).main11992f9695keeps #17850's rewritten debt entry with this PR's two after it, and runs #17850'sagc_driver_indirect_draw_pending_producertests with this PR's store pages (see Tested).vkCmdBindPipeline, so the merge ofmain884694cf85binds this PR's three compute pipelines through itscontext.BindComputePipeline(see Tested).main0173f20a5fkeeps itsreport.claim == 0check with this PR'spagesOverflowedRequireafter it, and this PR's store-page words move with its 40-byte fault record (see Tested).main8bb7635fe0keeps both: a module's build-time specialization leaves out this PR's and #18842's, and this PR'sStorePagespipeline variant gets #18842's lock table address (see Tested).BdaAbi.hpp'sFaultReasonafterWindowLaneSpill: this PRStorePages, #20519 and #22424BindlessMissandBindlessRefused, and #22359SplitState. Whichever lands second takes the next numbers, and every use names the reason, not its number.BdaResources.cpphas an adjacent#includeline (#20519 and #22424) and adjacent fault messages (#22359). InVulkanDevice.cpp, #22359's split-state block goes before this PR's store-page bind. No merge order: whichever lands second resolves the conflict (git merge-treeonmain1adc0e2f4b).VulkanDevice.cpp's compute pipeline creation. #22692 creates each compute module from aSharedSpirv::Words()lease, and this PR'sspecializedComputePipeline(splitComputePipelineonmain) keys its pipelines by the store-page flag as well as the workgroup offsets. The merge keeps this PR's four-word key andreplacedconstants, withStorePageswhen the flag is set, and creates the module from #22692's lease. IncreateComputePipelineboth addconst auto words = shader.spirv.Words();, so the merge drops this PR's line, and itsStorePagesscan reads #22692's lease, declared beforeobjects->module. Merge order: #22692 first, this one second (note). That's one text conflict onmainb1a1e61f91(git merge-tree).note_bda_writehash table with per-range granule bits and a page map. This PR's store-page words followSrtGuardWord, and itsStorePageGather.compfinds the pages BDA stores hit from the table's count, slot and list words, whichRecorder.cpppasses to it. The merge puts the store-page words after #22944'sSrtGuardWordand has the gather read #22944's written-page record. InSpirvEmitterState.hppit dropsbdaNoteWriteFunctionwith #22944 and keeps this PR's two store-page members. Merge order: #22944 first, this one second (note). That's six conflict blocks in five files onmain8dbb3bf68d(git merge-tree).Recorder.cppmerges without one but still passes the table's words.GuestBufferMemory.cpp'sRecordCopyBacks, where both change the loop that records the heap-mirror readbacks. Proposed order: this PR first, and #23596 then resolves the conflict keeping both sides (see the note on #23596). The merged loop is #23596's, with itsheapMirrorandwritableCopybranches, iterating this PR'sdeclaredReadbacks, and with this PR'sAddressStoreTallies().readbackBytesline in theheapMirrorbranch. Whichever goes second runs this PR'sagc_driver_bda_store_heap_mirror*tests and #23596's copy write-back tests on the merged tree.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)main88e804b0a7,4f41f4c375,11992f9695,0173f20a5f,8bb7635fe0and2b31f86019keep bothImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T14:00:24Z.
Review: COMMENTED
Linux run of head
582e856556.agc_driver_pipeline_journalstill fails here on both devices, in a different case from the one582e856556fixed:EvictionWatermarkTestsends withthree consecutive records after a rewrite triggered another rewrite. It misses the 1 MiB cap by 92 bytes.Setup: Ubuntu 26.04, GCC 15.2, Release with the default
ANYPS5_ENABLE_SPIRV_TOOLS=OFF. RTX 3070 with NVIDIA 595.99.02 and lavapipe (Mesa 26.0.3), one at a time viaVK_DRIVER_FILES. The head is merged--no-ffontomain809c7fa2dfwith no conflicts.mainhas no AGC or shader changes since the828ac0b2aethe NVIDIA CI used.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1.Results
^agcpasses too: 1136/1137.mainon the same box: passes, 3/3 on the 3070.ReplayRacesDispatchTestsskipped (local change), it fails the same way, 3/3 on the 3070 and 1/1 on lavapipe.Size measurements (file size printed before and after the watermark's three records, local only; 3070, no layer)
mainEvictionTests.main, and the store-page lookups use all of it.Why CI passes: probably the build option.
build.ymlconfigures with-DANYPS5_ENABLE_SPIRV_TOOLS=ON, the NVIDIA CI build does too, and it didn't select this test anyway. With the SPIR-V optimized, the modules are smaller and the watermark records likely fit. I haven't rebuilt withONto confirm. The default build isOFF, and there it fails.Possible fixes: give
EvictionWatermarkTestsits own empty journal, as582e856556does for the race, or size its three records from the rewrite target instead of fixed 16 Ki-word payloads. Either way it would stop depending on how large the fixture's SPIR-V is.GPUs tested: NVIDIA GeForce RTX 3070, 595.99.02, Ubuntu 26.04; Mesa 26.0.3 lavapipe, Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:51:00Z.
Review: COMMENTED
The evidence is thorough, and the refusal being removed is the real blocker in #5166. One design point.
The store-page pool is a fixed limit that throws, and its default looks sized to one title.
APS5_BDA_STORE_PAGESdefaults to 1,024 4 KiB pages (about 4.6 MiB), found by a 16-probe hash, and the body states the default "starts refusing consecutive pages at about 988". A dispatch needing more distinct pages faults and none of its stores reach guest memory. The mirror that triggered this is 0x8c600000 bytes (about 2.2 GiB). A FLAT-store compute pass that writes a large buffer densely (a clear, a scatter, a skinning output) can legitimately touch far more than 988 pages. Throwing is the right behaviour and the "Store page pool" debt entry records it, but the numbers do not say where the default comes from.Please state how many distinct store pages the PPSA02225 dispatch uses in the Tsushima runs (the
[bda-store-spans]line), and whether the pool could be sized from the build's declared mirror span instead of a constant, so a legal shader does not hit a limit that raising an env var is the only way past.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T16:28:53Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
a96efaa504feb785cb81ab375577dcdb1e30620a, basemain. Merged-preview check: not run.diff.patch(2,956 lines, 31 changed files).Results
MarkGpuWritescall siteVulkanDevice.cpp:6136Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Graphics/src/BdaResources.cpp,checkFault, loop-guard branch (diff.patchhunk@@ -492,6 +581,7 @@):attachStorePages()runs aftercollectStorePages()has already movedpagesto the recorder pool.attachStorePages()returns early whenpagesis null, so the zeroed fault record gets no store-page table. If that record is reused after a loop-guard trip, stores into unbound blocks would take the fault path. I did not confirm whether a tripped record is ever reused.Not verified
Execution/src/VulkanDevice.cpp,Graphics/src/GuestBufferMemory.cpp,Graphics/src/ShaderResources.cppandtests/Recorder.cpp. Only their diff hunks were read.MarkGpuWritesis called atVulkanDevice.cpp:6136; I did not read the dispatch path above it in full.SpirvBdaLookup.cppfaults with the "store pages free" message when the access does not fit; whether a read can reach that path is not confirmed.StorePageGather.compandSpirvBdaLookup.cpp: not compiled and not validated here.set_tests_properties(agc_driver_pipeline_journal ... TIMEOUT 240)registration in CMake: not checked against where that test is defined.To get this to a good state
Nothing is required.
Optional:
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:55:53Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: add
parameters.basewhen the gather shader reconstructs a page address, so it can match absolute target spans and gather the resident page contents.What I ran
Reviewed head
2687eec5fd8bd19a74e40ac7a10981c18942d338using the prepared review bundle andrepo_read.py. No tests or builds were run.Results
Findings
Blocking
StorePageGather.comp, the gathered page address is reconstructed from a relative chunk offset, but target span bounds are absolute guest addresses. The address therefore fails the target-span overlap check, so a written resident page is skipped and later write-back can fail because the page was not gathered. Addparameters.baseto the reconstructed address. Evidence:core/libs/prx/libSceAgcDriver/Graphics/shaders/StorePageGather.comp:444.Non-blocking
None.
Not verified
The full text for
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas excluded as too large for the review folder; the relevant diff hunk was inspected. No tests, builds, or runtime behavior were independently verified. The description, commits, manifest, diff, and included changed-file texts were read; the manifest also lists excluded files, includingVulkanDevice.cpp.To get this to a good state
Fix the absolute page address reconstruction, then rerun the focused resident heap mirror gather and write-back tests and review the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:26:26Z.
Review: COMMENTED
Reviewed — comments
The review is incomplete because several changed files were not read and no checks were run; nothing is required, and the optional points below identify what remains unverified.
What I ran
Inspected the prepared bundle for head
bf7e2772c517c34018afcf3da7fb891aa72aece9using the review reader. No tests or build checks were run.Results
Findings
Blocking
None identified in the inspected excerpts.
Non-blocking
Sources
diff.patch.Not verified
The full text or all added lines were not read for the changed files. In particular,
Execution/src/VulkanDevice.cpp,Graphics/src/GuestBufferMemory.cpp,Graphics/src/ShaderResources.cpp, andtests/Recorder.cppwere excluded from the preparedfiles/bundle; other changed files were also not fully read. No source behavior beyond the inspected excerpts, build, or tests was verified. Author-reported checks in the description were not run by this review.To get this to a good state
Nothing is required. Optional: complete the changed-line review and run the relevant checks before treating this review as a merge assessment.