fix(agc): compare pending storage results over a surface whose page walk fails #12792
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12792"
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-29T09:26:30Z.
What
When a page walk over a storage image stops part way, the surface's collect returns 0 while the range stays watched. The walk also reports the rest of its range as written by the CPU.
StorageTexture::Refreshthen sees the 64 KiB units that hold GPU results as CPU-written newer than their generations. It drops them, re-uploads them from guest memory, and printsguest memory changed while GPU results were pending; keeping the CPU's blocks. The write-back leaves the same blocks to the CPU.scanBlocks) and the write-back (writeBackLayers) no longer read the walk's synthetic stamps as CPU stores.PAGEMAP_SCANthat fails has already written out the dirty regions it found before the failure and re-protected those pages. The newGuestWriteWatchCollectReporting_nid_postfixandGuestWriteWatchCollectArmedReporting_nid_postfixreport those regions as written, and the range the walk didn't finish as unreached. The old collect calls are unchanged.ChangedBlocksoverload answers per 64 KiB block: known (today's stamps), CPU-confirmed (a genuine store after the block's generation) or unknown.docs/dev/debt/libSceAgcDriver.md:PAGEMAP_SCANerror leaves the whole range unreached (Linux 6.18 writes them);main's write-back leaves a stamped block to the CPU only when its bytes differ, so a same-value store made while results are pending is overwritten there. That'smain's existing rule, in its own entry, and isn't changed here;markLayersPendingandRefresh, and they're co-author of the commit.markLayersPending. That doesn't reach the loss: the refresh's own failed walk stamps the blocks newer again. It would also hide a CPU store made between a refresh and the pending mark. Case 3 below covers that.mainand on this PR alike. On Windows the title run below is the evidence.Tested
agc_driver_pending_untracked_layer(new):Setup: a watched surface, real
image_storedispatches, then a readback throughimage_load. It setsAPS5_NO_HOST_IMPORT=1itself, so lavapipe doesn't take the range off the watch with an import, and it skips (77) on Windows.Red/green on Linux (Ubuntu 24.04, GCC 13.3, lavapipe, Release): red at run 1 of
--repeat until-fail:10onmain'sTexture.cpp, and 10 of 10 direct runs fail. Green, 10 of 10.ctest -R '^agc'on this change: 1,118 tests, 1,045 passed, 73 skipped, 0 failed.main.keeping the CPU's blockswent from every frame to 1 occurrence at allocation on0x1500010000(3840x2160R16G16B16A16_SFLOAT), and 8 in the whole run (7 on0x1504000000during setup).agc_driver_pending_untracked_layerpassed 10 of 10 under validation. With it, the^agc_storageand^agc_driver_storagetests ran 21 tests: 20 passed and 1 skipped,agc_storage_clear_hand_over, since lavapipe makes no watched host import.mainand with this change isVUID-VkDeviceCreateInfo-pNext-pNext, for an extension structure the layer predates. The change adds none.APS5_SKIP_TIMING_TESTS=1, pass: 191 and 291 tests on Linux, 220 and 314 on Windows.main, so the runner's comparison arm has no red. The red is the Linux one above.-fsyntax-onlyonTexture.cppand the test gives no warning on the changed lines.check_conventions.pypasses, with no comment lines added.5e106c566d, oneandonlydean's merge ofmain88e804b0a7. The one conflict was indocs/dev/debt/libSceAgcDriver.md, where this PR's page-walk entry sits amongmain's new write-watch entries; both sides are kept. This PR's diff overmainis unchanged. On GitHub's runners (run, on 7ed1db8f0d, the same merge with that entry one line higher),agc_driver_pending_untracked_layerand the^agc_storageand^agc_driver_storagetests ran 10 times with no failure. Linux: 24 run, 23 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Windows: 25 run, 0 pass, 25 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.81ad915d78: a case that can't run no longer hides a failure, oneandonlydean's second point (comment).main()runs every case, requires that none came backLost, and only then returns 77 if a case couldn't run. On GitHub's runners (run),agc_driver_pending_untracked_layerand the^agc_driver_pending,^agc_storageand^agc_driver_storagetests ran 10 times with no failure. Linux: 25 run, 24 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Windows: 26 run, 0 pass, 26 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.5e106c566dmerged ontomaina4eca2a056, Linux, with the Khronos validation layer. The new test is red onmain3 of 3 and green on the merge 3 of 3. 22 tests under the layer give no new VUID; the gate's exit 1 comes only fromagc_storage_clear_hand_overskipping on both sides.81ad915d78merged ontomain1d91f29, driver 595.99.02, Ubuntu 26.04.1. 2,621 passed, 3 failed (none new: all 3 fail onmain) and 44 skipped, with no new validation IDs over 983 tests on the GPU.89c782b89eand37a0eb949a: the CPU stores a failed walk saw are kept, oneandonlydean's first point and the blocking finding in XairRrR's and mashingaan's reviews, on @sktharunbalaji13-cmd's plan, with them as co-author.agc_driver_pending_untracked_layer: 5, a same-value CPU store in a block the walk reached before it failed on a later block, then a refresh; 6, the same, then a direct write-back (FlushAllPending) with no refresh. Each requires guest memory and the image to hold the 8 stored words and no results, and guest memory still to hold them after a last flush.^agc_driver_pending,^agc_storage,^agc_driver_storageand^guest_memorytests,agc_collect_memo_generation,agc_import_watchandagc_write_watch_coverage. Linux: 32 run, 31 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Windows: 31 run, 4 pass, 27 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.agcandguest_memorytest, once (run): Linux: 1,223 run, 1,145 pass, 77 skip, 1 fail. Windows: 1,258 run, 382 pass, 876 skip (no Vulkan device), 0 fail. The Linux failure isagc_driver_pipeline_journal's 120-second timeout, whichmain7feb37ee3e's own run of that test hits too (run).agc_driver_pending_untracked_layer,agc_import_watchand the^agc_storageand^agc_driver_storagetests pass on both arms, and the change adds no VUID.PAGEMAP_SCANthat fails on a remapped page returns -1, but it has already written out the dirty regions before that page and re-protected them. Itswalk_endgives the range end, so the whole unfinished range is reported unreached.main's rule, in its own debt entry.check_conventions.pypasses, with no comment lines added. On a cloud Linux machine (lavapipe),ctest -R '^agc'runs 1,219 tests on both trees: 1,142 pass, 77 skip, 0 fail.37a0eb949amerged ontomain7feb37e, RADV NAVI24, Mesa 25.2.8. 3,621 passed, 14 failed (none new: 12 fail onmaintoo, 2 are unstable there) and 59 skipped, with no new validation IDs over 1,309 tests on the GPU.37a0eb949amerged ontomain9090972, driver 595.99.02. 3,502 passed, 5 failed (none new: 3 fail onmaintoo, 2 are unstable there) and 51 skipped, with no new validation IDs over 1,307 tests on the GPU.51249fede2,test(agc): the walk-failure cases on Windows. The test no longer skips on Windows. There the surface is one section mapped into the guest arena, and the first page of block 3 is mapped a second time and compared when shared (GuestArenaCompareWhenShared), so a walk over the surface is refused, as on the production path.main's code: on the same GPU, before the same-value and new cases ran on Windows, the four earlier cases passed 3 of 3 withmain88e804b0a7's code as well as with this PR's, also with the shared page moved under the results' block or the CPU word's block. So on Windows this case covers the refused-walk path without showing a loss.37a0eb949arun. Linux: 32 run, 31 pass, 1 skip (agc_storage_clear_hand_over), 0 fail, withagc_driver_pending_untracked_layerpassing 10 of 10. Windows: 31 run, 4 pass, 27 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.check_test_registration.pyandcheck_skips.pypass. Only the test and the debt file change, with no comment lines added.51249fede2merged ontomainf6232fc, driver 595.99.02. 3,636 passed, 6 failed (none new: 3 fail onmaintoo, 3 are unstable there) and 52 skipped, with no new validation IDs over 1,309 tests on the GPU.4e4cba9535, oneandonlydean's merge ofmaind1ae628bc2. The one conflict was inExecution/src/GuestMemory.cpp, where #14899 made the write-tracker generations 64-bit. The merge widens this PR's unreached-page tracker (UnreachedPage,noteUnreached,newestUnknownMark,provenCpuStore) tostd::uint64_twith them, andagc_driver_pending_untracked_layerruns its cases a second time with the generation past 2^32 (AdvanceTrackerGenerationForTest). Apart from those types and that pass, this PR's diff overmainis unchanged.agc_driver_pending_untracked_layerandmain's fiveagc_write_trackingtests pass 3 of 3.51249fede2run, withmain'sagc_write_trackingtests and the compared-shared tests added. Linux: 34 run, 33 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Withmain's implementation onlyagc_driver_pending_untracked_layerfails there, in cases 1 and 2 and in the same-value direct write-back case, in both generation passes. Windows: 40 run, 13 pass, 27 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (297 and 321) and on Windows (324 and 342). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.4e4cba9535merged ontomaind1ae628bc2.agc_driver_pending_untracked_layerpasses 3 of 3, with all 7 cases run in both generation passes, and 30 of 31 related tests pass, with 1 skip (agc_storage_clear_hand_over). There are no new VUIDs over 768 tests. Withmain's five production files, the test fails 3 of 3, in cases 1 and 2 and in the same-value direct write-back case, in both passes.26ed2aec06, a merge ofmain4f41f4c375, which brings hugodearaujo's #14302 (a CPU store that rewrote a pending block with its baseline bytes is kept).Graphics/src/Texture.cpp, inStorageTexture::writeBackLayers, on the line that decides whether a block was written. #14302 replaced its!unchangedSinceBaseline(from, to)with!cpuLeftUnchanged(layer, from, to, edge), and this PR had putcpuSeen(a CPU store that a failed walk saw) in front of that check. The merge keeps both:(cpuSeen || !cpuLeftUnchanged(layer, from, to, edge)), with this PR'sbyByteswheremainhascompared[layer], and in the skip condition below it, as before.mainstays +723 −32 in 8 files; that line is the only one that changes.agc_driver_pending_untracked_layer,agc_collect_memo_generation,agc_import_watch,agc_write_watch_coverageand every test matching^agc_driver_pending,^agc_storage,^agc_driver_storage,^guest_memoryor^agc_write_tracking, with the compared-shared tests (agc_compared_shared_generations,agc_import_alias_shared,agc_resident_direct_remap,agc_rewatched_direct_shared) on Windows, the only runner that has them. Linux: 36 run, 35 pass, 1 skip (agc_storage_clear_hand_over), 0 fail; withmain's implementation onlyagc_driver_pending_untracked_layerfails there. Windows: 42 run, 13 pass, 29 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,277 run, 1,193 pass, 83 skip, 1 fail. Windows: 1,313 run, 402 pass, 911 skip (no Vulkan device), 0 fail. The Linux failure is751/1277 Test #1389: agc_driver_pipeline_journal ...........................................***Timeout 120.06 sec, the 120-second limit thatmain's own run of that test reaches too (see the37a0eb949asweep above); this PR doesn't touch the journal.4f13bb4bb0, a debt note (docs only), for XairRrR's review: since #14302, thecpuSeenterm is untested for a block the layer covers only in part and for a layer with no pending stamp, which this PR's fixture doesn't reach.e14b677a04anda3bb73fa98, debt notes (docs only), for XairRrR's review: the same-value write-back entry is narrowed to the cases #14302 left open, a block the layer covers only in part and a layer with no pending stamp. The Windows refused-walk entry and its skip stay: with the skip lifted on the merged code, the same-value direct write-back case still fails 3 of 3 on an RTX 3070 Laptop GPU (driver 617.42, Windows 11, WinLibs GCC 15.2.0, Release) with "guest memory holds 8 results and 0 stored words", in both generation passes, and the other six cases pass.3317dcb318, a merge ofmainb5a9a4781c, which brings Tehshortbus's #12452 (aliased direct memory stays on the Linux write watch, and a collect takes stores through every alias).libc/src/GuestWriteWatch.cpp. #12452 rebuiltCollect,CollectFreshandCollectArmedaround aFanout, which reports a written range at its own address and at every alias in an alias plan. This PR had givenCollectandCollectArmedanunreachedcallback for the pages a failed walk couldn't read. The merge keeps both.Fanoutcarriesunreachedbesidewritten, andFanout::ReportUnreachedreports an unreached range at every alias address, the same wayReportdoes for a written range. When a step ofCollectorCollectArmedfails, the aliases it hasn't reached yet are reported unreached too, and so are their armed parts forCollectArmed.CollectFreshkeeps #12452's loop and reports nothing unreached, as before. This PR'stakeFreshandscanWrittenmerged without a conflict.agc_driver_pending_untracked_layermakes a walk fail with no alias. #12452's alias tests collect through aliases, but no walk fails in them. So no test runs an unreached report over an aliased range.maingoes from +724 −32 to +776 −46 in 8 files, all of the change inGuestWriteWatch.cpp.agc_driver_pending_untracked_layer,agc_collect_memo_generation, and every test matching^agc_driver_pending,^agc_storage,^agc_driver_storage,^agc_write_tracking,^agc_write_watch,^write_watch,^windows_write_watchor^guest_memory.agc_storage_clear_hand_over), 0 fail.agc_driver_pending_untracked_layerpasses 10 of 10.agc_driver_pending_untracked_layeris among the skips, as on every earlier Windows-runner run of this PR.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main's Windowsguest_standard_streamsfailure (#17423) didn't show up in these runs.agctest, once (run): Linux: 1,453 run, 1,361 pass, 92 skip, 0 fail. Windows: 1,493 run, 445 pass, 1,048 skip (no Vulkan device), 0 fail.3317dcb318: Lucke0051's two Linux GPUs (below). The RTX 3070 Laptop runs and TechLevelZero's bot reports above are on the heads they name. The Windows unreached path, the refused walk over a compared shared page, has had no GPU run since this merge.3317dcb318merged ontomain02452319ce, CachyOS (Linux 7.3.1), GCC 16.2.1, Release,ctest -R '^(agc|video_out|shader)', againstmainon the same machine. Both GPUs (NVIDIA 615.78.08; Mesa 26.2.6) show no difference frommain, andagc_driver_pending_untracked_layerpasses on both. No validation layer was installed there.7219255b4d, a merge ofmainea32608486(×10, everyagctest), which brings JJenkx's #18940 (a pending texture's snapshot at an unwatch covers only the units the unwatched range meets, and when the write-watch query over the whole range fails, each unit is queried on its own).Graphics/src/Texture.cpp, four hunks, inStorageTexture::refresh's drop rule and inStorageTexture::writeBackLayers. Where this PR's lines read the range-widetrackedandcompared, #18940 reads per-unit answers (unitTracked, and in the refreshunitCompared) when the range query fails. The merge keeps both:comparedandtracked, and still compares a unit's stamps when a failed walk left its block unknown;compareUnknownahead of #18940's per-layer queries, which run only when it can't answer. Itsunknownand skip conditions read #18940'slayerTrackedwhere this PR hadtracked, with this PR's!compared[layer]and!byBytesterms kept.So in those lines, a surface with no unknown blocks takes
main's path, and one with unknown blocks takes 3317dcb318's.mainstays +776 −46 in 8 files. InTexture.cppthe changed lines are the same, on #18940's per-unit names.3317dcb318run, with #18940's fiveagc_unwatch_snapshot_scope*tests. Linux: 51 run, 50 pass, 1 skip (agc_storage_clear_hand_over), 0 fail;agc_driver_pending_untracked_layerand #18940's five tests pass 10 of 10. Windows: 58 run, 15 pass, 43 skip (no Vulkan device;agc_driver_pending_untracked_layerand #18940's five tests are among them), 0 fail. The libc and libkernel suites run 380 and 376 tests on Linux and 410 and 404 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: Linux: 1,690 run, 1,582 pass, 106 skip, 2 fail. Windows: 1,728 run, 502 pass, 1,226 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._putenv_stest fix (#19899) on top, becausemain's Windows test build breaks without it ("'setenv' was not declared" inUploadCacheReadOnlyFlush.cpp, from #18037); it isn't on this branch. The first runs, on this head alone (×10, everyagctest), gave the same Linux results, and their Windows builds stopped at that error.7219255b4d.a124bdd5c4, a merge ofmain790e9a371c(×10, ×10 with the Windows test fix, everyagctest), which brings Ducengarth's #17788 (a storage image's upload copy is renewed when its range leaves the write watch).docs/dev/debt/libSceAgcDriver.mdonly. #17788 rewrote the "Units without a baseline outside the write watch" entry, right before this PR's four entries. The file merges withmerge=union, which would keep the old copy of that entry next to the new one, so the merge takes #17788's entry and keeps this PR's four after it.mainstays +776 −46. Only context lines moved: that debt entry, and chitters2004's #17766 lines next to this PR's intests/CollectMemoGeneration.cpp.Texture.cpp, where #17788 also changesStorageTexture, merged without a conflict.7219255b4drun. Linux: 54 run, 53 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Windows: 64 run, 19 pass, 45 skip (no Vulkan device), 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,801 run, 1,677 pass, 114 skip, 10 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_frame_replay_rewind_copy("FAILED: no memory delta was read while 1 submissions waited for the CPU") and theagc_driver_runtime_buffer_spans_x3_spansand_x4_spanstimeouts. Over 10 runs ofmain790e9a371cwith #19899's test-only commit on top (run), all three fail too,frame_replay_rewind_copywith the same message. Over 10 runs of this merge (run),frame_replay_rewind_copypasses 10 of 10, and the span tests fail as onmain.7219255b4d, the Windows runs had Sankalp7317's #19899 on top, sincemain's Windows test build still 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.a124bdd5c4.095d749357, a merge ofmain0694c4cbd6(×10, everyagctest), which brings klosixgaming-arch's #19071 (settled imports under live storage images go back to the write watch).Graphics/src/Texture.cppplanned under Overlap, resolved as described there. The declarations keep this PR'sunknownBlocksand #19071'srewatchCompared.scanBlockskeeps this PR'sChangedBlocksread, taken only when the surface's own collect succeeded, with #19071'sconfirmRewatchedcall after it.droppablekeeps both cases in one condition.writeBackLayerskeeps this PR'sunknownBlocks, and #19071'sconfirmRewatchedcall now follows this PR'swalked && ChangedBlocksline.mainit is +777 −47 in the same 8 files, against +776 −46 before. The changed lines are the same, apart from where #19071's code meets this PR's: thedroppablecondition this PR extends now also holds #19071's rewatched-unit case, and #19071'sconfirmRewatchedcall inwriteBackLayersmoves after this PR'sChangedBlocksline.a124bdd5c4run. Linux: 55 run, 54 pass, 1 skip (agc_storage_clear_hand_over), 0 fail. Windows: 66 run, 19 pass, 47 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 391 and 390 tests on Linux and 421 and 417 on Windows. On Windows, 0 failed. On Linux, libkernel'sguest_thermal_sensorsreached 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 on GitHub's other runners and inmain's own job. This PR changes no libkernel 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,867 run, 1,739 pass, 116 skip, 12 fail. Windows: 1,909 run, 558 pass, 1,351 skip (no Vulkan device), 0 fail.main's own Linux job at0694c4cbd6(job):agc_driver_global_atomic_csub,agc_driver_stencil_copy_draw,agc_driver_coherent_atomic_loads_enabled,agc_hook_clear_access,agc_hook_clear_access_off,agc_driver_recorder,agc_draw_input_mirrorsandagc_draw_input_reuse.agc_driver_image_table_packed_guardsfails 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 open #21255 changes that test.agc_driver_runtime_buffer_spans_x2_spans,_x3_spansand_x4_spanstimeouts:main's own Linux job passes them at0694c4cbd6, in 3.09, 3.79 and 4.16 s, and times them out atdcf3d15978(job), together with_x4_reference. On GitHub's runners, ×10 of the span tests with this PR's set in both arms,main0694c4cbd6(run, Intel Xeon 6975P-C) and this merge (run, AMD EPYC 9V74) differ by little. The merge's passing medians are 0.99 to 1.12 ofmain's:runtime_buffer_spans3.92 and 3.90 s,_x2_reference1.55 and 1.66 s,_x3_reference1.89 and 2.08 s,_fault_stop0.205 and 0.230 s,_fault_barrier0.210 and 0.230 s. Its timeouts are the fourmain's own job shows atdcf3d15978. The two arms ran on different CPUs. For scale,main's own code takes 0.68 to 0.78 of the time on the Xeon that it takes on an AMD EPYC 7763 (run), and two runs of this merge on the same EPYC 9V74 differ from each other by up to 20% (run).095d749357: @domx4q's RTX 4090 run with the validation layer (below).ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1. This head095d749357merged ontomaine4caa07950(a clean merge), againstmaine4caa07950alone,ctest -R '^agc_(driver_pending|collect_memo_generation|storage|driver_storage|write_tracking|write_watch_coverage|import_watch)'.main: 45 of 45 pass. This PR: 46 of 46 pass, includingagc_driver_pending_untracked_layer, whichmaindoesn't have, run on the RTX 4090 (no skip). NoVUID-line on either side, and every device test selected the RTX 4090.main, by @milescoviello (comment): Ubuntu 26.04.1, NVIDIA GeForce RTX 4070 Ti (driver 615.71.09), Release libraries,maineb20410673against its merge with095d749357, 3 runs per arm of up to 600 s from a pinned save with a cold shader cache.keeping the CPU's blocks8 times, all during setup. Without the stack above, this title doesn't reach the per-frame case, so the run can't show the fix, as expected.mainrun and two of this PR's runs; they read it as varying from run to run rather than following the change. The two PR runs with the most of it also had the highest RSS (25.0 and 24.1 GB, one killed at the 22G cap at 393 s, against 19.2 to 20.3 GB formain).main's third run entered the same phase and was killed at 237 s, so they don't read the memory difference as coming from this PR.Overlap
Graphics/src/Texture.cpp, inStorageTexture::RefreshandStorageTexture::writeBackLayers, conflicted with this PR, and the merge ofmain0694c4cbd6resolves them like this (see Tested):unknownBlocksand #19071'srewatchComparedare added on the same line, and both are kept.scanBlocksandwriteBackLayers: this PR readsChangedBlocksonly when the surface's own collect succeeded, and movesmain'sawaitStoredSaveinto its!trackedpath, after the unknown-block compare. #19071 callsconfirmRewatchedaftermain'sChangedBlockscall. The merge keeps this PR's lines and callsconfirmRewatchedafter this PR'sChangedBlockscall, with #19071's conditions.droppable: both add a case to the same condition, this PR's unknown blocks and #19071's rewatched units, and both are kept.libc/src/GuestWriteWatch.cpp: a fresh range is protected before it is reported, and eachFanoutre-resolves its alias translations when a link changes during a collect. It conflicts with this PR in four hunks, inCollect,CollectFresh,CollectArmedandFanout::Report(git merge-treeof its895760f025and this PR's095d749357; each merges cleanly withmaind50640e264on its own). Proposed order: #24008 first, and this PR then resolves the conflict keeping both sides (note):Fanout: carries both PRs' members, #24008's watch, range, link version and refreshed translations, and this PR'sunreached. EveryFanoutis built with all of them, including this PR's constructions inCollectArmed's uncovered-range path and inunreachAliases, which merge without a text conflict;unreachAliasesstops beingstaticso it can pass the watch.takeFreshandscanWrittentake this PR's unreached report besideFanout::Report, and this PR's failure paths, which report the remaining aliases as unreached before returningfalse, are kept.ReportUnreachedcalls #24008'srefresh()before it fans out, asReportdoes, so an unreached range also reaches a view linked during the collect.agc_write_trackingtests and this PR'sagc_driver_pending_untracked_layer,^agc_storageand^agc_driver_storagetests 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)main0694c4cbd6keeps bothmain, which doesn't reach the case), by @milescovielloImported from boykopovar/AnyPS5. Originally posted by mashingaan on 2026-11-02T20:42:59Z.
Review: CHANGES_REQUESTED
The current head still has the same-value CPU-store loss described in the earlier issue review. The new test only writes a distinct value in another block, so it does not exercise the case where the guest bytes equal the saved baseline but a real CPU store must still win. Please preserve successful CPU-write provenance across a later failed page walk, or otherwise distinguish confirmed writes from synthetic failure stamps, and cover both Refresh and direct write-back.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T20:54:00Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The fix builds, the new test passes and fails on
main'sTexture.cpp, but I reproduced the open same-value-store point. When the walk fails on a later page, GPU results overwrite a CPU store that the successful part of the walk had recorded. The path that walks the whole surface keeps that store.What I ran
Head
5e106c566dda63169ca2accc08b7b0008994918d,main9090972b7e91fd266819cbd77a8b058e177b5682, merged treed50c2a238617b5054bb243dbd17474bd57ec10db. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6, LLVM 19), Release.Results
git diff --checkcheck_conventions.pymainagc_driver_pending_untracked_layer(merged)not runline)main'sTexture.cpp)Negative control output (each of 3 runs)
Same-value probe output (identical in 3 of 3 runs)
What the probe does: after the first store (guest holds
Stored, which is also the saved baseline), theStoreAgainCoderesult is held pending. The CPU then storesStoredagain to the first result word, in block 0, andRefreshruns. One case remaps the block 3 page (LoseWalk), so the walk succeeds over block 0 and fails later. The other case keeps the walk complete.The probe's non-zero exit came only from the probe case's own pass condition. It was a local edit and is not part of the PR.
Negative control
I restored
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppfrommainand rebuilt the test executable:main's code: the new test failed 3 of 3 runs, in cases 1 and 2, matching the description's main column.git status --porcelainwas empty afterwards.Findings
Blocking
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:2355-2363for the refresh, and atTexture.cpp:6490andTexture.cpp:6500for the write-back.current == 0orwalkedis false, both paths drop every stamp fromChangedBlocksand decide only by comparing bytes with the saved baseline.docs/dev/debt/libSceAgcDriver.md:193does not record this loss.scanWrittenfrom stamping[cursor, end)as CPU writes, or report that part separately. Compare bytes only for blocks in the unreached part.Refreshand for a direct write-back with noRefreshfirst.Non-blocking
core/libs/prx/libSceAgcDriver/tests/execution/PendingUntrackedLayer.cpp:372,main()returnsVulkanTestSkippedon the firstNotRun, even when an earlier case already came backLost. oneandonlydean raised this on 2026-10-29 and it is still there. Fail whenkeptis already false before returning 77, or skip only the cases that cannot run.collectWindowsWritesfailing, thennoteRefusedWalk) is not tested. The debt entry should at least say so if no test can reach it.Not verified
noteRefusedWalkpath.Refreshon Linux, with a page remapped by the test. I did not build a direct write-back variant.To get this to a good state
Refreshand for a direct write-back.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T22:25:02Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The one new commit,
81ad915d78, changes how the test handles a skipped case: an earlier failure now fails the test instead of being reported as a skip.Texture.cppdid not change, so the blocking same-value CPU-store loss from my last review is still open.What changed since my last review
81ad915d78: it changes onlyPendingUntrackedLayer.cpp. A case that cannot run (NotRun) is now noted and skipped over.main()checks that no case wasLostbefore it returns 77.git diff 5e106c566d 81ad915d78touches no other file.Texture.cppand the debt entry are the same as in the head I reviewed last time.Refresh, a direct write-back, and Windows. None of it has been pushed yet.What I ran
Head
81ad915d786415669b61143d7bb202272ab521a2,main9090972b7e91fd266819cbd77a8b058e177b5682, merged tree0036d44d39bfe7ff176afa824122aca64a268a47. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6, LLVM 19), Release.git diff --checkcheck_conventions.pymain.agc_driver_pending_untracked_layer(merged tree)main'sTexture.cpp)git status --porcelainafter the restoreNegative control output (identical in all 3 runs)
Previous findings
Texture.cppis the same as in the head I reviewed last time. On a failed walk,core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:2355-2360still overwrites every stamp. The write-back does the same atTexture.cpp:6490andTexture.cpp:6500.docs/dev/debt/libSceAgcDriver.md:193still does not record this loss.PendingUntrackedLayer.cpp:368-380now setsnotRun, finishes the loop, callsRequire(kept, ...), and only then returnsVulkanTestSkipped. ALostoutcome therefore fails the test even when a later case cannot run._WIN32. The author's reply plans a Windows case throughGuestArenaCompareWhenShared_nid_no_patch, but none has been pushed.New findings
Blocking
None beyond the open finding above.
Non-blocking
None.
Not verified
To get this to a good state
Refreshand through a direct write-back with noRefreshbefore it. Each should fail without the fix and pass with it.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T06:11:18Z.
Review: APPROVED
Re-checked — approved
New commits
89c782b89e,37a0eb949aand51249fede2resolve the blocking finding. A failed walk now keeps the CPU stores it saw before it stopped. The new same-value cases fail with this PR's earlierTexture.cppand pass now, and the test also runs on Windows.What changed since my last review
I last reviewed
81ad915d78. Since then:89c782b89e, a production change:PAGEMAP_SCANthat fails now reports the regions the kernel wrote out before the error. It also reports the rest of the range as unreached, through the newGuestWriteWatchCollect(Armed)Reporting_nid_postfixexports.noteUnreached,provenCpuStore).ChangedBlocksoverload marks each block as known, CPU-confirmed or unknown.StorageTexture::refreshandwriteBackLayerscompare bytes only for unknown blocks.cpuSeen).37a0eb949a: adds the same-value store cases throughRefreshand through a direct write-back.51249fede2: the test runs on Windows, where the walk is refused over a compared shared page. It also adds a case that stores a different value, then does a direct write-back. The Windows same-value write-back case is excluded there and recorded as debt.4e4cba9535, a merge ofmain: it widens the new tracker fields to 64-bit, and the test runs every case a second time with the generation past 2^32.docs/dev/debt/libSceAgcDriver.md.What I ran
Head
4e4cba95350d08a31066b643fe1a2f286f576215,maind1ae628bc2f62459cce1e9872ba5632c938c71f2, merged treed95e062d196a92cd78b9eb7e4c3fc108866c8a41. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6, LLVM 19), Release.git diff --checkcheck_conventions.pymain. One new failure,unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, is anos.chownEINVAL in atools/test inside the sandbox. This PR touches no file undertools/.agc_driver_pending_untracked_layer(merged tree)not runline.agc_storage_clear_hand_over, because lavapipe makes no watched host import.git status --porcelainafter the restoreNegative control
main: the test failed 3 of 3. It failed in cases 1 and 2 and in the same-value direct write-back case, in both generation passes.main. That is expected: there, every block of the failed walk is stamped as CPU-written, so the refresh keeps the CPU's block.mainplus this PR's first-versionTexture.cppchange (87b51a63b9): the test failed 3 of 3. Only the two new same-value cases failed, which is the loss my previous review reported.Control B output (identical in all 3 runs)
Control A output (identical in all 3 runs)
Previous findings
core/libs/prx/libc/src/GuestWriteWatch.cpp:218-225now reports the regions the kernel wrote out before the error, then the unfinished range as unreached.noteUnreachedandprovenCpuStore(core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:1218-1257) keep the real stamp under the synthetic one.ChangedBlocksoverload (GuestMemory.cpp:2487) flags only unknown blocks. The refresh compares just those (Texture.cpp:2352), and so does the write-back (Texture.cpp:6539). The write-back'scpuSeen(Texture.cpp:6626-6627) leaves a block the walk saw the CPU write to the CPU.docs/dev/debt/libSceAgcDriver.md:193records what is still open: a same-value store in a page the walk never reached._WIN32. It makes the walk fail throughGuestArenaCompareWhenShared_nid_no_patchon a second mapping of block 3.main, so it is coverage, not a red/green. The same-value direct write-back case is excluded there, anddocs/dev/debt/libSceAgcDriver.md:194records that loss.New findings
Blocking
None.
Non-blocking
None.
Not verified
PAGEMAP_SCANwrites out the regions it found first, and re-protects those pages. I did not run a standalone probe; I only saw that the test passes on this kernel (6.12).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T15:06:02Z.
Review: APPROVED
Re-checked — approved
The only change since my last review is merge
26ed2aec06, which brings inmain4f41f4c375(#14302). Its conflict resolution inStorageTexture::writeBackLayersis correct, the new test still fails onmain's code and passes on the merge, and I found nothing blocking.What changed since my last review
I last reviewed
4e4cba9535. Since then:26ed2aec06mergesmain4f41f4c375. The one conflict was thewrittencondition inwriteBackLayers. #14302 replaced!unchangedSinceBaseline(from, to)with!cpuLeftUnchanged(layer, from, to, edge). The merge keeps that and puts this PR'scpuSeen ||in front of it, withbyByteswheremainhascompared[layer](core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:6679). Compared withmain4f41f4c375, the diff is still +723 −32 in 8 files.PendingUntrackedLayer.cpp,GuestWriteWatch.*and the PR's debt entries are unchanged. Every other difference between4e4cba9535and26ed2aec06comes frommain.What I ran
Head
26ed2aec065e159ab16b4f519042b6968039c6dd,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree093e485ae28cbf12e38f92fda7d5861125a49aaf. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6), Release.git diff --checkcheck_conventions.pymain.guest_net_ctlskips for a reasoncheck_skips.pydoesn't expect, and it does the same onmain.agc_driver_pending_untracked_layer(merged tree)not runlineagc_storage_clear_hand_over, because lavapipe makes no watched host import.git status --porcelainafter the restoreNegative control
A, the five production files from
main4f41f4c375: the test fails 3 of 3. Cases 1 and 2 fail in both generation passes, and so does the different-value direct write-back case. Since #14302 is inmain, the same-value direct write-back case no longer fails there, somainnow loses one case fewer than my last control showed.Control A output (the same in all 3 runs; counts are per run)
B, the merged tree without the merged-in
cpuSeen ||term: the test still passes 3 of 3. See the non-blocking finding below.Restore: with the merged file back, the worktree is clean and the test passes.
Previous findings
byBytes/cpuSeenlogic (Texture.cpp:6677-6679). The same-value refresh and write-back cases pass on the merge.New findings
Blocking
None.
Non-blocking
cpuSeenterm since the merge (core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:6678-6679).cpuSeen ||from the merged condition leavesagc_driver_pending_untracked_layergreen. #14302'scpuLeftUnchanged(Texture.cpp:6526-6534) now queries the CPU stamps sincelayerPendingSince, which already keeps a same-value store in a whole 64 KiB block.cpuLeftUnchangedreturnstrueas soon as the bytes are unchanged whenedgeis set orlayerPendingSince[layer] == 0(Texture.cpp:6528). In those cases a block the failed walk saw the CPU write is still only kept bycpuSeen.Not verified
PAGEMAP_SCANwrites out regions. The test passes on this VM's kernel (6.12).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T15:39:25Z.
Review: APPROVED
Re-checked — approved
The only new commit is
4f13bb4bb0. It changes only the docs: it adds a debt entry saying thecpuSeenterm has no test since #14302. The entry matches the code and resolves my earlier non-blocking finding. The checks and the new test still pass, and nothing is blocking.What changed since my last review
I last reviewed
26ed2aec06. Since then:4f13bb4bb0is new. It adds one entry todocs/dev/debt/libSceAgcDriver.md, "Blocks a failed walk saw the CPU write". No code changes.edgecase or the case of a layer with no pending stamp. They chose to record both as debt instead of adding a second surface geometry, which was one of the two options I suggested.4f13bb4bb0.What I ran
Head
4f13bb4bb02a5b15c0e32d318287b23c1c614e32,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree2a6f5f25fee0de1dc40bb76d64bd4fcbed728ed4. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6), Release.git diff --checkcheck_conventions.pymain.guest_net_ctlskips for a reasoncheck_skips.pydoesn't expect, and it does the same onmain.agc_driver_pending_untracked_layer(merged tree)git status --porcelainNegative control: not rerun. The new commit changes only docs, and the tests and production code are the same as in
26ed2aec06, where control A failed onmain's code.Previous findings
cpuSeenterm since the merge. Resolved, as debt.docs/dev/debt/libSceAgcDriver.md:199matches the code.cpuLeftUnchanged(core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:6526-6534) returnstruefrom the bytes alone whenedgeis set orlayerPendingSince[layer] == 0. In those two cases onlycpuSeen(Texture.cpp:6678-6679) keeps the store.26ed2aec06.New findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceAgcDriver.md:201).cpuLeftUnchangedasks for the CPU stamps sincelayerPendingSinceand keeps that store in a whole block of a layer with a pending stamp. The project rule is to cut an entry down to what is still open.main's code no longer loses the same-value direct write-back case.edgecase and the case of a layer with no pending stamp. Re-check the Windows case on the merged code, and update or drop line 200 to match.Not verified
PAGEMAP_SCANwrites out regions. The test passes on this VM's kernel (6.12).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T16:14:35Z.
Review: APPROVED
Re-checked — approved
The two new commits,
e14b677a04anda3bb73fa98, change onlydocs/dev/debt/libSceAgcDriver.md. The narrowed same-value write-back entry now matches what the code does after #14302, and the Windows entry records the author's re-check on the merged code. That resolves my last non-blocking finding, and nothing is blocking.What changed since my last review
I last reviewed
4f13bb4bb0. Commits 1–6 are unchanged; the range-diff shows them as identical. The new commits are:e14b677a04rewrites the "Same-value CPU stores under a write-back of pending storage-image results" entry (line 201). It now covers only two cases:a3bb73fa98adds one sentence to the "Refused walks over a compared shared page" entry (line 200). It says the Windows loss still occurs on the code merged with #14302: 3 of 3 runs, RTX 3070 Laptop GPU, driver 617.42.No code or test changed.
What I ran
Head
a3bb73fa980199e51b91ebcacd40ed7a2e051829,main4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree4fafe195290374dbf4ff40c0ba16bea7198e333b. Debian 13 VM, Xeon Gold 6136, GCC 14.2.0, lavapipe (Mesa 26.1.6), Release.git diff --checkcheck_conventions.pymain.guest_net_ctlskips for an unexpected reason, and it does the same onmain.agc_driver_pending_untracked_layer(merged tree)git status --porcelainNegative control: not rerun. The new commits change only docs. The test and production code are the same as at
26ed2aec06, where my earlier control failed withmain's code.Previous findings
cpuLeftUnchanged. Once the bytes equal the baseline, it returnstruewithout asking for CPU stamps whenedge || layerPendingSince[layer] == 0. Otherwise it keeps a same-value store through the stamps since the pending mark.cpuSeenterm since the merge. Still resolved, as debt. The entry is unchanged.New findings
Blocking
None.
Non-blocking
None.
Not verified
a3bb73fa98records.26ed2aec06, which has the same code as this head.PAGEMAP_SCANwrites out regions. The test passes on this VM's kernel (6.12).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:14:17Z.
Review: APPROVED
Reviewed — looks good
No verified defect blocks this change; the prepared evidence includes targeted regression runs and a GPU validation run at this head, while I did not run checks myself.
What I ran
Reviewed head
095d74935785c1090069e4b427f2388f52120b32. I did not run tests or build commands. Readdescription.md,commits.md,manifest.json,diff.patch, and all included changed files except only portions of long files; readTexture.cppthroughrepo_read.pyfor the changed refresh block. The full text ofTexture.cppwas excluded from the review folder as too large, and I read only its relevant range through the reader.files.jsonwas not present; the review folder listing served to identify included and excluded changed files.Results
Texture.cppwas read only in the relevant rangeFindings
Blocking
None.
Non-blocking
None.
Not verified
I did not run tests, builds, or GPU checks. I did not read the entire
Texture.cppfile or all unchanged repository context. The prepared description reports several known limitations and an untested alias failure-reporting path; I did not verify those behaviors independently.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:28:34Z.
Review: COMMENTED
Reviewed — comments
A complete approval is not justified because I could not run checks or read every changed file in full.
What I ran
Reviewed head
38516b5e639672419eed45fae5ede9caef11c917againstmainusing the prepared review bundle andrepo_read.pytargeted reads. No commands or tests were run.Results
Negative control
Not run; no tests were executed.
Findings
Blocking
None identified in the code ranges reviewed.
Non-blocking
None.
Sources
Reviewed
description.md,commits.md,manifest.json, anddiff.patch, plus targeted ranges inGuestMemory.hpp,GuestMemory.cpp,Texture.cpp,PendingUntrackedLayer.cpp, andGuestWriteWatch.cppat the pinned head.Not verified
Did not run tests or prechecks. Did not read all lines of the changed files; in particular, the full text of
Texture.cppwas excluded from the review folder as too large, and only relevant ranges were read throughrepo_read.py. The full test and documentation files were not read. The file listing shows eight changed files;Texture.cppis the only one excluded from the prepared full-text bundle.To get this to a good state
Nothing is required. Optional: run the relevant AGC tests and review the remaining changed-file content before treating this as a complete approval.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:54:41Z.
Review: COMMENTED
The trial merge conflicts in
GuestWriteWatch.cpp. The new behavior depends on an unavailable page walk triggering byte comparison instead of discarding pending GPU results. Please keep a case where only part of the range can be collected, with a CPU update in that range and unchanged bytes beside it. That can verify that the fallback preserves the GPU result while still detecting CPU edits. Please move the direct debt update to a fragment. I have no paired Vulkan result for this head.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.