perf(shader): use table-driven formatted loads and fold constant table lookups #8721

Merged
hamb3r merged 11 commits from upstream-pr/8721 into main 2026-10-23 19:42:25 +00:00
hamb3r commented 2026-10-20 22:19:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T22:19:54Z.


What

  • Use the table-driven genericFormattedLoad path in SpirvRuntimeBuffer.cpp for all formatted buffer loads (!store), shifting non-dword descriptor-backed loads right by the subword byte offset when memory.gpuDescriptor is false and gating active/required component checks through Select instead of emitting a 57-case OpSwitch across every IrBufferFormat for each formatted load.
  • Teach SpecializeSpirv (SpirvSpecialization.cpp) to fold constant loads from read-only StorageClassPrivate composite tables (OpVariable initialized by OpConstantComposite and only accessed via constant-index OpAccessChain/OpInBoundsAccessChain + OpLoad) and simplify identity OpLogicalAnd/OpLogicalOr (true && x -> x, false || x -> x) and identical-arm OpSelect operands so specialized shaders fold known buffer formats to a single conversion path and prune unused component branches.

Tested

  • Windows 10.0.19045 (x86_64), NVIDIA GeForce RTX 3080 (driver 617.14), AMD Ryzen 7 7700:
    • Ran focused shader recompiler and AGC tests (agc_shader_memory, agc_vector_window, agc_driver_pixel_sample_iteration, agc_spirv_module, agc_formatted_buffer_once, agc_driver_buffer_format, agc_redundant_value_elimination, agc_shader_srt_read_patching, agc_formatted_buffer_byte_stores, agc_driver_gated_dispatch_capture, agc_driver_image_sample_unnormalized, agc_driver_image_store_sint, agc_driver_image_table, agc_driver_prepared_shaders_indirect) with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:
      • All passed on both main and this branch.
      • Confirmed neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS and 0 VUID- validation errors are logged.
    • Demon's Souls (PPSA01341 v01.007.000, APS5_TRACE_FRAMES=0:5):
      • Total cached SPIR-V size across frames 0:5 decreased by 65,455,891 bytes (249.12 MB -> 186.69 MB, -25.06%), with the largest formatted-buffer compute shaders shrinking from 5.86 MB to 4.01 MB.
      • Vulkan.ComputePipeline dropped from 35186.352 to 15480.517 ms/frame (-56.00%), Driver.Dispatch.prepared_invocation dropped from 1210.725 to 498.748 ms/frame (-58.81%), gpu_busy_ms_per_present dropped from 51.609 to 23.870 ms (-53.75%), and window.ms dropped from 181523.249 to 79598.147 ms (-56.15%).

tools/trace_digest.py — main (ca74ef2177ee)

frames 0:5 from present 0: 5 presents, frame p50 970.2 / p90 178158.2 / p99 178158.2 / max 178158.2 ms, GPU busy 51.6 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit ca74ef2177, dropped: no

{"commit":"ca74ef2177ee","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_FRAMES":"0:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"frames 0:5","first_present":0,"ms":181523.249},"presents":5,"frame_ms":{"p50":970.158,"p90":178158.169,"p99":178158.169,"max":178158.169},"gpu_busy_ms_per_present":51.609,"worker_busy_pct":{"queue worker 0x0":99.911,"queue worker 0x20":99.91,"queue worker 0x28":99.812,"queue worker 0x30":99.91,"queue worker 0x38":99.887,"queue worker 0x40":99.903,"queue worker 0x50":99.901,"queue worker 0x48":99.815},"top_phases_ms_per_frame":{"Driver.Packet":290051.157,"Driver.Packet.memory_wait":251696.612,"Driver.Packet.dispatch":38274.806,"Driver.Dispatch":38227.808,"Vulkan.ComputePipeline":35186.352,"Driver.Dispatch.prepared_invocation":1210.725,"Driver.Dispatch.materialize":601.947,"Vulkan.Dispatch":489.598},"trace_dropped":false,"trace":"aps5-trace-ca74ef2177ee-49812.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1: 178158.2 ms at 21 ms: Driver.Packet (queue worker 0x0) 178015.2, Driver.Packet (queue worker 0x30) 178014.1, Driver.Packet (queue worker 0x40) 178002.0, Driver.Packet (queue worker 0x50) 178000.1
  • present 3: 2282.8 ms at 179149 ms: Driver.Packet (queue worker 0x30) 2282.7, Driver.Packet (queue worker 0x50) 2282.5, Driver.Packet (queue worker 0x40) 2282.5, Driver.Packet (queue worker 0x38) 2282.2
  • present 2: 970.2 ms at 178179 ms: Driver.Packet (queue worker 0x40) 969.8, Driver.Packet (queue worker 0x20) 969.5, Driver.Packet (queue worker 0x0) 968.4, Driver.Packet (queue worker 0x50) 967.0
  • present 4: 91.4 ms at 181432 ms: Driver.Packet (queue worker 0x30) 91.0, Driver.Packet (queue worker 0x40) 90.9, Driver.Packet (queue worker 0x50) 90.7, Driver.Packet (queue worker 0x20) 90.5
  • present 0: 20.7 ms at 0 ms: Driver.Present (presenter) 1.4, Driver.Present.queue_present (presenter) 1.0, Vulkan.QueuePresent (presenter) 1.0, Vulkan.QueuePresent.queue_present (presenter) 1.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.1 (0 %) 0.0 (0 %) 36304.5 0.0 Shader.Register 0.1, Shader.ResolveGraphicsStagesAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 36304.6 0.0 Shader.ResolveGraphicsStagesAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 36304.6 0.0
shader prepare 2.1 (0 %) 0.0 (0 %) 36302.6 0.0 Vulkan.GraphicsPipelinePrebuild 2.1
title 0.1 (0 %) 0.0 (0 %) 36304.5 0.0 Shader.Register 0.1
title 0.0 (0 %) 0.0 (0 %) 36304.6 0.0
title 5.8 (0 %) 0.0 (0 %) 36298.9 0.0 Shader.ResolveAbi 5.7, Shader.ResolveGraphicsStagesAbi 0.1
title 0.0 (0 %) 0.0 (0 %) 36304.6 0.0
queue worker 0x0 35724.0 (98 %) 546.8 (2 %) 33.8 5.2 Driver.Packet 36270.8
presenter 1.2 (0 %) 2.6 (0 %) 36300.9 0.1 VideoOut.Flip 3.4, Driver.Present 0.3
draw committer 21.3 (0 %) 249.8 (1 %) 36033.5 0.2 Graphics.Draw 19.6, Vulkan.DispatchRecipe 1.1
queue worker 0x20 1764.7 (5 %) 34507.0 (95 %) 33.0 1.3 Driver.Packet 36263.2, Driver.EndSubmission 8.2
queue worker 0x28 59.4 (0 %) 36212.5 (100 %) 32.7 0.6 Driver.Packet 36234.4, Driver.EndSubmission 1.6
queue worker 0x30 265.2 (1 %) 36006.7 (99 %) 32.8 0.1 Driver.Packet 36270.9, Driver.EndSubmission 0.9
queue worker 0x38 58.7 (0 %) 36212.1 (100 %) 33.8 0.2 Driver.Packet 36236.3, Driver.EndSubmission 27.2
queue worker 0x40 329.7 (1 %) 35939.5 (99 %) 35.5 0.4 Driver.Packet 36269.0, Driver.EndSubmission 0.1
queue worker 0x50 3.0 (0 %) 36265.7 (100 %) 35.9 0.3 Driver.Packet 36268.1, Driver.EndSubmission 0.7
queue worker 0x48 0.0 (0 %) 36268.8 (100 %) 35.8 0.0 Driver.Packet 36236.1, Driver.EndSubmission 1.5
gpu 62.4 (0 %) 0.0 (0 %) 36242.2 0.0 batch 62.4

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 290048.8, Driver.Packet.memory_wait 251696.5, Driver.Packet.dispatch 38274.4, Driver.Dispatch 38227.1, Vulkan.ComputePipeline 35186.4, Driver.Dispatch.prepared_invocation 1210.4, Driver.Dispatch.materialize 601.1, Vulkan.Dispatch 489.1, Vulkan.Dispatch.shader_resources 476.1, Resources.Prepare 331.4

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x50) 177686.8 ms at 485 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x28) 176970.3 ms at 323 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x30) 176124.7 ms at 2048 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x38) 175880.3 ms at 2292 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x40) 175594.8 ms at 2577 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x48) 175584.2 ms at 323 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x20) 170075.8 ms at 2049 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x48) 2265.0 ms at 175907 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x28) 2246.4 ms at 179158 ms, present 3
  • Driver.Packet.memory_wait (queue worker 0x48) 2245.5 ms at 179158 ms, present 3

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 53: 51.3 ms at 2508 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 281.0, Driver.Packet.dispatch (queue worker 0x0) 281.0, Driver.Dispatch (queue worker 0x0) 281.0, GpuMutex.wait.dispatch (queue worker 0x0) 232.2
  • batch 1: 25.0 ms at 298 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 321.3, Driver.Packet.dispatch (queue worker 0x0) 321.3, Driver.Dispatch (queue worker 0x0) 321.2, GpuMutex.wait.dispatch (queue worker 0x0) 180.5
  • batch 177: 10.9 ms at 181409 ms, present 3: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 35.4, Driver.Packet.device_lock (queue worker 0x0) 22.7, Driver.Packet.draw (queue worker 0x0) 8.7, Driver.Draw (queue worker 0x0) 8.6
  • batch 136: 6.9 ms at 179107 ms, present 2: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 818.0, Driver.Packet.dispatch (queue worker 0x0) 776.1, Driver.Dispatch (queue worker 0x0) 776.1, Driver.Packet.device_lock (queue worker 0x0) 33.6
  • batch 217: 6.7 ms at 181514 ms, present 4: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4

tools/trace_digest.py — PR (815919fe7b93)

frames 0:5 from present 0: 5 presents, frame p50 2208.1 / p90 73516.8 / p99 73516.8 / max 73516.8 ms, GPU busy 23.9 ms per present
NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 815919fe7b93, dropped: no

