Repository navigation
perf(shader): avoid redundancy traversal map copies - #47
Merged
Merged
Conversation
JJenkx
force-pushed
the
perf/spirv-bounded-redundancy
branch
from
October 14, 2026 06:33
180d47a to
5aea65b
Compare
JJenkx
marked this pull request as draft
October 14, 2026 06:36
JJenkx
marked this pull request as ready for review
October 14, 2026 07:37
JJenkx
force-pushed
the
perf/spirv-bounded-redundancy
branch
from
October 14, 2026 10:03
5aea65b to
b009318
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The bundled redundancy-elimination traversal copies inherited value maps for sibling branches. Replace those copies with an iterative depth-first traversal, one scoped value map, and a log of values inserted by each subtree. Roll back each subtree's insertions on return so ancestor reuse is preserved and sibling values remain isolated. Optimization passes, type restrictions, value numbering and validation are unchanged.
CMake patches a build-directory copy of the pinned SPIRV-Tools source and rejects drift in the traversal and elimination helper. The dependency checkout is untouched. This extends SPIRV-Tools #6962, which releases processed maps but retains sibling map copies; it does not replace the separate AnyPS5 IR work in boykopovar#4948.
Tested
Current published head
b00931842321f466b8ce1e7a48ac952d4f06f1ecis three topic/documentation commits directly above main56429064fc3074ed5192e32a06ba0cf7813af4fc, with zero merge commits. Additive shader-debt conflicts were resolved while retaining main's structurizer entry. Conventions and whitespace checks pass. The production patch and optimizer regression file are byte-for-byte identical to measured head5aea65b4b1c363c8783beb804f7e7579a2e9001e. The current-head Linux Release runtime builds with bundled SPIRV-Tools; default/full/none optimizer checks pass (3 passed, 0 skipped). Fresh full Linux/Windows CI passes this head against base56429064fc3074ed5192e32a06ba0cf7813af4fc: Linux 1,073 passed / 48 skipped / 1,121 total; Windows 739 passed / 406 skipped / 1,145 total. All three optimizer modes pass on Linux. Windows disables SPIRV-Tools and does not validate the traversal patch; skipped cases remain unvalidated. The measurements below retain their original revisions; no performance measurement against the new base is claimed.5aea65b4b1c3, Linux Release builds with bundled SPIRV-Tools enabled pass. Default/full/none optimizer checks pass on both main and this PR, with zero skips, including ancestor reuse, sibling scopes, conditional control flow, volatile stores and storage-only byte output. The earlier omitted-rollback negative control fails validation because the sibling value does not dominate its use.5aea65b4b1c363c8783beb804f7e7579a2e9001eand base1e7272196389c30eff9af9e91a51c72d781f46c6: Linux 1068 passed / 46 skipped / 1114 total; Windows 735 passed / 402 skipped / 1137 total. Linux exercises all three optimizer modes. The Windows configuration does not enable SPIRV-Tools and does not validate the dependency traversal patch. Skips remain unvalidated.Cold-title measurements
Astro Bot PPSA21564, untouched startup with no input, main
1e7272196389versus main plus this PR5aea65b4b1c3. Same machine, executable, modules, assets and settings; separate empty AnyPS5 shader, Vulkan pipeline and Mesa caches. Both builds enableAPS5_ENABLE_TIMING_LOG=ONto retain preparation before first present. OfficialAPS5_TRACE_SECONDS=0:60traces start at first present; no other trace/profile switch and console output not redirected. This deliberately measures cold loading, as requested, rather than the performance form's warm-cache gameplay protocol.First-flip wait is 13.0% shorter in the first pair and 16.0% shorter in the reverse-order repeat. Inclusive preparation is 23.6% / 26.6% lower. Repeat call counts are identical (2,245); the first pair differs by two calls. Both repeat runs reached the ASTRO BOT title screen in PID-matched snapshots at approximately 612 seconds, without input, and closed normally (exit 0); temporary kernel settings were restored.
Shader preparation includes translation, optimization and cache work. It sums inclusive elapsed calls across concurrent threads, so it exceeds wall-clock time and is not optimizer-only CPU time. First flip completion has
display_confirmed=0; it is not the time to a visible frame or completed title loading. Sparse title-screen snapshots establish the destination, not a precisely measured time-to-menu gain. The traces cover initial loading, with different present counts (the seconds-based window ends after its final present). No gameplay or steady-FPS improvement is claimed. Build timing adds overhead to both builds. Two pairs establish a repeated observed gain on this host, not broad hardware coverage.The first pair closed earlier during resource loading and both processes exited 139 after the close request. Those unresolved shutdown observations remain recorded; both longer repeat runs closed normally. No game assets, screenshots, core dumps or raw console logs are published.
Download all four traces, summary lines, digests and extracted timing comparison. The fork prerelease is a timing attachment, not an emulator build release; each
.json.gzopens in Perfetto.Official summary lines (pair 1 main/PR, then reverse-order repeat main/PR):
{"commit":"1e7272196389","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"0:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":64056.804},"presents":105,"frame_ms":{"p50":37.269,"p90":2364.364,"p99":4295.703,"max":4548.802},"gpu_busy_ms_per_present":33.152,"worker_busy_pct":{"queue worker 0x0":7.853,"queue worker 0x48":5.405,"queue worker 0x40":7.332},"top_phases_ms_per_frame":{"Driver.Packet":125.119,"Driver.Packet.memory_wait":68.363,"Shader.PrepareArtifact":43.275,"Driver.Packet.dispatch":31.749,"Driver.Dispatch":31.69,"Vulkan.Dispatch":19.241,"Vulkan.Dispatch.shader_resources":18.996,"Vulkan.GraphicsPipelinePrebuild":16.309},"trace_dropped":false,"trace":"aps5-trace-1e7272196389-3451464.json.gz"} {"commit":"5aea65b4b1c3","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"0:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":62409.625},"presents":105,"frame_ms":{"p50":37.947,"p90":2207.181,"p99":3281.585,"max":3371.253},"gpu_busy_ms_per_present":34.569,"worker_busy_pct":{"queue worker 0x0":7.324,"queue worker 0x40":6.717,"queue worker 0x48":4.487},"top_phases_ms_per_frame":{"Driver.Packet":109.736,"Driver.Packet.memory_wait":57.306,"Shader.PrepareArtifact":44.191,"Driver.Dispatch":28.25,"Driver.Packet.dispatch":28.208,"Vulkan.GraphicsPipelinePrebuild":17.346,"Vulkan.GraphicsPipeline":17.322,"Vulkan.GraphicsPipelineLibrary":17.162},"trace_dropped":false,"trace":"aps5-trace-5aea65b4b1c3-3620398.json.gz"} {"commit":"1e7272196389","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"0:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":62789.392},"presents":91,"frame_ms":{"p50":39.617,"p90":2610.342,"p99":4203.167,"max":4203.167},"gpu_busy_ms_per_present":34.887,"worker_busy_pct":{"queue worker 0x0":7.23,"queue worker 0x40":6.691,"queue worker 0x48":4.982},"top_phases_ms_per_frame":{"Driver.Packet":129.92,"Driver.Packet.memory_wait":71.194,"Shader.PrepareArtifact":44.54,"Driver.Packet.dispatch":34.86,"Driver.Dispatch":34.808,"Vulkan.Dispatch":22.51,"Vulkan.Dispatch.shader_resources":22.246,"Vulkan.GraphicsPipelinePrebuild":19.135},"trace_dropped":false,"trace":"aps5-trace-1e7272196389-4086320.json.gz"} {"commit":"5aea65b4b1c3","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_TRACE_SECONDS":"0:60"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":61633.391},"presents":125,"frame_ms":{"p50":31.313,"p90":1939.731,"p99":3029.308,"max":3053.024},"gpu_busy_ms_per_present":32.66,"worker_busy_pct":{"queue worker 0x0":8.393,"queue worker 0x48":5.481,"queue worker 0x40":7.758},"top_phases_ms_per_frame":{"Driver.Packet":106.213,"Driver.Packet.memory_wait":56.589,"Shader.PrepareArtifact":33.973,"Driver.Packet.dispatch":26.534,"Driver.Dispatch":26.468,"Vulkan.Dispatch":15.256,"Vulkan.GraphicsPipelinePrebuild":15.075,"Vulkan.GraphicsPipeline":15.051},"trace_dropped":false,"trace":"aps5-trace-5aea65b4b1c3-3880445.json.gz"}Checklist