perf(agc): fill a DCC fast-clear surface by doubling copies #13527

Merged
JJenkx merged 1 commit from upstream-pr/13527 into main 2026-10-31 00:40:19 +00:00
JJenkx commented 2026-10-30 17:40:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-30T17:40:33Z.


What

FillDccClear writes the texels of a surface whose DCC keys say it is fast-cleared. It built one element (4 to 16 bytes) and then copied it with one memcpy per element, so a 3840x2160 RGBA8 surface took about 8.3 million calls. ReadTextureSurface uses it for every upload of such a texture, so the cost recurs whenever a cleared texture is uploaded again.

It now copies the first element, then copies the filled prefix onto the rest, doubling the filled length each time (about 25 calls for that surface). The last copy stops at the last whole element, and a trailing partial element is zeroed as before, so the bytes written are the same. A test in TextureFormat.cpp fills 1003 bytes with an 8-byte R16G16B16A16_SFLOAT 1111 clear (125 elements and a 3-byte tail) and checks every byte. Making the doubling skip one byte per round makes it fail.

Where it showed up. Afterimage (PPSA14053, UE4) on Windows runs its intro cinematic at about 10 fps on main. In an APS5_SAMPLE_WORKER run the queue worker spends 65 % of its samples waiting in DrawPipeline::Drain/Enqueue. So the draw committer sets the pace, and in an APS5_SAMPLE_COMMITTER run cachedTexture → ReadTextureSurface → FillDccClear takes 21 % of the committer, most of it ucrtbase memcpy calls on a few bytes each.

Tested

Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD proprietary driver 26.10.1, WinLibs GCC 15.2.0 UCRT r7, Release, BUILD_TESTING=ON.

Performance (Afterimage PPSA14053 01.000.000, 3840x2160). Both libSceAgcDriver.prx were built in one build directory from main 556547da71: main itself (SHA-256 fe591ad3…), and this commit on it (37a0dbc26a, 14370687…). All other libraries and app.exe are identical. Every run started from a fresh save with the same scripted pad input (Start Game, New Game, intro). Caches were warm: each arm had run several times with its own shader cache before these runs, which then alternated. Each pair captures the same presents, 1900–2099, which are inside the intro cinematic in both arms. The arms reach different points of the intro by then, because the menus before it run for a fixed time at different frame rates. The intro's frame cost is flat, though: its 10 s frame p50 stays between 89.7 and 99.3 ms on main and between 74.9 and 79.6 ms with this change, in the warm-up runs. The only APS5_TRACE_*/APS5_PROFILE_* switch set is APS5_TRACE_FRAMES=1900:200 (recaptured after review; the first captures also set APS5_TRACE_SUMMARY_EVERY). python tools/performance_compare.py --require-matching-context:

pair metric main this PR change
1 frame p50 / p90 / p99 ms 99.0 / 106.7 / 114.7 74.6 / 78.2 / 87.1 −24.7 % / −26.7 % / −24.1 %
1 mean frame ms 96.7 74.9 −22.5 %
1 Graphics.Draw (draw committer) ms per frame 49.9 32.8 −34.3 %
1 Driver.Packet ms per frame 94.7 73.1 −22.9 %
2 frame p50 / p90 / p99 ms 98.8 / 104.9 / 113.6 77.2 / 79.6 / 89.6 −21.9 % / −24.1 % / −21.1 %
2 mean frame ms 96.2 77.2 −19.7 %
2 Graphics.Draw ms per frame 55.1 32.8 −40.4 %
2 Driver.Packet ms per frame 94.3 75.3 −20.1 %

GPU busy per present: 53.9 → 47.4 and 53.1 → 49.9 ms. All four traces report dropped events, so the event detail is incomplete; the phase totals are not affected.

Summary lines (pair 1 main, pair 1 PR, pair 2 main, pair 2 PR):

