Repository navigation
perf(agc): deliver end-of-pipe interrupts after their work without draining - #409
Merged
boykopovar merged 1 commit intoOct 3, 2026
Merged
Conversation
…aining A RELEASE_MEM with an interrupt select drained the device: the queue worker submitted everything recorded and waited for the GPU before it stored the label and delivered the interrupt. PPSA21564 issues about 300 of them per frame, so the worker and the GPU took turns. The label is now recorded like any other (on the GPU behind the work, or as a completion action behind pending write-backs), and the delivery becomes a completion action of the batch holding the work before the packet (Recorder::AfterRecordedWork, after the batch's earlier completions). It is counted with the completion labels, so idle workers and pollers reap it, and it starts the label flush deadline. With draws or dispatches recorded since the last submit the batch is submitted at once. A batch holding only label stores stays open and goes out with the next work, at the label flush deadline, at a wait, at a flip or at the end of the submission, like any other pending label. A label the GPU cannot store, or one that does not decode, still drains. The interrupt so never arrives before the work ahead of it completed and its label landed; it can only arrive later, by at most the flush deadline plus the work recorded into the same batch.
9 tasks done
|
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.
|
This was referenced Oct 2, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 3, 2026
…oykopovar#304 boykopovar#305 boykopovar#306 boykopovar#322 boykopovar#409 boykopovar#416, boykopovar#276 boykopovar#277 boykopovar#275 boykopovar#307, shader ops boykopovar#226 boykopovar#255 boykopovar#260 boykopovar#280 boykopovar#308 boykopovar#309 boykopovar#311 boykopovar#318 boykopovar#320 boykopovar#324 boykopovar#326 boykopovar#379 boykopovar#384 boykopovar#399, boykopovar#261, kernel boykopovar#335 boykopovar#341 boykopovar#349 boykopovar#355, libs boykopovar#227 boykopovar#244 boykopovar#245 boykopovar#273 boykopovar#274 boykopovar#279 boykopovar#286 boykopovar#287 boykopovar#289 boykopovar#296 boykopovar#300 boykopovar#328 boykopovar#358 boykopovar#402) into astrobot Where our PR merged in a revised form, main's version is taken; where astrobot carries the same work plus later local commits, astrobot's code stays and main's additions appear once. Conflicts: - AvPlayer (Export.cpp both libs, include/AvPlayer.hpp, src/Player.cpp, src/Source.cpp, AvPlayerLibrary.cmake, CMakeLists.txt, SceTypes.hpp, tests/GuestAvPlayer.cpp): main's boykopovar#307 (our reviewed squash, which carries 9c8e7fd e9ea5c8 adcede3 fb4eeb9 953057c ac456ee). It links the shared ffmpeg-core target, so astrobot's second FFmpeg build goes: 3rdparty/FFmpeg submodule, core/libs/FFmpeg.cmake and src/Exports.cpp. - libScePngEnc: main's boykopovar#227 (supersedes OverkillLabs' encoder). - libScePad Export.cpp: main's boykopovar#287 tilt correction (supersedes 49d45f5). - libSceAudioPropagation Export.cpp: astrobot's object model, which defines every function boykopovar#289 declares as a stub. - libSceSaveData.native Export.cpp: both (SaveDataHoldWrites and boykopovar#289's unknown exports). - VideoOutDriver.cpp: astrobot's (2546bd1 counters around boykopovar#416's lastFlipVblank store, same value). tests/Flip.cpp: boykopovar#416's pacing test and boykopovar#417's after-GPU test both kept. - boykopovar#278 files (DisplayFormat, VulkanDevice, GpuColorTransfer, ResidentPresent, agc CMakeLists): main's comment-free boykopovar#278 plus astrobot's P5 present-direct (b29728d), which removed DetileImage, ResidentPresent.hpp and the recorder-test hook; the resident present test stays its own executable. - VulkanDevice.cpp/.hpp: astrobot's GDS, local memory probe, sample dumps and P5 code; boykopovar#303/boykopovar#409 comments as main has them; main's shader clock (boykopovar#324) and DepthSurface-free includes. - RequestSerializer.cpp: version stays 8 (6 mesh passthrough, 7 nonConstantImageOffsets, 8 astrobot's later field). boykopovar#303's auto-merged second write and read of nonConstantImageOffsets removed. - SpirvEmitter.hpp, SpirvEmitterState.hpp, Recompiler.hpp/.cpp, StageIO.hpp, SpirvOptimizer.cpp, InstructionTranslator.cpp, ShaderReplay.cpp: local fields kept, boykopovar#303/boykopovar#305 comments as main has them. - SpirvAluEmitterMath.cpp: v_readlane keeps the split-wave path and takes boykopovar#322's wrap at the wave size for the others. - SpirvEmitter.cpp: astrobot's single-lane layout check. - SpirvFlowEmitter.cpp: boykopovar#304 as merged (the second lane emits a shared value itself when the first lane defined nothing). - SpirvImageEmitter.cpp: main's Offset operand placed before MinLod. - boykopovar#304: main's WaveUniformValues (SpirvAnalysis.cpp) replaces astrobot's copy in SpirvWaveExchange.cpp. - Recorder.hpp/.cpp, Draw.hpp, Graphics Draw.cpp, ShaderResources.cpp: astrobot's boykopovar#276/boykopovar#277 with its later snapshot work (per-use budgets, stale-snapshot refresh, profile counters, boykopovar#410, boykopovar#424, fan GS); boykopovar#409/boykopovar#306 comments as main has them. - PacketMemory.cpp: boykopovar#409 as merged plus astrobot's two opt-outs. - tests: ShaderMemory.cpp takes boykopovar#303's and boykopovar#304's new tests; Recorder.cpp takes boykopovar#409's afterRecordedWorkTests and drops main's copies of the boykopovar#276/boykopovar#277 tests astrobot already has; Structurizer.cpp keeps boykopovar#413's case. boykopovar#143 (NGG passthrough) stays as on astrobot: upstream did not touch its files since the boykopovar#258 revert.
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
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.