perf(shader): allocate a program's use lists from an arena #12039

Merged
milescoviello merged 4 commits from upstream-pr/12039 into main 2026-10-30 13:38:30 +00:00
milescoviello commented 2026-10-27 17:24:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-27T17:24:51Z.


What

Performance evidence: this is a CPU-only change to shader compilation, and the SPIR-V is byte-identical. oneandonlydean accepted paired replay timings for this class of change instead of title captures (#9132, #9198), and so did MarcZX10 on #11719. Exact revisions, raw runs, the command and the request set are below.

At the current head 1d9eaeaa89 (rebased onto main aaccd0ba39), with the same replay on an otherwise idle host: 9.86 s → 9.00 s task-clock (−8.7 % median, lower in 10 of 10 rounds, −7.9 % to −9.6 % per round), and max RSS +4.4 MiB (+1.7 %). The SPIR-V is byte-identical: all 65 Crimson Desert modules and all 302 MXGP modules. The 82 focused tests pass 3 of 3 at the head and on that main, and Khronos validation over them has no VUID- messages on either side. Rounds and method. The previous head e7c7184498 on main edf6804cf5 gave −8.6 % (rounds). The measurements below are from the earlier heads.

Every IrValue keeps the list of instructions that read it (operandUses, a std::vector<IrUse>). Each AddArgument, ReplaceArgument and ReplaceAllUsesWith pushes onto a use list, and every growth is a heap reallocation, so a program's use lists churn through malloc/free while the passes run. All of a program's values die with the program, so freeing their use lists one by one buys nothing.

With this change, a program's use lists come from a bump arena (std::pmr::monotonic_buffer_resource) that the program owns. Growing a list bumps a pointer, and freeing the old buffer does nothing. The memory goes back when the program is destroyed.

Measured with the shader replay over the 152 Crimson Desert (PPSA25286) pipeline requests in --prepare mode, the same corpus as #11798, #11820, #11967 and #12002. Both sides are exact upstream revisions: main 9af563f33d and this PR's head 9aaf9be4a0, which sits directly on it:

Build Mean task-clock Median Rounds lower Max RSS (median)
main 9af563f33d 15.67 s 15.69 s 264.7 MB
this PR 9aaf9be4a0 14.53 s (−7.2 %) 14.50 s 10 of 10 268.9 MB
All 10 rounds (task-clock and max RSS of each run)
Round Order main (ms) PR (ms) change main max RSS (KB) PR max RSS (KB)
1 main PR 15,997.8 14,612.6 -8.7 % 271,388 275,428
2 PR main 15,705.9 14,613.0 -7.0 % 271,168 275,548
3 main PR 15,739.0 14,635.6 -7.0 % 270,872 275,344
4 PR main 15,555.0 14,719.1 -5.4 % 270,804 275,668
5 main PR 15,561.6 14,464.9 -7.0 % 270,784 275,440
6 PR main 15,808.7 14,462.1 -8.5 % 271,156 275,324
7 main PR 15,675.1 14,429.4 -7.9 % 271,204 275,240
8 PR main 15,513.1 14,492.3 -6.6 % 270,804 274,928
9 main PR 15,397.4 14,511.8 -5.8 % 271,592 275,256
10 PR main 15,735.3 14,397.4 -8.5 % 271,028 275,328

Max RSS grows by about 4 MB (1.6 %). That's the arena's transient peak while programs are being built. A counting diagnostic build shows the arena peaking at 6.5 MiB in this replay, with no cached program holding arena memory (review reply). Use lists grow geometrically, so a program being built holds at most about twice its final use-list bytes.

Where the time goes, from perf record -F 499 of one replay of the same corpus on each side, taken at the earlier head 787e3f6eae against main c547deaacb (samples, not percentages):

Function main this PR
whole run 7,966 7,174
allocator (malloc, free, new, delete and glibc's internals) 1,948 1,509
ValidateProgram 410 371
IrValue::HasUses 365 326
ConstantFolder::Fold 227 201
DeadCodeEliminator::Eliminate 183 159
IrValue::Parent 181 163

More than half of the saving is in the allocator. The passes that walk use lists gain a little more, because a program's lists now sit together in its arena.

The SPIR-V is byte-identical to main's: all 65 modules from the Crimson Desert requests and all 302 from MXGP 26's (PPSA30839) dump. Only where use-list buffers live changes; the order of uses and every pass's behaviour stay the same.

How

  • IrValue.hpp: IrUseAllocator<T> holds a std::pmr::memory_resource*. With an arena it allocates from it and deallocate does nothing. Without one it is std::allocator. operandUses is an IrUseList (std::vector<IrUse, IrUseAllocator<IrUse>>), and OperandUses() returns it. A copy of a use list (select_on_container_copy_construction) goes back to the heap, so a copy can outlive the program. The allocator propagates on move and swap.
  • IrValue(opcode, type, id, useArena = nullptr): values made outside a program (resource plans, the disk cache, tests) keep the heap.
  • IrUseArena owns the program's monotonic_buffer_resource, created on the first CreateValue. IrProgram declares it before values, so values are destroyed before their arena. Its move assignment swaps, so in a = std::move(b) the old arena of a moves into b and outlives the values a drops. deallocate never touches the arena either way.
  • IrValue grows by the allocator's pointer, from 128 to 136 bytes; ShaderDiskCache.cpp's size check follows. The plan value encoder doesn't serialise use lists, so the disk-cache format is unchanged.
  • ConstantFolder.cpp: the two places that copied a use list into a std::vector<IrUse> copy it as an IrUseList. UseRewrite.cpp compares against IrUseList.
  • A monotonic_buffer_resource isn't thread-safe. A program's values are only changed by the thread compiling it, as std::vector already requires.
  • IrReclaim.cpp adds a case: 40 readers grow one value's use list in its program's arena and keep their order; ReplaceAllUsesWith moves all of them to another value; then move assignment into that program keeps the assigned program's use lists intact.

Cached programs (after review): getSource stores some programs in their SourceEntry. Before it does, IrProgram::ReleaseUseArena() copies each surviving value's use list into a heap vector and frees the arena, so a cached program keeps none of the arena's buffers: neither the ones whose values ReclaimUnusedValues dropped, nor the old buffers growth left. This also holds on the getSource(..., false) path, which caches without reclaiming. Values created after that get a new arena. Second commit: 3d427e3e32.

Merge order:

  • #11798 (mine): both change the allocation line of IrProgram::CreateValue. This PR lands after it and is rebased onto it, with the resolution validated below.
  • #11820 (mine): it also changes the IrValue size check from 128 to 136. The two edits are identical, so git merges them without a conflict, but together IrValue is 144 bytes. This PR lands after #11820 and sets the check to 144 when it's rebased onto it (validated below).
  • #7689 (MarcZX10): it changes the IrResourcePlan size check on the line before. That's a one-line textual conflict with no behavioural dependency. Agreed on #7689 (comment): #7689 lands first, and this PR is rebased after it, keeping both size values.
  • #9132, #11967 and #12002 merge with this branch without conflicts.

Tested

Head 0fe2329ee8 (6a98793e3b with main 422f96b3a9 merged in, which brings main's Recompiler.cpp change), built from these exact revisions:

  • shader_ir_use_rewrite, agc_ir_reclaim, agc_constant_select, agc_masked_select and agc_validate_program pass 3 of 3.
  • agc_shader_replay --spv gives byte-identical SPIR-V on main 422f96b3a9 and on this head: all 65 Crimson Desert modules (152 requests) and all 302 MXGP modules (305 requests).
  • Task-clock of --spv over all 457 requests, 10 alternating rounds: 26.61 s mean on main, 19.83 s on this head (−25.5 %), lower in 10 of 10 (24.5–26.0 %). Median max RSS is 1,374,254 KB on main and 1,391,460 KB on this head.

This is a CPU-only change to IR allocation with byte-identical SPIR-V, so it has no GPU-side effect to capture. oneandonlydean accepted replay evidence in place of title captures for such changes on #9132 and #9198.

Earlier:

Exact head 6a98793e3b merged with main dc38224141 (merge b0bf86ca7d, clean), Linux, GCC 15.2, Release, SPIRV-Tools off:

  • shader_ir_use_rewrite, agc_ir_reclaim, agc_constant_select, agc_masked_select and agc_validate_program pass 3 of 3.
  • agc_shader_replay --spv gives byte-identical SPIR-V on main and on the merge: all 65 Crimson Desert modules (152 requests) and all 302 MXGP modules (305 requests).
  • Task-clock of --spv over all 457 requests, 10 alternating rounds: 26.43 s mean on main, 19.85 s on the merge (−24.9 %), lower in 10 of 10 (24.4–25.6 %). Median max RSS is 1,370,986 KB on main and 1,392,566 KB on the merge. This workload includes SPIR-V emission, unlike the --prepare timings below.

Earlier heads:

Linux (Ubuntu 26.04, GCC 15.2), Release:

  • At 787e3f6eae (this patch before the rebase onto 9af563f33d, unchanged by it): the 47 test targets whose sources use the IR API, ctest 3 runs, all 76 entries pass in every run. AddressSanitizer: agc_ir_reclaim, agc_shader_memory, agc_validate_program and shader_ir_use_rewrite, 3 runs, all pass with no AddressSanitizer or LeakSanitizer report.
  • Windows 11 VM (GeForce GT 1030, WinLibs GCC, Release): shader_ir_use_rewrite, agc_ir_reclaim, agc_validate_program, agc_shader_memory and agc_constant_select, 3 runs each on main c547deaacb and at 787e3f6eae: 5 of 5 pass in every run on both sides.

At 3d427e3e32 (after review), with the same replay and 10 rotating rounds against main 9af563f33d and the previous head 9aaf9be4a0, built from those exact revisions:

  • Mean task-clock is 15.55 s on main, 14.37 s on the previous head and 14.64 s on this head: −5.9 % against main, lower in 10 of 10. This head is 1.9 % slower than the previous one.
  • Median max RSS is 271,204, 275,354 and 275,416 KB.
  • SPIR-V is byte-identical to main for all 65 Crimson Desert and 302 MXGP modules.
  • shader_ir_use_rewrite, agc_ir_reclaim, agc_constant_select, agc_masked_select and agc_validate_program pass 3 of 3. A ReleaseUseArena that does nothing fails agc_ir_reclaim. On the Windows 11 VM they pass 3 of 3 at main and at this head.
  • Super Meat Boy 3D, 3 rotating rounds, median RssAnon peak: 608dd76843 5,141 MB, + the previous head 4,856 MB, + this head 4,610 MB. That's within the roughly 600 MB spread between runs of one build.

Combined layout with #11798 and #11820 (033713cac5 on my fork: main 9af563f33d + #11798 c31e8e0fe3 + #11820 e339f57e4d + this change):

  • The conflict with #11798 resolves as values.Create(opcode, type, nextValueId, useArena.Resource()), with IrValuePool::Create taking the arena and passing it to the value's constructor.
  • IrValue is 144 bytes there. The ShaderDiskCache.cpp check is set to 144 and builds.
  • The 47 IR test targets pass 3 of 3 (76 entries), and the four AddressSanitizer targets pass 3 of 3 with no report.
  • SPIR-V is byte-identical to the same stack without this change: all 65 Crimson Desert and all 302 MXGP modules.
  • Timing, 6 alternating rounds against that stack: 10.40 s → 8.98 s mean task-clock (−13.6 %), lower in 6 of 6. Max RSS goes from 256.2 to 265.8 MB. That's more growth than on main alone, and I haven't looked into why.
All 6 rounds on the stack
Round Order stack (ms) stack+PR (ms) change stack max RSS (KB) stack+PR max RSS (KB)
1 stack+PR stack+PR 10,345.4 8,939.3 -13.6 % 262,200 272,364
2 stack+PR stack+PR 10,362.8 8,892.2 -14.2 % 262,116 273,212
3 stack+PR stack+PR 10,360.8 9,017.6 -13.0 % 262,488 270,724
4 stack+PR stack+PR 10,385.6 9,054.8 -12.8 % 262,208 272,812
5 stack+PR stack+PR 10,448.9 9,030.2 -13.6 % 263,060 271,920
6 stack+PR stack+PR 10,488.0 8,972.8 -14.4 % 263,076 270,200

How the numbers were taken:

  • Builds: release agc_shader_replay (SPIR-V Tools off, as users build) of each exact revision. Replay binary SHA-256 prefixes: main 0b1feee1a3a5, this PR 531fdc2c2a97.
  • Command, per run: ANYPS5_NO_SHADER_CACHE=1 /usr/bin/time -f %M perf stat -x, -e task-clock agc_shader_replay --prepare <the 152 requests>, in a fresh empty directory, alternating which side runs first.
  • Request set: 152 requests. The SHA-256 over the sorted list of their file digests is 4fc9e044c1e59fb3. The 305 MXGP requests give 7a681333ac4a2b4e. The requests themselves are game shader dumps and aren't published.
  • SPIR-V: agc_shader_replay --spv over both sets on each side, then a diff of the sorted sha256sum lists of the output modules.

Supplementary: Black Ops II title captures with a cold recompiler cache (comment). Black Ops II stops at 8 s on main without #9656, so both sides there are local builds of eece5da035 + #9656, with and without this commit. They aren't upstream revisions and aren't the evidence for this PR. They showed 14.5 % and 17.4 % less preparation time per artifact on the title thread, and no change on the workers.

Title captures (after review): Super Meat Boy 3D, main 9af563f33d + #11580 (608dd76843) against the same + this PR (561c7f952a), 3 interleaved rounds, recompiler cache off. Shader.PrepareArtifact worker time is 12,196 ms → 11,322 ms (−7.2 %), lower in 3 of 3 (table and traces). Round 2's summary lines:

{"commit":"608dd7684303","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA31162","title":"Super Meat Boy 3D","content_version":"02.000.001","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":60032.708},"presents":421,"frame_ms":{"p50":125.841,"p90":141.927,"p99":1311.172,"max":3996.694},"gpu_busy_ms_per_present":87.926,"worker_busy_pct":{"queue worker 0x0":86.308,"queue worker 0x20":84.754},"top_phases_ms_per_frame":{"Driver.Packet":243.826,"Driver.Packet.memory_wait":120.231,"Driver.Packet.dispatch":57.628,"Driver.Dispatch":57.465,"Shader.PrepareArtifact":43.040,"Driver.Packet.pipeline_drain":40.281,"Recorder.Sync":39.168,"GpuMutex.wait.hook":38.208},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":39.470,"events_lost":327140,"totals_full":false}},"trace":"aps5-trace-608dd7684303-3.json.gz"}
{"commit":"561c7f952a08","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA31162","title":"Super Meat Boy 3D","content_version":"02.000.001","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":60061.392},"presents":428,"frame_ms":{"p50":125.393,"p90":140.113,"p99":1366.643,"max":3861.073},"gpu_busy_ms_per_present":87.289,"worker_busy_pct":{"queue worker 0x0":87.165,"queue worker 0x20":84.964},"top_phases_ms_per_frame":{"Driver.Packet":241.484,"Driver.Packet.memory_wait":118.840,"Driver.Packet.dispatch":57.317,"Driver.Dispatch":57.176,"Recorder.Sync":39.805,"Driver.Packet.pipeline_drain":39.747,"Shader.PrepareArtifact":39.409,"GpuMutex.wait.hook":37.774},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":38.766,"events_lost":337406,"totals_full":false}},"trace":"aps5-trace-561c7f952a08-3.json.gz"}

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: #11798, #11820, #7689 (textual overlaps, see the merge order above; this PR lands after all three and is rebased onto them)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CPU-side shader compilation; SPIR-V byte-identical)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5038264970 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-27T17:24:51Z. --- ### What **Performance evidence:** this is a CPU-only change to shader compilation, and the SPIR-V is byte-identical. oneandonlydean accepted paired replay timings for this class of change instead of title captures (#9132, #9198), and so did MarcZX10 on #11719. Exact revisions, raw runs, the command and the request set are below. **At the current head** `1d9eaeaa89` (rebased onto `main` `aaccd0ba39`), with the same replay on an otherwise idle host: 9.86 s → 9.00 s task-clock (−8.7 % median, lower in 10 of 10 rounds, −7.9 % to −9.6 % per round), and max RSS +4.4 MiB (+1.7 %). The SPIR-V is byte-identical: all 65 Crimson Desert modules and all 302 MXGP modules. The 82 focused tests pass 3 of 3 at the head and on that `main`, and Khronos validation over them has no `VUID-` messages on either side. [Rounds and method](https://github.com/boykopovar/AnyPS5/pull/12039#issuecomment-6493234376). The previous head `e7c7184498` on `main` `edf6804cf5` gave −8.6 % ([rounds](https://github.com/boykopovar/AnyPS5/pull/12039#issuecomment-6491190645)). The measurements below are from the earlier heads. Every `IrValue` keeps the list of instructions that read it (`operandUses`, a `std::vector<IrUse>`). Each `AddArgument`, `ReplaceArgument` and `ReplaceAllUsesWith` pushes onto a use list, and every growth is a heap reallocation, so a program's use lists churn through `malloc`/`free` while the passes run. All of a program's values die with the program, so freeing their use lists one by one buys nothing. With this change, a program's use lists come from a bump arena (`std::pmr::monotonic_buffer_resource`) that the program owns. Growing a list bumps a pointer, and freeing the old buffer does nothing. The memory goes back when the program is destroyed. Measured with the shader replay over the 152 Crimson Desert (PPSA25286) pipeline requests in `--prepare` mode, the same corpus as #11798, #11820, #11967 and #12002. Both sides are exact upstream revisions: `main` `9af563f33d` and this PR's head `9aaf9be4a0`, which sits directly on it: | Build | Mean task-clock | Median | Rounds lower | Max RSS (median) | |---|---|---|---|---| | `main` `9af563f33d` | 15.67 s | 15.69 s | | 264.7 MB | | this PR `9aaf9be4a0` | 14.53 s (−7.2 %) | 14.50 s | 10 of 10 | 268.9 MB | <details><summary>All 10 rounds (task-clock and max RSS of each run)</summary> | Round | Order | main (ms) | PR (ms) | change | main max RSS (KB) | PR max RSS (KB) | |---|---|---|---|---|---|---| | 1 | main PR | 15,997.8 | 14,612.6 | -8.7 % | 271,388 | 275,428 | | 2 | PR main | 15,705.9 | 14,613.0 | -7.0 % | 271,168 | 275,548 | | 3 | main PR | 15,739.0 | 14,635.6 | -7.0 % | 270,872 | 275,344 | | 4 | PR main | 15,555.0 | 14,719.1 | -5.4 % | 270,804 | 275,668 | | 5 | main PR | 15,561.6 | 14,464.9 | -7.0 % | 270,784 | 275,440 | | 6 | PR main | 15,808.7 | 14,462.1 | -8.5 % | 271,156 | 275,324 | | 7 | main PR | 15,675.1 | 14,429.4 | -7.9 % | 271,204 | 275,240 | | 8 | PR main | 15,513.1 | 14,492.3 | -6.6 % | 270,804 | 274,928 | | 9 | main PR | 15,397.4 | 14,511.8 | -5.8 % | 271,592 | 275,256 | | 10 | PR main | 15,735.3 | 14,397.4 | -8.5 % | 271,028 | 275,328 | </details> Max RSS grows by about 4 MB (1.6 %). That's the arena's transient peak while programs are being built. A counting diagnostic build shows the arena peaking at 6.5 MiB in this replay, with no cached program holding arena memory ([review reply](https://github.com/boykopovar/AnyPS5/pull/12039#issuecomment-6467222175)). Use lists grow geometrically, so a program being built holds at most about twice its final use-list bytes. Where the time goes, from `perf record -F 499` of one replay of the same corpus on each side, taken at the earlier head `787e3f6eae` against `main` `c547deaacb` (samples, not percentages): | Function | `main` | this PR | |---|---|---| | whole run | 7,966 | 7,174 | | allocator (`malloc`, `free`, `new`, `delete` and glibc's internals) | 1,948 | 1,509 | | `ValidateProgram` | 410 | 371 | | `IrValue::HasUses` | 365 | 326 | | `ConstantFolder::Fold` | 227 | 201 | | `DeadCodeEliminator::Eliminate` | 183 | 159 | | `IrValue::Parent` | 181 | 163 | More than half of the saving is in the allocator. The passes that walk use lists gain a little more, because a program's lists now sit together in its arena. The SPIR-V is byte-identical to `main`'s: all 65 modules from the Crimson Desert requests and all 302 from MXGP 26's (PPSA30839) dump. Only where use-list buffers live changes; the order of uses and every pass's behaviour stay the same. ### How - `IrValue.hpp`: `IrUseAllocator<T>` holds a `std::pmr::memory_resource*`. With an arena it allocates from it and `deallocate` does nothing. Without one it is `std::allocator`. `operandUses` is an `IrUseList` (`std::vector<IrUse, IrUseAllocator<IrUse>>`), and `OperandUses()` returns it. A copy of a use list (`select_on_container_copy_construction`) goes back to the heap, so a copy can outlive the program. The allocator propagates on move and swap. - `IrValue(opcode, type, id, useArena = nullptr)`: values made outside a program (resource plans, the disk cache, tests) keep the heap. - `IrUseArena` owns the program's `monotonic_buffer_resource`, created on the first `CreateValue`. `IrProgram` declares it before `values`, so values are destroyed before their arena. Its move assignment swaps, so in `a = std::move(b)` the old arena of `a` moves into `b` and outlives the values `a` drops. `deallocate` never touches the arena either way. - `IrValue` grows by the allocator's pointer, from 128 to 136 bytes; `ShaderDiskCache.cpp`'s size check follows. The plan value encoder doesn't serialise use lists, so the disk-cache format is unchanged. - `ConstantFolder.cpp`: the two places that copied a use list into a `std::vector<IrUse>` copy it as an `IrUseList`. `UseRewrite.cpp` compares against `IrUseList`. - A `monotonic_buffer_resource` isn't thread-safe. A program's values are only changed by the thread compiling it, as `std::vector` already requires. - `IrReclaim.cpp` adds a case: 40 readers grow one value's use list in its program's arena and keep their order; `ReplaceAllUsesWith` moves all of them to another value; then move assignment into that program keeps the assigned program's use lists intact. **Cached programs (after review):** `getSource` stores some programs in their `SourceEntry`. Before it does, `IrProgram::ReleaseUseArena()` copies each surviving value's use list into a heap vector and frees the arena, so a cached program keeps none of the arena's buffers: neither the ones whose values `ReclaimUnusedValues` dropped, nor the old buffers growth left. This also holds on the `getSource(..., false)` path, which caches without reclaiming. Values created after that get a new arena. Second commit: `3d427e3e32`. **Merge order:** - **#11798 (mine):** both change the allocation line of `IrProgram::CreateValue`. This PR lands after it and is rebased onto it, with the resolution validated below. - **#11820 (mine):** it also changes the `IrValue` size check from 128 to 136. The two edits are identical, so git merges them without a conflict, but together `IrValue` is 144 bytes. This PR lands after #11820 and sets the check to 144 when it's rebased onto it (validated below). - **#7689 (MarcZX10):** it changes the `IrResourcePlan` size check on the line before. That's a one-line textual conflict with no behavioural dependency. Agreed on #7689 ([comment](https://github.com/boykopovar/AnyPS5/pull/7689#issuecomment-6482995257)): #7689 lands first, and this PR is rebased after it, keeping both size values. - #9132, #11967 and #12002 merge with this branch without conflicts. ### Tested **Head `0fe2329ee8`** (`6a98793e3b` with `main` `422f96b3a9` merged in, which brings main's `Recompiler.cpp` change), built from these exact revisions: - `shader_ir_use_rewrite`, `agc_ir_reclaim`, `agc_constant_select`, `agc_masked_select` and `agc_validate_program` pass 3 of 3. - `agc_shader_replay --spv` gives byte-identical SPIR-V on `main` `422f96b3a9` and on this head: all 65 Crimson Desert modules (152 requests) and all 302 MXGP modules (305 requests). - Task-clock of `--spv` over all 457 requests, 10 alternating rounds: 26.61 s mean on `main`, 19.83 s on this head (−25.5 %), lower in 10 of 10 (24.5–26.0 %). Median max RSS is 1,374,254 KB on `main` and 1,391,460 KB on this head. This is a CPU-only change to IR allocation with byte-identical SPIR-V, so it has no GPU-side effect to capture. oneandonlydean accepted replay evidence in place of title captures for such changes on #9132 and #9198. **Earlier:** **Exact head `6a98793e3b` merged with `main` `dc38224141`** (merge `b0bf86ca7d`, clean), Linux, GCC 15.2, Release, SPIRV-Tools off: - `shader_ir_use_rewrite`, `agc_ir_reclaim`, `agc_constant_select`, `agc_masked_select` and `agc_validate_program` pass 3 of 3. - `agc_shader_replay --spv` gives byte-identical SPIR-V on `main` and on the merge: all 65 Crimson Desert modules (152 requests) and all 302 MXGP modules (305 requests). - Task-clock of `--spv` over all 457 requests, 10 alternating rounds: 26.43 s mean on `main`, 19.85 s on the merge (−24.9 %), lower in 10 of 10 (24.4–25.6 %). Median max RSS is 1,370,986 KB on `main` and 1,392,566 KB on the merge. This workload includes SPIR-V emission, unlike the `--prepare` timings below. **Earlier heads:** Linux (Ubuntu 26.04, GCC 15.2), Release: - At `787e3f6eae` (this patch before the rebase onto `9af563f33d`, unchanged by it): the 47 test targets whose sources use the IR API, `ctest` 3 runs, all 76 entries pass in every run. AddressSanitizer: `agc_ir_reclaim`, `agc_shader_memory`, `agc_validate_program` and `shader_ir_use_rewrite`, 3 runs, all pass with no AddressSanitizer or LeakSanitizer report. - Windows 11 VM (GeForce GT 1030, WinLibs GCC, Release): `shader_ir_use_rewrite`, `agc_ir_reclaim`, `agc_validate_program`, `agc_shader_memory` and `agc_constant_select`, 3 runs each on `main` `c547deaacb` and at `787e3f6eae`: 5 of 5 pass in every run on both sides. **At `3d427e3e32` (after review),** with the same replay and 10 rotating rounds against `main` `9af563f33d` and the previous head `9aaf9be4a0`, built from those exact revisions: - Mean task-clock is 15.55 s on `main`, 14.37 s on the previous head and 14.64 s on this head: −5.9 % against `main`, lower in 10 of 10. This head is 1.9 % slower than the previous one. - Median max RSS is 271,204, 275,354 and 275,416 KB. - SPIR-V is byte-identical to `main` for all 65 Crimson Desert and 302 MXGP modules. - `shader_ir_use_rewrite`, `agc_ir_reclaim`, `agc_constant_select`, `agc_masked_select` and `agc_validate_program` pass 3 of 3. A `ReleaseUseArena` that does nothing fails `agc_ir_reclaim`. On the Windows 11 VM they pass 3 of 3 at `main` and at this head. - Super Meat Boy 3D, 3 rotating rounds, median RssAnon peak: `608dd76843` 5,141 MB, + the previous head 4,856 MB, + this head 4,610 MB. That's within the roughly 600 MB spread between runs of one build. **Combined layout with #11798 and #11820** ([`033713cac5`](https://github.com/milescoviello/AnyPS5/commit/033713cac5) on my fork: `main` `9af563f33d` + #11798 `c31e8e0fe3` + #11820 `e339f57e4d` + this change): - The conflict with #11798 resolves as `values.Create(opcode, type, nextValueId, useArena.Resource())`, with `IrValuePool::Create` taking the arena and passing it to the value's constructor. - `IrValue` is 144 bytes there. The `ShaderDiskCache.cpp` check is set to 144 and builds. - The 47 IR test targets pass 3 of 3 (76 entries), and the four AddressSanitizer targets pass 3 of 3 with no report. - SPIR-V is byte-identical to the same stack without this change: all 65 Crimson Desert and all 302 MXGP modules. - Timing, 6 alternating rounds against that stack: 10.40 s → 8.98 s mean task-clock (−13.6 %), lower in 6 of 6. Max RSS goes from 256.2 to 265.8 MB. That's more growth than on `main` alone, and I haven't looked into why. <details><summary>All 6 rounds on the stack</summary> | Round | Order | stack (ms) | stack+PR (ms) | change | stack max RSS (KB) | stack+PR max RSS (KB) | |---|---|---|---|---|---|---| | 1 | stack+PR stack+PR | 10,345.4 | 8,939.3 | -13.6 % | 262,200 | 272,364 | | 2 | stack+PR stack+PR | 10,362.8 | 8,892.2 | -14.2 % | 262,116 | 273,212 | | 3 | stack+PR stack+PR | 10,360.8 | 9,017.6 | -13.0 % | 262,488 | 270,724 | | 4 | stack+PR stack+PR | 10,385.6 | 9,054.8 | -12.8 % | 262,208 | 272,812 | | 5 | stack+PR stack+PR | 10,448.9 | 9,030.2 | -13.6 % | 263,060 | 271,920 | | 6 | stack+PR stack+PR | 10,488.0 | 8,972.8 | -14.4 % | 263,076 | 270,200 | </details> **How the numbers were taken:** - **Builds:** release `agc_shader_replay` (SPIR-V Tools off, as users build) of each exact revision. Replay binary SHA-256 prefixes: `main` `0b1feee1a3a5`, this PR `531fdc2c2a97`. - **Command, per run:** `ANYPS5_NO_SHADER_CACHE=1 /usr/bin/time -f %M perf stat -x, -e task-clock agc_shader_replay --prepare <the 152 requests>`, in a fresh empty directory, alternating which side runs first. - **Request set:** 152 requests. The SHA-256 over the sorted list of their file digests is `4fc9e044c1e59fb3`. The 305 MXGP requests give `7a681333ac4a2b4e`. The requests themselves are game shader dumps and aren't published. - **SPIR-V:** `agc_shader_replay --spv` over both sets on each side, then a diff of the sorted `sha256sum` lists of the output modules. **Supplementary:** Black Ops II title captures with a cold recompiler cache ([comment](https://github.com/boykopovar/AnyPS5/pull/12039#issuecomment-6449512144)). Black Ops II stops at 8 s on `main` without #9656, so both sides there are local builds of `eece5da035` + #9656, with and without this commit. They aren't upstream revisions and aren't the evidence for this PR. They showed 14.5 % and 17.4 % less preparation time per artifact on the title thread, and no change on the workers. **Title captures (after review):** Super Meat Boy 3D, `main` `9af563f33d` + #11580 (`608dd76843`) against the same + this PR (`561c7f952a`), 3 interleaved rounds, recompiler cache off. `Shader.PrepareArtifact` worker time is 12,196 ms → 11,322 ms (−7.2 %), lower in 3 of 3 ([table and traces](https://github.com/milescoviello/AnyPS5/releases/tag/pr12039-smb3d-captures)). Round 2's summary lines: ``` {"commit":"608dd7684303","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA31162","title":"Super Meat Boy 3D","content_version":"02.000.001","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":60032.708},"presents":421,"frame_ms":{"p50":125.841,"p90":141.927,"p99":1311.172,"max":3996.694},"gpu_busy_ms_per_present":87.926,"worker_busy_pct":{"queue worker 0x0":86.308,"queue worker 0x20":84.754},"top_phases_ms_per_frame":{"Driver.Packet":243.826,"Driver.Packet.memory_wait":120.231,"Driver.Packet.dispatch":57.628,"Driver.Dispatch":57.465,"Shader.PrepareArtifact":43.040,"Driver.Packet.pipeline_drain":40.281,"Recorder.Sync":39.168,"GpuMutex.wait.hook":38.208},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":39.470,"events_lost":327140,"totals_full":false}},"trace":"aps5-trace-608dd7684303-3.json.gz"} {"commit":"561c7f952a08","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 615.71.09","os":"Linux 7.0.0-38-generic","cpu":"13th Gen Intel(R) Core(TM) i7-13700K","cpu_threads":24,"memory_mib":30993,"title_id":"PPSA31162","title":"Super Meat Boy 3D","content_version":"02.000.001","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":60061.392},"presents":428,"frame_ms":{"p50":125.393,"p90":140.113,"p99":1366.643,"max":3861.073},"gpu_busy_ms_per_present":87.289,"worker_busy_pct":{"queue worker 0x0":87.165,"queue worker 0x20":84.964},"top_phases_ms_per_frame":{"Driver.Packet":241.484,"Driver.Packet.memory_wait":118.840,"Driver.Packet.dispatch":57.317,"Driver.Dispatch":57.176,"Recorder.Sync":39.805,"Driver.Packet.pipeline_drain":39.747,"Shader.PrepareArtifact":39.409,"GpuMutex.wait.hook":37.774},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":38.766,"events_lost":337406,"totals_full":false}},"trace":"aps5-trace-561c7f952a08-3.json.gz"} ``` ### 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: #11798, #11820, #7689 (textual overlaps, see the merge order above; this PR lands after all three and is rebased onto them) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (CPU-side shader compilation; SPIR-V byte-identical) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-27 18:53:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:53:25Z.

Review: CHANGES_REQUESTED


Reviewed exact head 787e3f6eae82e11b336343d94f450455bee6907d. The allocator and arena lifetime approach is coherent on inspection, and the PR reports extensive IR, ASan, and Windows/Linux test coverage. I have not independently rebuilt this large shader change in this pass.

There are two repository-rule blockers:

  1. The perf report does not currently meet the required evidence format. The linked title summary lines use commits ed3b6566a2c6 and 2bb6ee4de359; neither resolves as a commit in upstream boykopovar/AnyPS5, and the report describes its other replay baseline as main c547deaacb, rather than the current base. The required tools/trace_digest.py output is also absent, and the trace assets are linked from a separate fork rather than attached here. Please provide the same-title/current-main and PR captures, both summary lines, trace assets and digest, or remove the performance claim/label and resolve the automated report check.

  2. The PR itself identifies unresolved overlapping work: exact pairwise git merge-tree shows content conflicts with open #11798 in IrProgram.cpp and #7689 in ShaderDiskCache.cpp. #11820 also overlaps the IrValue size check and the description says the combined layout requires changing the size from 136 to 144. The description says whichever lands second will be rebased, but CONTRIBUTING.md requires authors to agree the order and declare it with Depends on; the checklist currently says none. Please coordinate the order with those authors, declare dependencies, and validate the combined layout and cache size check after rebasing.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5672641101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5672641101). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T18:53:25Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `787e3f6eae82e11b336343d94f450455bee6907d`. The allocator and arena lifetime approach is coherent on inspection, and the PR reports extensive IR, ASan, and Windows/Linux test coverage. I have not independently rebuilt this large shader change in this pass. There are two repository-rule blockers: 1. The `perf` report does not currently meet the required evidence format. The linked title summary lines use commits `ed3b6566a2c6` and `2bb6ee4de359`; neither resolves as a commit in upstream `boykopovar/AnyPS5`, and the report describes its other replay baseline as `main` `c547deaacb`, rather than the current base. The required `tools/trace_digest.py` output is also absent, and the trace assets are linked from a separate fork rather than attached here. Please provide the same-title/current-main and PR captures, both summary lines, trace assets and digest, or remove the performance claim/label and resolve the automated report check. 2. The PR itself identifies unresolved overlapping work: exact pairwise `git merge-tree` shows content conflicts with open #11798 in `IrProgram.cpp` and #7689 in `ShaderDiskCache.cpp`. #11820 also overlaps the `IrValue` size check and the description says the combined layout requires changing the size from 136 to 144. The description says whichever lands second will be rebased, but `CONTRIBUTING.md` requires authors to agree the order and declare it with `Depends on`; the checklist currently says `none`. Please coordinate the order with those authors, declare dependencies, and validate the combined layout and cache size check after rebasing.
MarcZX10 commented 2026-10-27 19:42:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T19:42:57Z.

Review: CHANGES_REQUESTED


Rechecked exact head 9aaf9be4a0d50baf45e59825107eb432e9e5a114. The new report substantially improves the technical evidence: it gives exact replay revisions, ten paired rounds, request-set digest, SPIR-V comparisons, memory cost, and the combined layout tests. The earlier conflicts with #11798 and #11820 now have declared dependencies, and the author of #7689 has proposed the same either-order resolution in a comment there.

Two repository requirements are still unresolved:

  1. This PR still claims a 7.2% speedup and retains the perf title/label. The current PR labels include perf numbers missing, and the description still has no two valid aps5-summary.jsonl lines or attached traces for the same title, scene and machine. The replay timing table is useful supplemental evidence, but CONTRIBUTING.md requires those paired capture summaries and traces for a speed claim; AGENTS.md also requires tools/trace_digest.py summaries. Please add the required report material, or remove the speed claim and perf label so the automated missing-numbers label clears.

  2. #12039 and #7689 both change the ShaderDiskCache.cpp size-assert region. The new checklist declares #11798 and #11820, but still does not declare an agreed order with #7689. The current comment proposes either order, and the #7689 author has not replied to this specific proposal. Please get that order agreed and record it with Depends on as the overlap rule requires.

The report and tests are author-provided; I have not independently rebuilt the shader changes. Current hosted Windows, Ubuntu relinker and ASan checks pass; two macOS relinker checks are still pending. These checks do not resolve the report or overlap items above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5673249523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5673249523). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T19:42:57Z. **Review:** CHANGES_REQUESTED --- Rechecked exact head `9aaf9be4a0d50baf45e59825107eb432e9e5a114`. The new report substantially improves the technical evidence: it gives exact replay revisions, ten paired rounds, request-set digest, SPIR-V comparisons, memory cost, and the combined layout tests. The earlier conflicts with #11798 and #11820 now have declared dependencies, and the author of #7689 has proposed the same either-order resolution in a comment there. Two repository requirements are still unresolved: 1. This PR still claims a 7.2% speedup and retains the `perf` title/label. The current PR labels include `perf numbers missing`, and the description still has no two valid `aps5-summary.jsonl` lines or attached traces for the same title, scene and machine. The replay timing table is useful supplemental evidence, but `CONTRIBUTING.md` requires those paired capture summaries and traces for a speed claim; `AGENTS.md` also requires `tools/trace_digest.py` summaries. Please add the required report material, or remove the speed claim and perf label so the automated missing-numbers label clears. 2. #12039 and #7689 both change the `ShaderDiskCache.cpp` size-assert region. The new checklist declares #11798 and #11820, but still does not declare an agreed order with #7689. The current comment proposes either order, and the #7689 author has not replied to this specific proposal. Please get that order agreed and record it with `Depends on` as the overlap rule requires. The report and tests are author-provided; I have not independently rebuilt the shader changes. Current hosted Windows, Ubuntu relinker and ASan checks pass; two macOS relinker checks are still pending. These checks do not resolve the report or overlap items above.
adriadam10 commented 2026-10-28 10:04:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T10:04:01Z.

Review: CHANGES_REQUESTED


Read the full diff; the arena lifetime (declared before values, swap on move assignment, heap on copy) and the new IrReclaim case look right. Three things before this can merge:

  • Recompiler.cpp:536-538: source->program is kept in the SourceEntry, and IrProgram::ReclaimUnusedValues (57b2dc8584) exists to shrink exactly those cached programs. With the arena, the use-list buffers of the dropped values, and every old buffer left by growth, stay allocated until the entry is destroyed, so reclaim no longer returns that memory. Please bound this (for example keep the arena only for programs that are not cached, or move the surviving use lists to the heap after reclaim) and show peak RSS before/after on a title run that keeps cached programs, not only on the --prepare replay (+1.6 % there, +3.7 % on the stack with #11798/#11820, still unexplained).
  • Order with #7689 on the ShaderDiskCache.cpp size asserts is still not agreed; please get the reply there and record it in Depends on. Note that with #11820 the IrValue check has to be 144: two identical 136 edits merge without a conflict and fail the build.
  • Rebase onto #11798/#11820 once they land, or drop them from the stack, so the head tested is what lands.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680869130 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5680869130). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T10:04:01Z. **Review:** CHANGES_REQUESTED --- Read the full diff; the arena lifetime (declared before `values`, swap on move assignment, heap on copy) and the new `IrReclaim` case look right. Three things before this can merge: - `Recompiler.cpp:536-538`: `source->program` is kept in the `SourceEntry`, and `IrProgram::ReclaimUnusedValues` (57b2dc8584) exists to shrink exactly those cached programs. With the arena, the use-list buffers of the dropped values, and every old buffer left by growth, stay allocated until the entry is destroyed, so reclaim no longer returns that memory. Please bound this (for example keep the arena only for programs that are not cached, or move the surviving use lists to the heap after reclaim) and show peak RSS before/after on a title run that keeps cached programs, not only on the `--prepare` replay (+1.6 % there, +3.7 % on the stack with #11798/#11820, still unexplained). - Order with #7689 on the `ShaderDiskCache.cpp` size asserts is still not agreed; please get the reply there and record it in `Depends on`. Note that with #11820 the `IrValue` check has to be 144: two identical 136 edits merge without a conflict and fail the build. - Rebase onto #11798/#11820 once they land, or drop them from the stack, so the head tested is what lands.
MarcZX10 commented 2026-10-29 07:16:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:16:07Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The author’s latest update adds a focused arena-release test and an independent approval on this exact head. I rechecked the new head against current main; the branch is still based on an older revision, and current main has changed files this PR modifies. The reported performance captures also use the prior PR head, so the current combined change still needs validation.

What I ran

  • Refreshed the PR metadata, discussion, labels, reviews and hosted checks with gh.
  • Compared the PR head with upstream main using git merge-base, git merge-tree --write-tree, and git diff --check.
  • Compared current-main changes since the PR’s base with the files changed by this PR.
  • Did not build or run local tests.

Results

Check Result
Hosted conventions, eligibility, labels, Windows, relinker (macOS and Ubuntu), ASan and report Passed
Hosted Linux product, register-context and write-watch Skipped
Merge preview Clean
git diff --check Passed
Independent local build/tests in this review Not run
Unedited command output
$ git rev-parse refs/review/upstream-12039
3d427e3e3283f576112072da3cbea2965063ce37
$ git rev-parse upstream/main
edf6804cf52c62eacafc592dd6142cb4efe5bd05
$ git merge-base upstream/main refs/review/upstream-12039
9af563f33d43c66d8a30b8bb8a442e8abd120183
$ git merge-tree --write-tree upstream/main refs/review/upstream-12039 | head -40
07bfceffc8b9976e274926cc89a48dbdfbdc8778
$ git diff --check refs/review/upstream-12039^..refs/review/upstream-12039
(no output; exit status 0)
$ gh pr checks 12039 --repo boykopovar/AnyPS5
conventions	pass	16s	https://github.com/boykopovar/AnyPS5/actions/runs/40787031335/job/123162680926
eligibility	pass	7s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122772606866
labels	pass	7s	https://github.com/boykopovar/AnyPS5/actions/runs/40787031415/job/123162680996
relinker (macos-latest, clang++)	pass	2m37s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696640
relinker (macos-latest, clang++, x86_64)	pass	6m20s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696568
relinker (ubuntu-latest, g++)	pass	2m42s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696543
relinker (windows-latest, g++)	pass	9m3s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696450
windows	pass	3m19s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696374
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698334
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698787
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698803
relinker-asan	pass	2m27s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696536
report	pass	52s	https://github.com/boykopovar/AnyPS5/actions/runs/40675461543/job/122772605960

Negative control

Not run. I did not build a deliberately failing control or compare test logs locally.

Findings

Blocking

  • Rebase this branch onto current main and rerun the focused shader-recompiler tests on both the same current-main base and the exact PR head, with Vulkan validation configured as the repository requires. Current main has changed IrProgram.hpp, IrProgram.cpp, ConstantFolder.cpp, Recompiler.cpp and ShaderDiskCache.cpp, all paths touched by this PR; the author’s latest test report names the older base 9af563f33d.
  • Refresh the paired performance report for the rebased base and exact current head. The report in the PR body measures the earlier head 9aaf9be4a0; the current head adds ReleaseUseArena(), so the existing capture pair does not measure the full change now under review. Keep the same title, scene and machine and include the required summary lines, traces and digests.

Non-blocking

  • The current merge preview is clean, and the hosted checks listed above pass. Those results do not substitute for checking the changed shader-recompiler paths on current main and this exact head.

Sources

Not verified

  • I did not independently reproduce the author’s IR tests, ASan runs, replay timings, or SPIR-V comparisons.
  • Hosted Linux product, register-context and write-watch jobs were skipped.

To get this to a good state

Rebase onto current main; run the same focused shader-recompiler/Vulkan-validation tests on that base and the exact new head; then refresh the paired performance evidence for those exact revisions.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694107413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5694107413). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T07:16:07Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested The author’s latest update adds a focused arena-release test and an independent approval on this exact head. I rechecked the new head against current `main`; the branch is still based on an older revision, and current `main` has changed files this PR modifies. The reported performance captures also use the prior PR head, so the current combined change still needs validation. ## What I ran - Refreshed the PR metadata, discussion, labels, reviews and hosted checks with `gh`. - Compared the PR head with upstream `main` using `git merge-base`, `git merge-tree --write-tree`, and `git diff --check`. - Compared current-main changes since the PR’s base with the files changed by this PR. - Did not build or run local tests. ## Results | Check | Result | |---|---| | Hosted conventions, eligibility, labels, Windows, relinker (macOS and Ubuntu), ASan and report | Passed | | Hosted Linux product, register-context and write-watch | Skipped | | Merge preview | Clean | | `git diff --check` | Passed | | Independent local build/tests in this review | Not run | <details><summary>Unedited command output</summary> ```text $ git rev-parse refs/review/upstream-12039 3d427e3e3283f576112072da3cbea2965063ce37 $ git rev-parse upstream/main edf6804cf52c62eacafc592dd6142cb4efe5bd05 $ git merge-base upstream/main refs/review/upstream-12039 9af563f33d43c66d8a30b8bb8a442e8abd120183 $ git merge-tree --write-tree upstream/main refs/review/upstream-12039 | head -40 07bfceffc8b9976e274926cc89a48dbdfbdc8778 $ git diff --check refs/review/upstream-12039^..refs/review/upstream-12039 (no output; exit status 0) $ gh pr checks 12039 --repo boykopovar/AnyPS5 conventions pass 16s https://github.com/boykopovar/AnyPS5/actions/runs/40787031335/job/123162680926 eligibility pass 7s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122772606866 labels pass 7s https://github.com/boykopovar/AnyPS5/actions/runs/40787031415/job/123162680996 relinker (macos-latest, clang++) pass 2m37s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696640 relinker (macos-latest, clang++, x86_64) pass 6m20s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696568 relinker (ubuntu-latest, g++) pass 2m42s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696543 relinker (windows-latest, g++) pass 9m3s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696450 windows pass 3m19s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696374 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698334 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698787 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774698803 relinker-asan pass 2m27s https://github.com/boykopovar/AnyPS5/actions/runs/40675461677/job/122774696536 report pass 52s https://github.com/boykopovar/AnyPS5/actions/runs/40675461543/job/122772605960 ``` </details> ## Negative control Not run. I did not build a deliberately failing control or compare test logs locally. ## Findings ### Blocking - Rebase this branch onto current `main` and rerun the focused shader-recompiler tests on both the same current-main base and the exact PR head, with Vulkan validation configured as the repository requires. Current `main` has changed `IrProgram.hpp`, `IrProgram.cpp`, `ConstantFolder.cpp`, `Recompiler.cpp` and `ShaderDiskCache.cpp`, all paths touched by this PR; the author’s latest test report names the older base `9af563f33d`. - Refresh the paired performance report for the rebased base and exact current head. The report in the PR body measures the earlier head `9aaf9be4a0`; the current head adds `ReleaseUseArena()`, so the existing capture pair does not measure the full change now under review. Keep the same title, scene and machine and include the required summary lines, traces and digests. ### Non-blocking - The current merge preview is clean, and the hosted checks listed above pass. Those results do not substitute for checking the changed shader-recompiler paths on current `main` and this exact head. ## Sources - [Current PR head `3d427e3e3283f576112072da3cbea2965063ce37`](https://github.com/boykopovar/AnyPS5/commit/3d427e3e3283f576112072da3cbea2965063ce37) - [Current upstream `main` `edf6804cf52c62eacafc592dd6142cb4efe5bd05`](https://github.com/boykopovar/AnyPS5/commit/edf6804cf52c62eacafc592dd6142cb4efe5bd05) - [Repository review and test requirements at that revision](https://github.com/boykopovar/AnyPS5/blob/edf6804cf52c62eacafc592dd6142cb4efe5bd05/AGENTS.md#L11-L14) - [Performance evidence and shader-test requirements at that revision](https://github.com/boykopovar/AnyPS5/blob/edf6804cf52c62eacafc592dd6142cb4efe5bd05/CONTRIBUTING.md#L67-L71) ## Not verified - I did not independently reproduce the author’s IR tests, ASan runs, replay timings, or SPIR-V comparisons. - Hosted Linux product, register-context and write-watch jobs were skipped. ## To get this to a good state Rebase onto current `main`; run the same focused shader-recompiler/Vulkan-validation tests on that base and the exact new head; then refresh the paired performance evidence for those exact revisions.
MarcZX10 commented 2026-10-29 08:36:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:36:39Z.

Review: CHANGES_REQUESTED


Re-reviewed exact head e7c7184498e5441dc2e9412e8610fdc010991a49 and your current update. The use-arena lifetime regression and the 82-test/3-run report on edf6804cf5 address the earlier older-base test concern, and the new replay report is well described for that pair. The head still does not include current main 4c7d275bef89d309313d16bc2bc05d37a1b50be2; current main changed core/shader/recompiler/Recompiler.cpp, which this PR also changes. Please integrate current main and rerun the focused tests and paired performance report on that exact current integration. The merge preview is clean; diff check and conventions pass. I did not run the shader/GPU tests locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694880472 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5694880472). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:36:39Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact head `e7c7184498e5441dc2e9412e8610fdc010991a49` and your current update. The use-arena lifetime regression and the 82-test/3-run report on `edf6804cf5` address the earlier older-base test concern, and the new replay report is well described for that pair. The head still does not include current `main` `4c7d275bef89d309313d16bc2bc05d37a1b50be2`; current main changed `core/shader/recompiler/Recompiler.cpp`, which this PR also changes. Please integrate current main and rerun the focused tests and paired performance report on that exact current integration. The merge preview is clean; diff check and conventions pass. I did not run the shader/GPU tests locally.
MarcZX10 commented 2026-10-29 09:44:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:44:00Z.

Review: APPROVED


Re-checked — approved

The exact head is now rebased onto current main aaccd0ba39; the previously noted Recompiler.cpp integration is included, and the use-arena production diff remains unchanged. The author reports 82 focused tests passing in each of three runs on both the current-main baseline and this head, with the Vulkan validation layer reporting no VUIDs. The SPIR-V output is reported byte-identical across 152 replay requests.

The CPU shader-replay benchmark is reported as 9.86 s to 9.00 s median task-clock (10 paired rounds) with +4.4 MiB maximum RSS. This supports the compiler-time claim; it is not a title frame-time claim. Hosted checks are pending after the update.

I reviewed the integration and evidence but did not rerun the tests or benchmark locally. No blocking issue found; approval covers exact head 1d9eaeaa8950c2ed0b07b068efecddde93a3addc.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695684759 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5695684759). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:44:00Z. **Review:** APPROVED --- # Re-checked — approved The exact head is now rebased onto current `main` `aaccd0ba39`; the previously noted `Recompiler.cpp` integration is included, and the use-arena production diff remains unchanged. The author reports 82 focused tests passing in each of three runs on both the current-main baseline and this head, with the Vulkan validation layer reporting no VUIDs. The SPIR-V output is reported byte-identical across 152 replay requests. The CPU shader-replay benchmark is reported as 9.86 s to 9.00 s median task-clock (10 paired rounds) with +4.4 MiB maximum RSS. This supports the compiler-time claim; it is not a title frame-time claim. Hosted checks are pending after the update. I reviewed the integration and evidence but did not rerun the tests or benchmark locally. No blocking issue found; approval covers exact head `1d9eaeaa8950c2ed0b07b068efecddde93a3addc`.
MarcZX10 commented 2026-10-29 21:15:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T21:15:19Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The two latest code commits are not covered by the performance and focused-test evidence currently reported for older heads.

