perf(shader): insert patched SRT reads before their use without appending first #7431

Merged
milescoviello merged 1 commit from upstream-pr/7431 into main 2026-10-20 20:29:46 +00:00
milescoviello commented 2026-10-18 06:17:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T06:17:38Z.


What

PlanBuilder::PatchReads replaces each planned SRT read with a GetSrtResource and a ReadConst placed right before the read. It built both values with IrBuilder::Emit, which appends them at the end of the block, then took each back out with IrBlock::RemoveInstruction and inserted it before the read. RemoveInstruction searches the block's list from the front, and the value it looks for is always the last one. So every patched read walked its whole block twice.

Both values are now created with IrProgram::CreateValue and inserted before the read directly, the way EmitBefore in ResourceTracker.cpp already does it. ReferenceU32 for kept reads is still emitted through the builder at the end of the block. The order of the instructions, and so the SPIR-V, is unchanged.

verifySrtReadPatching in ShaderMemory.cpp now also checks that the GetSrtResource and its ReadConst sit right before the original read. That holds on main too, so it is not a red test; it guards the placement this PR now does by hand. With the ReadConst appended at the end of the block instead, it fails with "the flat read is not right before the original read".

Tested

Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02.

  • ctest -R ^agc_: 707/707 pass (3 skipped: host import sparse, sparse dma-buf import, stencil ref export).
  • ctest -R "^(agc_shader|agc_ir|shader_ir)": 23/23 pass. With the new check added, agc_shader_srt_read_patching and agc_shader_memory pass, on main's PatchReads too.
  • agc_shader_replay --spv (Release, ANYPS5_ENABLE_SPIRV_TOOLS off, ANYPS5_NO_SHADER_CACHE=1) on all 46 shader requests dumped from PPSA31162: the 46 .spv files have the same SHA-256 on main ccb0c09268 and with this PR, and the replay output is identical.
  • A second corpus, on current main 2185dbf92e merged with this PR (d87f876236, a clean merge): the 304 shader requests dumped from PPSA30839. All 304 .spv files have the same SHA-256 on main and with this PR, and the replay logs match. CPU time (perf stat -e task-clock, interleaved runs) for the whole set: median 20.51 s on main and 18.84 s with this PR, 4 runs each, ranges 20.49–20.55 s and 18.54–18.94 s, so about 8% less. For its largest shader, shader_10f9f30000 (1.13M SPIR-V words): 807 ms and 760 ms, 10 runs each. In a --call-graph dwarf profile of that shader on main, IrBlock::RemoveInstruction is 7.2% of samples, all of it from PlanBuilder::PatchReads.

Where it showed up. I profiled the Release replay of that title's largest compute shader (13,508 code words, 1,056,287 SPIR-V words) with perf record (task-clock). On main, IrBlock::RemoveInstruction was 6.6% of samples. In a --call-graph dwarf profile it was 8.1%, and all of it came from PatchReads, reached through both Recompile and PrepareResourceProgram. With this PR it no longer appears in the profile.

Replay CPU time of that shader (perf stat -e task-clock), 40 runs per build, interleaved:

Build mean ± sd median
main ccb0c09268 1219.5 ± 130.2 ms 1226.4 ms
this PR 1106.3 ± 102.5 ms 1102.0 ms

Another workload was using about 8 cores on the host during these runs, so the spread is wide. Wall-clock times from the same kind of run were noisier (means 1.248 s and 1.187 s). I didn't time the other 45 requests separately (the next largest produce 211,283 to 254,011 SPIR-V words), and I make no claim about them.

Title level: no speed claim. This is background shader preparation. I didn't run the title for it.

tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists only conflicting PRs that it could not compare, all for ShaderMemory.cpp. Of those, #6412 has the end of verifySrtReadPatching as context, and #6674 calls it. #6947 changes SrtPlanBuilder.cpp, but not PatchReads.

  • AMD on Linux: @DavidAmsellem ran the full suite on an RX 7900 XT (RADV NAVI31, Mesa 25.2.8), merged onto main 0fbfd91e5: 1637/1639 with this PR and on main, with the same two failures (#7766, #7784), and no test added, skipped or removed. That's correctness only; the speed-up wasn't measured there.

Title capture

As the perf label asks, these are captures of one title and scene on one machine. MXGP26 (PPSA30839) ran from boot with APS5_TRACE_SECONDS=0:60, ANYPS5_NO_SHADER_CACHE=1 and a fresh run directory (cold AnyPS5 and NVIDIA caches), so the shaders compile inside the window. NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04, release libs, Xvfb display, no input. main dbac9fa15b was captured five times: before the PR captures, after them, and three more times in a row after that. Each PR capture and the first two main captures followed a rebuild of the release libraries; the last three main captures did not, and they came out lower. The change is main with this PR merged on top as a local merge commit (632261e94460). The time is the wall time of the Shader.PrepareArtifact slices on the shader prepare threads in each trace.

capture presents frame p50 / p90 artifacts prepared prepare time, total per artifact, mean / median
main 1 194 16.7 / 32.8 ms 935 87.3 s 93.4 / 27.7 ms
main 2 195 16.7 / 34.0 ms 956 91.4 s 95.6 / 29.6 ms
main 3 166 16.7 / 28.4 ms 961 82.1 s 85.4 / 27.3 ms
main 4 161 16.7 / 27.9 ms 946 77.6 s 82.1 / 24.7 ms
main 5 183 16.7 / 22.7 ms 939 78.4 s 83.5 / 22.8 ms
this PR 173 16.7 / 28.3 ms 950 89.3 s 94.0 / 29.2 ms

The five main captures span 17.7% in total prepare time, and the 13 prepare threads run in parallel with the title, so a title capture can't resolve a recompiler change of a few percent. The replay measurement above is this change's measurement. This PR's capture falls inside the range of the five main captures.

main 1 trace, digest, main 2 trace, digest, main 3 trace, digest, main 4 trace, digest, main 5 trace, digest, this PR trace, digest

{"commit":"dbac9fa15b61","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":120148.301},"presents":194,"frame_ms":{"p50":16.686,"p90":32.765,"p99":2921.590,"max":112847.624},"gpu_busy_ms_per_present":6.483,"worker_busy_pct":{"queue worker 0x0":88.481,"queue worker 0x20":73.127},"top_phases_ms_per_frame":{"Driver.Packet":1000.862,"Driver.Packet.dispatch":503.561,"Driver.Dispatch":503.451,"Shader.PrepareArtifact":450.125,"Driver.Packet.memory_wait":424.003,"Vulkan.GraphicsPipeline":132.519,"Vulkan.GraphicsPipelineLibrary":126.497,"Vulkan.GraphicsPipelinePrebuild":77.312},"trace_dropped":false,"trace":"aps5-trace-dbac9fa15b61-3.json.gz"}
{"commit":"632261e94460","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":115180.976},"presents":173,"frame_ms":{"p50":16.689,"p90":28.324,"p99":2304.095,"max":109211.934},"gpu_busy_ms_per_present":4.606,"worker_busy_pct":{"queue worker 0x0":88.548,"queue worker 0x20":71.872},"top_phases_ms_per_frame":{"Driver.Packet":1068.048,"Driver.Packet.dispatch":544.669,"Driver.Dispatch":544.539,"Shader.PrepareArtifact":516.424,"Driver.Packet.memory_wait":449.546,"Vulkan.GraphicsPipeline":144.647,"Vulkan.GraphicsPipelineLibrary":138.209,"Vulkan.GraphicsPipelinePrebuild":86.670},"trace_dropped":false,"trace":"aps5-trace-632261e94460-3.json.gz"}
  • Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_' -V on main e2a2914aa1 and on main + this PR (9be717d11b, a local merge). main: 815 of 815 pass; with this PR: 815 of 815 pass. Neither log reports the layer missing. VUIDs on main: VUID-VkImageViewCreateInfo-usage-02275 ×6, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 ×18, VUID-vkCmdCopyBuffer-srcBuffer-00118 ×2, VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285 ×2, VUID-vkCmdWaitEvents-srcStageMask-01158 ×2, VUID-vkSetEvent-event-09543 ×2; with this PR: VUID-VkImageViewCreateInfo-usage-02275 ×6, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 ×18, VUID-vkCmdCopyBuffer-srcBuffer-00118 ×2, VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285 ×2, VUID-vkCmdWaitEvents-srcStageMask-01158 ×2, VUID-vkSetEvent-event-09543 ×2. None is new with this PR.

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: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4906892108 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-18T06:17:38Z. --- ### What `PlanBuilder::PatchReads` replaces each planned SRT read with a `GetSrtResource` and a `ReadConst` placed right before the read. It built both values with `IrBuilder::Emit`, which appends them at the end of the block, then took each back out with `IrBlock::RemoveInstruction` and inserted it before the read. `RemoveInstruction` searches the block's list from the front, and the value it looks for is always the last one. So every patched read walked its whole block twice. Both values are now created with `IrProgram::CreateValue` and inserted before the read directly, the way `EmitBefore` in `ResourceTracker.cpp` already does it. `ReferenceU32` for kept reads is still emitted through the builder at the end of the block. The order of the instructions, and so the SPIR-V, is unchanged. `verifySrtReadPatching` in `ShaderMemory.cpp` now also checks that the `GetSrtResource` and its `ReadConst` sit right before the original read. That holds on `main` too, so it is not a red test; it guards the placement this PR now does by hand. With the `ReadConst` appended at the end of the block instead, it fails with "the flat read is not right before the original read". ### Tested Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02. - `ctest -R ^agc_`: 707/707 pass (3 skipped: host import sparse, sparse dma-buf import, stencil ref export). - `ctest -R "^(agc_shader|agc_ir|shader_ir)"`: 23/23 pass. With the new check added, `agc_shader_srt_read_patching` and `agc_shader_memory` pass, on `main`'s `PatchReads` too. - `agc_shader_replay --spv` (Release, `ANYPS5_ENABLE_SPIRV_TOOLS` off, `ANYPS5_NO_SHADER_CACHE=1`) on all 46 shader requests dumped from PPSA31162: the 46 `.spv` files have the same SHA-256 on `main` ccb0c09268 and with this PR, and the replay output is identical. - A second corpus, on current `main` 2185dbf92e merged with this PR (d87f876236, a clean merge): the 304 shader requests dumped from PPSA30839. All 304 `.spv` files have the same SHA-256 on `main` and with this PR, and the replay logs match. CPU time (`perf stat -e task-clock`, interleaved runs) for the whole set: median 20.51 s on `main` and 18.84 s with this PR, 4 runs each, ranges 20.49–20.55 s and 18.54–18.94 s, so about 8% less. For its largest shader, `shader_10f9f30000` (1.13M SPIR-V words): 807 ms and 760 ms, 10 runs each. In a `--call-graph dwarf` profile of that shader on `main`, `IrBlock::RemoveInstruction` is 7.2% of samples, all of it from `PlanBuilder::PatchReads`. **Where it showed up.** I profiled the Release replay of that title's largest compute shader (13,508 code words, 1,056,287 SPIR-V words) with `perf record` (task-clock). On `main`, `IrBlock::RemoveInstruction` was 6.6% of samples. In a `--call-graph dwarf` profile it was 8.1%, and all of it came from `PatchReads`, reached through both `Recompile` and `PrepareResourceProgram`. With this PR it no longer appears in the profile. **Replay CPU time** of that shader (`perf stat -e task-clock`), 40 runs per build, interleaved: | Build | mean ± sd | median | |---|---|---| | `main` ccb0c09268 | 1219.5 ± 130.2 ms | 1226.4 ms | | this PR | 1106.3 ± 102.5 ms | 1102.0 ms | Another workload was using about 8 cores on the host during these runs, so the spread is wide. Wall-clock times from the same kind of run were noisier (means 1.248 s and 1.187 s). I didn't time the other 45 requests separately (the next largest produce 211,283 to 254,011 SPIR-V words), and I make no claim about them. **Title level: no speed claim.** This is background shader preparation. I didn't run the title for it. `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` lists only conflicting PRs that it could not compare, all for `ShaderMemory.cpp`. Of those, #6412 has the end of `verifySrtReadPatching` as context, and #6674 calls it. #6947 changes `SrtPlanBuilder.cpp`, but not `PatchReads`. - AMD on Linux: @DavidAmsellem [ran the full suite](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6272003875) on an RX 7900 XT (RADV NAVI31, Mesa 25.2.8), merged onto `main` 0fbfd91e5: 1637/1639 with this PR and on `main`, with the same two failures (#7766, #7784), and no test added, skipped or removed. That's correctness only; the speed-up wasn't measured there. ### Title capture As the `perf` label asks, these are captures of one title and scene on one machine. MXGP26 (PPSA30839) ran from boot with `APS5_TRACE_SECONDS=0:60`, `ANYPS5_NO_SHADER_CACHE=1` and a fresh run directory (cold AnyPS5 and NVIDIA caches), so the shaders compile inside the window. NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04, release libs, Xvfb display, no input. `main` dbac9fa15b61 was captured five times: before the PR captures, after them, and three more times in a row after that. Each PR capture and the first two `main` captures followed a rebuild of the release libraries; the last three `main` captures did not, and they came out lower. The change is `main` with this PR merged on top as a local merge commit (632261e94460). The time is the wall time of the `Shader.PrepareArtifact` slices on the `shader prepare` threads in each trace. | capture | presents | frame p50 / p90 | artifacts prepared | prepare time, total | per artifact, mean / median | |---|---:|---:|---:|---:|---:| | `main` 1 | 194 | 16.7 / 32.8 ms | 935 | 87.3 s | 93.4 / 27.7 ms | | `main` 2 | 195 | 16.7 / 34.0 ms | 956 | 91.4 s | 95.6 / 29.6 ms | | `main` 3 | 166 | 16.7 / 28.4 ms | 961 | 82.1 s | 85.4 / 27.3 ms | | `main` 4 | 161 | 16.7 / 27.9 ms | 946 | 77.6 s | 82.1 / 24.7 ms | | `main` 5 | 183 | 16.7 / 22.7 ms | 939 | 78.4 s | 83.5 / 22.8 ms | | this PR | 173 | 16.7 / 28.3 ms | 950 | 89.3 s | 94.0 / 29.2 ms | The five `main` captures span 17.7% in total prepare time, and the 13 prepare threads run in parallel with the title, so a title capture can't resolve a recompiler change of a few percent. The replay measurement above is this change's measurement. This PR's capture falls inside the range of the five `main` captures. [`main` 1 trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main-aps5-trace-dbac9fa15b61-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main-digest.txt), [`main` 2 trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main2-aps5-trace-dbac9fa15b61-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main2-digest.txt), [`main` 3 trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main3-aps5-trace-dbac9fa15b61-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main3-digest.txt), [`main` 4 trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main4-aps5-trace-dbac9fa15b61-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main4-digest.txt), [`main` 5 trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main5-aps5-trace-dbac9fa15b61-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-main5-digest.txt), [this PR trace](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-7431-aps5-trace-632261e94460-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-7431-digest.txt) ```json {"commit":"dbac9fa15b61","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":120148.301},"presents":194,"frame_ms":{"p50":16.686,"p90":32.765,"p99":2921.590,"max":112847.624},"gpu_busy_ms_per_present":6.483,"worker_busy_pct":{"queue worker 0x0":88.481,"queue worker 0x20":73.127},"top_phases_ms_per_frame":{"Driver.Packet":1000.862,"Driver.Packet.dispatch":503.561,"Driver.Dispatch":503.451,"Shader.PrepareArtifact":450.125,"Driver.Packet.memory_wait":424.003,"Vulkan.GraphicsPipeline":132.519,"Vulkan.GraphicsPipelineLibrary":126.497,"Vulkan.GraphicsPipelinePrebuild":77.312},"trace_dropped":false,"trace":"aps5-trace-dbac9fa15b61-3.json.gz"} {"commit":"632261e94460","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":115180.976},"presents":173,"frame_ms":{"p50":16.689,"p90":28.324,"p99":2304.095,"max":109211.934},"gpu_busy_ms_per_present":4.606,"worker_busy_pct":{"queue worker 0x0":88.548,"queue worker 0x20":71.872},"top_phases_ms_per_frame":{"Driver.Packet":1068.048,"Driver.Packet.dispatch":544.669,"Driver.Dispatch":544.539,"Shader.PrepareArtifact":516.424,"Driver.Packet.memory_wait":449.546,"Vulkan.GraphicsPipeline":144.647,"Vulkan.GraphicsPipelineLibrary":138.209,"Vulkan.GraphicsPipelinePrebuild":86.670},"trace_dropped":false,"trace":"aps5-trace-632261e94460-3.json.gz"} ``` - Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_' -V` on `main` e2a2914aa1 and on `main` + this PR (9be717d11b, a local merge). `main`: 815 of 815 pass; with this PR: 815 of 815 pass. Neither log reports the layer missing. VUIDs on `main`: `VUID-VkImageViewCreateInfo-usage-02275` ×6, `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` ×18, `VUID-vkCmdCopyBuffer-srcBuffer-00118` ×2, `VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285` ×2, `VUID-vkCmdWaitEvents-srcStageMask-01158` ×2, `VUID-vkSetEvent-event-09543` ×2; with this PR: `VUID-VkImageViewCreateInfo-usage-02275` ×6, `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` ×18, `VUID-vkCmdCopyBuffer-srcBuffer-00118` ×2, `VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285` ×2, `VUID-vkCmdWaitEvents-srcStageMask-01158` ×2, `VUID-vkSetEvent-event-09543` ×2. None is new with this PR. ### 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: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-18 06:28:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T06:28:42Z.


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.