{"commit":"556547da71c5","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":19338.648},"presents":200,"frame_ms":{"p50":98.962,"p90":106.729,"p99":114.709,"max":116.936},"gpu_busy_ms_per_present":53.929,"worker_busy_pct":{"queue worker 0x0":98.085},"top_phases_ms_per_frame":{"Driver.Packet":94.692,"Graphics.Draw":49.919,"Graphics.Draw.draw_and_resource_release":47.421,"Driver.Packet.pipeline_drain":32.114,"Driver.Packet.draw":24.656,"Driver.Draw":24.445,"Recorder.Sync":21.415,"Driver.Draw.shader_compile_and_link":19.857},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.143,"events_lost":291022,"totals_full":false}},"trace":"aps5-trace-556547da71c5-705620.json.gz"}
{"commit":"37a0dbc26ad1","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":14986.023},"presents":200,"frame_ms":{"p50":74.568,"p90":78.222,"p99":87.063,"max":90.327},"gpu_busy_ms_per_present":47.395,"worker_busy_pct":{"queue worker 0x0":97.568},"top_phases_ms_per_frame":{"Driver.Packet":73.052,"Graphics.Draw":32.790,"Graphics.Draw.draw_and_resource_release":30.229,"Driver.Packet.draw":24.198,"Driver.Draw":23.992,"Recorder.Sync":20.198,"Driver.Draw.shader_compile_and_link":19.088,"Shader.DrawStage":16.836},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.319,"events_lost":273205,"totals_full":false}},"trace":"aps5-trace-37a0dbc26ad1-1357256.json.gz"}
{"commit":"556547da71c5","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":19246.865},"presents":200,"frame_ms":{"p50":98.826,"p90":104.859,"p99":113.625,"max":114.769},"gpu_busy_ms_per_present":53.135,"worker_busy_pct":{"queue worker 0x0":98.035},"top_phases_ms_per_frame":{"Driver.Packet":94.283,"Graphics.Draw":55.071,"Graphics.Draw.draw_and_resource_release":52.436,"Driver.Packet.pipeline_drain":31.721,"Driver.Packet.draw":24.675,"Driver.Draw":24.458,"Recorder.Sync":20.813,"Driver.Draw.shader_compile_and_link":19.506},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.362,"events_lost":281238,"totals_full":false}},"trace":"aps5-trace-556547da71c5-36756.json.gz"}
{"commit":"37a0dbc26ad1","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":15447.520},"presents":200,"frame_ms":{"p50":77.177,"p90":79.599,"p99":89.635,"max":93.312},"gpu_busy_ms_per_present":49.888,"worker_busy_pct":{"queue worker 0x0":97.599},"top_phases_ms_per_frame":{"Driver.Packet":75.330,"Graphics.Draw":32.805,"Graphics.Draw.draw_and_resource_release":30.247,"Driver.Packet.draw":24.767,"Driver.Draw":24.556,"Recorder.Sync":22.588,"Driver.Draw.shader_compile_and_link":19.551,"Shader.DrawStage":17.259},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.421,"events_lost":283944,"totals_full":false}},"trace":"aps5-trace-37a0dbc26ad1-989140.json.gz"}

Traces, summaries, trace_digest.py and performance_compare.py outputs, library hashes, screenshots, the worker and committer sampler profiles (collapsed stacks and symbolized reports, from separate runs) and harness: afterimage-dcc-fill-doubling-ab-clean-20261030.tar.gz, SHA-256 fefb0538c51d64310a184ae515f87528b9a42c2a1bc4bedba8607383d8b6e48e.