What I ran

Reviewed exact PR head 6a98793e3b32994bd9f5481f37e925fc6af18a1b, whose GitHub base is 951f374c8716fd69f7241a936fb944ca0e8bf354; current upstream main is 9624d8c6bb9e96b7aa92b815f55690f69b0a88d5. The current-main merge preview is clean. Environment: Linux x86-64, Git and GitHub CLI; no compiler or build was used.

git diff --check fd9b3f62d43d6753d28a31a7c285e1f51e9c1b42..refs/review/pr-12039-head
git merge-tree --write-tree 9624d8c6bb9e96b7aa92b815f55690f69b0a88d5 refs/review/pr-12039-head
git rev-list --count 951f374c8716fd69f7241a936fb944ca0e8bf354..9624d8c6bb9e96b7aa92b815f55690f69b0a88d5

I read the exact-head diff, latest PR description/comments, and hosted check statuses. Reported benchmarks and focused test runs are author-provided; I did not rerun them.

Results

Check Result
Patch whitespace Pass
Merge preview onto current main Clean; tree 19f6a2f34262f608a3cf0b39c07cad9ab2288176
Base freshness PR base 951f374c8716; current main 9624d8c6bb9e, 13 commits ahead
Hosted Windows, Ubuntu/Windows relinker, relinker-asan, conventions, eligibility, labels, report Pass on exact head
Hosted macOS relinker jobs Queued
Hosted Linux product, write-watch, register-context jobs Skipped
Focused tests and performance evidence The description reports runs on 1d9eaeaa89 and 3d427e3e32; neither is the current head 6a98793e3b. The current head adds c01d0bb24f and 6a98793e3b, including the cached-program arena release and the IrValue size update. I found no exact-head matched performance result or focused-run report for those changes.
Local build/tests Not run
Unedited local command output
exit=0
19f6a2f34262f608a3cf0b39c07cad9ab2288176
merge-tree-exit=0
main-base=9624d8c6bb9e96b7aa92b815f55690f69b0a88d5
pr-head=6a98793e3b32994bd9f5481f37e925fc6af18a1b
main-advance-commits=13

