perf(agc): take a dword fill of any inline constant as a buffer fill #5380
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5380"
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 AlxcBTW on 2026-10-13T18:22:20Z.
What
A dword fill whose source is an inline integer constant other than zero is stored as a buffer fill, like the zero fill already is.
MatchZeroDwordFill(v_mov_b32 v1, 0; buffer_store_format_x) becomesMatchConstantDwordFill: the same 6-word kernel with any inline integer constant as the source (0 to 64 and -1 to -16). Float inline constants and vector registers are not matched. The fill then takes the existingdwordFillpath with the constant as its pattern. Run as compute dispatches, these writes are pending writes of unknown value, so a later read of DCC keys over their range waits for the dispatch (#3505). Sword of the Sea clears DCC keys with this kernel.Rebased onto current
mainafter #4603 merged; the diff is this one commit (b83755ac9). Fork CI for this head: run 38499865909: Linux and Windows green.ZeroDwordFillis renamedConstantDwordFilland gains match and execution cases for 1, 64, -1 and -16, a float constant and a vector register; the one-bit mutation check now flips a bit outside the source operand.Measured
Indication only, from our lab line (RTX 5070 laptop, Windows, Sword of the Sea,
APS5_PROFILE_DRAW=1, 10 s windows). These are two lab rows that differ in other levers, not a controlled A/B, and this PR is not what they measured on its own:m3-reckless1(cutscene, t360-t895): drawreadTarget4.3 s per 10 s, 2.30 FPS.m3-reckless4(same scene, t240-t480, with the DCC-key fills of this PR and #4603):readTarget235 ms per 10 s, 2.88 FPS (reckless1 over the same frames: 2.2).Motivation, measured by @parl0v on current
main(box 2,APS5_PROFILE_DRAW=1): cutscenereadTarget997.5 ms per 10 s (15,560 lookups walking 3.74 M pages) and main menureadTarget1,877-1,902 ms per 10 s, 86 % of draw time (https://github.com/AlxcBTW/AnyPS5/issues/44#issuecomment-6148397460, https://github.com/AlxcBTW/AnyPS5/issues/44#issuecomment-6148460257).I have not run the game on this branch.
Tested
CI only, no local build and no local GPU run. Fork CI (Linux and Windows jobs: configure, test registration check, build, libs, ctest) on
ci/lab/constfill= this branch plus three lab workflow commits: all green (run 38444188620).tools/check_conventions.pypasses locally.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
Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-13T18:50:17Z.
Ran this branch in the game. PPSA25344 (Sword of the Sea) title screen, RTX 3060 12 GB / i5-12400F / 32 GB, Windows 10, NVIDIA 617.42. This branch (
8f2637543, so #4603 + this commit) against its base18c438b10, same relinked executable,APS5_PROFILE_DRAW=1, 300 s runs, mean of the last twelve 10 s windows:readTargetper 10 sreadTargethalves and the title screen gains ~5 % (7.37 → 7.75 FPS). Pages walked don't drop, so the saving is the waits on the DCC-key fill dispatches, as described, not the walk.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:52:35Z.
I checked the hosted check state: the only run of conventions is red, while intake, eligibility and report pass; the build matrix was skipped for this path. I could not retrieve the conventions job log because GitHub returned HTTP 502 for the run details, so I cannot identify the failed rule. Please inspect that log and rerun after addressing it. The overlap check also flags the shared BufferFill.cpp hunk with #5313; please verify merge ordering when either change lands.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:57:12Z.
I was able to retrieve the conventions log now. Its only finding is the unchecked generic-behavior checklist item. The implementation description appears title-agnostic: it recognizes the same compiler-emitted buffer-fill pattern wherever it occurs, with Sword of the Sea as the first observed case. If that is accurate, please state that clearly and check the item; otherwise explain the title-specific scope without making a false checklist claim, then coordinate with the maintainers on the repo rule and rerun conventions.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-13T21:11:25Z.
@MarcZX100 thanks for digging out the log. Ticked: the change matches the compiler-emitted dword-fill kernel wherever it occurs, and Sword of the Sea is just where it was first seen.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:39:01Z.
Checked the kernel encoding (SRC0 0x80 = 0, 0x81..0xc0 = 1..64, 0xc1..0xd0 = -1..-16; float inline constants and VGPR sources are rejected), the match tests with a bit flipped outside the source operand, and the execution cases for 1, 64, -1 and -16 against the Vulkan device (
agc_driver_constant_dword_fillpasses). Also confirmed by @parl0v on PPSA25344 (readTarget1,034 → 535 ms per 10 s). Merging once the full Build is green.