{"commit":"815919fe7b93","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_FRAMES":"0:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"frames 0:5","first_present":0,"ms":79598.147},"presents":5,"frame_ms":{"p50":2208.069,"p90":73516.757,"p99":73516.757,"max":73516.757},"gpu_busy_ms_per_present":23.87,"worker_busy_pct":{"queue worker 0x0":99.804,"queue worker 0x20":99.799,"queue worker 0x28":99.763,"queue worker 0x30":99.795,"queue worker 0x40":99.794,"queue worker 0x38":99.765,"queue worker 0x48":99.619,"queue worker 0x50":99.791},"top_phases_ms_per_frame":{"Driver.Packet":127002.424,"Driver.Packet.memory_wait":109456.435,"Driver.Packet.dispatch":17507.051,"Driver.Dispatch":17489.918,"Vulkan.ComputePipeline":15480.517,"Driver.Dispatch.materialize":502.46,"Driver.Dispatch.prepared_invocation":498.748,"Vulkan.Dispatch":486.504},"trace_dropped":false,"trace":"aps5-trace-815919fe7b93-35896.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1: 73516.8 ms at 17 ms: Driver.Packet (queue worker 0x0) 73376.6, Driver.Packet (queue worker 0x30) 73370.8, Driver.Packet (queue worker 0x40) 73369.4, Driver.Packet (queue worker 0x50) 73367.8
  • present 3: 3770.8 ms at 75742 ms: Driver.Packet (queue worker 0x50) 3770.6, Driver.Packet (queue worker 0x30) 3770.5, Driver.Packet (queue worker 0x40) 3770.5, Driver.Packet.memory_wait (queue worker 0x50) 3770.3
  • present 2: 2208.1 ms at 73534 ms: Driver.Packet (queue worker 0x30) 2207.8, Driver.Packet (queue worker 0x40) 2207.8, Driver.Packet (queue worker 0x28) 2207.7, Driver.Packet (queue worker 0x50) 2207.6
  • present 4: 85.3 ms at 79513 ms: Driver.Packet (queue worker 0x30) 84.9, Driver.Packet (queue worker 0x50) 84.9, Driver.Packet (queue worker 0x40) 84.9, Driver.Packet (queue worker 0x20) 84.3
  • present 0: 17.2 ms at 0 ms: Driver.Present (presenter) 1.5, Driver.Present.queue_present (presenter) 1.2, Vulkan.QueuePresent (presenter) 1.2, Vulkan.QueuePresent.queue_present (presenter) 1.2

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 15919.6 0.0 Shader.ResolveAbi 0.0
title 0.0 (0 %) 0.0 (0 %) 15919.6 0.0 Shader.ResolveGraphicsStagesAbi 0.0
title 6.9 (0 %) 0.0 (0 %) 15912.8 0.0 Shader.ResolveAbi 6.2, Shader.ResolveGraphicsStagesAbi 0.5
title 0.1 (0 %) 0.0 (0 %) 15919.5 0.0 Shader.Register 0.1, Shader.ResolveGraphicsStagesAbi 0.0
shader prepare 2.0 (0 %) 0.0 (0 %) 15917.7 0.0 Vulkan.GraphicsPipelinePrebuild 2.0
title 0.0 (0 %) 0.0 (0 %) 15919.6 0.0
queue worker 0x0 14571.2 (92 %) 1315.9 (8 %) 32.6 5.5 Driver.Packet 15887.1, Driver.Suspend 0.0
presenter 1.0 (0 %) 0.8 (0 %) 15917.8 0.1 VideoOut.Flip 1.5, Driver.Present 0.3
draw committer 17.3 (0 %) 27.7 (0 %) 15874.6 0.2 Graphics.Draw 16.9, Recorder.Submit 0.4
queue worker 0x20 2166.8 (14 %) 13720.5 (86 %) 32.4 1.3 Driver.Packet 15880.0, Driver.EndSubmission 7.3
queue worker 0x28 31.7 (0 %) 15854.4 (100 %) 33.6 0.6 Driver.Packet 15858.1, Driver.EndSubmission 23.6
queue worker 0x30 257.9 (2 %) 15629.0 (98 %) 32.7 0.1 Driver.Packet 15886.8, Driver.EndSubmission 0.1
queue worker 0x40 131.5 (1 %) 15755.1 (99 %) 33.0 0.5 Driver.Packet 15886.5, Driver.EndSubmission 0.1
queue worker 0x38 37.1 (0 %) 15849.6 (100 %) 32.9 0.2 Driver.Packet 15857.8, Driver.EndSubmission 24.4
queue worker 0x48 0.1 (0 %) 15886.7 (100 %) 32.9 0.0 Driver.Packet 15857.7, Driver.EndSubmission 1.3
queue worker 0x50 1.4 (0 %) 15884.9 (100 %) 33.3 0.3 Driver.Packet 15886.2, Driver.EndSubmission 0.1
title 0.0 (0 %) 0.0 (0 %) 15919.6 0.0
title 0.0 (0 %) 0.0 (0 %) 15919.6 0.0 Shader.ResolveGraphicsStagesAbi 0.0
gpu 29.5 (0 %) 0.0 (0 %) 15890.1 0.0 batch 29.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 127000.1, Driver.Packet.memory_wait 109456.3, Driver.Packet.dispatch 17506.6, Driver.Dispatch 17489.2, Vulkan.ComputePipeline 15480.5, Driver.Dispatch.materialize 501.5, Driver.Dispatch.prepared_invocation 498.4, Vulkan.Dispatch 485.9, Vulkan.Dispatch.shader_resources 472.4, GpuMutex.wait.dispatch 314.5

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x50) 73053.7 ms at 474 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x28) 72633.6 ms at 296 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x30) 71538.6 ms at 1989 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x48) 71443.2 ms at 296 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x38) 71400.4 ms at 2128 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x40) 70956.2 ms at 2572 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x20) 67869.1 ms at 805 ms, present 1
  • Driver.Packet.memory_wait (queue worker 0x48) 3762.2 ms at 75744 ms, present 3
  • Driver.Packet.memory_wait (queue worker 0x28) 3750.9 ms at 75744 ms, present 3
  • Driver.Packet.memory_wait (queue worker 0x30) 3693.0 ms at 75742 ms, present 3

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 58: 28.9 ms at 2538 ms, present 1: GPU no ranges; recorded by Recorder.Submit (queue worker 0x40) 0.1
  • batch 1: 16.7 ms at 279 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 299.9, Driver.Packet.dispatch (queue worker 0x0) 299.9, Driver.Dispatch (queue worker 0x0) 299.8, GpuMutex.wait.dispatch (queue worker 0x0) 171.9
  • batch 204: 5.7 ms at 79522 ms, present 4: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.2
  • batch 216: 5.0 ms at 79577 ms, present 4: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.0, GpuMutex.wait.label (draw committer) 0.0, Graphics.Draw.draw_and_resource_release (draw committer) 0.0
  • batch 165: 4.0 ms at 79439 ms, present 3: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.1

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 3080, driver 617.14, Windows 10.0.19045
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4943286596 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-20T22:19:54Z. --- ### What - Use the table-driven `genericFormattedLoad` path in `SpirvRuntimeBuffer.cpp` for all formatted buffer loads (`!store`), shifting non-dword descriptor-backed loads right by the subword byte offset when `memory.gpuDescriptor` is false and gating active/required component checks through `Select` instead of emitting a 57-case `OpSwitch` across every `IrBufferFormat` for each formatted load. - Teach `SpecializeSpirv` (`SpirvSpecialization.cpp`) to fold constant loads from read-only `StorageClassPrivate` composite tables (`OpVariable` initialized by `OpConstantComposite` and only accessed via constant-index `OpAccessChain`/`OpInBoundsAccessChain` + `OpLoad`) and simplify identity `OpLogicalAnd`/`OpLogicalOr` (`true && x -> x`, `false || x -> x`) and identical-arm `OpSelect` operands so specialized shaders fold known buffer formats to a single conversion path and prune unused component branches. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Windows 10.0.19045 (`x86_64`), NVIDIA GeForce RTX 3080 (driver 617.14), AMD Ryzen 7 7700: - Ran focused shader recompiler and AGC tests (`agc_shader_memory`, `agc_vector_window`, `agc_driver_pixel_sample_iteration`, `agc_spirv_module`, `agc_formatted_buffer_once`, `agc_driver_buffer_format`, `agc_redundant_value_elimination`, `agc_shader_srt_read_patching`, `agc_formatted_buffer_byte_stores`, `agc_driver_gated_dispatch_capture`, `agc_driver_image_sample_unnormalized`, `agc_driver_image_store_sint`, `agc_driver_image_table`, `agc_driver_prepared_shaders_indirect`) with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: - All passed on both `main` and this branch. - Confirmed neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS` and 0 `VUID-` validation errors are logged. - Demon's Souls (`PPSA01341` v01.007.000, `APS5_TRACE_FRAMES=0:5`): - Total cached SPIR-V size across `frames 0:5` decreased by 65,455,891 bytes (`249.12 MB` -> `186.69 MB`, `-25.06%`), with the largest formatted-buffer compute shaders shrinking from `5.86 MB` to `4.01 MB`. - `Vulkan.ComputePipeline` dropped from `35186.352` to `15480.517` ms/frame (`-56.00%`), `Driver.Dispatch.prepared_invocation` dropped from `1210.725` to `498.748` ms/frame (`-58.81%`), `gpu_busy_ms_per_present` dropped from `51.609` to `23.870` ms (`-53.75%`), and `window.ms` dropped from `181523.249` to `79598.147` ms (`-56.15%`). #### `tools/trace_digest.py` — `main` (`ca74ef2177ee`) **frames 0:5** from present 0: 5 presents, frame p50 970.2 / p90 178158.2 / p99 178158.2 / max 178158.2 ms, GPU busy 51.6 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit ca74ef2177ee, dropped: no ```json {"commit":"ca74ef2177ee","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_FRAMES":"0:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"frames 0:5","first_present":0,"ms":181523.249},"presents":5,"frame_ms":{"p50":970.158,"p90":178158.169,"p99":178158.169,"max":178158.169},"gpu_busy_ms_per_present":51.609,"worker_busy_pct":{"queue worker 0x0":99.911,"queue worker 0x20":99.91,"queue worker 0x28":99.812,"queue worker 0x30":99.91,"queue worker 0x38":99.887,"queue worker 0x40":99.903,"queue worker 0x50":99.901,"queue worker 0x48":99.815},"top_phases_ms_per_frame":{"Driver.Packet":290051.157,"Driver.Packet.memory_wait":251696.612,"Driver.Packet.dispatch":38274.806,"Driver.Dispatch":38227.808,"Vulkan.ComputePipeline":35186.352,"Driver.Dispatch.prepared_invocation":1210.725,"Driver.Dispatch.materialize":601.947,"Vulkan.Dispatch":489.598},"trace_dropped":false,"trace":"aps5-trace-ca74ef2177ee-49812.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1: 178158.2 ms at 21 ms: Driver.Packet (queue worker 0x0) 178015.2, Driver.Packet (queue worker 0x30) 178014.1, Driver.Packet (queue worker 0x40) 178002.0, Driver.Packet (queue worker 0x50) 178000.1 - present 3: 2282.8 ms at 179149 ms: Driver.Packet (queue worker 0x30) 2282.7, Driver.Packet (queue worker 0x50) 2282.5, Driver.Packet (queue worker 0x40) 2282.5, Driver.Packet (queue worker 0x38) 2282.2 - present 2: 970.2 ms at 178179 ms: Driver.Packet (queue worker 0x40) 969.8, Driver.Packet (queue worker 0x20) 969.5, Driver.Packet (queue worker 0x0) 968.4, Driver.Packet (queue worker 0x50) 967.0 - present 4: 91.4 ms at 181432 ms: Driver.Packet (queue worker 0x30) 91.0, Driver.Packet (queue worker 0x40) 90.9, Driver.Packet (queue worker 0x50) 90.7, Driver.Packet (queue worker 0x20) 90.5 - present 0: 20.7 ms at 0 ms: Driver.Present (presenter) 1.4, Driver.Present.queue_present (presenter) 1.0, Vulkan.QueuePresent (presenter) 1.0, Vulkan.QueuePresent.queue_present (presenter) 1.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.1 (0 %) | 0.0 (0 %) | 36304.5 | 0.0 | Shader.Register 0.1, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 36304.6 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 36304.6 | 0.0 | | | shader prepare | 2.1 (0 %) | 0.0 (0 %) | 36302.6 | 0.0 | Vulkan.GraphicsPipelinePrebuild 2.1 | | title | 0.1 (0 %) | 0.0 (0 %) | 36304.5 | 0.0 | Shader.Register 0.1 | | title | 0.0 (0 %) | 0.0 (0 %) | 36304.6 | 0.0 | | | title | 5.8 (0 %) | 0.0 (0 %) | 36298.9 | 0.0 | Shader.ResolveAbi 5.7, Shader.ResolveGraphicsStagesAbi 0.1 | | title | 0.0 (0 %) | 0.0 (0 %) | 36304.6 | 0.0 | | | queue worker 0x0 | 35724.0 (98 %) | 546.8 (2 %) | 33.8 | 5.2 | Driver.Packet 36270.8 | | presenter | 1.2 (0 %) | 2.6 (0 %) | 36300.9 | 0.1 | VideoOut.Flip 3.4, Driver.Present 0.3 | | draw committer | 21.3 (0 %) | 249.8 (1 %) | 36033.5 | 0.2 | Graphics.Draw 19.6, Vulkan.DispatchRecipe 1.1 | | queue worker 0x20 | 1764.7 (5 %) | 34507.0 (95 %) | 33.0 | 1.3 | Driver.Packet 36263.2, Driver.EndSubmission 8.2 | | queue worker 0x28 | 59.4 (0 %) | 36212.5 (100 %) | 32.7 | 0.6 | Driver.Packet 36234.4, Driver.EndSubmission 1.6 | | queue worker 0x30 | 265.2 (1 %) | 36006.7 (99 %) | 32.8 | 0.1 | Driver.Packet 36270.9, Driver.EndSubmission 0.9 | | queue worker 0x38 | 58.7 (0 %) | 36212.1 (100 %) | 33.8 | 0.2 | Driver.Packet 36236.3, Driver.EndSubmission 27.2 | | queue worker 0x40 | 329.7 (1 %) | 35939.5 (99 %) | 35.5 | 0.4 | Driver.Packet 36269.0, Driver.EndSubmission 0.1 | | queue worker 0x50 | 3.0 (0 %) | 36265.7 (100 %) | 35.9 | 0.3 | Driver.Packet 36268.1, Driver.EndSubmission 0.7 | | queue worker 0x48 | 0.0 (0 %) | 36268.8 (100 %) | 35.8 | 0.0 | Driver.Packet 36236.1, Driver.EndSubmission 1.5 | | gpu | 62.4 (0 %) | 0.0 (0 %) | 36242.2 | 0.0 | batch 62.4 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 290048.8, Driver.Packet.memory_wait 251696.5, Driver.Packet.dispatch 38274.4, Driver.Dispatch 38227.1, Vulkan.ComputePipeline 35186.4, Driver.Dispatch.prepared_invocation 1210.4, Driver.Dispatch.materialize 601.1, Vulkan.Dispatch 489.1, Vulkan.Dispatch.shader_resources 476.1, Resources.Prepare 331.4 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x50) 177686.8 ms at 485 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x28) 176970.3 ms at 323 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x30) 176124.7 ms at 2048 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x38) 175880.3 ms at 2292 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x40) 175594.8 ms at 2577 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x48) 175584.2 ms at 323 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x20) 170075.8 ms at 2049 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x48) 2265.0 ms at 175907 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x28) 2246.4 ms at 179158 ms, present 3 - Driver.Packet.memory_wait (queue worker 0x48) 2245.5 ms at 179158 ms, present 3 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 53: 51.3 ms at 2508 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 281.0, Driver.Packet.dispatch (queue worker 0x0) 281.0, Driver.Dispatch (queue worker 0x0) 281.0, GpuMutex.wait.dispatch (queue worker 0x0) 232.2 - batch 1: 25.0 ms at 298 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 321.3, Driver.Packet.dispatch (queue worker 0x0) 321.3, Driver.Dispatch (queue worker 0x0) 321.2, GpuMutex.wait.dispatch (queue worker 0x0) 180.5 - batch 177: 10.9 ms at 181409 ms, present 3: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 35.4, Driver.Packet.device_lock (queue worker 0x0) 22.7, Driver.Packet.draw (queue worker 0x0) 8.7, Driver.Draw (queue worker 0x0) 8.6 - batch 136: 6.9 ms at 179107 ms, present 2: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 818.0, Driver.Packet.dispatch (queue worker 0x0) 776.1, Driver.Dispatch (queue worker 0x0) 776.1, Driver.Packet.device_lock (queue worker 0x0) 33.6 - batch 217: 6.7 ms at 181514 ms, present 4: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4 #### `tools/trace_digest.py` — PR (`815919fe7b93`) **frames 0:5** from present 0: 5 presents, frame p50 2208.1 / p90 73516.8 / p99 73516.8 / max 73516.8 ms, GPU busy 23.9 ms per present NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10.0.19045, 1920x1080, commit 815919fe7b93, dropped: no ```json {"commit":"815919fe7b93","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_GPU_WAIT_TIMEOUT_MS":"50","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PIPELINED_DRAWS":"1","APS5_PIPELINE_DISPATCH":"1","APS5_SKIP_FAILED_SHADERS":"1","APS5_TEXTURE_CACHE_MIB":"6144","APS5_THREAD_PRIORITY":"off","APS5_TRACE_DIR":"logs","APS5_TRACE_FRAMES":"0:5","APS5_UNKEYED_TABLE_KEYS":"256"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 617.14","os":"Windows 10.0.19045","cpu":"AMD Ryzen 7 7700 8-Core Processor","cpu_threads":16,"memory_mib":48005,"title_id":"PPSA01341","title":"Demon's Souls","content_version":"01.007.000","resolution":"1920x1080","window":{"spec":"frames 0:5","first_present":0,"ms":79598.147},"presents":5,"frame_ms":{"p50":2208.069,"p90":73516.757,"p99":73516.757,"max":73516.757},"gpu_busy_ms_per_present":23.87,"worker_busy_pct":{"queue worker 0x0":99.804,"queue worker 0x20":99.799,"queue worker 0x28":99.763,"queue worker 0x30":99.795,"queue worker 0x40":99.794,"queue worker 0x38":99.765,"queue worker 0x48":99.619,"queue worker 0x50":99.791},"top_phases_ms_per_frame":{"Driver.Packet":127002.424,"Driver.Packet.memory_wait":109456.435,"Driver.Packet.dispatch":17507.051,"Driver.Dispatch":17489.918,"Vulkan.ComputePipeline":15480.517,"Driver.Dispatch.materialize":502.46,"Driver.Dispatch.prepared_invocation":498.748,"Vulkan.Dispatch":486.504},"trace_dropped":false,"trace":"aps5-trace-815919fe7b93-35896.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1: 73516.8 ms at 17 ms: Driver.Packet (queue worker 0x0) 73376.6, Driver.Packet (queue worker 0x30) 73370.8, Driver.Packet (queue worker 0x40) 73369.4, Driver.Packet (queue worker 0x50) 73367.8 - present 3: 3770.8 ms at 75742 ms: Driver.Packet (queue worker 0x50) 3770.6, Driver.Packet (queue worker 0x30) 3770.5, Driver.Packet (queue worker 0x40) 3770.5, Driver.Packet.memory_wait (queue worker 0x50) 3770.3 - present 2: 2208.1 ms at 73534 ms: Driver.Packet (queue worker 0x30) 2207.8, Driver.Packet (queue worker 0x40) 2207.8, Driver.Packet (queue worker 0x28) 2207.7, Driver.Packet (queue worker 0x50) 2207.6 - present 4: 85.3 ms at 79513 ms: Driver.Packet (queue worker 0x30) 84.9, Driver.Packet (queue worker 0x50) 84.9, Driver.Packet (queue worker 0x40) 84.9, Driver.Packet (queue worker 0x20) 84.3 - present 0: 17.2 ms at 0 ms: Driver.Present (presenter) 1.5, Driver.Present.queue_present (presenter) 1.2, Vulkan.QueuePresent (presenter) 1.2, Vulkan.QueuePresent.queue_present (presenter) 1.2 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 15919.6 | 0.0 | Shader.ResolveAbi 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 15919.6 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | title | 6.9 (0 %) | 0.0 (0 %) | 15912.8 | 0.0 | Shader.ResolveAbi 6.2, Shader.ResolveGraphicsStagesAbi 0.5 | | title | 0.1 (0 %) | 0.0 (0 %) | 15919.5 | 0.0 | Shader.Register 0.1, Shader.ResolveGraphicsStagesAbi 0.0 | | shader prepare | 2.0 (0 %) | 0.0 (0 %) | 15917.7 | 0.0 | Vulkan.GraphicsPipelinePrebuild 2.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 15919.6 | 0.0 | | | queue worker 0x0 | 14571.2 (92 %) | 1315.9 (8 %) | 32.6 | 5.5 | Driver.Packet 15887.1, Driver.Suspend 0.0 | | presenter | 1.0 (0 %) | 0.8 (0 %) | 15917.8 | 0.1 | VideoOut.Flip 1.5, Driver.Present 0.3 | | draw committer | 17.3 (0 %) | 27.7 (0 %) | 15874.6 | 0.2 | Graphics.Draw 16.9, Recorder.Submit 0.4 | | queue worker 0x20 | 2166.8 (14 %) | 13720.5 (86 %) | 32.4 | 1.3 | Driver.Packet 15880.0, Driver.EndSubmission 7.3 | | queue worker 0x28 | 31.7 (0 %) | 15854.4 (100 %) | 33.6 | 0.6 | Driver.Packet 15858.1, Driver.EndSubmission 23.6 | | queue worker 0x30 | 257.9 (2 %) | 15629.0 (98 %) | 32.7 | 0.1 | Driver.Packet 15886.8, Driver.EndSubmission 0.1 | | queue worker 0x40 | 131.5 (1 %) | 15755.1 (99 %) | 33.0 | 0.5 | Driver.Packet 15886.5, Driver.EndSubmission 0.1 | | queue worker 0x38 | 37.1 (0 %) | 15849.6 (100 %) | 32.9 | 0.2 | Driver.Packet 15857.8, Driver.EndSubmission 24.4 | | queue worker 0x48 | 0.1 (0 %) | 15886.7 (100 %) | 32.9 | 0.0 | Driver.Packet 15857.7, Driver.EndSubmission 1.3 | | queue worker 0x50 | 1.4 (0 %) | 15884.9 (100 %) | 33.3 | 0.3 | Driver.Packet 15886.2, Driver.EndSubmission 0.1 | | title | 0.0 (0 %) | 0.0 (0 %) | 15919.6 | 0.0 | | | title | 0.0 (0 %) | 0.0 (0 %) | 15919.6 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | gpu | 29.5 (0 %) | 0.0 (0 %) | 15890.1 | 0.0 | batch 29.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 127000.1, Driver.Packet.memory_wait 109456.3, Driver.Packet.dispatch 17506.6, Driver.Dispatch 17489.2, Vulkan.ComputePipeline 15480.5, Driver.Dispatch.materialize 501.5, Driver.Dispatch.prepared_invocation 498.4, Vulkan.Dispatch 485.9, Vulkan.Dispatch.shader_resources 472.4, GpuMutex.wait.dispatch 314.5 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x50) 73053.7 ms at 474 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x28) 72633.6 ms at 296 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x30) 71538.6 ms at 1989 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x48) 71443.2 ms at 296 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x38) 71400.4 ms at 2128 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x40) 70956.2 ms at 2572 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x20) 67869.1 ms at 805 ms, present 1 - Driver.Packet.memory_wait (queue worker 0x48) 3762.2 ms at 75744 ms, present 3 - Driver.Packet.memory_wait (queue worker 0x28) 3750.9 ms at 75744 ms, present 3 - Driver.Packet.memory_wait (queue worker 0x30) 3693.0 ms at 75742 ms, present 3 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 58: 28.9 ms at 2538 ms, present 1: GPU no ranges; recorded by Recorder.Submit (queue worker 0x40) 0.1 - batch 1: 16.7 ms at 279 ms, present 1: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 299.9, Driver.Packet.dispatch (queue worker 0x0) 299.9, Driver.Dispatch (queue worker 0x0) 299.8, GpuMutex.wait.dispatch (queue worker 0x0) 171.9 - batch 204: 5.7 ms at 79522 ms, present 4: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.2 - batch 216: 5.0 ms at 79577 ms, present 4: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.0, GpuMutex.wait.label (draw committer) 0.0, Graphics.Draw.draw_and_resource_release (draw committer) 0.0 - batch 165: 4.0 ms at 79439 ms, present 3: GPU no ranges; recorded by GpuMutex.wait.label (draw committer) 0.1 ### 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 3080, driver 617.14, Windows 10.0.19045 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-20 22:22:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:22:15Z.