Findings

Blocking

  • This performance PR's reported measurements and focused test runs do not cover its submitted head. The latest two commits change where cached programs' use lists are stored and update the IrValue size assertion; those changes can affect the performance and memory behavior being reported. Please rerun the relevant focused tests and matched replay comparison on exact head 6a98793e3b and a current-main baseline.
  • The PR base remains 951f374c8716, while current upstream main is 9624d8c6bb9e. The merge preview is clean, but the repository requires branches to be based on and kept up to date with current main; this exact integration has not been tested by the reported runs.

I found no additional source-level defect in the reviewed diff.

Sources

Not verified

  • I did not independently run the focused IR/AGC tests, replay benchmark, SPIR-V comparison, ASan tests, or title captures.
  • The macOS relinker jobs remain queued; the listed Linux product and specialized jobs were skipped. The Windows hosted job passed on the exact head.

To get this to a good state

Update the branch onto current main, then rerun the focused tests and matched replay benchmark on the resulting exact head and current-main baseline; update the PR report with both exact revisions and results. I will recheck that head and repeat the non-build checks above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5705064910 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5705064910). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T21:15:19Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The two latest code commits are not covered by the performance and focused-test evidence currently reported for older heads. ## What I ran Reviewed exact PR head `6a98793e3b32994bd9f5481f37e925fc6af18a1b`, whose GitHub base is `951f374c8716fd69f7241a936fb944ca0e8bf354`; current upstream `main` is `9624d8c6bb9e96b7aa92b815f55690f69b0a88d5`. The current-main merge preview is clean. Environment: Linux x86-64, Git and GitHub CLI; no compiler or build was used. ```sh git diff --check fd9b3f62d43d6753d28a31a7c285e1f51e9c1b42..refs/review/pr-12039-head git merge-tree --write-tree 9624d8c6bb9e96b7aa92b815f55690f69b0a88d5 refs/review/pr-12039-head git rev-list --count 951f374c8716fd69f7241a936fb944ca0e8bf354..9624d8c6bb9e96b7aa92b815f55690f69b0a88d5 ``` I read the exact-head diff, latest PR description/comments, and hosted check statuses. Reported benchmarks and focused test runs are author-provided; I did not rerun them. ## Results | Check | Result | |---|---| | Patch whitespace | Pass | | Merge preview onto current `main` | Clean; tree `19f6a2f34262f608a3cf0b39c07cad9ab2288176` | | Base freshness | PR base `951f374c8716`; current `main` `9624d8c6bb9e`, 13 commits ahead | | Hosted Windows, Ubuntu/Windows relinker, relinker-asan, conventions, eligibility, labels, report | Pass on exact head | | Hosted macOS relinker jobs | Queued | | Hosted Linux product, write-watch, register-context jobs | Skipped | | Focused tests and performance evidence | The description reports runs on `1d9eaeaa89` and `3d427e3e32`; neither is the current head `6a98793e3b`. The current head adds `c01d0bb24f` and `6a98793e3b`, including the cached-program arena release and the `IrValue` size update. I found no exact-head matched performance result or focused-run report for those changes. | | Local build/tests | Not run | <details> <summary>Unedited local command output</summary> ```text exit=0 19f6a2f34262f608a3cf0b39c07cad9ab2288176 merge-tree-exit=0 main-base=9624d8c6bb9e96b7aa92b815f55690f69b0a88d5 pr-head=6a98793e3b32994bd9f5481f37e925fc6af18a1b main-advance-commits=13 ``` </details> ## Findings ### Blocking - This performance PR's reported measurements and focused test runs do not cover its submitted head. The latest two commits change where cached programs' use lists are stored and update the `IrValue` size assertion; those changes can affect the performance and memory behavior being reported. Please rerun the relevant focused tests and matched replay comparison on exact head `6a98793e3b` and a current-main baseline. - The PR base remains `951f374c8716`, while current upstream `main` is `9624d8c6bb9e`. The merge preview is clean, but the repository requires branches to be based on and kept up to date with current `main`; this exact integration has not been tested by the reported runs. I found no additional source-level defect in the reviewed diff. ## Sources - [Branch and performance-report requirements at current main](https://github.com/boykopovar/AnyPS5/blob/9624d8c6bb9e96b7aa92b815f55690f69b0a88d5/CONTRIBUTING.md) - [Performance report form at current main](https://github.com/boykopovar/AnyPS5/blob/9624d8c6bb9e96b7aa92b815f55690f69b0a88d5/.github/ISSUE_TEMPLATE/performance.yml) ## Not verified - I did not independently run the focused IR/AGC tests, replay benchmark, SPIR-V comparison, ASan tests, or title captures. - The macOS relinker jobs remain queued; the listed Linux product and specialized jobs were skipped. The Windows hosted job passed on the exact head. ## To get this to a good state Update the branch onto current `main`, then rerun the focused tests and matched replay benchmark on the resulting exact head and current-main baseline; update the PR report with both exact revisions and results. I will recheck that head and repeat the non-build checks above.
MarcZX10 commented 2026-10-30 04:25:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T04:25:33Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The new report adds useful replay and focused-test evidence, but it is based on an older main snapshot that has since changed a production file this PR also edits.