Tests

  • agc_driver_graphics (its executable has 38 CTest entries) pass, 3 of 3 runs.
  • 13 execution tests that use DCC keys, 28 CTest entries, run on the RX 6700 XT with VK_LAYER_KHRONOS_validation 1.4.309: AlphaToCoverage, ClampedGlobalFill, DccKeyPresync, DccKeysFirstWrite, DrawWriteRanges, FillCoverKeys, LayeredVolumeSubmit, MemoryValueFill, PresentKeyWriterWait, SampleMultisampleTarget, SgprPatternFillKeys, Srgb8ColorTarget, StagedClearSampledRead.
    • All pass 3 of 3 runs, with 84 layer insertions. agc_driver_msaa_dcc_compared_import_2/4/8 skip on this device.
    • The only VUID is VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, in agc_driver_srgb8_color_target. main 556547da71 reports the same one in that test; it is #11990 (open fixes #13006, #6782).
  • python tools/check_conventions.py --base origin/main: all checks passed.
  • Not run here: Linux, macOS, NVIDIA. The change only affects how the CPU writes the bytes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA14053 #9308 (intro frame rate)
  • GPUs tested: AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1, Windows 11 Enterprise 10.0.22621
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5088587698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13527). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-30T17:40:33Z. --- ### What `FillDccClear` writes the texels of a surface whose DCC keys say it is fast-cleared. It built one element (4 to 16 bytes) and then copied it with one `memcpy` per element, so a 3840x2160 RGBA8 surface took about 8.3 million calls. `ReadTextureSurface` uses it for every upload of such a texture, so the cost recurs whenever a cleared texture is uploaded again. It now copies the first element, then copies the filled prefix onto the rest, doubling the filled length each time (about 25 calls for that surface). The last copy stops at the last whole element, and a trailing partial element is zeroed as before, so the bytes written are the same. A test in `TextureFormat.cpp` fills 1003 bytes with an 8-byte `R16G16B16A16_SFLOAT` 1111 clear (125 elements and a 3-byte tail) and checks every byte. Making the doubling skip one byte per round makes it fail. **Where it showed up.** Afterimage (PPSA14053, UE4) on Windows runs its intro cinematic at about 10 fps on `main`. In an `APS5_SAMPLE_WORKER` run the queue worker spends 65 % of its samples waiting in `DrawPipeline::Drain`/`Enqueue`. So the draw committer sets the pace, and in an `APS5_SAMPLE_COMMITTER` run `cachedTexture` → `ReadTextureSurface` → `FillDccClear` takes 21 % of the committer, most of it `ucrtbase` `memcpy` calls on a few bytes each. ### Tested Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD proprietary driver 26.10.1, WinLibs GCC 15.2.0 UCRT r7, Release, `BUILD_TESTING=ON`. **Performance** (Afterimage PPSA14053 01.000.000, 3840x2160). Both `libSceAgcDriver.prx` were built in one build directory from `main` `556547da71`: `main` itself (SHA-256 `fe591ad3…`), and this commit on it (`37a0dbc26a`, `14370687…`). All other libraries and `app.exe` are identical. Every run started from a fresh save with the same scripted pad input (Start Game, New Game, intro). Caches were warm: each arm had run several times with its own shader cache before these runs, which then alternated. Each pair captures the same presents, 1900–2099, which are inside the intro cinematic in both arms. The arms reach different points of the intro by then, because the menus before it run for a fixed time at different frame rates. The intro's frame cost is flat, though: its 10 s frame p50 stays between 89.7 and 99.3 ms on `main` and between 74.9 and 79.6 ms with this change, in the warm-up runs. The only `APS5_TRACE_*`/`APS5_PROFILE_*` switch set is `APS5_TRACE_FRAMES=1900:200` (recaptured after review; the first captures also set `APS5_TRACE_SUMMARY_EVERY`). `python tools/performance_compare.py --require-matching-context`: | pair | metric | `main` | this PR | change | |---|---|---|---|---| | 1 | frame p50 / p90 / p99 ms | 99.0 / 106.7 / 114.7 | 74.6 / 78.2 / 87.1 | −24.7 % / −26.7 % / −24.1 % | | 1 | mean frame ms | 96.7 | 74.9 | −22.5 % | | 1 | `Graphics.Draw` (draw committer) ms per frame | 49.9 | 32.8 | −34.3 % | | 1 | `Driver.Packet` ms per frame | 94.7 | 73.1 | −22.9 % | | 2 | frame p50 / p90 / p99 ms | 98.8 / 104.9 / 113.6 | 77.2 / 79.6 / 89.6 | −21.9 % / −24.1 % / −21.1 % | | 2 | mean frame ms | 96.2 | 77.2 | −19.7 % | | 2 | `Graphics.Draw` ms per frame | 55.1 | 32.8 | −40.4 % | | 2 | `Driver.Packet` ms per frame | 94.3 | 75.3 | −20.1 % | GPU busy per present: 53.9 → 47.4 and 53.1 → 49.9 ms. All four traces report dropped events, so the event detail is incomplete; the phase totals are not affected. Summary lines (pair 1 `main`, pair 1 PR, pair 2 `main`, pair 2 PR): ``` {"commit":"556547da71c5","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":19338.648},"presents":200,"frame_ms":{"p50":98.962,"p90":106.729,"p99":114.709,"max":116.936},"gpu_busy_ms_per_present":53.929,"worker_busy_pct":{"queue worker 0x0":98.085},"top_phases_ms_per_frame":{"Driver.Packet":94.692,"Graphics.Draw":49.919,"Graphics.Draw.draw_and_resource_release":47.421,"Driver.Packet.pipeline_drain":32.114,"Driver.Packet.draw":24.656,"Driver.Draw":24.445,"Recorder.Sync":21.415,"Driver.Draw.shader_compile_and_link":19.857},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.143,"events_lost":291022,"totals_full":false}},"trace":"aps5-trace-556547da71c5-705620.json.gz"} {"commit":"37a0dbc26ad1","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":14986.023},"presents":200,"frame_ms":{"p50":74.568,"p90":78.222,"p99":87.063,"max":90.327},"gpu_busy_ms_per_present":47.395,"worker_busy_pct":{"queue worker 0x0":97.568},"top_phases_ms_per_frame":{"Driver.Packet":73.052,"Graphics.Draw":32.790,"Graphics.Draw.draw_and_resource_release":30.229,"Driver.Packet.draw":24.198,"Driver.Draw":23.992,"Recorder.Sync":20.198,"Driver.Draw.shader_compile_and_link":19.088,"Shader.DrawStage":16.836},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.319,"events_lost":273205,"totals_full":false}},"trace":"aps5-trace-37a0dbc26ad1-1357256.json.gz"} {"commit":"556547da71c5","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":19246.865},"presents":200,"frame_ms":{"p50":98.826,"p90":104.859,"p99":113.625,"max":114.769},"gpu_busy_ms_per_present":53.135,"worker_busy_pct":{"queue worker 0x0":98.035},"top_phases_ms_per_frame":{"Driver.Packet":94.283,"Graphics.Draw":55.071,"Graphics.Draw.draw_and_resource_release":52.436,"Driver.Packet.pipeline_drain":31.721,"Driver.Packet.draw":24.675,"Driver.Draw":24.458,"Recorder.Sync":20.813,"Driver.Draw.shader_compile_and_link":19.506},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.362,"events_lost":281238,"totals_full":false}},"trace":"aps5-trace-556547da71c5-36756.json.gz"} {"commit":"37a0dbc26ad1","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"installed","APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1900:200"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.22621","cpu":"AMD Ryzen 9 5950X 16-Core Processor","cpu_threads":32,"memory_mib":65457,"title_id":"PPSA14053","title":"Afterimage","content_version":"01.000.000","resolution":"3840x2160","window":{"spec":"frames 1900:200","first_present":1900,"ms":15447.520},"presents":200,"frame_ms":{"p50":77.177,"p90":79.599,"p99":89.635,"max":93.312},"gpu_busy_ms_per_present":49.888,"worker_busy_pct":{"queue worker 0x0":97.599},"top_phases_ms_per_frame":{"Driver.Packet":75.330,"Graphics.Draw":32.805,"Graphics.Draw.draw_and_resource_release":30.247,"Driver.Packet.draw":24.767,"Driver.Draw":24.556,"Recorder.Sync":22.588,"Driver.Draw.shader_compile_and_link":19.551,"Shader.DrawStage":17.259},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":7.421,"events_lost":283944,"totals_full":false}},"trace":"aps5-trace-37a0dbc26ad1-989140.json.gz"} ``` Traces, summaries, `trace_digest.py` and `performance_compare.py` outputs, library hashes, screenshots, the worker and committer sampler profiles (collapsed stacks and symbolized reports, from separate runs) and harness: [afterimage-dcc-fill-doubling-ab-clean-20261030.tar.gz](https://github.com/JJenkx/AnyPS5/releases/download/dcc-clear-fill-doubling-afterimage-clean-20261030/afterimage-dcc-fill-doubling-ab-clean-20261030.tar.gz), SHA-256 `fefb0538c51d64310a184ae515f87528b9a42c2a1bc4bedba8607383d8b6e48e`. **Tests** - `agc_driver_graphics` (its executable has 38 CTest entries) pass, 3 of 3 runs. - 13 execution tests that use DCC keys, 28 CTest entries, run on the RX 6700 XT with `VK_LAYER_KHRONOS_validation` 1.4.309: `AlphaToCoverage`, `ClampedGlobalFill`, `DccKeyPresync`, `DccKeysFirstWrite`, `DrawWriteRanges`, `FillCoverKeys`, `LayeredVolumeSubmit`, `MemoryValueFill`, `PresentKeyWriterWait`, `SampleMultisampleTarget`, `SgprPatternFillKeys`, `Srgb8ColorTarget`, `StagedClearSampledRead`. - All pass 3 of 3 runs, with 84 layer insertions. `agc_driver_msaa_dcc_compared_import_2/4/8` skip on this device. - The only VUID is `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605`, in `agc_driver_srgb8_color_target`. `main` `556547da71` reports the same one in that test; it is #11990 (open fixes #13006, #6782). - `python tools/check_conventions.py --base origin/main`: all checks passed. - Not run here: Linux, macOS, NVIDIA. The change only affects how the CPU writes the bytes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA14053 #9308 (intro frame rate) - [x] GPUs tested: AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1, Windows 11 Enterprise 10.0.22621 - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-30 17:45:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T17:45:03Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The fill optimization and added byte-level test look sound, but the paired performance captures set an additional tracing switch that the repository’s performance-report instructions prohibit for comparable measurements.

