Repository navigation
fix(agc): satisfy label waits from stores made after their submission - #178
Merged
boykopovar merged 2 commits intoOct 1, 2026
Merged
boykopovar merged 2 commits into
boykopovar merged 2 commits into
Conversation
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Sep 30, 2026
…, boykopovar#129) into astrobot Conflicts resolved: - Shader disk cache (boykopovar#129 as merged upstream): upstream's version, plus astrobot's imageDepthCompare and waveLayout fields (format 3). - Shader fusion: upstream's fd4700b replaces astrobot's boykopovar#124 version. - -KRzWekV120: upstream's export replaces astrobot's; its test now calls sceAgcUnknown__MKRzWekV120. - Misaligned buffer views: upstream's push-constant adjustment (3dec6ce) replaces astrobot's view aliases; GuestBufferMemory is the rebased boykopovar#121 version (write watch on shared direct memory). - DirectMemory: rebased boykopovar#121 (re-register after the shared-backing remap, aliased pages leave the watch) plus boykopovar#164's per-piece unmap. - Depth: astrobot's DepthTarget model is kept for attachments; upstream's DepthSurface module is dropped (it would duplicate it). Upstream's mip-chain colour targets, CB_COLOR_VIEW MIP_LEVEL at bits 26-29 and export formats are taken into DecodeColorBuffer. - GPU-selected V#s: upstream's gpuDescriptor replaces astrobot's opt-in runtimeDescriptor; image_bvh_intersect_ray is upstream's. - Occlusion counter dumps: upstream's Vulkan occlusion queries replace astrobot's always-visible PIXEL_PIPE_STAT dump. - AudioOut2 DualSense ports: rebased boykopovar#180 on upstream's 16-bit ports. - Pixel stage decode: rebased boykopovar#136; mesh push constants: rebased boykopovar#133. - Label waits (boykopovar#178): noteHeldAtSubmit moved into reserveOutputs.
A title may reclaim a label (reset it to 0) as soon as the submission that released it is done, trusting every queue waiting on it to have passed its WAIT_REG_MEM within microseconds, as the CP polls from the moment it reaches the wait. A worker that reaches a later wait of the same submission long after (it records and compiles in between) found the reset label and timed out. A memory wait now also passes when - a label store the driver committed (recorded on the GPU, as a completion action, or on the CPU) after the wait's submission gave the awaited bytes a value the wait accepts (the last four stores per dword, with their eventSerial stamps). Such a store belongs to this use of the label or a later one, since the title reset it before submitting. - the awaited bytes held such a value when the game submitted, and no earlier packet of the queue (in the submission, or one still queued or running) stores to them. A store made before the submission never satisfies a wait.
A WAIT_REG_MEM_64 whose mask leaves the high dword out compares the low dword alone, but the wait paths looked for all eight bytes: the recorder's label table and the stores committed since the submission want an entry for each dword, while a producer's RELEASE_MEM or WRITE_DATA stores 32 bits, so neither ever satisfied such a wait, and the held-at-submission check refused it when an earlier packet stored the unrelated high dword. Pm4::WaitAwaitedBytes gives the bytes that decide the compare (4 for WAIT_REG_MEM and for a WAIT_REG_MEM_64 whose high mask dword is zero, else 8), and the wait paths use it. The timeout report now prints a 64-bit wait's reference and mask (it printed the reference's two halves as "ref" and "mask").
oneandonlydean
force-pushed
the
fix/agc-label-waits-after-submission
branch
from
September 30, 2026 19:48
ab8ec68 to
a36ef52
Compare
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two commits on the same topic: when a
WAIT_REG_MEMcounts as satisfied.Stores made after the wait's submission. A title may reclaim a label (reset it to 0) as soon as the submission that released it is done, trusting every queue waiting on it to have passed its
WAIT_REG_MEMwithin microseconds: the CP polls from the moment it reaches the wait. Our queue workers can reach a later wait of a submission much later (they record and compile in between), find the reset label and time out. A memory wait now also passes when:Driver::noteLabelStorekeeps the last four stores per dword with theireventSerialstamps) gave the awaited bytes a value the wait accepts (Driver::storedSince). Such a store belongs to this use of the label or a later one, since the title reset it before submitting. A store made before the submission never satisfies the wait.noteHeldAtSubmit, checked under the submit mutex; the unfinished stores are counted per worker and forgotten when their submission completes).The ordering argument is the one the recorder's label table already uses for
Submission::received.64-bit waits. A
WAIT_REG_MEM_64whose mask leaves the high dword out compares the low dword alone, but the wait paths looked for all eight bytes: the recorder's label table and the stores above want an entry for each dword, while a producer'sRELEASE_MEM/WRITE_DATAstores 32 bits.Pm4::WaitAwaitedBytesgives the bytes that decide the compare (4 forWAIT_REG_MEMand for aWAIT_REG_MEM_64with a zero high mask dword, else 8), and the wait paths use it. The timeout report now prints a 64-bit wait's reference and mask (it printed the reference's two halves as "ref" and "mask").In PPSA21564 the async compute submissions wait on the same label up to five times between dispatches, and wait with
WAIT_REG_MEM_64(mask ffffffff:0) on queue 0's 32-bit labels. The intro stalled on 1 s GPU wait timeouts (15 in 200 s).Rebased onto current
mainafter #138: the CPU fallback inDriver.cppnow notes a label store afterPm4::Executeand then delivers #138's end-of-pipe interrupt, and the new tests sit aftertestEndOfPipeInterruptsintests/Submit.cpp.Tested
agc_driver(tests/Submit.cpp) gets three cases that submit to a compute queue held behind a gate, let a graphics-queueWRITE_DATAstore the label, reset the label from the CPU, then open the gate:testLabelStoredSinceSubmission: the consumer passes within 500 ms; a wait submitted after the store still times out (about 1 s).testLabelHeldAtSubmission: a wait whose value memory held at submission passes after a reset; one behind its own queue's earlier store to the label does not.testWideLabelStoredSinceSubmission: a low-dword 64-bit wait passes on a 32-bit store; with the high dword in its mask it does not.heldAtSubmitmakes the second fail.ctest: 79/79 pass on currentmain.agc_driver_recorder_tests,agc_driver_graphics_testsandagc_driver_pm4_testspass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository