Repository navigation
Conversation
…scan at a label At a label, StoreReadbackBeforeLabel scanned every pending image for a trapped overlap for each pending tiled image of 64 KiB to 1 MiB, and only then tested whether the image was written occasionally. Most images are not, so test the flag first. The same images are stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Refactor Merge Risk:
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The changed path has no verified blocking defect; the performance evidence available here does not include digest output for independent review.
What I ran
Reviewed head d8d603d4f5f2166835fe8608a5a407aa3c2a074b using repo_read.py and the prepared review artifacts. No build or tests were run.
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp 6530 6685
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp 5300 5380
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp 5095 5135
repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp 1039 1039
repo_read.py cat docs/dev/GAME_TESTING.md 90 110
repo_read.py cat docs/dev/TRACING.md 85 105
Read description.md, commits.md, manifest.json, files.json, and diff.patch. The manifest lists one changed file; its full text was too large for files/. I read the changed function and relevant flag update/declaration context in Texture.cpp and Texture.hpp.
Results
| Check | Result | Note |
|---|---|---|
| Changed-path inspection | passed | Early flag check precedes overlap scan |
| Build and tests | not run | Author reports results; not independently run |
| Performance evidence | not run | Captures and summaries are author-provided |
Negative control
Not run; no test was modified or executed.
Findings
Blocking
None.
Non-blocking
None.
Sources
Changed function at the reviewed commit shows the flag check before the trapped-overlap scan, with the existing atomic exchange retained before queuing the store. Performance testing guidance describes the capture and digest workflow.
Not verified
The remainder of Texture.cpp was not read. The description's Windows performance measurements, focused test results, and conventions check were not rerun. Linux, macOS, other GPUs, and the full test suite were not checked. The supplied description includes baseline/change captures and summary records, but no trace digest output was available here.
To get this to a good state
Nothing is required. Optional: include the trace digest or comparison output alongside the captures and summary records to make the performance comparison easier to audit.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
ligmaSec
left a comment
There was a problem hiding this comment.
I downloaded all four attached traces and ran tools/trace_digest.py against their matching summary lines. The two main captures had 46 and 48 presents at 220.3 and 208.3 ms median frame time. The PR captures had 72 and 77 presents at 138.3 and 128.8 ms. All four report the same capture window specification, GPU, driver, OS, and resolution, with no dropped events. I also compared the benchmarked commits. The early flag check is their only source difference.
This verifies the attached ten-second captures. I did not rerun the title or the Windows Vulkan tests.
AI-assisted: yes
Plyxen
left a comment
There was a problem hiding this comment.
I read the diff at d8d603d4f5. An image without the flag was skipped by the exchange below anyway, so the early test changes no stored image; only the cost of the scan goes away. A concurrent set of the flag between the two reads is picked up at the next label, as with the old order.
Windows 11, GCC 15.2, merged into main at cde48b5800e together with other open PRs (so not an isolated build): agc_driver_recorder and agc_small_tiled_shadow_label pass on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2) with VK_LAYER_KHRONOS_validation, without a VUID- or SYNC-HAZARD line.
Not checked: the time saved in Mafia.
AI-assisted: yes (Claude Code)
That holds in a second title, PPSA21564 at Crash Site, on Windows with NVIDIA: in the last 120 s of a run not one scanned image had the flag, and with this PR the scan did not run at all in that window. The saving is small in this title, though: the scan took at most 8.4 ms per second summed over threads, under 1 % of one thread's time, where the description measured the loop at 2,400 ms per 10 s (about 24 %) in Mafia: Definitive Edition, on a different machine and build. Counter. Local print lines (patches below, not pushed) at the
The My 3 A/B pairs on the older Not covered: one scene and one machine, NVIDIA only. Only the steady part is measured; on Counter patch on
|
|
Measured on a third title: Star Wars Jedi: Fallen Order (PPSA02199, 01.003.000), Windows 11 10.0.26300, RTX 3090 Ti (NVIDIA 621.14, so the traps are on), i9-9900K, 3840x2160. Throughput goes up by about 6 %. The cost moves only in the label commits. Slow frames from the title thread waiting on Setup.
Batch 1 (
Where the time goes. These are the committer's
In an offline replay of a 10-frame capture of the same scene ( Slow frames. In 5 of the 6 PR runs, 2 or 3 frames of 395-665 ms show up 19-27 s into the window. Only 1 of the 6
Two more PR runs with |
|
Follow-up to my measurement above: I found where the slow frames come from. The title thread's #28882 lets that import fall back to first use when the lock is held. With this PR plus #28882, 0 of 6 runs had the stall, against 16 of 26 with this PR alone. Throughput is unchanged. |
What
At a label,
StorageTexture::StoreReadbackBeforeLabelgoes through the pending tiled images of 64 KiB to 1 MiB and stores those written only occasionally. With label read traps on, it first scanned the whole pending list for a trapped image that overlaps, and only then testedwrittenOccasionally. Nearly every image fails that test, so the scan was wasted. This PR tests the flag first.5cf487d168this loop took about 2,400 ms per 10 s, on the thread that commits draws. It visited 11 to 16 million images in that time and 50 to 70 of them had the flag set. With the flag tested first it took 77 ms.No new test: the stored images do not change, and
agc_driver_recorderandagc_small_tiled_shadow_labelalready cover labels with large and small images under traps.tools/pr_overlap.py --branchcould not compare 30 open PRs that conflict withmain. I checked their diffs ofTexture.cpp: two edit this function. #9508 changes the header of the same loop (it iterates over a candidate list) and #20183 changes another loop. Neither makes this change.Tested
Windows 11 (10.0.26200), NVIDIA GeForce RTX 2070 SUPER, driver 617.14, 3840x2160, AMD Ryzen 7 7800X3D. WinLibs GCC, Release.
Mafia: Definitive Edition (PPSA36458, 01.002.000), loading a save into the city, with Cross pressed every second as the only input.
mainis4131f5185aand the change isd8d603d4f5, both clean builds with their full library set. The order was change, main, main, change. Each run hadAPS5_TRACE_SUMMARY_EVERY=2,APS5_TRACE_SECONDS=100:10andAPS5_TRACE_EVENTS=1048576.mainDriver.Packetper frameThe city medians use the intervals below 12 fps with more than 40 ms of GPU time per present, without the first five. Both runs of the change are faster than both runs of
main. The traces are attached.Focused tests on
mainand this PR withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(validation layer 1.4.363),ctest -R "^(agc_driver_label_ordered_flush|agc_driver_linear_target_completion|agc_read_trap|agc_recorder|agc_driver_recorder|agc_small_tiled|windows_read_trap|agc_driver_small_tiled)" -V: 37 of 37 pass on both. Each log showsInsert instance layer "VK_LAYER_KHRONOS_validation"27 times, nowas not foundline and noVUID-.tools/check_conventions.pypasses.Not run: Linux, macOS, other GPUs, the full test suite.
Summary lines (change 1, main 1, main 2, change 2)
aps5-trace-d8d603d4f5f2-4616.json.gz
aps5-trace-d8d603d4f5f2-12844.json.gz
aps5-trace-4131f5185afb-4608.json.gz
aps5-trace-4131f5185afb-16468.json.gz
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