perf(shader): leave out the dead code pass after masked-select elimination #7522

Merged
milescoviello merged 1 commit from upstream-pr/7522 into main 2026-11-08 09:47:41 +00:00
milescoviello commented 2026-10-18 11:49:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T11:49:12Z.


What

PrepareResourceProgram's simplification step runs MaskedSelectEliminator::Eliminate. When it removed selects, the step then ran DeadCodeEliminator::Eliminate over the whole program, after refolding first if a packed ancillary input is live.

MaskedSelectEliminator::Eliminate already runs dead code elimination at the end of every round that removes a select. It returns only after a round that removes nothing, and such a round doesn't change the program. So the program it returns is already free of dead code. Without the ancillary refolding, the following pass had nothing to remove. It now runs only after that refolding, which can create dead code.

To check this, I logged the instructions each Eliminate(IrProgram&) call removed, by call site, over 466 dumped shader requests (below). This call ran 833 times, never with a live ancillary input, and removed nothing each time. Over the 355 PPSA30839 requests plus PPSA31162's 46, it took 115 ms in 712 calls.

agc_masked_select routes its 39 cases through one eliminate() helper. After an elimination that removed selects, that helper now runs one more dead code pass and fails if it removes anything. That is the property this PR relies on. With the dead code pass inside MaskedSelectEliminator::Eliminate removed, 4 cases fail with "dead code is left after the selects were removed".

HostInterpolationChecker::Lower has the same pattern on its own path. I left it as it is, since #6222 and #7332 add code right after that line.

Tested

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

  • ctest -R "^agc_|^shader_ir" on 3e3e8b9050: 710/710 pass (3 skipped: host import sparse, sparse dma-buf import, stencil ref export). That run also had the HostInterpolationChecker change, which I then dropped. On the final code, the 6 tests matching masked_select|interpolat|barycentric pass.
  • agc_shader_replay --spv (Release, ANYPS5_ENABLE_SPIRV_TOOLS off, ANYPS5_NO_SHADER_CACHE=1) on 466 shader requests I had dumped with APS5_DUMP_SHADERS: 355 from MXGP 26 (PPSA30839), 107 from PPSA31162 and 4 from another app. All 462 .spv files (a few names repeat across the dumps) have the same SHA-256 on main 3e3e8b9050 and with this PR, and the replay output is identical.
  • Whole-replay CPU time of the 355 PPSA30839 requests moves less than the run-to-run spread (25,445 to 26,781 ms on main, 25,161 to 25,493 ms with this PR), so I'm only claiming the 115 ms of the removed pass.

Title level: no speed claim.

tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists only conflicting PRs that it could not compare on Recompiler.cpp; none of their diffs touch these lines.

  • AMD on Linux: @DavidAmsellem ran the full suite on an RX 7900 XT (RADV NAVI31, Mesa 25.2.8), merged onto main 0fbfd91e5. It matches main, with the same two failures (#7766, #7784), and no test is added, skipped or removed. That's correctness only.

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 (81180e30362c). 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 195 16.7 / 28.7 ms 941 90.6 s 96.2 / 25.3 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":"81180e30362c","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":112864.040},"presents":195,"frame_ms":{"p50":16.689,"p90":28.698,"p99":1844.369,"max":106806.209},"gpu_busy_ms_per_present":4.938,"worker_busy_pct":{"queue worker 0x0":88.961,"queue worker 0x20":71.973},"top_phases_ms_per_frame":{"Driver.Packet":931.461,"Driver.Packet.dispatch":472.715,"Driver.Dispatch":472.625,"Shader.PrepareArtifact":464.413,"Driver.Packet.memory_wait":389.638,"Vulkan.GraphicsPipeline":119.169,"Vulkan.GraphicsPipelineLibrary":113.480,"Vulkan.GraphicsPipelinePrebuild":69.047},"trace_dropped":false,"trace":"aps5-trace-81180e30362c-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 (cabf6ad533, 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.
  • Windows 11 Pro 26220, RTX 4070 (NVIDIA 596.21), WinLibs GCC 15.2 r7, Release, by @screamm (comment): stacked with #7520 on main 1d4164552 + #7516 + #7494: agc_masked_select with the no-dead-code check and the 41-test set pass 3 of 3; identical shader-cache entries and replay hashes against two main runs (Showcase PPSA99005, RetroArch PPSA99169, vkQuake PPSA99010), static frames bit-identical, and draw-path recompile time within main's spread.

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); NVIDIA RTX 4070 (596.21), Windows 11 (@screamm)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4908831002 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-18T11:49:12Z. --- ### What `PrepareResourceProgram`'s simplification step runs `MaskedSelectEliminator::Eliminate`. When it removed selects, the step then ran `DeadCodeEliminator::Eliminate` over the whole program, after refolding first if a packed ancillary input is live. `MaskedSelectEliminator::Eliminate` already runs dead code elimination at the end of every round that removes a select. It returns only after a round that removes nothing, and such a round doesn't change the program. So the program it returns is already free of dead code. Without the ancillary refolding, the following pass had nothing to remove. It now runs only after that refolding, which can create dead code. To check this, I logged the instructions each `Eliminate(IrProgram&)` call removed, by call site, over 466 dumped shader requests (below). This call ran 833 times, never with a live ancillary input, and removed nothing each time. Over the 355 PPSA30839 requests plus PPSA31162's 46, it took 115 ms in 712 calls. `agc_masked_select` routes its 39 cases through one `eliminate()` helper. After an elimination that removed selects, that helper now runs one more dead code pass and fails if it removes anything. That is the property this PR relies on. With the dead code pass inside `MaskedSelectEliminator::Eliminate` removed, 4 cases fail with "dead code is left after the selects were removed". `HostInterpolationChecker::Lower` has the same pattern on its own path. I left it as it is, since #6222 and #7332 add code right after that line. ### Tested Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02. - `ctest -R "^agc_|^shader_ir"` on 3e3e8b9050: 710/710 pass (3 skipped: host import sparse, sparse dma-buf import, stencil ref export). That run also had the `HostInterpolationChecker` change, which I then dropped. On the final code, the 6 tests matching `masked_select|interpolat|barycentric` pass. - `agc_shader_replay --spv` (Release, `ANYPS5_ENABLE_SPIRV_TOOLS` off, `ANYPS5_NO_SHADER_CACHE=1`) on 466 shader requests I had dumped with `APS5_DUMP_SHADERS`: 355 from MXGP 26 (PPSA30839), 107 from PPSA31162 and 4 from another app. All 462 `.spv` files (a few names repeat across the dumps) have the same SHA-256 on `main` 3e3e8b9050 and with this PR, and the replay output is identical. - Whole-replay CPU time of the 355 PPSA30839 requests moves less than the run-to-run spread (25,445 to 26,781 ms on `main`, 25,161 to 25,493 ms with this PR), so I'm only claiming the 115 ms of the removed pass. **Title level: no speed claim.** `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` lists only conflicting PRs that it could not compare on `Recompiler.cpp`; none of their diffs touch these lines. - AMD on Linux: @DavidAmsellem [ran the full suite](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6272003412) on an RX 7900 XT (RADV NAVI31, Mesa 25.2.8), merged onto `main` 0fbfd91e5. It matches `main`, with the same two failures (#7766, #7784), and no test is added, skipped or removed. That's correctness only. ### 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 (81180e30362c). 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 | 195 | 16.7 / 28.7 ms | 941 | 90.6 s | 96.2 / 25.3 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-7522-aps5-trace-81180e30362c-3.json.gz), [digest](https://github.com/milescoviello/AnyPS5/releases/download/perf-mxgp-2026-10-19/mxgp-7522-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":"81180e30362c","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":112864.040},"presents":195,"frame_ms":{"p50":16.689,"p90":28.698,"p99":1844.369,"max":106806.209},"gpu_busy_ms_per_present":4.938,"worker_busy_pct":{"queue worker 0x0":88.961,"queue worker 0x20":71.973},"top_phases_ms_per_frame":{"Driver.Packet":931.461,"Driver.Packet.dispatch":472.715,"Driver.Dispatch":472.625,"Shader.PrepareArtifact":464.413,"Driver.Packet.memory_wait":389.638,"Vulkan.GraphicsPipeline":119.169,"Vulkan.GraphicsPipelineLibrary":113.480,"Vulkan.GraphicsPipelinePrebuild":69.047},"trace_dropped":false,"trace":"aps5-trace-81180e30362c-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 (cabf6ad533, 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. - Windows 11 Pro 26220, RTX 4070 (NVIDIA 596.21), WinLibs GCC 15.2 r7, Release, by @screamm ([comment](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6293960377)): stacked with #7520 on `main` 1d4164552 + #7516 + #7494: `agc_masked_select` with the no-dead-code check and the 41-test set pass 3 of 3; identical shader-cache entries and replay hashes against two `main` runs (Showcase PPSA99005, RetroArch PPSA99169, vkQuake PPSA99010), static frames bit-identical, and draw-path recompile time within `main`'s spread. ### 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); NVIDIA RTX 4070 (596.21), Windows 11 (@screamm) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DavidAmsellem commented 2026-10-19 16:27:54 +00:00 (Migrated from github.com)

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


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:6272003412 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6272003412). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T16:27:54Z. --- 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:38:46 +00:00 (Migrated from github.com)

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


