fix(agc): copy GPU-side indirect draw records when the packet is processed #15327
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15327"
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 XatiX on 2026-11-03T00:04:42Z.
What
A GPU-side indirect draw read its records in place from the host import when its batch ran, so a record the guest changed after the packet was processed reached the draw. The console's CP fetches the records when it reaches the packet.
recordIndirectArgumentsnow copies the records into a buffer when the packet is processed, applies the constant vertex and instance rules to the copy, and draws from it. Records stay in place, read when the batch runs as before, when:Recorder::SnapshotWriteOverlaps);PendingLeaseSerial), since those stores are not pending writes.PPSA18653 resets the pool holding its records (a 0xEE fill) after submitting the command buffer and before the GPU runs it. The draw then read 0xEEEEEEEE (about 4e9 vertices times 4e9 instances), hung the GPU and ended in
VK_ERROR_DEVICE_LOST16-30 s after start.APS5_NO_HOST_IMPORT=1andAPS5_NO_GPU_INDIRECT_DRAW=1avoided it. When the console's CP fetch happens relative to such a reset is not measured, which is recorded in technical debt.agc_driver_indirect_argument_snapshotcovers both sides:HoldNextSubmit, must draw the original record (fails onmain);Tested
ctest -V -R "indirect|label|readback|video_out_flip|pending_producer"withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1onmainand on this change, same machine:main: 93/94, onlyagc_driver_indirect_argument_snapshotfails;VUID-error. Logs attached.main, 3/3 fail without the lease check.clock_gettime: unsupported clock_id 20from Party.prx (not addressed here).tools/check_conventions.pypasses;tools/pr_overlap.py --branchfinds no line overlaps.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)clock_gettimeclock_id 20)🤖 Generated with Claude Code
change.log
main.log
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T00:10:10Z.
Review: COMMENTED
Reviewed — no blocking findings
I reviewed all three changed files at head
7282713477b717cb9ea1197fc1d13ce88820bcac; I found no blocking source defect, but the required hosted checks are still queued, so this is a COMMENTED result rather than an approval.What I ran
Reviewed head
7282713477b717cb9ea1197fc1d13ce88820bcacagainst PR base5cb015caaaaf83f8ee431414ee6a457b5b307d49. The stack check reports a clean merge preview against that base. Environment: Debian 12, Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0; I did not compile with GCC.The PR itself reports matching Windows/NVIDIA RTX 5080 tests on
mainand this change, including a negative control. These are author-reported results, not runs I performed. I could not retrieve the claimed attached raw logs from the PR body or its comments.Results
Precheck results and helper output
The two failed helper rows above mean those workspace-only scripts are absent in the isolated PR snapshot, not that source checks failed. The direct ABI audit output was:
The exact-head test-quality heuristic output was:
Negative control
mainand 3/3 failures when the lease check is removed.Findings
Blocking
None found in the three changed files.
Non-blocking
VK_LAYER_KHRONOS_validationavailability messages or compare the raw VUID output. If those files are not visible to reviewers in the PR, please add direct links.Sources
Not verified
No local build, CTest, Vulkan run, hardware test, PS5 console behavior, or negative control was run. The PR author reports the matched RTX 5080 tests and mutation results; their raw logs were not retrievable in the PR content I inspected. Hosted checks were queued at the final status check.
To get this to a good state
Let the six hosted checks complete and make the raw matched GPU logs accessible in the PR if they are not already visible. I will refresh the head and rerun the no-build checks before deciding whether approval is warranted.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T07:33:54Z.
Review: APPROVED
Reviewed — approved
When the packet is processed, the draw now copies its GPU-side indirect records into a pooled host-visible buffer, applies the constant rules to the copy and draws from it. The new test passes on this tree. It fails on
mainand fails with the lease check removed. I found nothing blocking.What I ran
PR head
7282713477b717cb9ea1197fc1d13ce88820bcac, merged with--no-ffintomaind1ae628bc2f62459cce1e9872ba5632c938c71f2(merged tree637575784f7c6e71a55ddd3a29d3392805b27852). Machine: Debian 13 VM, 32 vCPU (2× Xeon Gold 6136), GCC 14.2.0, Release/Ninja, Vulkan on lavapipe (Mesa 26.1.6, LLVM 19), no GPU.Results
git diff --checkcheck_conventions.pylibs(script)main(denormal/division tests, one unwrap test)main(script, 768 tests)VUID-lines; layer loaded in all compared testsagc_driver_indirect_arguments_pending_producer)agc_driver_indirect_argument_snapshotmain's baseline because it is new)VUID-lines, no "was not found" messagegit status --porcelainemptyFocused run
Negative control
Draw.cpprestored frommain:agc_driver_indirect_argument_snapshotfailed 3/3 withbyte 0 of the indirect draw whose record the guest reused after the command processor passed it is 64, the record it was given draws 255.Draw.cppwithout thePendingLeaseSerialcondition: the test failed 3/3 withbyte 0 of the indirect draw whose record an address-based store ahead of it wrote is 64, the record it wrote draws 255.These runs confirm the author's 6/6-on-
mainand 3/3-without-lease claims on lavapipe. They also cover the negative control that MarcZX10's review could not run.Findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceAgcDriver.md:219). CONTRIBUTING asks that "an entry states the gap first". This entry opens with what the driver now does ("copies its records when the packet is processed"). The gap comes second: a record written after processing, by the CPU or by untracked GPU work ahead of the packet, is read before that write, and the console timing is not measured. The neighbouringSET_*_REG_INDIRECTentry has the same layout, so this is only wording. Suggested fix: lead with the difference from the console. The-after(libSceAgcDriver)is also unlike the other entries.core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2059). WhenGuestMemory::Accessible(source, bytes, false)fails, the draw silently uses the old in-place path. The description and the debt entry list only the draw-count, pending-write and lease cases. Consider naming this case in the debt entry, so its list of the cases that still read in place is complete.Code notes from reading the change; none of these is a problem:
mainpath: at prepare time,decide()already sends records with pending storage-image results, labels or copied writes off the GPU path (Draw.cpp at head, L3148-L3161). The snapshot adds the published pending-write ranges (which include the open batch) and address-based leases. The other packet-time CPU reads also checkAnyShadowedOverlaps. Unpublished unit-shadow contents would be just as stale in the import thatmainread in place, so leaving that check out is not a regression.recorder->Keepkeeps the snapshot alive. The non-recorded path submits and waits insiderecordPreparedDraw, so the localshared_ptroutlives the GPU read, asmeshArgumentsalready does.Buffercomes from theBufferPool, so there is novkAllocateMemoryper draw.RangeBytes()is(count-1)*stride + recordBytes, so the constant-rule writes atVertexDwordOffset/InstanceDwordOffsetstay inside the copy.tests/execution/*.cppglob throughagc_add_default_test. That is correct, because it needs no extra environment variants.Not verified
change.log/main.log.clock_gettimeclock_id 20 stop is the author's.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T07:58:38Z.
Review: APPROVED
Re-checked — same head, approved
Correction to my earlier review: the attached
main.logandchange.logare available, and they show the new snapshot test failing on the baseline and passing on the PR run.What I ran
Re-checked open PR #15327 at head
7282713477b717cb9ea1197fc1d13ce88820bcac, against PR base5cb015caaaaf83f8ee431414ee6a457b5b307d49; the source head has not changed since my review. I downloaded and inspected the paired logs linked from the PR description and ran the log comparison script. Review workstation: Debian Linux x86_64. The PR description reports the runs used Windows 11 Pro 26300 and an NVIDIA GeForce RTX 5080 with driver 617.42; the raw logs show the Windows test paths and RTX 5080 but do not themselves record the full commit SHA, OS version or driver version. No local build, CTest or GPU test was run.Results
Unedited log and comparison excerpts
change.log:main.log:compare_vulkan_logs.py:The comparison script checks log contents; it cannot establish from the files alone whether
VK_INSTANCE_LAYERSwas active. The PR description reports that the required validation-layer environment was used.Negative control
main; the PR log uses the snapshot implementation.Findings
Blocking
None found in the previously reviewed source diff. The paired logs support the reported regression fix.
Non-blocking
The raw logs do not include the full tested commit SHA or the
VK_INSTANCE_LAYERSenvironment value; those details are stated in the PR description rather than recorded in the files.Sources
main.logand PR-attachedchange.logNot verified
I did not reproduce the Windows/NVIDIA build, CTest run, validation-layer setup or console behavior. The supplied logs and machine details are author-reported evidence; the log comparison only analyzes their contents.
To get this to a good state
No code change is needed for this head. If the head changes, I will review the new diff and rerun the applicable checks.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T19:54:58Z.
Review: APPROVED
Re-checked — approved
The only new commit,
e4f570a7cf, changes docs alone. The debt entry now starts with the difference from the console, and it lists records the CPU cannot read among the cases still read in place. That resolves both non-blocking points from my last review.Draw.cppand the test are the same as in the commit I approved.What changed since my last review
e4f570a7cf84caf901b99a121d6c68a338eb3bc5docs(agc): lead the indirect record debt entry with the console difference. It changes one line indocs/dev/debt/libSceAgcDriver.md.7282713477is unchanged (the range-diff shows it as=), soDraw.cppandIndirectArgumentSnapshot.cppare identical to what I reviewed.VK_INSTANCE_LAYERSvalue appear only in the description, not in the attached logs, and that later paired runs will record both in the log files.What I ran
PR head
e4f570a7cf84caf901b99a121d6c68a338eb3bc5, merged with--no-ffintomain086c0686c8adff3ee648fdbe34e0b0b647e1d511(merged tree8fe940addd3a787d017c8f108b0aef3ad756b86a). Machine: Debian 13 VM, 32 vCPU (2× Xeon Gold 6136), GCC 14.2.0, Release/Ninja, Vulkan on lavapipe (Mesa 26.1.6, LLVM 19), no GPU.git diff --checkcheck_conventions.pylibs(script)mainagc_driver_image_gather_volumereports VUIDs, marked "test not run on main"agc_driver_indirect_argument_snapshotunder the validation layerVUID-lines and no "was not found" messagegit status --porcelainis emptyAbout
agc_driver_image_gather_volume: the script's baseline (1e658521a0) is older thanmain. Since then,mainhas changed that test and the 3D-gather recompiler in several commits (for examplee92ec413c9and27d9dc2e4e). This PR touches neither samplers nor shaders, so I do not attribute thoseVkSamplerCreateInfoVUIDs to it.Negative control: the test and the production code are unchanged since my last review. There,
Draw.cpprestored frommainfailed the test 3/3, and the mergedDraw.cppwithout thePendingLeaseSerialcondition also failed it 3/3. I did not run either control again.Previous findings
-separator after(libSceAgcDriver)is still there. That is cosmetic and I am not pursuing it.GuestMemory::Accessiblefails)" among the cases read in place, which matches the condition atcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:2059.New findings
Blocking
None.
Non-blocking
None.
Not verified
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T15:28:30Z.
Review: COMMENTED
Ran
e4f570a7cfmerged onmain302864d48con Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Khronos validation layer 1.4.368),ctest -R '^agc_driver_indirect_argument' -V:mainmain+ only this PR'sIndirectArgumentSnapshot.cppagc_driver_indirect_argument_snapshotfails on both GPUs with "byte 0 of the indirect draw whose record the guest reused after the command processor passed it is 64, the record it was given draws 255". With the change, it passes every time.indirect_argumenttests pass in all three builds.was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has aVUID-. To be sure validation messages reach these logs, the same layer with best practices on printed 28BestPractices-warnings into anagc_driver_recorderlog on each GPU.AI-assisted: yes.