I reviewed the current head 815919fe7b. The nine reported same-head tests and validation-layer runs are useful, but the diff adds no regression cases for the new specialization rules. Could you add a small SpecializeSpirv test for a constant-index private composite load folding, plus controls showing a dynamic index or a store through the access chain prevents that fold? A focused direct-buffer formatted-load case with 8/16-bit data at byte offsets 1–3 would also cover the new subwordOffset path. These are the key safety conditions for the table recognition and descriptor-backed extraction; the current runtime suite may not distinguish their failure modes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6303094595 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6303094595). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T22:22:15Z. --- I reviewed the current head `815919fe7b`. The nine reported same-head tests and validation-layer runs are useful, but the diff adds no regression cases for the new specialization rules. Could you add a small `SpecializeSpirv` test for a constant-index private composite load folding, plus controls showing a dynamic index or a store through the access chain prevents that fold? A focused direct-buffer formatted-load case with 8/16-bit data at byte offsets 1–3 would also cover the new `subwordOffset` path. These are the key safety conditions for the table recognition and descriptor-backed extraction; the current runtime suite may not distinguish their failure modes.
hamb3r commented 2026-10-20 23:18:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T23:18:40Z.


Added the requested regression tests in f8170fb78d (test(shader): cover private table specialization folding and subword formatted loads):

  1. SpecializeSpirv private composite table folding + controls (testPrivateCompositeTableLoadFolding in core/libs/prx/libSceAgcDriver/tests/SpirvModule.cpp and testSpecializedPrivateCompositeTableLoad in core/libs/prx/libSceAgcDriver/tests/SpirvOptimizer.cpp):
    • Verifies that for both OpAccessChain and OpInBoundsAccessChain into a StorageClassPrivate composite table (OpVariable initialized by OpConstantComposite), a constant index (including one produced by constant-folded arithmetic) folds the OpLoad to the corresponding element constant and removes the dead access chain.
    • Verifies the two safety controls: a dynamic index (%lane) or an OpStore through an access chain into the table (privateTables.erase(...)) prevents folding and preserves the OpAccessChain and OpLoad.
    • Also switched the constructor's non-load operand scan in SpirvSpecialization.cpp to VisitIdOperands so literal constant operands (e.g. OpConstant ... 16 or OpTypeInt 32) cannot collide with a private table or access-chain ID.
  2. Direct-buffer formatted-load subword offset coverage (RunSubwordOffsets / CheckSubwordOffsets in core/libs/prx/libSceAgcDriver/tests/execution/BufferFormat.cpp):
    • Exercises descriptor-backed (!memory.gpuDescriptor) buffer_load_format_x and buffer_load_format_xy with 8_UINT, 8_SINT, 16_UINT, 16_SINT, and 8_8_UINT at unaligned byte offsets 1..3 across all 32 lanes on the GPU, covering both unsigned (OpBitFieldUExtract) and signed (OpBitFieldSExtract) extraction along the subwordOffset path.
    • Re-ran the focused suite (agc_spirv_module, agc_formatted_buffer_once, agc_driver_buffer_format, agc_driver_gpu_buffer_format, agc_driver_formatted_store, agc_driver_formatted_store_unaligned, agc_driver_buffer_unaligned_base) with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation — all passed with 0 VUID- validation errors.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6303963787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6303963787). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-20T23:18:40Z. --- Added the requested regression tests in `f8170fb78d` (`test(shader): cover private table specialization folding and subword formatted loads`): 1. **`SpecializeSpirv` private composite table folding + controls** (`testPrivateCompositeTableLoadFolding` in `core/libs/prx/libSceAgcDriver/tests/SpirvModule.cpp` and `testSpecializedPrivateCompositeTableLoad` in `core/libs/prx/libSceAgcDriver/tests/SpirvOptimizer.cpp`): - Verifies that for both `OpAccessChain` and `OpInBoundsAccessChain` into a `StorageClassPrivate` composite table (`OpVariable` initialized by `OpConstantComposite`), a constant index (including one produced by constant-folded arithmetic) folds the `OpLoad` to the corresponding element constant and removes the dead access chain. - Verifies the two safety controls: a dynamic index (`%lane`) or an `OpStore` through an access chain into the table (`privateTables.erase(...)`) prevents folding and preserves the `OpAccessChain` and `OpLoad`. - Also switched the constructor's non-load operand scan in `SpirvSpecialization.cpp` to `VisitIdOperands` so literal constant operands (e.g. `OpConstant ... 16` or `OpTypeInt 32`) cannot collide with a private table or access-chain ID. 2. **Direct-buffer formatted-load subword offset coverage** (`RunSubwordOffsets` / `CheckSubwordOffsets` in `core/libs/prx/libSceAgcDriver/tests/execution/BufferFormat.cpp`): - Exercises descriptor-backed (`!memory.gpuDescriptor`) `buffer_load_format_x` and `buffer_load_format_xy` with `8_UINT`, `8_SINT`, `16_UINT`, `16_SINT`, and `8_8_UINT` at unaligned byte offsets `1..3` across all 32 lanes on the GPU, covering both unsigned (`OpBitFieldUExtract`) and signed (`OpBitFieldSExtract`) extraction along the `subwordOffset` path. - Re-ran the focused suite (`agc_spirv_module`, `agc_formatted_buffer_once`, `agc_driver_buffer_format`, `agc_driver_gpu_buffer_format`, `agc_driver_formatted_store`, `agc_driver_formatted_store_unaligned`, `agc_driver_buffer_unaligned_base`) with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` — all passed with 0 `VUID-` validation errors.