What I ran

Reviewed head 6a98793e3b32994bd9f5481f37e925fc6af18a1b; the author’s reported comparison base is dc38224141e0b6096007b876b4c42fc9144d11b8, while current main is 5ecef095b61e7a406b279c97896f3a8a6fbd6353. The current-main merge preview is clean (tree 04bb80575c5ba2585a7d094cb9c4331ee46bbea4), but shared paths changed since the report base include core/shader/recompiler/Recompiler.cpp, which this PR also changes.

git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/upstream/pr-12039
git diff --check refs/remotes/upstream/main...refs/remotes/upstream/pr-12039
git diff --unified=4 dc38224141e0b6096007b876b4c42fc9144d11b8..refs/remotes/upstream/main -- core/shader/recompiler/Recompiler.cpp

Results

Check Result
Current-main merge preview Clean
Diff check Passed; no output
Hosted conventions and Windows Passed
Focused tests and replay timing Author reports 5 focused suites 3/3, byte-identical SPIR-V for 457 requests, and a 10-round replay task-clock reduction; not independently run
Current-main qualification Not reported; the comparison uses dc382241

Findings

Blocking

  • The current-main change in Recompiler.cpp is outside the PR’s reported test/benchmark base, so the reported qualification does not cover the exact integration under review.
  • The PR is labeled perf. The replay timing is useful evidence for agc_shader_replay --spv, but the PR still needs the performance-report evidence required by the repository for the claimed change, or a maintainer decision that this tool-only measurement satisfies that requirement.

