Repository navigation
perf(agc): stores beside a range in its 64 KiB block leave the range unchanged - #6346
Conversation
…unchanged UnchangedSince and UnchangedSinceAll answered by the stamps of the 64 KiB blocks a range touches, so a CPU or driver store anywhere in a shared block failed every unchanged proof over it. When a block's stamp is newer, they now look at what wrote the block: the CPU page stamps over the range and the block's driver-store pieces, as StoredOver does. For that answer to see every driver stamp, the walk after an own store stamps the pages it finds dirty in a page map of their own. The unchanged proofs count those pages, so a guest store beside the stored bytes in the same page is not hidden. StoredOver counts them only in a block without driver pieces: where pieces exist it answers as before. They take no driver-piece slot and do not count for the complete coverage StoredAllSince proves. On Windows, a private mapping made over a block that has driver pieces marks them as forgotten instead of dropping them. StoredOver no longer answers stored over for a block whose newer stamp comes only from CPU stores to other pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent CPU correctness check at exact head The unchanged I also ran an external history oracle to vary the offsets beyond the fixed offsets in
Scope: sequential CPU tracker correctness after dirty-page collection. This does not check concurrent renderer interactions, Windows private mappings, GPU execution, or the reported title performance; no FPS claim. |
c128308 to
5532d51
Compare
|
Rebased onto #5554 added
On Windows, a private mapping made over a block with driver pieces marks them as forgotten instead of dropping them; a block without pieces gets no entry. New checks in RTX 3080 (NVIDIA 615.78.08), on 0e4ea13: @simonbbby, thanks for the check at c128308. New since that head: the page map, and on Windows existing pieces are marked forgotten instead of every block being marked stored whole. The merge of touching same-generation pieces is gone, and the whole-block entry now comes from #5554. AI-assisted: yes (Claude Code) |
|
Retested the changed page-map semantics at Same Ubuntu 24.04 / kernel 7.0.0-38 / GCC 13.3 / Ryzen 9 9950X setup, standalone production CPU objects and real Linux write watching:
This covers the important separation: dirty pages can invalidate an unchanged proof without claiming that the driver stored every byte on those pages. No repository source was changed. Scope remains sequential Linux CPU tracking after collection; Windows private mappings, concurrent renderer interactions, GPU execution and title performance were not tested. |
|
Windows/RTX5070Ti617.42 combined cross-test is ready at51b148e100509891c9b194da360e6dd80bdeb16b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-watch-proof-current . Includes #6346 5532d51 and #6273 fdcbb83, on main93e54cedd plus our explicitly listed007/shared-table/level prerequisites. Both author commits applied cleanly; no replacement implementation. 30/30 selected native CPU/Vulkan checks PASS14.19s, no skips, including write_tracking's new cases, repeated-neighbour stores, image-table reuse/bounds, shared-table vouches, draw reuse/verify/inline, storage flush ordering, tessellation, serializer/cache and prebuild unset/0/1. Conventions clean. After final revision-string rebuild,5/5 related controlsPASS1.46s. Combined native evidence, not standalone each-PR evidence; no title FPS result yet. Integration test adjustment: the There is also an opt-in bounded copied-buffer ownership sampler in this test branch (maximum25small records per process, no game contents). Its initial asynchronous output triggered a native process-exit timeout; sampler-off control passed, and switching it to the existing direct trace sink made all3prebuild policies pass with sampling on. That defect was mine, not attributed to either PR. The full native result above has sampling enabled after the correction. Starting a guarded007 cross-test next. AI-assisted: Codex; raw title data local. |
…e on Windows too Since #6346 a CPU write elsewhere in an image table's 64 KiB block no longer fails the table's unchanged proof on Windows, because the proof is answered per page there too. The Windows-only expectation of a second resolution is stale and agc_driver_image_table_reuse fails on Windows. Expect the Linux count on every host.
What
UnchangedSinceandUnchangedSinceAllanswered from the generations of the 64 KiB blocks a range touches. A CPU or driver store anywhere in a block failed every unchanged proof over any range in it. Among them are the proofs that let a draw keep its sampled textures (fastRevalidate), a reused image table (TableCurrent) and a storage image's upload (StorageTexture::refreshProved). Every caller of the two functions and ofStoredOvergets the finer answer. In some runs of 007 First Light (PPSA11386) the CPU writes other pages of the blocks that hold sampled textures in nearly every frame, and most fast revalidations fail and take the full walk.When a block's generation is newer than the query's, the two functions now look at what wrote the block: the CPU page generations over the range and the block's driver-store pieces, as
StoredOverdoes.StoredOverwas already used for this at the shared edge blocks of a surface's write-back (#441).So that this answer sees every driver stamp:
storeOwn) stamps the pages it finds dirty in a page map of their own.StoredOvercounts them only in a block without driver pieces; where pieces exist it answers as before.StoredAllSinceproves (fix(agc): apply completion-proven native depth clears #5554).A block without pieces or walked pages has therefore had no driver store. Forgotten pieces still count as a store over the whole block. One answer of
StoredOverchanges: a block whose newer stamp comes only from CPU stores to other pages no longer reads as stored over.Related:
noteDriverStorecreate a block's entry for a whole-block store; this change relies on that.Tested
agc_write_tracking:CheckSharedBlockProofs(new): CPU and driver stores beside a range leave it unchanged, alone and in a batch. These are seen:StoredAllSincekeeps an own store's exact coverage, is not proven by its dirty pages, and survives own stores elsewhere in the block; a neighbour in an own store's page is not stored over but reads as changed.CheckVersionRanges: the exact expectation was block-wide. It now checks three things:It also adds whole-block stores to the random history.
ctest -R '^agc'on this branch (onmain0e4ea13): 593 tests, 1 failure.agc_driver_store_over_untrackedfails the same way onmain3ee5371 (reported on fix(agc): save pending storage results in every 64 KiB block that leaves the write watch #5671).agc_driver_stencil_ref_exportskips itself on this machine.ctest -R '^agc', 589 tests, 8 failures, the same 8 as onmain4e9a2a8 built the same way. The container has no write watching, so the write-tracking tests skip there,agc_write_trackingincluded.APS5_PROFILE_DRAW=1in every run, for the revalidation counters. Both arms of these runs also setAPS5_HOST_IMPORT_MIB=12288,APS5_RESOURCE_CACHE_ENTRIES=64andAPS5_NO_DRAW_SRT_ENTRIES=1.The counters are cumulative at the end of the run (frames 252–259). B4's menu started later than the others' (frame ~210 instead of ~175–185), so its window starts with the menu and it has fewer revalidations. In every 10 s interval that started after frame 150, the share of revalidations that took the full walk was:
APS5_TRACE_FRAMES=200:40set, warm caches, the same tree; the sandbox writes the log to a file. 2 of the 5 A captures ran at about 0.45 FPS over frames 215–255 (one of them while a build ran on the machine), none of the 6 B captures did. 6 are attached, the ones with a saved trace that ran without another load on the machine: 3 per arm (the trace files are the assets aps5-trace-A1–A3 and B1–B3 of https://github.com/SleglJan/AnyPS5/releases/tag/perf-traces-unchanged-shared-block, in the order of the lines below). Commit 7141b56717d8 is the A build and 91e399694be4 the B build (both local). Frame p50, base (A): 2,240, 1,547 and 1,561 ms; with the change (B): 1,554, 1,641 and 1,553 ms. The first A capture had 327 ms of GPU work per present against 158–166 in the others and 11,028 ms ofDriver.Packetper frame against 7,636–8,083.{"commit":"7141b56717d8","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":89632.562},"presents":40,"frame_ms":{"p50":2239.687,"p90":2341.581,"p99":2416.897,"max":2416.897},"gpu_busy_ms_per_present":327.461,"worker_busy_pct":{"queue worker 0x0":99.979,"queue worker 0x20":97.573,"queue worker 0x28":98.590,"queue worker 0x30":98.588,"queue worker 0x38":97.573},"top_phases_ms_per_frame":{"Driver.Packet":11028.243,"Driver.Packet.memory_wait":8297.673,"Driver.Packet.draw":2155.935,"Driver.Draw":2155.674,"Driver.Draw.shader_compile_and_link":1356.085,"Shader.DrawStage":1335.618,"Shader.DrawStage.capture_resources":1171.822,"Driver.Draw.draw_and_resource_release":779.367},"trace_dropped":false,"trace":"aps5-trace-7141b56717d8-2.json.gz"} {"commit":"7141b56717d8","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":62039.415},"presents":40,"frame_ms":{"p50":1546.925,"p90":1593.178,"p99":1618.618,"max":1618.618},"gpu_busy_ms_per_present":158.336,"worker_busy_pct":{"queue worker 0x0":99.973,"queue worker 0x20":97.707,"queue worker 0x28":98.620,"queue worker 0x30":98.616,"queue worker 0x38":97.712},"top_phases_ms_per_frame":{"Driver.Packet":7636.375,"Driver.Packet.memory_wait":5873.218,"Driver.Packet.draw":1478.977,"Driver.Draw":1478.760,"Driver.Draw.shader_compile_and_link":1110.349,"Shader.DrawStage":1095.407,"Shader.DrawStage.capture_resources":943.222,"Driver.Draw.draw_and_resource_release":357.749},"trace_dropped":false,"trace":"aps5-trace-7141b56717d8-2.json.gz"} {"commit":"7141b56717d8","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":62364.688},"presents":40,"frame_ms":{"p50":1560.970,"p90":1613.087,"p99":1644.182,"max":1644.182},"gpu_busy_ms_per_present":160.874,"worker_busy_pct":{"queue worker 0x0":99.974,"queue worker 0x20":97.500,"queue worker 0x38":97.519,"queue worker 0x28":98.506,"queue worker 0x30":98.503},"top_phases_ms_per_frame":{"Driver.Packet":7668.336,"Driver.Packet.memory_wait":5886.401,"Driver.Packet.draw":1485.632,"Driver.Draw":1485.405,"Driver.Draw.shader_compile_and_link":1112.668,"Shader.DrawStage":1095.616,"Shader.DrawStage.capture_resources":942.856,"Driver.Draw.draw_and_resource_release":361.708},"trace_dropped":false,"trace":"aps5-trace-7141b56717d8-2.json.gz"} {"commit":"91e399694be4","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":62183.827},"presents":40,"frame_ms":{"p50":1554.095,"p90":1591.655,"p99":1630.537,"max":1630.537},"gpu_busy_ms_per_present":163.514,"worker_busy_pct":{"queue worker 0x0":99.971,"queue worker 0x20":97.632,"queue worker 0x28":98.608,"queue worker 0x30":98.606,"queue worker 0x38":97.635},"top_phases_ms_per_frame":{"Driver.Packet":7653.412,"Driver.Packet.memory_wait":5908.576,"Driver.Packet.draw":1486.227,"Driver.Draw":1486.015,"Driver.Draw.shader_compile_and_link":1110.462,"Shader.DrawStage":1099.376,"Shader.DrawStage.capture_resources":943.954,"Driver.Draw.draw_and_resource_release":367.067},"trace_dropped":false,"trace":"aps5-trace-91e399694be4-2.json.gz"} {"commit":"91e399694be4","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":65669.167},"presents":40,"frame_ms":{"p50":1641.170,"p90":1688.472,"p99":1719.335,"max":1719.335},"gpu_busy_ms_per_present":159.693,"worker_busy_pct":{"queue worker 0x0":99.973,"queue worker 0x20":97.663,"queue worker 0x38":97.666,"queue worker 0x30":98.611,"queue worker 0x28":98.613},"top_phases_ms_per_frame":{"Driver.Packet":8082.924,"Driver.Packet.memory_wait":6239.263,"Driver.Packet.draw":1575.564,"Driver.Draw":1575.358,"Driver.Draw.shader_compile_and_link":1193.099,"Shader.DrawStage":1182.535,"Shader.DrawStage.capture_resources":1029.930,"Driver.Draw.draw_and_resource_release":372.720},"trace_dropped":false,"trace":"aps5-trace-91e399694be4-2.json.gz"} {"commit":"91e399694be4","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"200:40"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","resolution":"3840x2160","window":{"spec":"frames 200:40","first_present":200,"ms":62375.632},"presents":40,"frame_ms":{"p50":1552.708,"p90":1610.929,"p99":1629.742,"max":1629.742},"gpu_busy_ms_per_present":165.812,"worker_busy_pct":{"queue worker 0x0":99.973,"queue worker 0x20":97.544,"queue worker 0x28":98.513,"queue worker 0x38":97.548,"queue worker 0x30":98.511},"top_phases_ms_per_frame":{"Driver.Packet":7669.890,"Driver.Packet.memory_wait":5933.916,"Driver.Packet.draw":1490.126,"Driver.Draw":1489.903,"Driver.Draw.shader_compile_and_link":1109.717,"Shader.DrawStage":1104.190,"Shader.DrawStage.capture_resources":948.091,"Driver.Draw.draw_and_resource_release":368.592},"trace_dropped":false,"trace":"aps5-trace-91e399694be4-2.json.gz"}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)🤖 Generated with Claude Code