@DavidAmsellem thank you, the gfx1100 full-suite run is in the description now.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272203669 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6272203669). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T16:38:46Z. --- @DavidAmsellem thank you, the gfx1100 full-suite run is in the description now. AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-19 16:38:59 +00:00 (Migrated from github.com)

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


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:6272207687 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6272207687). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T16:38:59Z. --- <!-- 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:21 +00:00 (Migrated from github.com)

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


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 (81180e30362c). 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:6277879370 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6277879370). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T21:35:21Z. --- 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 (81180e30362c). 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)
screamm commented 2026-10-20 15:01:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-20T15:01:50Z.


Windows run of #7520 and #7522 together. Host: Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 driver 596.21, Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2 r7, Release. I stacked #7520 at d484281b6 and #7522 at cabf6ad53 on main 1d4164552 + #7516 (f099292f8) + #7494 (0aab6c1f3). None of the four shares a file, and all merges were clean. Targeted build: the shader and AGC test targets plus libs. MinGW accepts the new static_assert(sizeof(IrValue) == 128).

  • shader_ir_use_rewrite with the tightened allocation bounds: 3 of 3. agc_masked_select with the new "no dead code left" check: 3 of 3. The rest of the 41-test set also passed 3 of 3, none skipped: the ^shader_|^agc_shader_ set, agc_ir_reclaim, agc_constant_phi and the f16/f32 min/max GPU tests.
  • Shader output, three homebrews, fresh shader cache directory per run, 60 s: Showcase PPSA99005 52 entries, RetroArch PPSA99169 24, vkQuake PPSA99010 52. Entry count, keys and payloads are the same for two main runs and this stack. I matched keys with the source-version word masked and compared payloads with host pointers masked: 5 Showcase entries hold a host address and differ between two main runs too. Showcase's two dumped compute requests replay (agc_shader_replay --spv) to identical SHA-256 on main and the stack.
  • One cold-cache title pass of the stack per title, 90 s, run after a main/#7516+#7494 A B A B. Settings: ANYPS5_NO_SHADER_CACHE=1, a freshly relinked run directory, APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_TRACE_SUMMARY_EVERY=10. No stop line. These titles compile on the draw path; they have no Shader.PrepareArtifact slices. Draw-path recompile time over the run, summed from the [draw] driver phases lines:
    • vkQuake 2245.5 ms against main 2594.5 / 2223.2 ms.
    • Showcase 39.7 ms against main 46.8 / 35.0 ms.
    • RetroArch 9111 presents against 8924 / 9118 on main, p50 8.34 ms in all.
    • All within the main range. This is one run, so it shows no regression, not a speed-up.
  • Frame dumps: vkQuake's static console and loading screens are bit-identical with main. The animated frames differ between two main runs too, so they can't be compared.
  • A negative control doesn't apply to a bit-exact optimisation. I didn't repeat your two negative checks (main against the new UseRewrite bound, and MaskedSelect without the inner DCE).
  • tools/check_conventions.py --base origin/main and git diff --check: pass.