MarcZX10 commented 2026-10-20 23:23:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:23:48Z.

Review: APPROVED


Thanks for adding these cases. The specialization tests now cover both access-chain opcodes, a constant-folded index, dynamic-index and mutation controls; the direct-buffer execution test covers signed/unsigned subword extraction at unaligned offsets. I also checked the changed operand scan: it visits ID operands rather than treating literal words as IDs, and it preserves the paired literal width for 64-bit OpSwitch selectors. The focused suite and validation-layer results you reported address my requested coverage. Hosted checks are still pending policy checks, and the full build/runtime jobs are not available on this PR run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593052851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#pullrequestreview-5593052851). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T23:23:48Z. **Review:** APPROVED --- Thanks for adding these cases. The specialization tests now cover both access-chain opcodes, a constant-folded index, dynamic-index and mutation controls; the direct-buffer execution test covers signed/unsigned subword extraction at unaligned offsets. I also checked the changed operand scan: it visits ID operands rather than treating literal words as IDs, and it preserves the paired literal width for 64-bit `OpSwitch` selectors. The focused suite and validation-layer results you reported address my requested coverage. Hosted checks are still pending policy checks, and the full build/runtime jobs are not available on this PR run.
hamb3r commented 2026-10-20 23:40:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T23:40:44Z.