Not verified

I did not run a local build, replay benchmarks, tests, or GPU validation. The figures above are author-reported.

To get this to a good state

Please rebase or merge current main and rerun the focused tests and replay comparison on the exact resulting head. Please also attach the required matched performance-report artifacts, or record the maintainer’s accepted equivalent. I’ll re-check the same paths and commands on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5708065372 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12039#pullrequestreview-5708065372). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T04:25:33Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The new report adds useful replay and focused-test evidence, but it is based on an older main snapshot that has since changed a production file this PR also edits. ## What I ran Reviewed head `6a98793e3b32994bd9f5481f37e925fc6af18a1b`; the author’s reported comparison base is `dc38224141e0b6096007b876b4c42fc9144d11b8`, while current main is `5ecef095b61e7a406b279c97896f3a8a6fbd6353`. The current-main merge preview is clean (tree `04bb80575c5ba2585a7d094cb9c4331ee46bbea4`), but shared paths changed since the report base include `core/shader/recompiler/Recompiler.cpp`, which this PR also changes. ```sh git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/upstream/pr-12039 git diff --check refs/remotes/upstream/main...refs/remotes/upstream/pr-12039 git diff --unified=4 dc38224141e0b6096007b876b4c42fc9144d11b8..refs/remotes/upstream/main -- core/shader/recompiler/Recompiler.cpp ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Diff check | Passed; no output | | Hosted conventions and Windows | Passed | | Focused tests and replay timing | Author reports 5 focused suites 3/3, byte-identical SPIR-V for 457 requests, and a 10-round replay task-clock reduction; not independently run | | Current-main qualification | Not reported; the comparison uses `dc382241` | ## Findings ### Blocking - The current-main change in `Recompiler.cpp` is outside the PR’s reported test/benchmark base, so the reported qualification does not cover the exact integration under review. - The PR is labeled `perf`. The replay timing is useful evidence for `agc_shader_replay --spv`, but the PR still needs the performance-report evidence required by the repository for the claimed change, or a maintainer decision that this tool-only measurement satisfies that requirement. ## Not verified I did not run a local build, replay benchmarks, tests, or GPU validation. The figures above are author-reported. ## To get this to a good state Please rebase or merge current main and rerun the focused tests and replay comparison on the exact resulting head. Please also attach the required matched performance-report artifacts, or record the maintainer’s accepted equivalent. I’ll re-check the same paths and commands on the new 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!12039
No description provided.