Repository navigation
perf(agc): keep label stores larger than 64 bytes out of the label table - #627
Merged
oneandonlydean merged 1 commit intoOct 5, 2026
Merged
Conversation
PPSA21564 clears each occlusion query slot with a 256-byte WRITE_DATA before its begin dump, about 8,400 times per frame in one level. The clear is larger than a deferred label, so it is recorded at once, and Recorder::NoteLabel entered all 64 of its dwords in the pending-label table: 64 map inserts, 64 batch dword entries and 64 group entries, then 64 lookups in CloseLabelGroup and 64 erases when the batch is reaped. A replay of that pattern (21 clears per batch, 20 batches in flight) costs 1.6 us for the inserts, 0.7 us for the close and 1.3 us for the erases per clear, about 31 ms of the graphics worker per frame there. The new path costs 0.07 us per clear in the same replay. The table serves WAIT_REG_MEM values and CPU pollers, which read 4 or 8 bytes. A store larger than 64 bytes (the bound the driver's own label history already uses) now enters one range instead of its dwords: - table entries inside the range are removed, as the store replaced them before: a lookup there finds no value and falls back to the pending-write path, where it used to find the store's value; - the range leaves with its batch, like the dword entries; - PendingLabelIn sees the range, and the write-evidence check, which syncs a capture read over any pending label dword, now also syncs over a pending range (Recorder::WideLabelIn). The store is still a pending write of the open batch (the flush hook syncs CPU readers), still starts the label flush deadline and is recorded exactly as before. Stores of 64 bytes or less are unchanged. Test: agc_driver_recorder_tests largeLabelTests (a 256-byte label enters no dwords and removes the older entry under it but not one beside it, its range, pending write and deadline, a later 4-byte label over it, a 64-byte label entered in full, everything gone after the batch).
9 tasks done
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 5, 2026
Takes upstream's merged versions of our boykopovar#586 boykopovar#611 boykopovar#612 boykopovar#505 boykopovar#490 boykopovar#619 boykopovar#503 boykopovar#627 boykopovar#628 boykopovar#618 and drops astrobot's local copies, plus gate-batch-3 (boykopovar#469 boykopovar#500 boykopovar#504 boykopovar#509 boykopovar#510 boykopovar#514 boykopovar#525 boykopovar#526 boykopovar#528), round o/p (boykopovar#617 boykopovar#620 boykopovar#621 boykopovar#622 boykopovar#623 boykopovar#624 boykopovar#501 boykopovar#508 boykopovar#629 boykopovar#630 boykopovar#631). Conflicts: - SpirvAnalysis.hpp/.cpp, SpirvBufferAccess.cpp: upstream's boykopovar#586/boykopovar#612. The 64-bit LDS atomics keep the full array (f27d6e5 no longer needed). - SpirvMemoryInstructions.cpp: upstream's constant slot plus offset; astrobot's split-wave append/consume kept. - GuestTextureResource.cpp, TextureTiling.cpp and their tests: upstream's boykopovar#490/boykopovar#503 (astrobot had no other change there). - MaskedSelect.cpp test, ShaderMemory.cpp LDS test: upstream's. - State.cpp: upstream's boykopovar#505 export count and boykopovar#469 null pixel program; astrobot's depth export rejection and depth target model kept. - Pipeline.cpp: upstream's pipeline key; astrobot's depth attachment and blend check (a trailing unused attachment stays valid, as colorGapPipelineTests expects). - Draw.cpp, Recorder.cpp, ShaderResources.cpp: astrobot's (renderPassKey with depth, moved sample functions, residency maintenance), which already hold the merged boykopovar#505/boykopovar#628/boykopovar#490 changes. - ShaderInputState.cpp: both register sets. - State.hpp: the duplicate exportIndex member from the auto-merge removed. - CMakeLists.txt: astrobot's test list (a superset of upstream's). - tests/Graphics.cpp: upstream's CompactedExportTests replaces astrobot's inline copy; tests/Recorder.cpp: upstream's viewPastLastMipTests added.
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
Recorder::NoteLabelenters every dword of a recorded label store in the pending-label table. A store larger than 64 bytes (the bound the driver's own label history already uses) now enters one range instead of its dwords:PendingLabelInsees the range, and the write-evidence check, which syncs a capture read over any pending label dword, now also syncs over a pending range (Recorder::WideLabelIn).The store is still a pending write of the open batch (the flush hook syncs CPU readers), still starts the label flush deadline, and is recorded exactly as before. Stores of 64 bytes or less are unchanged.
Why it is exact: the table serves
WAIT_REG_MEMvalues and CPU pollers, which read 4 or 8 bytes. Inside a wide store's range such a reader now takes the pending-write path, which waits for the store instead of taking its value from the table.Why
PPSA21564 clears each occlusion query slot with a 256-byte
WRITE_DATAbefore its begin dump, about 8,400 times per frame in one level. That clear is larger than a deferred label, so it is recorded at once, and each one cost 64 map inserts, 64 batch entries and 64 group entries, then 64 lookups when the label group closes and 64 erases when the batch is reaped. A replay of that pattern (21 clears per batch, 20 batches in flight) costs 1.6 us for the inserts, 0.7 us for the close and 1.3 us for the erases per clear; the new path costs 0.07 us per clear.Measured in that level on my integration branch, together with #628 (the query entry points). The FPS gain was only measured with both; each packet's time is its own:
WRITE_DATAms per present (this PR; profiled runs)EVENT_WRITEms per present (#628; profiled runs)Tested
BUILD_TESTING=ON;ctestpasses (268/268).agc_driver_recorder_tests(needs a GPU, not in ctest) passes, with the newlargeLabelTests:largeLabelTestsfails.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)