Ran line-by-line gcov diff coverage against origin/main..HEAD across the focused suite on f8170fb78d and found 4 executable lines in core/shader/recompiler/SpirvBackend/src/SpirvSpecialization.cpp (out of 62 in that file and 11 in SpirvRuntimeBuffer.cpp) that were still unexecuted:

text 3075 : 754 : } else if (instruction[4] == instruction[5]) { ##### : 755 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[4]}); ##### : 756 : changed = true; ... 232* : 772 : } else if (const auto right = value(instruction[4]); right && *right == 0u) { ##### : 773 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[3]}); ##### : 774 : changed = true;

Amended the test commit in efc3bd2efd so testPrivateCompositeTableLoadFolding (SpirvModule.cpp) and testSpecializedPrivateCompositeTableLoad (SpirvOptimizer.cpp) route the constant table index through a dynamic-left / constant-false-right OpLogicalOr (%cond = OpLogicalOr %bool %rawCond %false) and an identical-arm OpSelect (%index = OpSelect %uint %cond %baseIndex %baseIndex), asserting both opcodes are simplified away before folding the OpLoad.

Re-running gcov confirms 100.0% diff line coverage across all modified files (11/11 in SpirvRuntimeBuffer.cpp, 62/62 in SpirvSpecialization.cpp):

text 3081 : 754 : } else if (instruction[4] == instruction[5]) { 6 : 755 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[4]}); 6 : 756 : changed = true; ... 238 : 772 : } else if (const auto right = value(instruction[4]); right && *right == 0u) { 6 : 773 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[3]}); 6 : 774 : changed = true;

cc @MarcZX10

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304285195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6304285195). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-20T23:40:44Z. --- Ran line-by-line `gcov` diff coverage against `origin/main..HEAD` across the focused suite on `f8170fb78d` and found 4 executable lines in `core/shader/recompiler/SpirvBackend/src/SpirvSpecialization.cpp` (out of 62 in that file and 11 in `SpirvRuntimeBuffer.cpp`) that were still unexecuted: ``text 3075 : 754 : } else if (instruction[4] == instruction[5]) { ##### : 755 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[4]}); ##### : 756 : changed = true; ... 232* : 772 : } else if (const auto right = value(instruction[4]); right && *right == 0u) { ##### : 773 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[3]}); ##### : 774 : changed = true; `` Amended the test commit in `efc3bd2efd` so `testPrivateCompositeTableLoadFolding` (`SpirvModule.cpp`) and `testSpecializedPrivateCompositeTableLoad` (`SpirvOptimizer.cpp`) route the constant table index through a dynamic-left / constant-false-right `OpLogicalOr` (`%cond = OpLogicalOr %bool %rawCond %false`) and an identical-arm `OpSelect` (`%index = OpSelect %uint %cond %baseIndex %baseIndex`), asserting both opcodes are simplified away before folding the `OpLoad`. Re-running `gcov` confirms 100.0% diff line coverage across all modified files (`11/11` in `SpirvRuntimeBuffer.cpp`, `62/62` in `SpirvSpecialization.cpp`): ``text 3081 : 754 : } else if (instruction[4] == instruction[5]) { 6 : 755 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[4]}); 6 : 756 : changed = true; ... 238 : 772 : } else if (const auto right = value(instruction[4]); right && *right == 0u) { 6 : 773 : instruction = Make(spv::OpCopyObject, {instruction[1], instruction[2], instruction[3]}); 6 : 774 : changed = true; `` cc @MarcZX10
MarcZX10 commented 2026-10-20 23:48:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T23:48:36Z.

Review: APPROVED


Reviewed the latest head efc3bd2efd. The added SPIR-V inputs exercise OpLogicalOr with a false right operand and an identical-arm OpSelect, then assert both are simplified before constant-table folding; the optimizer and specialization test versions cover the same paths. git diff --check and the conventions checker pass. I did not run the C++ test binaries locally; the author reports focused tests and 100% changed-line coverage. My approval applies to this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593220885 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#pullrequestreview-5593220885). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T23:48:36Z. **Review:** APPROVED --- Reviewed the latest head `efc3bd2efd`. The added SPIR-V inputs exercise `OpLogicalOr` with a false right operand and an identical-arm `OpSelect`, then assert both are simplified before constant-table folding; the optimizer and specialization test versions cover the same paths. `git diff --check` and the conventions checker pass. I did not run the C++ test binaries locally; the author reports focused tests and 100% changed-line coverage. My approval applies to this head.
oneandonlydean commented 2026-10-21 05:58:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T05:58:00Z.


@hamb3r thanks, the subword tests and the table-fold controls cover what MarcZX10 asked for. I checked the direct-buffer path against readBuffer, and for every field that fits in its dword, a 32-bit read plus the (addr & 3) * 8 extract matches the old per-format result. Three things:

  1. 780284c150 describes the dropped call as a redundant spirv-opt pass, but its fifth argument is optimize = false, so it only validated the module after the descriptor compaction. That compaction decides "used" from AccessChain/Load/CopyObject operands, and that validation was its only check. Do you have a timing for this commit on its own? Otherwise it may be better to keep the validation. Since a maintainer added it, I will leave that call to them.
  2. In genericFormattedLoad, a 16-bit field at byte offset 3 now reaches OpBitFieldUExtract with offset 24 and count 16, which SPIR-V leaves undefined (the new test stops at +2). Could you clamp the count to 32 - offset there, or explain why that case cannot happen?
  3. Small one: PureInstruction now treats every OpExtInst as pure. That holds for GLSL.std.450 today. Checking the set id would keep it true if a NonSemantic set such as DebugPrintf is ever imported.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309185638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6309185638). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T05:58:00Z. --- @hamb3r thanks, the subword tests and the table-fold controls cover what MarcZX10 asked for. I checked the direct-buffer path against `readBuffer`, and for every field that fits in its dword, a 32-bit read plus the `(addr & 3) * 8` extract matches the old per-format result. Three things: 1. `780284c150` describes the dropped call as a redundant spirv-opt pass, but its fifth argument is `optimize = false`, so it only validated the module after the descriptor compaction. That compaction decides "used" from AccessChain/Load/CopyObject operands, and that validation was its only check. Do you have a timing for this commit on its own? Otherwise it may be better to keep the validation. Since a maintainer added it, I will leave that call to them. 2. In `genericFormattedLoad`, a 16-bit field at byte offset 3 now reaches `OpBitFieldUExtract` with offset 24 and count 16, which SPIR-V leaves undefined (the new test stops at +2). Could you clamp the count to `32 - offset` there, or explain why that case cannot happen? 3. Small one: `PureInstruction` now treats every `OpExtInst` as pure. That holds for GLSL.std.450 today. Checking the set id would keep it true if a NonSemantic set such as DebugPrintf is ever imported.
hamb3r commented 2026-10-21 07:42:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-21T07:42:42Z.


Addressed all three points in 00f7cb9c21:

  1. Restored post-compaction SPIR-V validation (Recompiler.cpp):
    • Restored ValidateAndOptimizeSpirv(materialized, target.vulkanVersion, target.spirvVersion, target.nonConstantImageOffsets, false) after the descriptor-compaction loop in buildSpecializedModule (Recompiler.cpp is no longer modified by this PR, and ### What in the PR description has been updated accordingly).
  2. Shifted raw right by the subword bit offset before bitfield extraction (SpirvRuntimeBuffer.cpp, BufferFormat.cpp):
    • In genericFormattedLoad, non-gpuDescriptor loads now shift raw right by Select(state, u32, dword, constant(0u), (addresses[component].guest & 3u) << 3u) (OpShiftRightLogical, where the shift is in {0, 8, 16, 24} < 32) and keep bitOffset = Select(state, u32, packed, field(state, bitOffsets, component * 8u, 8u), constant(0u)) (0 for all non-packed formats), so bitOffset + bits[component] <= 32 holds for all formats and subword alignments without undefined OpBitFieldUExtract/OpBitFieldSExtract behavior at byte offset +3.
    • Extended RunSubwordOffsets / CheckSubwordOffsets in BufferFormat.cpp to test byte offset +3 for 16_UINT and 16_SINT as well.
  3. Restricted OpExtInst purity to GLSL.std.450 (SpirvSpecialization.cpp, SpirvModule.cpp):
    • Recorded GLSL.std.450 OpExtInstImport result IDs in glslExtInstSets during Specialization's initial instruction scan and gated case spv::OpExtInst: in PureInstruction on instruction.size() >= 5u && glslExtInstSets.contains(instruction[3]).
    • Extended testPrivateCompositeTableLoadFolding in SpirvModule.cpp to verify that unused GLSL.std.450 OpExtInst instructions are removed while live GLSL.std.450 and unused non-GLSL.std.450 OpExtInst instructions are preserved.

Verification

  • Vulkan validation (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation):
    • Ran ctest --test-dir build-portable -R "^(agc_spirv_module|agc_formatted_buffer_once|agc_driver_buffer_format|agc_driver_gpu_buffer_format|agc_driver_formatted_store|agc_driver_formatted_store_unaligned|agc_driver_buffer_unaligned_base|agc_driver_tbuffer_format_d16)$" -V: 8/8 Passed, 0 VUID- validation errors.
  • Line-by-line gcov diff coverage (-O0 --coverage):
    • core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp: 10 / 10 (100.0%)
    • core/shader/recompiler/SpirvBackend/src/SpirvSpecialization.cpp: 90 / 90 (100.0%)
    • Total diff coverage: 100 / 100 (100.0%)
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310773743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6310773743). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-21T07:42:42Z. --- Addressed all three points in [`00f7cb9c21`](https://github.com/boykopovar/AnyPS5/pull/8721/commits/00f7cb9c2135a4b84a83cf65f95bf899036b0078): 1. **Restored post-compaction SPIR-V validation (`Recompiler.cpp`)**: - Restored `ValidateAndOptimizeSpirv(materialized, target.vulkanVersion, target.spirvVersion, target.nonConstantImageOffsets, false)` after the descriptor-compaction loop in `buildSpecializedModule` (`Recompiler.cpp` is no longer modified by this PR, and `### What` in the PR description has been updated accordingly). 2. **Shifted `raw` right by the subword bit offset before bitfield extraction (`SpirvRuntimeBuffer.cpp`, `BufferFormat.cpp`)**: - In `genericFormattedLoad`, non-`gpuDescriptor` loads now shift `raw` right by `Select(state, u32, dword, constant(0u), (addresses[component].guest & 3u) << 3u)` (`OpShiftRightLogical`, where the shift is in `{0, 8, 16, 24} < 32`) and keep `bitOffset = Select(state, u32, packed, field(state, bitOffsets, component * 8u, 8u), constant(0u))` (`0` for all non-packed formats), so `bitOffset + bits[component] <= 32` holds for all formats and subword alignments without undefined `OpBitFieldUExtract`/`OpBitFieldSExtract` behavior at byte offset `+3`. - Extended `RunSubwordOffsets` / `CheckSubwordOffsets` in `BufferFormat.cpp` to test byte offset `+3` for `16_UINT` and `16_SINT` as well. 3. **Restricted `OpExtInst` purity to `GLSL.std.450` (`SpirvSpecialization.cpp`, `SpirvModule.cpp`)**: - Recorded `GLSL.std.450` `OpExtInstImport` result IDs in `glslExtInstSets` during `Specialization`'s initial instruction scan and gated `case spv::OpExtInst:` in `PureInstruction` on `instruction.size() >= 5u && glslExtInstSets.contains(instruction[3])`. - Extended `testPrivateCompositeTableLoadFolding` in `SpirvModule.cpp` to verify that unused `GLSL.std.450` `OpExtInst` instructions are removed while live `GLSL.std.450` and unused non-`GLSL.std.450` `OpExtInst` instructions are preserved. ### Verification - **Vulkan validation (`ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`)**: - Ran `ctest --test-dir build-portable -R "^(agc_spirv_module|agc_formatted_buffer_once|agc_driver_buffer_format|agc_driver_gpu_buffer_format|agc_driver_formatted_store|agc_driver_formatted_store_unaligned|agc_driver_buffer_unaligned_base|agc_driver_tbuffer_format_d16)$" -V`: **8/8 Passed**, `0` `VUID-` validation errors. - **Line-by-line `gcov` diff coverage (`-O0 --coverage`)**: - `core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp`: `10 / 10` (**100.0%**) - `core/shader/recompiler/SpirvBackend/src/SpirvSpecialization.cpp`: `90 / 90` (**100.0%**) - **Total diff coverage**: **`100 / 100` (100.0%)**
hamb3r commented 2026-10-21 07:44:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-21T07:44:28Z.


@oneandonlydean Thanks for the thorough review and especially for catching the 16-bit +3 subword bitfield bounds case and the post-compaction validation pass — all three points are addressed in 00f7cb9c21 and ready for another look when you have a moment.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310802779 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6310802779). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-21T07:44:28Z. --- @oneandonlydean Thanks for the thorough review and especially for catching the 16-bit +3 subword bitfield bounds case and the post-compaction validation pass — all three points are addressed in 00f7cb9c21 and ready for another look when you have a moment.
oneandonlydean commented 2026-10-21 08:11:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T08:11:32Z.