Not checked: a full build, the agc_driver_ GPU suite (the RADV full-suite run above covers that on AMD), replay CPU time, an A B A B of these two on their own, AMD/Intel on Windows.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6293960377 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6293960377). Originally posted by [screamm](https://github.com/screamm) on 2026-10-20T15:01:50Z. --- Windows run of #7520 and #7522 together. Host: Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 driver 596.21, Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2 r7, Release. I stacked #7520 at `d484281b6` and #7522 at `cabf6ad53` on `main` `1d4164552` + #7516 (`f099292f8`) + #7494 (`0aab6c1f3`). None of the four shares a file, and all merges were clean. Targeted build: the shader and AGC test targets plus `libs`. MinGW accepts the new `static_assert(sizeof(IrValue) == 128)`. - `shader_ir_use_rewrite` with the tightened allocation bounds: 3 of 3. `agc_masked_select` with the new "no dead code left" check: 3 of 3. The rest of the 41-test set also passed 3 of 3, none skipped: the `^shader_|^agc_shader_` set, `agc_ir_reclaim`, `agc_constant_phi` and the f16/f32 min/max GPU tests. - Shader output, three homebrews, fresh shader cache directory per run, 60 s: Showcase PPSA99005 52 entries, RetroArch PPSA99169 24, vkQuake PPSA99010 52. Entry count, keys and payloads are the same for two `main` runs and this stack. I matched keys with the source-version word masked and compared payloads with host pointers masked: 5 Showcase entries hold a host address and differ between two `main` runs too. Showcase's two dumped compute requests replay (`agc_shader_replay --spv`) to identical SHA-256 on `main` and the stack. - One cold-cache title pass of the stack per title, 90 s, run after a `main`/#7516+#7494 A B A B. Settings: `ANYPS5_NO_SHADER_CACHE=1`, a freshly relinked run directory, `APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_TRACE_SUMMARY_EVERY=10`. No stop line. These titles compile on the draw path; they have no `Shader.PrepareArtifact` slices. Draw-path recompile time over the run, summed from the `[draw] driver phases` lines: - vkQuake 2245.5 ms against `main` 2594.5 / 2223.2 ms. - Showcase 39.7 ms against `main` 46.8 / 35.0 ms. - RetroArch 9111 presents against 8924 / 9118 on `main`, p50 8.34 ms in all. - All within the `main` range. This is one run, so it shows no regression, not a speed-up. - Frame dumps: vkQuake's static console and loading screens are bit-identical with `main`. The animated frames differ between two `main` runs too, so they can't be compared. - A negative control doesn't apply to a bit-exact optimisation. I didn't repeat your two negative checks (`main` against the new UseRewrite bound, and MaskedSelect without the inner DCE). - `tools/check_conventions.py --base origin/main` and `git diff --check`: pass. Not checked: a full build, the `agc_driver_` GPU suite (the RADV full-suite run above covers that on AMD), replay CPU time, an A B A B of these two on their own, AMD/Intel on Windows. Written with Claude Code assistance (validation by a subagent, reviewed in this session).
milescoviello commented 2026-10-20 15:03:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T15:03:48Z.


Thanks @screamm, the first Windows title runs of this one, and the identical cache entries and replay hashes are the right check for a bit-exact change. Added to the description.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294002119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6294002119). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T15:03:48Z. --- Thanks @screamm, the first Windows title runs of this one, and the identical cache entries and replay hashes are the right check for a bit-exact change. Added to the description. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 03:31:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T03:31:44Z.


