fix(agc): store polled guest labels with release stores #22029
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22029"
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 chitters2004 on 2026-11-17T02:14:32Z.
What
Depends on #20185, which reads polled guest labels with acquire loads (
Pm4::LoadLabel,GuestMemory::ReadLabel). This PR does the writer side of the same labels: the stores a poller pairs with were still plainmemcpys, so an acquire poll had no release to synchronize with, and ThreadSanitizer reports the writer against the poll.Driver label stores. A label write names its width, taken from what the operation means, and goes through one primitive,
GuestMemory::StoreLabelWords(WriteLabelsfor packet writes,StoreOwnLabelsfor write-tracked stores). It stores each word with a releaseatomic_refstore at the guest address.LabelWrite::Width,DeferredLabel::width, thecommitLabelwidth).Recorder::AfterCompletions) receive the label's width fromVulkanDevice::WriteLabelOnGpu; width 0 is a plain store.VulkanDevice::CopyBufferpublishes a 4- or 8-byte range atLabelStoreWidthof that range.GuestMemory::Write,StoreOwnBytesof a byte span) keepLabelStoreWidth: one 8-byte store for an 8-byte-aligned qword, otherwise 4-byte stores. It depends on the address and size, not on the caller'salignment, which onlyCheckRangeuses.GuestArenaWriteSharedBacking, amemcpythrough a second mapping) and takes the release stores at the guest address. Longer writes keep the backing view. See "Cost" below.Validaterejects a 64-bit RELEASE_MEM to any other address, andAgcDriverStoreGuestLabel_nid_postfixchecks alignment.Label loads mask the address.
Pm4::LoadLabelmasks the address to its width, as the GPU does for WAIT_REG_MEM and WAIT_REG_MEM_64, so it never makes a misalignedatomic_refaccess whatever its caller passes. The callers already passed aligned addresses (DecodeWaitandWaitSatisfiedmask the same way), sonoteHeldAtSubmitno longer has its own alignment check; that check could never fail.Frame replay.
tools/FrameReplay.cpppublishes through the same primitive:restoreGroupbuilds one table of the awaited words a memory group touches, at their waits' widths: held waits, parked REWIND controls and polled labels; a dword inside a qword merges into it and keeps the stronger publication. Each word is seeded from memory once a GPU write pending over it has landed, left out of the bulk copy of the delta, laid over by the group's chunks in recording order, and stored once after the delta's data, or staged once for its later release when held. A word that two chunks split, or that a later chunk partly rewrites, is therefore never copied plainly or published twice.releaseStaged,writeRecordedValueand the synthetic release store at the wait's width;loadand the "already equal" check are acquire loads. A recorded value is replayed only when one recorded chunk holds the whole awaited word.The held-wait overlap check is the one #17338 uses, so the two merge cleanly. All five
FrameReplay.cpphunks touch lines #22156 also changes: thereleaseStagedstore, therestoreGroupcandidate loop and release stores,load,writeRecordedValue, and the synthetic release. The merge keeps this PR's label stores and #22156'sCopyToGuestBytesfor the delta data between them.Test,
testStoreAfterGatedCopy. It now waits for a label the GPU writes after the gated copy, instead of polling the copy's target bytes with plain reads.agc_driver_pm4_replaynow submits a WAIT_REG_MEM_64 whose address dword has bit 2 set, over an 8-byte label that matches at submit. libSceAgc never emits that form, but a title can build the packet itself. The wait must be marked held at submit and released by that route. With both theDecodeWaitandLoadLabelmasks removed, the test fails.New tests. In each, a writer thread writes a payload and then stores the label. The main thread polls the label with an acquire load and must see the payload before it joins.
agc_driver_pm4_written_label_thread: the label is stored by a WRITE_DATA.agc_driver_pm4_written_label_alignment_one_dwordand_qword: an ordinary 16-byteWriteresets the label before polling starts. The writer makes an ordinary 24-byte payloadWrite, then callsWrite(label, 4 or 8 bytes, 1).agc_driver_pm4_write_data_label_second_dwordand_third_dword: a two- or three-dword WRITE_DATA, polled at its last dword, 32 rounds each.agc_driver_cpu_label_publish: 4- and 8-byte labels through the CPU path ofCopyBuffer(the test requires that path), and a three-dword completion label polled at its last dword, 8 rounds each.agc_driver_frame_replay_awaited_label_split_dwordand_halfword: a 64-bit WAIT_REG_MEM label captured in two chunks, split at its middle dword or inside its first dword._rewind_control_split: a REWIND control captured as two halfwords._held_label_overlapped: a held qword captured whole and then partly rewritten by a later chunk._held_waits_overlapping: a held qword wait containing a held dword wait._held_label_pending_write: a GPU write pending over a held label's high dword, outside the recorded bytes.agc_shared_write_label_publish_dwordand_qword:StoreOwnBytesof the label over a real direct mapping. On Linux the test first checks that the backing writer accepts the range.The debt entry "Label publication" states what this PR covers and lists the writes that do not give a release at the polled width:
Writes and backing-view writes;WriteChanged*;StoreOwnBytescallbacks;GuestCopyOut_nid_no_patchin libc and file reads into guest memory underGuestArena::HostWritein libkernel.LabelStoreWidthandPm4::LoadLabelpick matching widths for the same packet; when a title polls a different width than it writes, the C++ model gives no release/acquire pairing between the twoatomic_refobjects (x86-64 orders it anyway), and the same-width fixtures here do not test it.Resetting a label before its wait starts is fine.
Out of scope: bulk copies that race other readers (capture
copyCommittedBytes, DMA copies, the replay's delta data itself,copyLink), write-tracking compares, and test-side bulk polls.Cost
On Linux, a label stored at the guest address of a write-watched page takes one write-watch fault, which the backing view avoided.
storeOwncollects before and after each tracked store, so consecutive tracked label stores to one page can each fault. Measured in one process on one fork CI runner (AMD EPYC 7763), both routes interleaved, 20 passes of 256 stores each, watch re-armed before every store (--benchmark-label-routes, a measurement-only mode, not in this PR):Run: 46232330853 (measured on cc42dadd535, the same
GuestMemorycode). Windows takes no fault on this path.How many tracked label stores a frame makes does not depend on the platform. Replaying a three-frame GTA V capture (PPSA04263 01.011.001, prologue, Windows RTX 3080) with a counter on every tracked label store (a measurement-only build, not in this PR) gives 18 stores for one pass and 56 for three, about 6 per frame, each on one page. At 5.3-7.3 us extra per store that is at most 0.03-0.05 ms per frame on Linux for this scene. It is one workload, not a bound: a title that publishes many more labels per frame pays proportionally more. Release stores through the backing view would keep the fast route and are correct on x86-64 and arm64, but ThreadSanitizer cannot see them; that is a follow-up.
Tested
Fork CI on this head
4398f790da, on theagc_driver_pm4_(written|write_data)*, shared-write,agc_driver_frame_replay*,agc_driver_recorderand label execution tests (96 tests):Run 46244717472, Linux gate, Windows and ThreadSanitizer:
VUID-lines. The log hasCPU label publish tests passedand, for bothagc_shared_write_label_publishtests,Label publication over direct backing test passed, so they ran on the backing path rather than skipping.agc_driver_frame_replay_cold_pipelinesandagc_driver_recorderfail on themainbasebb89b8a4f5too.copyCommittedBytes,copyLink, the test fixture'sReserve), aWriteTrackerstatic destructor racing the collect-prefetch thread at exit (multisample_depth), andhost_neighbors, which cannot map its host range under ThreadSanitizer. The tsan job buildstests/executionsources as skip stubs, soagc_driver_cpu_label_publishran in its own TSan runs below.ThreadSanitizer with
agc_driver_cpu_label_publishbuilt (execution_tests=CpuLabelPublish):write_datasecond / thirdcpu_label_publish4398f790dab9002d15e7)fa2a5f0b8e)Write(on123b6624b7)memcpy(on123b6624b7)StoreOwnBytes(on123b6624b7)123b6624b7)On the old code each label test reports the payload read after the poll, for example:
with the label written by
memcpyfromstoreGuestBytesor from the CPU copy inVulkanDevice::CopyBuffer, againstPm4::LoadLabel's acquire load. The two replay splits reportrestoreGroup'smemcpyagainst the queue's poll; the three held tests fail by value in any build (a stale or partial staged value, or the label written before its release).awaited_label_split_dwordpasses on the old code too (two dword release stores reach the same value) and is kept as layout coverage. The red-first runs prove final values and the plain accesses ThreadSanitizer sees; none of these tests observes an intermediate publication, so none proves by itself that a qword is published once rather than as two dwords. The three-dword WRITE_DATA test survives the relaxed mutant in two runs; six other label tests kill it.agc_driver_frame_replay_rewind_releasefailed once in 46244736101 on a capturecopyCommittedBytesbulk copy againstWriteand passed in 46244717472.Windows, local (MinGW GCC 15, RTX 3080): the 28
agc_driver_frame_replaystate and REWIND tests, the six new ones included, pass on4398f790da.Windows, local, on
123b6624b7: the 90 tests of that head pass 3 times in a row with the single-round tests (ea1cf37a029); with the final repeated tests,agc_driver_pm4_(written|write_data)*,cpu_label_publish,fill_completion_labelsandrecorderpass twice.python3 tools/debt_fold.py --checkpasses.No game timing. The Windows label path is the same
movwith release ordering as before. The Linux cost is measured above, with the per-frame count from a GTA V replay.Earlier, on the previous head:
Local, Linux lavapipe (LLVM 20.1.2), on #20185 merged with
main38c924f1de. The branch is now #20185's heade3d9cefb3amerged withmain802a0aeb2d, with the four commits of this PR on top:ThreadSanitizer, gcc 13 RelWithDebInfo:
agc_driver_pm4_written_label_threadfails 3 of 3 without part 1 (exit 66, one race:Write'smemcpyagainst the acquire poll) and passes 5 of 5 with it, with no warnings.Release build:
agc_driver_pm4*and theagc_driver_frame_replay*set pass 77 of 77.On the new head (#20185
e3d9cefb3amerged withmain802a0aeb2d):agc_driver_pm4*and theagc_driver_frame_replay*set pass, 76 of 76.Small-write microbench:
GuestMemory::Writefrom one thread, 200,000 writes per rep, 7 reps, median ns per write, order A B B A (A = without part 1, B = this PR):The differences are within run-to-run noise. This benchmark predates the label routing: on Linux, label-width stores over direct backing now go to the guest address instead of the backing view (see Cost), while other stores of 12 bytes or more run the same
memcpyas before.Fork CI on this head
52627c572b(run 44044854305, Linux gate, Windows and ThreadSanitizer): Linux gate 76/76 and Windows 75/76 (the one failure,agc_driver_frame_replay_cold_pipelines, fails onmaintoo), 0VUID-lines; under ThreadSanitizer the remaining reports inagc_driver_frame_replay*andagc_driver_pm4_replayare all bulk guest copies (storeGuestBytes/copyCommittedBytes,Emit, the test fixture'sReserveagainstrestoreGroup), which #22156 handles on top of this PREarlier, on 423e71ea75 (run 43996886641):
main802a0aeb2d: 75 of 75), including the newagc_driver_pm4_written_label_thread. No VUID lines.agc_driver_frame_replay_cold_pipelines, also fails on the base.agc_driver_frame_replay_rewind_store. That is the replay race fixed in #22026.python3 tools/check_conventions.py --base origin/main: no new findings. The debt fragmentdocs-nkwebkit-drop-readded-count-lines.mdfails onmainitself.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T07:17:16Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
PR #22029 at head
72bd7753eb, base main. I found no verified defect in the changed hunks, but I could not run the build or the tests in this review, so the verdict is a comment, not an approval.What I ran
diff.patchat the pinned head.repo_read.py: a search forheldintools/FrameReplay.cpp, a search forbumpWaitEpochand the label helpers in the driver, andGuestMemory.cpplines 3990–4032,WaitStatistics.cpplines 118–128.ctest, nocheck_conventions.py.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp:117:Pm4::LoadLabeltreats every size other than 8 as a 4-byte load.GuestMemory::ReadLabelinGuestMemory.cppthrowsinvalid_argumentfor any size other than 4 or 8. The callers I found pass 4 or 8, so this is not a live defect. Matching the throw, or asserting inLoadLabel, would make a wrong width fail loudly.Not verified
diff.patchand the head context listed under What I ran.heldWaits()snapshot intools/FrameReplay.cpp(called at line 505) matches theAgcDriverAwaitedWaitssnapshot insiderestoreGroup. The removed write-back of held words relies on the two being the same. I did not confirm this.GuestMemory::ReadLabelcallsGuardReadandFlushGpuWritesbeforeCheckRange. I did not compare this order withGuestMemory::Read.docs/dev/BUILD.md, line 408) is not checked against the fence code.agc_driver_frame_replay_cold_pipelinesare not confirmed by me.To get this to a good state
Nothing is required.
Optional: make
Pm4::LoadLabelreject sizes other than 4 and 8 the same wayReadLabeldoes (Pm4.hpp:117).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T12:16:05Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
52627c572bfe556f88961aaccf10753c5da0e514, basemain.diff.patch, then the head text of the code around the changed hunks with the repository reader.Results
diff.patchPm4.cpp,GuestMemory.cpp,tools/FrameReplay.cppFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/tests/Pm4Replay.cpp:204:wideHeldTag[6] |= 4uchanges the mask's low dword, not the address.DecodeWaitreads the address frompacket[2..3]and the mask frompacket[6..7](core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp:806). The mask is~0ull, so the OR changes nothing, and the wait's address stays 8-byte aligned. The test therefore does not exercise the 4-byte-aligned packet address the description says it covers. Suggested fix:The masked address still reads the same 8-byte label, so the expected value holds.
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:3679:ReadLabelcopiesReadbut drops itscatcharoundCheckRange(GuestMemory.cpp:3669-3675). A wait on an unreadable label no longer logs underAPS5_TRACE_UNREADABLE. This is a debug-only trace, so the effect is small. Either keep the trace inReadLabelor haveReadLabelcallReadinto a local.Checked and fine: removing the alignment check in
noteHeldAtSubmitis safe, becauseDecodeWaitalready masks the address to the awaited width (Pm4.cpp:806).WaitAwaitedBytesreturns only 4 or 8, soLoadLabelandReadLabelnever throw on a valid wait.Not verified
sceAgcDcbWaitRegMemis outsidelibSceAgcDriver. I did not read it, so the packet layout the test builds is assumed, not confirmed.FrameReplayrestore, and the two-dword write semantics the description attributes to the GPU, were checked by reading, not by running.files.jsonreviewed, through the diff. Head text only for the ranges above. Excluded by rule: none.To get this to a good state
Nothing is required. The two non-blocking points are optional.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T13:00:53Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
Head reviewed:
0dea130854(base main). Review is a static read of the diff with targeted context; I did not build or run tests.What I ran
diff.patch(covers all 15 reviewed files).files/copies:tools/FrameReplay.cpp(releaseStaged,restoreGroup),Pm4.cpp(WaitSatisfied,WaitSatisfiedUnchecked,DecodeWait),WaitMemory.cpp(awaited address mask).Results
noteHeldAtSubmitalignment check is redundant:DecodeWaitmasks the address (checked)Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp:589:releaseStagedstores each dword throughstd::atomic_ref<std::uint32_t>atword.address + at. If a held wait's address were not 4-byte aligned, that is a misaligned atomic access. The oldmemcpyhad no such requirement. Held waits come fromheldWaits(), which does not check alignment. Likely safe becauseAgcDriverAwaitedWaitsaddresses come from maskedDecodeWait, but I did not confirm that path. Suggest an assertion or a skip for unaligned addresses.core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp:586: the loopat + 4 <= word.value.size()silently drops trailing bytes when the size is not a multiple of 4. Staged sizes arewait.bytes(4 or 8), so there is no effect today. A short comment-free guard or anifwould make the intent explicit.Not verified
AgcDriverStoreGuestLabel_nid_postfixalignment check and the 64-bit RELEASE_MEM rejection inValidate: described in the PR body, not read.restoreGroup. The removedmemcpyof current target bytes for held waits (tools/FrameReplay.cpp, around line 641) means such words are now overwritten by the delta. Not confirmed reachable.testWrittenLabelPolledAcrossThreadsandtestWaitRegMemAcquiresPublishedData: read as written; not checked againstexecuteand the PM4 test harness.storeGuestBytesordering againstCopyGuestBytes): reasoned from the diff, not checked against the rest of the write path.reviewed, with full-context reading only for the sections listed under What I ran. Excluded by rule: none.To get this to a good state
Nothing is required. Optional: add an alignment guard in
releaseStaged(tools/FrameReplay.cpp:589) and make the 4-byte trailing-size case explicit (tools/FrameReplay.cpp:586).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T14:04:23Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional. Head
d726f18fdc6a, basemain. The review covers the diff and a few repository lookups, not the full text of the changed files.What I ran
Head SHA
d726f18fdc6a7f2c87560a52cd9672b6ae6114fa, basemain. No build and no tests were run in this review. Commands, all through the repository reader:Reader commands
A fourth combined search (an alternation pattern) returned no matches. I did not treat it as evidence.
Results
files/copies were not openedThe author reports Linux 76 of 76 and Windows 75 of 76, with the Windows failure also present on
main. I did not run these, so they are author-reported only.Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:3684:ReadLabelrepeats the width check and the atomic load ofPm4::LoadLabel(Pm4.hpp:116). UnlikeLoadLabel, it does not mask the address. Both callers pass aligned addresses, so this is correct today, but the two helpers can drift apart. An assert or a shared helper would keep them in step.core/libs/prx/libSceAgcDriver/tests/Pm4.cpp:2393:testLabelLoadWidthscoversLoadLabelonly.testUnreadableLabelTracecoversReadLabelonly for an unmapped page. No test exercisesReadLabel's width rejection or a misaligned address.Sources
Pm4.hpp:116— inlineLoadLabel.GuestMemory.cpp:3684—ReadLabel.GuestMemory.cpp:4044—AgcDriverStoreGuestLabel_nid_postfix, found but not read.Not verified
files/, andfiles.json, were not read. The review is limited to the diff hunks and three reader lookups.noteHeldAtSubmitdrops itsaddress % 4guard on the argument thatDecodeWaitalready masks the address.DecodeWaitwas not read.Validaterejecting a misaligned 64-bit RELEASE_MEM, andAgcDriverStoreGuestLabel_nid_postfixchecking alignment, were not confirmed. The second function was found at the line above, but its body was not read.ReadLabelrelies oncheckReadablewith alignment equal to the width to reject misaligned reads.CheckRangewas not read.tools/FrameReplay.cpp,restoreGroupnow stops copying the current target bytes into a held wait. Held words are kept out of the bulk copy only if they also appear among the awaited waits. I did not confirm that held waits always appear there, so their words may now receive delta bytes.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T14:55:06Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
Head reviewed:
75513feceb(base main).What I ran
repo_read.py search DecodeWaitandrepo_read.py catonExecution/src/Pm4.cpp(DecodeWait) andtools/FrameReplay.cpp(restore and release code), at the pinned head.Results
Findings
Blocking
None.
Non-blocking
tools/FrameReplay.cpp:582:releaseStagednow throwsstd::runtime_errorwhen a held word is not a whole, 4-byte-aligned dword run. Before, it copied any length withmemcpy. The held addresses come fromDecodeWait, which masks them to the wait's width, so the throw should not fire for waits libSceAgc emits. I did not find a test that covers the throw, so a bad capture would now abort the replay rather than copy the bytes.Not verified
diff.patch,DecodeWaitat the head, and therestoreGroupandreleaseStagedregion oftools/FrameReplay.cpp. The rest of the context was not read, so the review is incomplete.Validatecheck on 64-bit RELEASE_MEM and theAgcDriverStoreGuestLabel_nid_postfixalignment check named in the description were not read.polledlist, so the bulk copy leaves them alone, was reasoned from the code, not confirmed in the awaited-slot code.std::invalid_argumentandstd::runtime_erroruses intests/Pm4.cpp) was not checked.To get this to a good state
Nothing is required.
Optional: state in the description whether a held-wait capture with an unaligned word can reach
releaseStaged, or add a test for the throw.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T00:49:24Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review supports merging, though I did not independently run its tests.
What I ran
f4458d2c779a4e00c7da7bd2554ac6a0776ebd72usingrepo_read.pyand the prepared review bundle.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
included: trueinmanifest.json; no files were excluded by the manifest. The bundle'sfiles.jsonwas not available as a review-folder file.description.md,commits.md,manifest.json, anddiff.patchwere read. Repository context was read throughrepo_read.pyat the pinned head.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:58:01Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the code reviewed; the remaining scope and runtime checks were not verified.
What I ran
Read the prepared diff for head
6e414cae536a99b9b367a79b068089ce2a242ab7and targeted code at that head withrepo_read.py. No build or tests were run.Results
Findings
Blocking
None in the code inspected.
Non-blocking
None.
Not verified
The manifest lists 14 changed files, all marked included, but the prepared diff ends after 12 file sections and does not show the listed
docs/dev/BUILD.mdordocs/dev/debt/libSceAgcDriver.mdchanges. I read 10 of the 14 files listed in the manifest:GuestMemory.hpp,Pm4.hpp,Submission.cpp,WaitMemory.cpp,WaitStatistics.cpp,GuestMemory.cpp,Pm4.cpp,tests/FrameReplay.cpp,tests/Pm4.cpp,tests/Pm4Replay.cpp,tests/Pm4ReplayTool.cmake,tests/cmake/agc_driver_graphics_tests.cmake,tools/FrameReplay.cpp,docs/dev/BUILD.md, anddocs/dev/debt/libSceAgcDriver.md—correction: this is 15 paths, of which the last two were not read from the repository; their diff text was inspected. The remaining verification limitation is that I did not inspect each complete file or run tests. The description’s local and CI test results are author-reported, not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T18:50:46Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the remaining bulk-copy races are outside its stated scope.
What I ran
5f0d02f5541200bfcfd5984e5d774fa30b7b221fusing the prepared diff andrepo_read.pyfor targeted source context.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
manifest.json; none were excluded. The review useddescription.md,commits.md,manifest.json, anddiff.patch; no repositoryfiles.jsonwas available in the prepared review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T15:44:31Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
f81848b170dbc1e27b4bff7a17a61cfae33950a6using the prepared review bundle andrepo_read.py. I did not run tests or other commands.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Behavior claims were checked against the prepared diff and code read at the pinned head; no external links were used.
Not verified
I did not run tests or independently verify the reported build, sanitizer, CI, or benchmark results. All 11 changed paths are included in the review manifest; I reviewed their changed hunks in
diff.patchand targeted head code ranges where relevant, not every full file.files.jsonwas not provided in the reader listing, so excluded files are not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T15:45:18Z.
Review: COMMENTED
Actionable comments posted: 1
a10b4f7e-a983-4aa3-aa3d-a366a7da1193Reviewing files that changed from the base of the PR and between
bb89b8a4f5andf81848b170.core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/include/Pm4.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/tests/FrameReplay.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4Replay.cppcore/libs/prx/libSceAgcDriver/tests/Pm4ReplayTool.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmakecore/libs/prx/libSceAgcDriver/tools/FrameReplay.cppdocs/dev/debt/libSceAgcDriver.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T17:23:20Z.
Review: COMMENTED
Actionable comments posted: 1
6d4603df-69cb-41d4-abb2-04f296762e72Reviewing files that changed from the base of the PR and between
f81848b170and778ccc1313.docs/dev/debt/changes/agc-label-release-stores.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T17:42:04Z.
Review: DISMISSED
Reviewed — comments
Changes are required before merge: the release-store path can fail to synchronize with acquire polls for unaligned 4- or 8-byte
GuestMemory::Writecalls.What I ran
Reviewed head
778ccc13139486dc466ab378c8f200484ba9abc2throughrepo_read.py. No build or tests were run; reported test results below are author supplied.Results
Findings
Blocking
GuestMemory::Writepreserves its caller supplied alignment, which can be less than the label width. For example, an aligned 8 byte label may be written through an API call withalignment=1after an ordinary write to the same bytes. The new helper selects atomic stores based on width and address only, but the acquire poll is anatomic_refaccess. If any competing access to these bytes remains non atomic, the release/acquire synchronization is not guaranteed and the data race the change intends to fix remains. Either ensure the label range is always stored atomically when it can be polled, or constrain and document the API contract so the writer cannot take a plainmemcpypath for polled label bytes. Evidence:core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:3323,core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp:4573.Non-blocking
None.
Not verified
Read all changed files listed in the manifest:
GuestMemory.hpp,Pm4.hpp,Submission.cpp,GuestMemory.cpp,FrameReplay.cpp(test and tool files),Pm4.cpp,Pm4Replay.cpp,Pm4ReplayTool.cmake,agc_driver_graphics_tests.cmake, andagc-label-release-stores.md. No files were excluded by the manifest. Tests were not run. The description reports Linux, Windows, and ThreadSanitizer results; these were not independently verified.To get this to a good state
Ensure polled label bytes cannot be written through the non-atomic fallback, add coverage for the relevant alignment/API path, and rerun the affected tests and ThreadSanitizer check on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T14:21:28Z.
Review: COMMENTED
Actionable comments posted: 1
e7ee4eb1-e81f-4752-a741-ccb6ad0d92cbReviewing files that changed from the base of the PR and between
778ccc1313and4398f790da.core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Synchronization/DeferredLabels.hppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/include/Pm4.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/FrameReplayState.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/RecorderKeptBytes.cppcore/libs/prx/libSceAgcDriver/tests/SharedWrites.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_frame_replay_state_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_shared_write_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/AliasCopyLabel.cppcore/libs/prx/libSceAgcDriver/tests/execution/BdaStoreHeapMirror.cppcore/libs/prx/libSceAgcDriver/tests/execution/CopiedWriterLabelOrder.cppcore/libs/prx/libSceAgcDriver/tests/execution/CpuLabelPublish.cppcore/libs/prx/libSceAgcDriver/tests/execution/FillCompletionLabels.cppcore/libs/prx/libSceAgcDriver/tests/execution/IndirectArgumentsPendingProducer.cppcore/libs/prx/libSceAgcDriver/tests/execution/IndirectThreadDimensions.cppcore/libs/prx/libSceAgcDriver/tests/execution/LabelAfterImportCopy.cppcore/libs/prx/libSceAgcDriver/tests/execution/LabelImportWindow.cppcore/libs/prx/libSceAgcDriver/tests/execution/LinearTargetCompletionStores.cppcore/libs/prx/libSceAgcDriver/tests/execution/TwoDevicePendingStore.cppcore/libs/prx/libSceAgcDriver/tests/execution/UnimportedLabelOrder.cppcore/libs/prx/libSceAgcDriver/tests/execution/UnregisteredLabelBehindWriteBack.cppcore/libs/prx/libSceAgcDriver/tests/execution/UnregisteredLabelOnGpu.cppcore/libs/prx/libSceAgcDriver/tools/FrameReplay.cppdocs/dev/debt/changes/agc-label-release-stores.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T14:27:37Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
4398f790dacae37431d894f019d81ea8d4805de2against the prepared diff and source pinned to that head. No commands or tests were run; reported CI results below are author-reported.Results
Findings
Blocking
None.
Non-blocking
LabelStoreWidth,storeGuestBytesperforms atomic stores inside theStoreOwnBytescallback.CheckRangeis called only afterward bywriteGuest, so an invalid address can fault in the atomic store before the API performs its intended range validation. Consider validating the destination before invokingstore()while preserving the write-tracking order.Not verified
Did not run checks or tests.
VulkanDevice.cppandtests/Recorder.cppwere excluded from the review folder for size; the relevantVulkanDevice.cppranges were read through the pinned reader, buttests/Recorder.cppwas not read. Other changed files were not individually read in full. The author reports CI runs indescription.md; those results were not independently verified.To get this to a good state
Nothing is required. Optional: validate the destination before the atomic store in
writeGuest.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T04:36:10Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
d97b8a3c16ecbf2314b2eb735a1ab535d8a25908from the prepared diff and pinned reader. No build or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
WriteChanged*, callbacks, and native API outputs. The debt entry explicitly lists these cases as out of scope.Not verified
The repository tests and build were not run. The full contents of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwere excluded from the review folder; the relevant changed hunks were read throughrepo_read.py. Other changed files included by the manifest were not individually read, so the review does not cover every changed file. The prepared bundle excluded lockfiles, minified files,dist/,build/, and.svgfiles according to its rules;files.jsonwas not available through the reader for confirming any additional exclusions.To get this to a good state
Nothing is required. The follow-up scope above is optional.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T04:46:38Z.
Review: COMMENTED
Architecture findings (2)
Advisory architecture findings (2)
99c1c5cb-6b99-4826-9e6f-ba5bba980a3dReviewing files that changed from the base of the PR and between
4398f790daandd97b8a3c16.core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppcore/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:13:37Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean.LabelStoreWidthselects one 64-bit release store for an aligned qword.Pm4::LoadLabelselects the acquire width from the wait packet. The debt entry correctly leaves mixed-width concurrent access open. Please state that boundary in the PR description and keep it visible for callers of the shared primitive. A dword waiter on the low half of a qword release does not get the same-object C++ release/acquire guarantee, and the same-width fixtures alone cannot verify it. Paired PM4 and label controls are pending.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.