@hamb3r thanks, 00f7cb9c2 covers all three. The validation call is back exactly as it was. OpExtInst counts as pure only for an import of exactly GLSL.std.450, and the new test keeps both a live GLSL call and a NonSemantic one. The other PureInstruction caller still treats OpExtInst as impure, which is what main does.

One follow-up on the subword fix. On the direct-buffer path, a 16-bit field at byte offset 3 is now the dword shifted right by 24, so it returns byte 3 with a zero high byte. main reads the field's two bytes at that address (EmitBdaReadBytes with width / 8), so its high byte is byte 4 of the next dword. The SPIR-V is now defined, but the value differs from main, and the new 16_UINT +3 / 16_SINT +3 expectations (word >> 24) pin the truncated value. Could a field that crosses its dword ((addr & 3) * 8 + bits > 32) keep main's byte read, or the next dword be combined in? If you think the truncation is right, please explain why.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6311269157 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6311269157). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T08:11:32Z. --- @hamb3r thanks, `00f7cb9c2` covers all three. The validation call is back exactly as it was. `OpExtInst` counts as pure only for an import of exactly `GLSL.std.450`, and the new test keeps both a live GLSL call and a `NonSemantic` one. The other `PureInstruction` caller still treats `OpExtInst` as impure, which is what `main` does. One follow-up on the subword fix. On the direct-buffer path, a 16-bit field at byte offset 3 is now the dword shifted right by 24, so it returns byte 3 with a zero high byte. `main` reads the field's two bytes at that address (`EmitBdaReadBytes` with `width / 8`), so its high byte is byte 4 of the next dword. The SPIR-V is now defined, but the value differs from `main`, and the new `16_UINT +3` / `16_SINT +3` expectations (`word >> 24`) pin the truncated value. Could a field that crosses its dword (`(addr & 3) * 8 + bits > 32`) keep `main`'s byte read, or the next dword be combined in? If you think the truncation is right, please explain why.
hamb3r commented 2026-10-21 09:56:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-21T09:56:46Z.


@oneandonlydean On main, the direct-buffer path (!memory.gpuDescriptor) actually produced word >> 24 as well — EmitBdaReadBytes in genericFormattedLoad was only reachable when memory.gpuDescriptor == true:

  1. What main executed for !memory.gpuDescriptor:

    • In formatSwitch on main, genericFormattedLoad was gated on if (!store && memory.gpuDescriptor) (moreover, EmitBdaReadBytes requires a 64-bit BDA guest address and state.bdaPointerFunction != 0, whereas addresses[component].guest on the direct-buffer path is a 32-bit buffer-relative byte offset).
    • For !memory.gpuDescriptor, main fell through to the OpSwitch calling formatted -> readBuffer(context, instruction, addresses[component].guest, info.packedBitfield ? 32u : bits).
    • Inside readBuffer (lines 182–189), low and high only combine adjacent storage-buffer words to compensate for the descriptor's base misalignment (baseMisalignment(context, instruction)), and then combine(low, high) shifts that single reconstructed view dword right by subwordShift = (address & 3u) << 3u:
      const auto combine = [&](std::uint32_t low, std::uint32_t high) {
          auto value = EmitOrU32(state, low, high);
          if (bits != 32u) {
              const auto subwordShift = Binary(state, spv::OpShiftLeftLogical, TypeU32(state), EmitAndConstant(state, address, 3u), ConstantU32(state, 3u));
              value = Binary(state, spv::OpShiftRightLogical, TypeU32(state), value, subwordShift);
          }
          return EmitAndConstant(state, value, bits == 32u ? 0xffffffffu : (1u << bits) - 1u);
      };
      
      Followed in formatted (line 364) by OpBitFieldUExtract / OpBitFieldSExtract at bitOffset = 0 with count = bits.
  2. Hardware reference in BufferUnalignedBase.cpp:

    • This also matches the hardware-verified subword reference helper ViewField in BufferUnalignedBase.cpp:
      std::uint32_t ViewField(const std::uint8_t* view, std::uint32_t byte, std::uint32_t mask) {
          return (ViewDword(view, byte / 4u) >> ((byte % 4u) * 8u)) & mask;
      }
      
      which extracts subword fields by shifting the containing view dword ViewDword(view, byte / 4u) right by (byte % 4u) * 8u without reading from the next view dword.

So shifting the reconstructed 32-bit view dword right by (address & 3u) << 3u before extracting bits[component] at bitOffset = 0 preserves main's exact direct-buffer behavior from formatted -> readBuffer.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313187387 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6313187387). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-21T09:56:46Z. --- @oneandonlydean On `main`, the direct-buffer path (`!memory.gpuDescriptor`) actually produced `word >> 24` as well — `EmitBdaReadBytes` in `genericFormattedLoad` was only reachable when `memory.gpuDescriptor == true`: 1. **What `main` executed for `!memory.gpuDescriptor`**: - In [`formatSwitch`](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L542) on `main`, `genericFormattedLoad` was gated on `if (!store && memory.gpuDescriptor)` (moreover, `EmitBdaReadBytes` requires a 64-bit BDA guest address and `state.bdaPointerFunction != 0`, whereas `addresses[component].guest` on the direct-buffer path is a 32-bit buffer-relative byte offset). - For `!memory.gpuDescriptor`, `main` fell through to the `OpSwitch` calling [`formatted`](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L358) -> [`readBuffer(context, instruction, addresses[component].guest, info.packedBitfield ? 32u : bits)`](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L163-L203). - Inside `readBuffer` ([lines 182–189](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L182-L189)), `low` and `high` only combine adjacent storage-buffer words to compensate for the descriptor's base misalignment (`baseMisalignment(context, instruction)`), and then `combine(low, high)` shifts that single reconstructed view dword right by `subwordShift = (address & 3u) << 3u`: ```cpp const auto combine = [&](std::uint32_t low, std::uint32_t high) { auto value = EmitOrU32(state, low, high); if (bits != 32u) { const auto subwordShift = Binary(state, spv::OpShiftLeftLogical, TypeU32(state), EmitAndConstant(state, address, 3u), ConstantU32(state, 3u)); value = Binary(state, spv::OpShiftRightLogical, TypeU32(state), value, subwordShift); } return EmitAndConstant(state, value, bits == 32u ? 0xffffffffu : (1u << bits) - 1u); }; ``` Followed in `formatted` ([line 364](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L364)) by `OpBitFieldUExtract` / `OpBitFieldSExtract` at `bitOffset = 0` with `count = bits`. 2. **Hardware reference in `BufferUnalignedBase.cpp`**: - This also matches the hardware-verified subword reference helper [`ViewField`](https://github.com/boykopovar/AnyPS5/blob/ca74ef2177ee3e13451c20b9c8789e92b5dc7d28/core/libs/prx/libSceAgcDriver/tests/execution/BufferUnalignedBase.cpp#L88-L90) in `BufferUnalignedBase.cpp`: ```cpp std::uint32_t ViewField(const std::uint8_t* view, std::uint32_t byte, std::uint32_t mask) { return (ViewDword(view, byte / 4u) >> ((byte % 4u) * 8u)) & mask; } ``` which extracts subword fields by shifting the containing view dword `ViewDword(view, byte / 4u)` right by `(byte % 4u) * 8u` without reading from the next view dword. So shifting the reconstructed 32-bit view dword right by `(address & 3u) << 3u` before extracting `bits[component]` at `bitOffset = 0` preserves `main`'s exact direct-buffer behavior from `formatted` -> `readBuffer`.
oneandonlydean commented 2026-10-21 10:11:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T10:11:43Z.


@hamb3r you're right, thanks for tracing it. On main the direct-buffer path never reached EmitBdaReadBytes. genericFormattedLoad is gated on memory.gpuDescriptor, and readBuffer takes the BDA read only for GPU descriptors. Without one, combine shifts the reconstructed dword right by (address & 3) << 3 and masks to bits, so a 16-bit field at byte offset 3 already came back as byte 3 with a zero high byte. Your change keeps that exactly, so I withdraw that follow-up. It doesn't block this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313462116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6313462116). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T10:11:43Z. --- @hamb3r you're right, thanks for tracing it. On `main` the direct-buffer path never reached `EmitBdaReadBytes`. `genericFormattedLoad` is gated on `memory.gpuDescriptor`, and `readBuffer` takes the BDA read only for GPU descriptors. Without one, `combine` shifts the reconstructed dword right by `(address & 3) << 3` and masks to `bits`, so a 16-bit field at byte offset 3 already came back as byte 3 with a zero high byte. Your change keeps that exactly, so I withdraw that follow-up. It doesn't block this PR.
oneandonlydean commented 2026-10-21 12:16:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T12:16:54Z.