A data point from a second title, and it doesn't show a gain here. Crimson Desert (PPSA25286) replay: a fixed subset of 152 of its 6,065 registration requests, agc_shader_replay --prepare, Release, task-clock, 8 interleaved runs per build, i7-13700K:

build median range
main 5d10ea9ea0 16.72 s 16.41 to 19.02 s
main + this PR (cabf6ad533, merged cleanly) 16.69 s 16.42 to 22.44 s

The medians are within noise of each other; one run on each side was slowed by other load on the host. The prepared SPIR-V of the 152 requests is byte-identical to main's.

In this title's profile, the dead-code passes inside MaskedSelectEliminator::Eliminate are about 6 % of that function. Most of its time is in UnreadLanes: settle 38 %, its own loop 28 %, readerOf 10 %. So there's little here for this PR to remove. The MXGP replay numbers in the description stand as they are.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307335003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#issuecomment-6307335003). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T03:31:44Z. --- A data point from a second title, and it doesn't show a gain here. Crimson Desert (PPSA25286) replay: a fixed subset of 152 of its 6,065 registration requests, `agc_shader_replay --prepare`, Release, task-clock, 8 interleaved runs per build, i7-13700K: | build | median | range | |---|---|---| | `main` 5d10ea9ea0 | 16.72 s | 16.41 to 19.02 s | | `main` + this PR (cabf6ad533, merged cleanly) | 16.69 s | 16.42 to 22.44 s | The medians are within noise of each other; one run on each side was slowed by other load on the host. The prepared SPIR-V of the 152 requests is byte-identical to `main`'s. In this title's profile, the dead-code passes inside `MaskedSelectEliminator::Eliminate` are about 6 % of that function. Most of its time is in `UnreadLanes`: `settle` 38 %, its own loop 28 %, `readerOf` 10 %. So there's little here for this PR to remove. The MXGP replay numbers in the description stand as they are. AI-assisted: yes (Claude Code)
BunnyFl commented 2026-11-03 05:01:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T05:01:00Z.

Review: APPROVED


Windows 11, AMD RX 9070 XT, WinLibs GCC 15.2.0, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, merged onto current main f6232fcfda (clean merge): agc_masked_select passes, including the new check in eliminate() that one more DeadCodeEliminator pass removes nothing after selects were removed. With main's core/shader/recompiler/Recompiler.cpp restored it passes too. That's expected: the test checks the property this PR relies on, inside MaskedSelectEliminator::Eliminate, not the removed call. The removed pass is still in PrepareResourceProgram on current main (the merge is clean). I didn't reproduce the timing; the summary lines and digests in the description are the performance evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5747460115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7522#pullrequestreview-5747460115). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T05:01:00Z. **Review:** APPROVED --- Windows 11, AMD RX 9070 XT, WinLibs GCC 15.2.0, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, merged onto current `main` `f6232fcfda` (clean merge): `agc_masked_select` passes, including the new check in `eliminate()` that one more `DeadCodeEliminator` pass removes nothing after selects were removed. With `main`'s `core/shader/recompiler/Recompiler.cpp` restored it passes too. That's expected: the test checks the property this PR relies on, inside `MaskedSelectEliminator::Eliminate`, not the removed call. The removed pass is still in `PrepareResourceProgram` on current `main` (the merge is clean). I didn't reproduce the timing; the summary lines and digests in the description are the performance evidence.
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!7522
No description provided.