Pull request Shared files not compared
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6290 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6645 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6683 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6947 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/SrtWalker/SrtPlanBuilder.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/SrtWalker/SrtPlanBuilder.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7816 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7888 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8004 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8077 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6246566424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6246566424). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T06:28:42Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6290](https://www.github.com/boykopovar/AnyPS5/pull/6290) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6488](https://www.github.com/boykopovar/AnyPS5/pull/6488) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6645](https://www.github.com/boykopovar/AnyPS5/pull/6645) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`core/shader/recompiler/Optimization/src/SrtWalker/SrtPlanBuilder.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`<br>`core/shader/recompiler/Optimization/src/SrtWalker/SrtPlanBuilder.cpp` | | [PR 7684](https://www.github.com/boykopovar/AnyPS5/pull/7684) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 7816](https://www.github.com/boykopovar/AnyPS5/pull/7816) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 7888](https://www.github.com/boykopovar/AnyPS5/pull/7888) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 8004](https://www.github.com/boykopovar/AnyPS5/pull/8004) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` | | [PR 8077](https://www.github.com/boykopovar/AnyPS5/pull/8077) | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` |
DavidAmsellem commented 2026-10-19 16:27:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T16:27:56Z.


First AMD-on-Linux (RADV) run of this PR. Merged onto main 0fbfd91e5 (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1637/1639 with this PR, against 1637/1639 on main. The failures are the same two on both, so this PR adds none: agc_driver_image_table_vouched_lookups (#7766, fixed by #7916) and agc_driver_guest_memory_lifetime (#7784). The PR adds no new ctest entry, and no test is skipped or removed compared with main. This checks correctness only: I did not measure the speed-up.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272003875 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6272003875). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T16:27:56Z. --- First AMD-on-Linux (RADV) run of this PR. Merged onto `main` `0fbfd91e5` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`): **1637/1639 with this PR**, against 1637/1639 on `main`. The failures are the same two on both, so this PR adds none: `agc_driver_image_table_vouched_lookups` (#7766, fixed by #7916) and `agc_driver_guest_memory_lifetime` (#7784). The PR adds no new ctest entry, and no test is skipped or removed compared with `main`. This checks correctness only: I did not measure the speed-up. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
milescoviello commented 2026-10-19 16:30:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T16:30:48Z.


@DavidAmsellem thank you for the RADV full-suite run. It matches main on gfx1100 with the same two failures, so this change adds none. It's in the description now.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272055216 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6272055216). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T16:30:48Z. --- @DavidAmsellem thank you for the RADV full-suite run. It matches `main` on gfx1100 with the same two failures, so this change adds none. It's in the description now. AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-19 16:31:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T16:31:00Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272058867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6272058867). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T16:31:00Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
milescoviello commented 2026-10-19 21:35:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T21:35:37Z.


The title capture the perf label asks for is now in the description, with both summary lines, the traces and the digests: MXGP26 from boot, a cold shader cache, main dbac9fa15b against main + this PR (632261e94460). The five main captures span 17.7% in total shader prepare time, so the capture can't resolve this change, and the replay measurement in the description is still its measurement. This PR's capture falls inside the range of the five main captures.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6277887074 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6277887074). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T21:35:37Z. --- The title capture the `perf` label asks for is now in the description, with both summary lines, the traces and the digests: MXGP26 from boot, a cold shader cache, `main` dbac9fa15b61 against `main` + this PR (632261e94460). The five `main` captures span 17.7% in total shader prepare time, so the capture can't resolve this change, and the replay measurement in the description is still its measurement. This PR's capture falls inside the range of the five `main` captures. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-20 20:23:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T20:23:04Z.


More evidence, from a second title's corpus on current main 2185dbf92e. The PR merges cleanly onto it. The 304 PPSA30839 shader requests produce identical SPIR-V, and the whole set takes 20.51 s on main against 18.84 s with this PR (median CPU time of 4 interleaved runs each, ranges not overlapping), about 8% less. The description has the details.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300663117 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6300663117). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T20:23:04Z. --- More evidence, from a second title's corpus on current `main` 2185dbf92e. The PR merges cleanly onto it. The 304 PPSA30839 shader requests produce identical SPIR-V, and the whole set takes 20.51 s on `main` against 18.84 s with this PR (median CPU time of 4 interleaved runs each, ranges not overlapping), about 8% less. The description has the details. AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-20 20:30:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T20:30:06Z.


Checked PatchReads against IrBuilder::Emit and EmitBefore in ResourceTracker.cpp: same opcodes, types and arguments, same instruction order; the removed append/RemoveInstruction pair was the only difference. Rechecked against current main: clean merge, nothing it changed touches PatchReads or verifySrtReadPatching. The new placement check guards the order, and the RADV full-suite run from @DavidAmsellem matches main; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300798555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7431#issuecomment-6300798555). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T20:30:06Z. --- Checked `PatchReads` against `IrBuilder::Emit` and `EmitBefore` in `ResourceTracker.cpp`: same opcodes, types and arguments, same instruction order; the removed append/`RemoveInstruction` pair was the only difference. Rechecked against current `main`: clean merge, nothing it changed touches `PatchReads` or `verifySrtReadPatching`. The new placement check guards the order, and the RADV full-suite run from @DavidAmsellem matches `main`; merged.
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!7431
No description provided.