What I ran

Reviewed head 37a0dbc26ad169c4b03730c557d43d6c025f5843 against base 223b19ba0adb11b66893a57fa656ecf6bc4a45cf; the exact-head merge preview against that base was clean. The base used in the performance captures was 556547da71c5; it is 14 commits behind the current base, and none of those intervening commits changed either PR path. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or compile.

Commands and checks:

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13527
python3 tools/check_conventions.py --base 223b19ba0adb11b66893a57fa656ecf6bc4a45cf --head 37a0dbc26ad169c4b03730c557d43d6c025f5843 --title 'perf(agc): fill a DCC fast-clear surface by doubling copies' --body /tmp/anyps5-pr-13527-evidence/pr-body.md
git diff --check 223b19ba0adb11b66893a57fa656ecf6bc4a45cf...37a0dbc26ad169c4b03730c557d43d6c025f5843
gh api repos/boykopovar/AnyPS5/compare/556547da71c5...223b19ba0adb --jq '{status, ahead_by, behind_by, files: [.files[].filename]}'

The supplied archive checksum matched the PR body. I reran the exact-head trace_digest.py and performance_compare.py outputs on the attached traces; after normalizing CRLF/LF, all four digests and both pair reports matched the attached outputs byte-for-byte. The precheck's ABI-audit and test-quality helper subprocesses could not run because those local helper scripts are not present at the PR head; these are tool-availability errors, not findings in the patch.

