fix(agc): collect fresh CPU writes before depth plane stores #11690
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11690"
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 JJenkx on 2026-10-27T02:56:32Z.
What
A CPU write after an earlier memoized
CollectWritesin the same epoch can be missed when a stale depth plane is flushed. The depth store then overwrites the CPU-repurposed unit, including vertex descriptors. Collect writes uncached immediately beforeFlushDepthPlanessynchronizes the plane, matching the existing storage-image writeback rule; keep collect memoization elsewhere.The regression draws depth into a six-unit plane, primes the collect memo, writes a descriptor into one unit without advancing the epoch, then requests a small read from that unit. It checks that the descriptor survives, that the repurposed unit is not stored, and that an untouched unit still returns its GPU depth.
Overlap review: #11685 changes depth-copy methods and adds a different argument to the same fixture. Neither implementation depends on the other; preserve both command-line modes when combining their test edits. Other shared depth-source diffs were checked for a duplicate fresh collection in this store path; none found.
Tested
Current-main refresh, 2026-10-27 10:18 UTC pass: exact head
748661795896eca6fd54dbae3a7aad3de45ac859on main3fea2a937ba9fbab2f06c51691fe0c5763659aa3. One topic commit retains the fresh collect immediately before the stale-plane store, with current main's separate buffer-copy control preserved. All submodule pointers match that main.Linux Release, RX 6650 XT/RADV Mesa 26.2.4, required Vulkan and shader caches disabled. Matched main passes all three existing controls three times (9 passes). Candidate passes four groups × three repetitions (12 passes), then 12 again after restoration. Replacing only production DepthSurface.cpp with main fails exactly the memoized-collect regression; the three controls pass. The within-unit regression places a 4 KiB unwatched hole and CPU descriptors in an adjacent watched page of the same 64 KiB unit, checking descriptor preservation and retained GPU depth.
Every individual physical execution proves RX 6650 XT selection and actual Khronos instance/device-layer insertion; zero skips, VUIDs or missing-layer failures. Restored production source matches the candidate, and the rebuilt AGC driver is byte-identical to its initial candidate. The forced-buffer setting is recorded in the executed harness/process environment and linked to the startup flag; CTest does not print every inherited variable. Conventions and whitespace pass. This is synthetic GPU regression evidence, without a new title, console, Windows or performance run. Earlier contributor results retain their original exact pins.
Exact source/dependency pins, initial/negative/restored raw logs and JUnit, forced-buffer receipt, independent reviews, hashes and service-owned FIFO/PTY receipts. SHA-256:
4787a341e92b9f1764de6e6bc11f7ae5af8d8e21ff5c75f8f71483c60742d798; downloaded copy verified.Independent validation by jotitadev, exact head
0907519c74on mainb986c11a34: RTX 3070 / NVIDIA 595.99.02 and lavapipe / Mesa 26.0.3, Ubuntu 26.04. Main plus the new memo regression fails on both devices; adding the production fix gives 3/3 passes on both. These are reviewer-run results, separate from the author RADV qualification.Arch Linux, AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1. Same source/build directory and GPU for both arms; main
abed03546804575703dbedcdd3c65efc6bf5d0f2plus only the new regression isa43914cb24230136104b74e8cf7653ec4bf7cb2f; adding the one-line fix is0907519c746f153526c619f1fefb738ef406b1dd.Both ran:
Main plus regression: existing two controls pass; the new test fails with
a depth flush overwrote CPU descriptors written after a memoized collect. With the fix: 3/3 pass. Both logs show three actual Khronos layer insertions, no missing layer, no skipped tests, and zeroVUID-errors.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branch codex/depth-plane-fresh-collect-20261027was run; shared-fixture overlap noted above.Paired logs, results and patch, SHA256
2ce1a72c81723057ac6024668414a33b661fb425e1610274e80c09a0bb202188. No performance claim. Windows and other GPU vendors not tested. Bendy PPSA27624 discussion #10154 motivated the investigation. A follow-up native run on the same earlier diagnostic integration plus only this production line still exits 134 with overwritten descriptors (actual Khronos active, zero VUIDs, all state restored); the fresh scan fixes the synthetic memo regression but does not fix the title. No native-title unblock claimed.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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T05:08:43Z.
Review: COMMENTED
Linux run on NVIDIA and lavapipe, since the description covers RADV only. Head
0907519c74onmainb986c11a34(patch applies cleanly). Ubuntu 26.04, GCC 15.2, Release.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,-j1. lavapipe selected withVK_ICD_FILENAMES=.../lvp_icd.json.agc_driver_depth_plane_partial_store,_partial_store_unimportedandagc_driver_depth_plane_cpu_write_after_memo:main+ the new test onlya depth flush overwrote CPU descriptors written after a memoized collect; both controls passmain+ the test + theDepthSurface.cpplineSo the test catches the bug on both devices, and the one-line fix is what makes it pass.
Full
^agcsuite (withoutagc_display_buffer_dcc,agc_driver_flip,agc_driver_lds_atomics64,--timeout 30) with #11692 and #11691 applied together onmain: 1041/1042 on both devices. The one failure on each also fails on unmodifiedmainon this machine, with the same message:agc_driver_pipeline_journalon the 3070 (the oversized record was not counted as a write failure; it passes when only the NVIDIA ICD is visible), andagc_driver_multisample_retirementon lavapipe (MSAA storage promotion did not retain its source image).GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:28:18Z.
Review: APPROVED
Reviewed exact head
0907519c746f153526c619f1fefb738ef406b1dd; approve.The fresh uncached collect is placed immediately before
SyncFromMemoryin the stale-plane flush path. That refreshes write stamps even when a same-epoch memoized collect would otherwise be reused, allowing the existing per-unitWrittenSincecomparison to protect CPU-repurposed bytes. The new regression primes that memo, performs a CPU descriptor write without advancing the epoch, and checks descriptor preservation plus GPU depth in an untouched unit. I found no duplicate fresh collect in the same path.Validation evidence: the author reports main-plus-test failing and the fix passing on RADV with the validation layer active and zero VUIDs. An independent reviewer reports the same focused result on RTX 3070 and lavapipe. I could not run a fresh local GPU test in this environment; hosted product jobs are skipped by path policy. The fixture also overlaps #11685, so integration should retain both PRs' separate test modes.