perf(agc): deliver end-of-pipe interrupts after their work without draining #409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/409"
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 oneandonlydean on 2026-10-02T21:28:41Z.
What
A RELEASE_MEM with an interrupt select (an end-of-pipe interrupt) drained the device: the queue worker submitted everything recorded, waited for the GPU, then stored the label on the CPU and delivered the interrupt. PPSA21564 issues about 300 of these per frame, so the graphics worker and the GPU took turns. In a profile of my integration branch at the title screen, RELEASE_MEM handling took about 2.3 s of every 10 s of the graphics worker, almost all of it waiting.
This PR keeps the packet's meaning (the interrupt reaches the queue's event once the work before it completed and its label landed) without the CPU wait:
WriteLabelOnGpu), or kept as a completion action behind pending write-backs (reasons 5 and 6), exactly as for a RELEASE_MEM without an interrupt. With nothing recorded (reason 1) it is stored on the CPU and the interrupt is delivered at once, as before.Recorder::AfterRecordedWork,VulkanDevice::AfterRecordedWork). It is appended after that batch's earlier completions, so a label kept as a completion action lands first. It is counted with the completion labels, so idle queue workers and WAIT_REG_MEM pollers reap its batch; it also starts the label flush deadline, like a pending label.WriteLabelOnGpurefuses (reasons 2 to 4), a label that does not decode, andAPS5_DRAIN_ALLstill drain as before.Ordering guarantees:
Two variants I tried first and dropped, for context:
Tests:
testEndOfPipeLabelsWithoutWork(agc_driver_tests): two back-to-back end-of-pipe labels with no work before them land, satisfy a WAIT_REG_MEM on the compute queue, and raise both interrupts. Without a device (CI) this covers the CPU path only.afterRecordedWorkTests(agc_driver_recorder_tests, needs a Vulkan device, run by hand like the rest of that binary): an idle recorder refuses the action; an action behind the open batch is pending and starts the label flush deadline; actions behind the open batch, behind a completion label and behind an in-flight batch run once each, in order, only when their batch is reaped, and after the completion label recorded ahead of them landed.Tested
ctest125/125 pass, includingtestEndOfPipeLabelsWithoutWork.agc_driver_recorder_testsby hand: passes, includingafterRecordedWorkTests.afterRecordedWorkTestsdoes not build (it tests the newRecorder::AfterRecordedWork).testEndOfPipeLabelsWithoutWorkhas no device inagc_driver_tests, so it takes the CPU path and also passes onmain; it guards the label-only case that the batch deferral changes.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 (attach them to this PR)preparePacketMemory, so whichever lands second needs a small rebase.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-02T23:47:22Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppL6, L19core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppL6, L19core/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppL6, L19