Results

Check Result
git diff --check Passed
Repository conventions and PR template Passed
Exact-head merge preview against current base Clean
Benchmark archive SHA-256 Matches PR description
Recomputed trace digests and pair comparisons Match attached reports
Build and C++ tests Not run; initial review is no-build
Hosted CI All six visible checks were queued at last refresh
Unedited output from checks
All conventions checks passed.
m3-main-ab/trace-digest.md == recomputed-m3-at-head.md: True (5508 vs 5508 bytes)
m4-main-ab/trace-digest.md == recomputed-m4-at-head.md: True (5306 vs 5306 bytes)
p3-fill2x/trace-digest.md == recomputed-p3-at-head.md: True (5377 vs 5377 bytes)
p4-fill2x/trace-digest.md == recomputed-p4-at-head.md: True (5315 vs 5315 bytes)
compare-pair1.md == recomputed-pair1.md: True (1955 vs 1955 bytes)
compare-pair2.md == recomputed-pair2.md: True (1956 vs 1956 bytes)
7b1526afc4881670d787d332418cf4a60fa38faf3f809f896ddc1a7414014668  /tmp/anyps5-pr-13527-evidence/afterimage-dcc-fill-doubling-ab-20261030.tar.gz
{"status":"ahead","ahead_by":14,"behind_by":0,"files":[".github/workflows/sanitizers.yml","CMakeLists.txt","core/libs/prx/libSceNpCppWebApi/CMakeLists.txt","core/libs/prx/libSceNpCppWebApi/Export.cpp","core/libs/prx/libSceNpCppWebApi/include/Api.hpp","core/libs/tests/GuestNpCppWebApiTitleCloudStorage.cpp","docs/dev/debt/libSceNpCppWebApi.md","tools/annotate_module.py","tools/check_configure_seed.py","tools/tests/test_annotate_module.py","tools/tests/test_check_configure_seed.py"]}