@hamb3r thanks again for the patience on the subword question. The full CI run on 00f7cb9c2 (merged into main b3f4783ab) fails three tests that pass on main in the same configuration:

test lane message
agc_shader_memory Linux and Windows two-lane uniform values: the scalar multiply must be emitted once per invocation
agc_vector_window Linux (Windows passes) a sampler dword spilled into a relatively read register keeps its definition through v_readlane
agc_driver_pixel_sample_iteration Linux (Windows has no GPU and skips it) AGC graphics: 2x: a pixel shader that only reorders its samples was not given the position input

All three compile shaders through Recompile, which runs SpecializeSpirv on every module (Recompiler.cpp:788). So the new folds reach them: GLSL.std.450 OpExtInst treated as pure, OpLogicalAnd/OpLogicalOr short-circuits, OpSelect with equal operands, and the constant private-table loads.

  • The first two tests were already on your branch's base (ca74ef2177), and main hasn't touched any of this PR's files since. They should fail on the branch alone. agc_shader_memory counts OpIMul in the output, and the per-invocation variant must have exactly one more than the uniform one. It fails on both platforms, so it looks deterministic: one of the folds probably removes or shares that multiply.
  • The third test arrived with #6683 (merged on 21 Oct), so it only appears once main is merged in. It needs the position input whenever the sample order alone reorders. A fold that turns that dependency into a constant would drop the input.

Could you merge current main, run those three, and find which fold changes each result? If a fold is wrong for these shapes, it should either keep the instruction or check the condition that makes folding safe. If a test's expectation is too strict, say why in the PR before changing it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315685500 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6315685500). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T12:16:54Z. --- @hamb3r thanks again for the patience on the subword question. The full CI run on `00f7cb9c2` (merged into `main` `b3f4783ab`) fails three tests that pass on `main` in the same configuration: | test | lane | message | |---|---|---| | `agc_shader_memory` | Linux and Windows | `two-lane uniform values: the scalar multiply must be emitted once per invocation` | | `agc_vector_window` | Linux (Windows passes) | `a sampler dword spilled into a relatively read register keeps its definition through v_readlane` | | `agc_driver_pixel_sample_iteration` | Linux (Windows has no GPU and skips it) | `AGC graphics: 2x: a pixel shader that only reorders its samples was not given the position input` | All three compile shaders through `Recompile`, which runs `SpecializeSpirv` on every module (`Recompiler.cpp:788`). So the new folds reach them: `GLSL.std.450` `OpExtInst` treated as pure, `OpLogicalAnd`/`OpLogicalOr` short-circuits, `OpSelect` with equal operands, and the constant private-table loads. - The first two tests were already on your branch's base (`ca74ef2177`), and `main` hasn't touched any of this PR's files since. They should fail on the branch alone. `agc_shader_memory` counts `OpIMul` in the output, and the per-invocation variant must have exactly one more than the uniform one. It fails on both platforms, so it looks deterministic: one of the folds probably removes or shares that multiply. - The third test arrived with #6683 (merged on 21 Oct), so it only appears once `main` is merged in. It needs the position input whenever the sample order alone reorders. A fold that turns that dependency into a constant would drop the input. Could you merge current `main`, run those three, and find which fold changes each result? If a fold is wrong for these shapes, it should either keep the instruction or check the condition that makes folding safe. If a test's expectation is too strict, say why in the PR before changing it.
janzezno commented 2026-10-21 14:56:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-21T14:56:10Z.


Run on AMD hardware.

Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON.
main cecb540a6; PR head 00f7cb9c2 merged on top (clean merge).

Your nine tests, plus the other buffer-format and formatted-store tests and agc_spirv_module:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -j6 -V -R '^(agc_redundant_value_elimination|agc_shader_srt_read_patching|agc_formatted_buffer_once|agc_formatted_buffer_byte_stores|agc_driver_gated_dispatch_capture|agc_driver_image_sample_unnormalized|agc_driver_image_store_sint|agc_driver_image_table|agc_driver_prepared_shaders_indirect)$|buffer_format|formatted_store|agc_spirv_module'
  • main: 15 of 15 pass. PR: 15 of 15 pass, including agc_driver_buffer_format, agc_driver_gpu_buffer_format, agc_driver_tbuffer_format_d16 and both agc_driver_formatted_store tests.
  • No VUID- messages in either run, and the validation layer loaded in both.
  • I checked correctness only; I didn't measure the shader size or pipeline time on RADV.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6319089959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6319089959). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-21T14:56:10Z. --- Run on AMD hardware. Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release, `BUILD_TESTING=ON`. `main` `cecb540a6`; PR head `00f7cb9c2` merged on top (clean merge). Your nine tests, plus the other buffer-format and formatted-store tests and `agc_spirv_module`: ``` ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -j6 -V -R '^(agc_redundant_value_elimination|agc_shader_srt_read_patching|agc_formatted_buffer_once|agc_formatted_buffer_byte_stores|agc_driver_gated_dispatch_capture|agc_driver_image_sample_unnormalized|agc_driver_image_store_sint|agc_driver_image_table|agc_driver_prepared_shaders_indirect)$|buffer_format|formatted_store|agc_spirv_module' ``` - `main`: 15 of 15 pass. PR: 15 of 15 pass, including `agc_driver_buffer_format`, `agc_driver_gpu_buffer_format`, `agc_driver_tbuffer_format_d16` and both `agc_driver_formatted_store` tests. - No `VUID-` messages in either run, and the validation layer loaded in both. - I checked correctness only; I didn't measure the shader size or pipeline time on RADV.
hamb3r commented 2026-10-21 15:12:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-21T15:12:41Z.


@oneandonlydean Merged current main (2f161d4f33), reproduced all three failures, and resolved them in cbdbc601dc:

  1. agc_shader_memory and agc_vector_window:

    • Cause: One-sided short-circuit folding of OpLogicalAnd(false, non_const) -> 0u and OpLogicalOr(true, non_const) -> 1u in Specialization::evaluate folded access.inBounds in byteAddress (OpLogicalAnd(resource.valid, OpLogicalAnd(nonzero(format), inBounds))) to false when a test's output V# had data_format == 0 (word3 = 0xfacu or 0u) while records or the address was runtime. That caused simplifyControlFlow() to prune the writeBuffer store block and removeDeadComputations() to strip the tested upstream instructions (OpIMul in agc_shader_memory and the spilled sampler OpImageSampleImplicitLod chain in agc_vector_window).
    • Fix: Removed one-sided OpLogicalAnd / OpLogicalOr constant evaluation from evaluate() (keeping only identity simplification true && x -> x and false || x -> x in fold()), and updated genericFormattedLoad in SpirvRuntimeBuffer.cpp to gate active[component] and required[component] through Select so unused components still fold to false via constant-condition OpSelect and have their branches pruned by simplifyControlFlow().
  2. agc_driver_pixel_sample_iteration (ExpectOrderModules from #6683):

    • Cause: Adding spv::OpExtInst to PureInstruction and VisitInputs changed removeDeadComputations() on pixel shaders with iterated = false and a reordered sampleOrder, eliminating the otherwise-unused state.sampleOrderWord (BuiltInFragCoord) computation checked by ExpectOrderModules.
    • Fix: Restored PureInstruction and VisitInputs to main's OpExtInst handling; because genericFormattedLoad prunes inactive components at the EmitValueOrZeroIfCondition block level via Select, agc_formatted_buffer_once continues to pass (2075 words for 1 load, 2389 for 3; GPU-selected 16379 and 17169; vertex 2266 specialized, 2755 registration).

Verified with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: agc_shader_memory, agc_vector_window, agc_driver_pixel_sample_iteration, agc_spirv_module, agc_formatted_buffer_once, and agc_driver_buffer_format all pass with 0 VUID- validation errors.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6319428664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6319428664). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-21T15:12:41Z. --- @oneandonlydean Merged current `main` (`2f161d4f33`), reproduced all three failures, and resolved them in `cbdbc601dc`: 1. **`agc_shader_memory` and `agc_vector_window`**: - **Cause**: One-sided short-circuit folding of `OpLogicalAnd(false, non_const) -> 0u` and `OpLogicalOr(true, non_const) -> 1u` in `Specialization::evaluate` folded `access.inBounds` in `byteAddress` (`OpLogicalAnd(resource.valid, OpLogicalAnd(nonzero(format), inBounds))`) to `false` when a test's output V# had `data_format == 0` (`word3 = 0xfacu` or `0u`) while `records` or the address was runtime. That caused `simplifyControlFlow()` to prune the `writeBuffer` store block and `removeDeadComputations()` to strip the tested upstream instructions (`OpIMul` in `agc_shader_memory` and the spilled sampler `OpImageSampleImplicitLod` chain in `agc_vector_window`). - **Fix**: Removed one-sided `OpLogicalAnd` / `OpLogicalOr` constant evaluation from `evaluate()` (keeping only identity simplification `true && x -> x` and `false || x -> x` in `fold()`), and updated `genericFormattedLoad` in `SpirvRuntimeBuffer.cpp` to gate `active[component]` and `required[component]` through `Select` so unused components still fold to `false` via constant-condition `OpSelect` and have their branches pruned by `simplifyControlFlow()`. 2. **`agc_driver_pixel_sample_iteration` (`ExpectOrderModules` from `#6683`)**: - **Cause**: Adding `spv::OpExtInst` to `PureInstruction` and `VisitInputs` changed `removeDeadComputations()` on pixel shaders with `iterated = false` and a reordered `sampleOrder`, eliminating the otherwise-unused `state.sampleOrderWord` (`BuiltInFragCoord`) computation checked by `ExpectOrderModules`. - **Fix**: Restored `PureInstruction` and `VisitInputs` to `main`'s `OpExtInst` handling; because `genericFormattedLoad` prunes inactive components at the `EmitValueOrZeroIfCondition` block level via `Select`, `agc_formatted_buffer_once` continues to pass (`2075 words for 1 load, 2389 for 3; GPU-selected 16379 and 17169; vertex 2266 specialized, 2755 registration`). Verified with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: `agc_shader_memory`, `agc_vector_window`, `agc_driver_pixel_sample_iteration`, `agc_spirv_module`, `agc_formatted_buffer_once`, and `agc_driver_buffer_format` all pass with 0 `VUID-` validation errors.
oneandonlydean commented 2026-10-22 02:26:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T02:26:26Z.