The precheck's two unavailable helper commands returned:

/usr/bin/python3: can't open file '.../tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '.../tools/pr_test_quality.py': [Errno 2] No such file or directory

Findings

Blocking

  • The PR's four summary records include APS5_TRACE_SUMMARY_EVERY=10 alongside APS5_TRACE_FRAMES. The performance form says to set no other APS5_TRACE_*/APS5_PROFILE_* switch because it costs time; the build documentation specifically says APS5_TRACE_SUMMARY_EVERY adds timestamp recording and two clock reads per performance-timer scope. This changes the measured instrumentation overhead, so the supplied traces do not follow the required capture protocol. Please repeat the matched main/change captures with only the documented frame-window switch, then update the summary lines, traces, digests, and comparison. I checked the current main history: its 14 intervening commits touch neither changed PR path, so the existing baseline code itself is still representative for these files.

Non-blocking

  • The source change copies the initial element then doubles the initialized prefix using non-overlapping ranges; the remaining tail is zero-filled. The 1003-byte test checks all 1000 repeated bytes and all 3 tail bytes. No code defect was found in this source review.
  • The captured traces report dropped event details, and the comparison tool warns that event detail is incomplete. The summary records have totals_full:false, which means the per-thread totals table did not overflow; aggregate summary totals remain available. The attachments therefore support aggregate comparisons but not complete event-level inspection.

Sources

Not verified

  • I did not build or run C++ tests locally, run Linux/macOS/GPU tests, or independently reproduce the author's Windows captures.
  • Hosted checks were queued at the last refresh; I did not wait for them to finish.
  • A negative-control mutation was not run; none is relevant to the performance-capture protocol finding.

To get this to a good state

Please rerun the paired captures on the same machine, scene, and settings without APS5_TRACE_SUMMARY_EVERY, then replace the four summary lines and attached traces and regenerate the digests/comparison. I will re-run the same checks against the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5716324504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13527#pullrequestreview-5716324504). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T17:45:03Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The fill optimization and added byte-level test look sound, but the paired performance captures set an additional tracing switch that the repository’s performance-report instructions prohibit for comparable measurements. ## What I ran Reviewed head `37a0dbc26ad169c4b03730c557d43d6c025f5843` against base `223b19ba0adb11b66893a57fa656ecf6bc4a45cf`; the exact-head merge preview against that base was clean. The base used in the performance captures was `556547da71c5`; it is 14 commits behind the current base, and none of those intervening commits changed either PR path. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build or compile. Commands and checks: ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13527 python3 tools/check_conventions.py --base 223b19ba0adb11b66893a57fa656ecf6bc4a45cf --head 37a0dbc26ad169c4b03730c557d43d6c025f5843 --title 'perf(agc): fill a DCC fast-clear surface by doubling copies' --body /tmp/anyps5-pr-13527-evidence/pr-body.md git diff --check 223b19ba0adb11b66893a57fa656ecf6bc4a45cf...37a0dbc26ad169c4b03730c557d43d6c025f5843 gh api repos/boykopovar/AnyPS5/compare/556547da71c5...223b19ba0adb --jq '{status, ahead_by, behind_by, files: [.files[].filename]}' ``` The supplied archive checksum matched the PR body. I reran the exact-head `trace_digest.py` and `performance_compare.py` outputs on the attached traces; after normalizing CRLF/LF, all four digests and both pair reports matched the attached outputs byte-for-byte. The precheck's ABI-audit and test-quality helper subprocesses could not run because those local helper scripts are not present at the PR head; these are tool-availability errors, not findings in the patch. ## Results | Check | Result | |---|---| | `git diff --check` | Passed | | Repository conventions and PR template | Passed | | Exact-head merge preview against current base | Clean | | Benchmark archive SHA-256 | Matches PR description | | Recomputed trace digests and pair comparisons | Match attached reports | | Build and C++ tests | Not run; initial review is no-build | | Hosted CI | All six visible checks were queued at last refresh | <details><summary>Unedited output from checks</summary> ```text All conventions checks passed. ``` ```text m3-main-ab/trace-digest.md == recomputed-m3-at-head.md: True (5508 vs 5508 bytes) m4-main-ab/trace-digest.md == recomputed-m4-at-head.md: True (5306 vs 5306 bytes) p3-fill2x/trace-digest.md == recomputed-p3-at-head.md: True (5377 vs 5377 bytes) p4-fill2x/trace-digest.md == recomputed-p4-at-head.md: True (5315 vs 5315 bytes) compare-pair1.md == recomputed-pair1.md: True (1955 vs 1955 bytes) compare-pair2.md == recomputed-pair2.md: True (1956 vs 1956 bytes) 7b1526afc4881670d787d332418cf4a60fa38faf3f809f896ddc1a7414014668 /tmp/anyps5-pr-13527-evidence/afterimage-dcc-fill-doubling-ab-20261030.tar.gz ``` ```text {"status":"ahead","ahead_by":14,"behind_by":0,"files":[".github/workflows/sanitizers.yml","CMakeLists.txt","core/libs/prx/libSceNpCppWebApi/CMakeLists.txt","core/libs/prx/libSceNpCppWebApi/Export.cpp","core/libs/prx/libSceNpCppWebApi/include/Api.hpp","core/libs/tests/GuestNpCppWebApiTitleCloudStorage.cpp","docs/dev/debt/libSceNpCppWebApi.md","tools/annotate_module.py","tools/check_configure_seed.py","tools/tests/test_annotate_module.py","tools/tests/test_check_configure_seed.py"]} ``` The precheck's two unavailable helper commands returned: ```text /usr/bin/python3: can't open file '.../tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '.../tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Findings ### Blocking - The PR's four summary records include `APS5_TRACE_SUMMARY_EVERY=10` alongside `APS5_TRACE_FRAMES`. The performance form says to set no other `APS5_TRACE_*`/`APS5_PROFILE_*` switch because it costs time; the build documentation specifically says `APS5_TRACE_SUMMARY_EVERY` adds timestamp recording and two clock reads per performance-timer scope. This changes the measured instrumentation overhead, so the supplied traces do not follow the required capture protocol. Please repeat the matched main/change captures with only the documented frame-window switch, then update the summary lines, traces, digests, and comparison. I checked the current main history: its 14 intervening commits touch neither changed PR path, so the existing baseline code itself is still representative for these files. ### Non-blocking - The source change copies the initial element then doubles the initialized prefix using non-overlapping ranges; the remaining tail is zero-filled. The 1003-byte test checks all 1000 repeated bytes and all 3 tail bytes. No code defect was found in this source review. - The captured traces report dropped event details, and the comparison tool warns that event detail is incomplete. The summary records have `totals_full:false`, which means the per-thread totals table did not overflow; aggregate summary totals remain available. The attachments therefore support aggregate comparisons but not complete event-level inspection. ## Sources - [Performance report capture requirements at base `223b19ba0adb11b66893a57fa656ecf6bc4a45cf`](https://github.com/boykopovar/AnyPS5/blob/223b19ba0adb11b66893a57fa656ecf6bc4a45cf/.github/ISSUE_TEMPLATE/performance.yml#L8-L13) - [Tracing overhead and combined-switch behavior at base `223b19ba0adb11b66893a57fa656ecf6bc4a45cf`](https://github.com/boykopovar/AnyPS5/blob/223b19ba0adb11b66893a57fa656ecf6bc4a45cf/docs/dev/BUILD.md#L245-L253) - [Reviewed fill implementation at head `37a0dbc26ad169c4b03730c557d43d6c025f5843`](https://github.com/boykopovar/AnyPS5/blob/37a0dbc26ad169c4b03730c557d43d6c025f5843/core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp) - [Added fill test at head `37a0dbc26ad169c4b03730c557d43d6c025f5843`](https://github.com/boykopovar/AnyPS5/blob/37a0dbc26ad169c4b03730c557d43d6c025f5843/core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp) ## Not verified - I did not build or run C++ tests locally, run Linux/macOS/GPU tests, or independently reproduce the author's Windows captures. - Hosted checks were queued at the last refresh; I did not wait for them to finish. - A negative-control mutation was not run; none is relevant to the performance-capture protocol finding. ## To get this to a good state Please rerun the paired captures on the same machine, scene, and settings without `APS5_TRACE_SUMMARY_EVERY`, then replace the four summary lines and attached traces and regenerate the digests/comparison. I will re-run the same checks against the updated head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13527
No description provided.