@hamb3r thanks for cbdbc601dc. The three tests from the last round now pass on the full CI run (agc_shader_memory on Linux and Windows, agc_vector_window and agc_driver_pixel_sample_iteration on Linux). One bar test now fails on Linux only:

450 - agc_formatted_buffer_once (Failed, 0.53 s)
formatted buffer once: a formatted load from a known descriptor kept every format's decoder (8643 words, a GPU-selected descriptor needs 13906)
  • The run merges this head into main 8c26eac3cd. main's own push run at that same commit passes this test on Linux and Windows, so the change comes from this PR.
  • On this PR's run the Windows lane builds and runs the test, and it passes there. The test only recompiles a shader and needs no GPU, so the same input gives a pruned module on Windows and the unpruned one on Linux.
  • The check is one.words < gpuOne.words / 2 (FormattedBufferOnce.cpp). 8643 words is close to what every format's decoder costs, so the known-descriptor load isn't pruned on Linux. Your comment quotes 2075 words for one load.

I think the likely spot is the pruning that cbdbc601dc moved. With the one-sided OpLogicalAnd(false, x) / OpLogicalOr(true, x) evaluation removed, unused components now rely on Select(active[component], ..., false) in genericFormattedLoad folding to a constant condition. Since the result differs between toolchains, I'd check whether that fold depends on processing order: iteration over a hash container, or a fixed number of rounds in the while (changed) loop in SpirvSpecialization.cpp.

Could you run agc_formatted_buffer_once on Linux with GCC (CI uses Ubuntu 24.04) on a merge with current main, and post the one and gpuOne word counts? The failure message prints them; if the test passes for you there, a print of the two Count() results would show where your toolchain and CI differ.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331193650 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6331193650). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T02:26:26Z. --- @hamb3r thanks for cbdbc601dc. The three tests from the last round now pass on the full CI run (agc_shader_memory on Linux and Windows, agc_vector_window and agc_driver_pixel_sample_iteration on Linux). One bar test now fails on Linux only: ``` 450 - agc_formatted_buffer_once (Failed, 0.53 s) formatted buffer once: a formatted load from a known descriptor kept every format's decoder (8643 words, a GPU-selected descriptor needs 13906) ``` - The run merges this head into `main` 8c26eac3cd. `main`'s own push run at that same commit passes this test on Linux and Windows, so the change comes from this PR. - On this PR's run the Windows lane builds and runs the test, and it passes there. The test only recompiles a shader and needs no GPU, so the same input gives a pruned module on Windows and the unpruned one on Linux. - The check is `one.words < gpuOne.words / 2` (FormattedBufferOnce.cpp). 8643 words is close to what every format's decoder costs, so the known-descriptor load isn't pruned on Linux. Your comment quotes 2075 words for one load. I think the likely spot is the pruning that cbdbc601dc moved. With the one-sided `OpLogicalAnd(false, x)` / `OpLogicalOr(true, x)` evaluation removed, unused components now rely on `Select(active[component], ..., false)` in `genericFormattedLoad` folding to a constant condition. Since the result differs between toolchains, I'd check whether that fold depends on processing order: iteration over a hash container, or a fixed number of rounds in the `while (changed)` loop in SpirvSpecialization.cpp. Could you run `agc_formatted_buffer_once` on Linux with GCC (CI uses Ubuntu 24.04) on a merge with current `main`, and post the `one` and `gpuOne` word counts? The failure message prints them; if the test passes for you there, a print of the two `Count()` results would show where your toolchain and CI differ.
Scramblrrrr commented 2026-10-22 08:05:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T08:05:51Z.


Reviewing cbdbc601dc for a possible Windows007 cross-test after our current pinned baseline. Current main d6eafa54d plus two HLE/import fixes generates compute pipelines around3.58–3.66million SPIR-V words on RTX5070Ti617.42; representative cold pipeline creations take133–147s. Raw requests/captures stay local. Startup is still warming, so I have no menu-speed or size-reduction result for your PR.

Your published head merges cleanly into the same base (local source-only530dd84f8). I noted the latest Linux-only agc_formatted_buffer_once pruning-bar failure and the earlier three regressions that cbdbc fixed. I will include all four, plus both buffer-format paths and the native load/store cases under the real Khronos1.4.363 layer, before any title run. No concurrent compilation/native tests while the baseline game is running. Is there a newer head for the Linux pruning issue, or is cbdbc still the right cross-test target? I can investigate a local reproduction once this run ends; no duplicate implementation planned. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335899913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6335899913). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T08:05:51Z. --- Reviewing cbdbc601dc for a possible Windows007 cross-test after our current pinned baseline. Current main d6eafa54d plus two HLE/import fixes generates compute pipelines around3.58–3.66million SPIR-V words on RTX5070Ti617.42; representative cold pipeline creations take133–147s. Raw requests/captures stay local. Startup is still warming, so I have no menu-speed or size-reduction result for your PR. Your published head merges cleanly into the same base (local source-only530dd84f8). I noted the latest Linux-only `agc_formatted_buffer_once` pruning-bar failure and the earlier three regressions that cbdbc fixed. I will include all four, plus both buffer-format paths and the native load/store cases under the real Khronos1.4.363 layer, before any title run. No concurrent compilation/native tests while the baseline game is running. Is there a newer head for the Linux pruning issue, or is cbdbc still the right cross-test target? I can investigate a local reproduction once this run ends; no duplicate implementation planned. AI-assisted: Codex.
Scramblrrrr commented 2026-10-22 11:54:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T11:54:37Z.


Updated to your current a31c679cda head (includes6e6c15962a and main4777caca). Source-only integration merges cleanly on our current007 stack:
https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-oct22-formatted-current (38f1f43574ae)
Conventions:0errors, one existing long host-import debt warning. UNBUILT/UNTESTED here; runtime remains the separate8942cb7c interior-import test.

The newer runtime removes the dominant finite12.5MiB region from the sampled upload log, but still reaches huge level pipelines:3,586,267words took141686ms and3,663,117words138065ms on RTX5070Ti617.42. Currently past those compiles without a logged fatal, still black/no verified gameplay. No raw requests/captures uploaded.

Next after this bounded run: WindowsOFF paired controls, including all the previous regressions, formatted_buffer_once, spirv_module/optimizer, shader_memory/vector_window, pixel_sample_iteration and native buffer-format/load/store cases with the actual validation layer. The reported Private-to-Function fix is retained; I will not carry the old cbdbc study forward. Thanks for the specific failure analysis. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340105029 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6340105029). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T11:54:37Z. --- Updated to your current a31c679cda head (includes6e6c15962a and main4777caca). Source-only integration merges cleanly on our current007 stack: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-oct22-formatted-current (38f1f43574ae) Conventions:0errors, one existing long host-import debt warning. UNBUILT/UNTESTED here; runtime remains the separate8942cb7c interior-import test. The newer runtime removes the dominant finite12.5MiB region from the sampled upload log, but still reaches huge level pipelines:3,586,267words took141686ms and3,663,117words138065ms on RTX5070Ti617.42. Currently past those compiles without a logged fatal, still black/no verified gameplay. No raw requests/captures uploaded. Next after this bounded run: WindowsOFF paired controls, including all the previous regressions, formatted_buffer_once, spirv_module/optimizer, shader_memory/vector_window, pixel_sample_iteration and native buffer-format/load/store cases with the actual validation layer. The reported Private-to-Function fix is retained; I will not carry the old cbdbc study forward. Thanks for the specific failure analysis. AI-assisted: Codex.
Scramblrrrr commented 2026-10-22 12:17:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-22T12:17:38Z.


Windows cross-test of updated #8721 head a31c679cda (including 6e6c15962a), integrated as 38f1f43574ae1c81c50e9fd3dc30a3cc9e9ed5b0 on our 007 stack 8942cb7c407aa0eb17be391d0b5ac714e6b58776:

  • Focused baseline and candidate: 10/10 pass each, actual Khronos validation layer loaded in four native cases, zero validation errors. Candidate took 4.36 seconds; this is test duration, not a performance claim.
  • Broader compatibility baseline and candidate: 87 pass, one expected sparse-import skip each. Candidate took 35.46 seconds, with 69 layer insertions. Both have the same two pre-existing VUID-VkImageViewCreateInfo-usage-02275 errors; no new validation errors.
  • FormattedBufferOnce reports 2075 words for one load / 2389 for three, versus GPU-selected 16379 / 17169. The Function-storage synthetic cases in SpirvModule also pass.

This Windows build has ANYPS5_ENABLE_SPIRV_TOOLS=OFF. The optimizer-specific test is not registered, so this does not verify the actual optimizer pass or the ON configuration. A production-only negative control is also still pending. The candidate is pushed on Scramblrrrr/AnyPS5 branch codex/first-light-oct22-formatted-current, but is not staged into the game runtime and has not been title-tested. Pausing here at the user's request; thanks for the Function-storage fix.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340532927 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8721#issuecomment-6340532927). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-22T12:17:38Z. --- Windows cross-test of updated #8721 head a31c679cda5969d5613ccf1838e06be5344e37c3 (including 6e6c15962a), integrated as 38f1f43574ae1c81c50e9fd3dc30a3cc9e9ed5b0 on our 007 stack 8942cb7c407aa0eb17be391d0b5ac714e6b58776: - Focused baseline and candidate: 10/10 pass each, actual Khronos validation layer loaded in four native cases, zero validation errors. Candidate took 4.36 seconds; this is test duration, not a performance claim. - Broader compatibility baseline and candidate: 87 pass, one expected sparse-import skip each. Candidate took 35.46 seconds, with 69 layer insertions. Both have the same two pre-existing VUID-VkImageViewCreateInfo-usage-02275 errors; no new validation errors. - FormattedBufferOnce reports 2075 words for one load / 2389 for three, versus GPU-selected 16379 / 17169. The Function-storage synthetic cases in SpirvModule also pass. This Windows build has ANYPS5_ENABLE_SPIRV_TOOLS=OFF. The optimizer-specific test is not registered, so this does not verify the actual optimizer pass or the ON configuration. A production-only negative control is also still pending. The candidate is pushed on Scramblrrrr/AnyPS5 branch codex/first-light-oct22-formatted-current, but is not staged into the game runtime and has not been title-tested. Pausing here at the user's request; thanks for the Function-storage fix.
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!8721
No description provided.