perf(shader): check f32 NaN sources only for NaN results, narrow window reads #12548

Closed
josealissonbr wants to merge 5 commits from upstream-pr/12548 into main
josealissonbr commented 2026-10-28 19:11:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by josealissonbr on 2026-10-28T19:11:52Z.


What

The f32 add, sub, mul and fma NaN rule (nanResultF32) selected over every source after every operation: one compare and one select per source on each of these instructions. The new IR opcode NanPropagateF32 keeps the same result bits but checks the sources in a branch taken only when the host result is NaN. That is exact because every module declares f32 SignedZeroInfNanPreserve, so a NaN source always gives a NaN host result, and the tiny-product flush needs finite factors and a zero addend. Immediate sources are emitted as integer constants, since a float constant bitcast quiets a signaling NaN on NVIDIA. The SRT evaluator evaluates the opcode with the same rule, and the passes that inspect selects (masked select, redundant value, tessellation lowering, denormal flush) know it.

VectorWindowIndexNarrower lists the few values a relative read index can take (adds, shifts, masks, bit-field extracts and selects of known values, at most 16) and, when every relative access of a window is such a read and every listed value is inside the window, reads the listed constant slots and selects between them, so the window needs no indexed access. It changes nothing when any window access is a store or has an index it cannot bound.

Each change alone made no difference in the measured scene; together they shorten the two particle passes of the PPSA01325 title screen. The behaviour is generic: no title, shader or address is matched. docs/dev/debt/shader.md records both, including that the SRT tape compiler does not know the new opcode and falls back to the interpreter.

Tests: ShaderMemory covers the evaluator with NaN, signaling NaN, IEEE and non-IEEE sources and the invalid product; VectorWindow covers the narrowed shape of a dynamic function access; the new GPU test execution/RelativeIndexingBoundedValues runs relative reads whose index takes a small set of values and checks every lane.

Tested

Windows 11 Pro 26200, Intel Core i5-14400, NVIDIA GeForce RTX 5070 (driver 616.64), MinGW GCC 15.2 Release build.

  • Full CTest suite with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1: 2862 of 2862 passed on this head (4dee5b5e32, main 319621ba2e merged), and 2857 of 2857 on 0c620add72 (main e4da19aff0 merged). The 65 main commits between them change one file of the recompiler (ControlFlow/src/GraphBuilder.cpp) and add one AGC test; neither touches the code of this change.
  • Validation: the agc_ tests with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos layer built from b2b44c0, API 1.4.366), ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, ctest -R "^agc_" -V, on main e4da19aff0 and on 0c620add72, same machine and GPU: 1138 of 1138 and 1139 of 1139 passed (the extra one is the new test). Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS; the same 20 tests log validation messages on both, with the same IDs, and this change adds no new VUID- ID.
  • PPSA01325 01.905.000 (Astro's Playroom), relinked with --windows --windows-gui --to-intel, from start without input to the title screen, 3840x2160. main e4da19aff0 against 0c620add72 (this branch before the merge of main 319621ba2e), both built in the same session on the same machine. Each capture is 20 s from 110 s after start (APS5_TRACE_SECONDS=110:20, no other switch, log not redirected), after one warm-up run of each build; captures ran alternating main 1, change 1, main 2, change 2. All four windows are on the looping title screen animation.
capture commit presents in 20 s frame p50 / p90 / p99 / max (ms) GPU busy per present
main 1 e4da19aff0 283 70.5 / 73.8 / 77.1 / 81.7 56.2 ms
change 1 0c620add72 351 56.7 / 59.7 / 64.3 / 66.5 41.5 ms
main 2 e4da19aff0 284 70.1 / 72.8 / 76.1 / 88.6 55.5 ms
change 2 0c620add72 312 58.0 / 62.0 / 70.3 / 1754.4 42.4 ms

Summary lines:

{"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2171,"ms":20022.129},"presents":283,"frame_ms":{"p50":70.459,"p90":73.799,"p99":77.083,"max":81.656},"gpu_busy_ms_per_present":56.152,"worker_busy_pct":{"queue worker 0x0":99.375,"queue worker 0x3d":99.712,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":140.625,"Driver.Packet.memory_wait":56.227,"Driver.Packet.dispatch":26.511,"Driver.Dispatch":25.967,"Vulkan.Dispatch":23.921,"Vulkan.Dispatch.shader_resources":23.665,"Driver.Packet.draw":19.713,"Driver.Draw":19.604},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-40620.json.gz"}
{"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2036,"ms":20054.828},"presents":351,"frame_ms":{"p50":56.749,"p90":59.722,"p99":64.314,"max":66.495},"gpu_busy_ms_per_present":41.454,"worker_busy_pct":{"queue worker 0x0":99.196,"queue worker 0x3d":99.723,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":113.493,"Driver.Packet.memory_wait":52.147,"Driver.Packet.dispatch":16.624,"Driver.Dispatch":16.070,"Graphics.Draw":15.212,"Vulkan.Dispatch":14.220,"Vulkan.Dispatch.shader_resources":13.968,"Driver.Packet.draw":13.903},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-22844.json.gz"}
{"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2173,"ms":20028.327},"presents":284,"frame_ms":{"p50":70.110,"p90":72.849,"p99":76.116,"max":88.590},"gpu_busy_ms_per_present":55.493,"worker_busy_pct":{"queue worker 0x0":99.379,"queue worker 0x3d":99.696,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":140.232,"Driver.Packet.memory_wait":55.518,"Driver.Packet.dispatch":26.931,"Driver.Dispatch":26.399,"Vulkan.Dispatch":24.206,"Vulkan.Dispatch.shader_resources":23.942,"Driver.Packet.draw":19.938,"Driver.Draw":19.831},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-35696.json.gz"}
{"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2410,"ms":20011.073},"presents":312,"frame_ms":{"p50":58.020,"p90":61.977,"p99":70.254,"max":1754.371},"gpu_busy_ms_per_present":42.432,"worker_busy_pct":{"queue worker 0x0":99.261,"queue worker 0x3d":99.474,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":127.268,"Driver.Packet.memory_wait":52.553,"Graphics.Draw":22.970,"Driver.Packet.draw":21.051,"Driver.Draw":20.935,"Graphics.Draw.draw_and_resource_release":20.802,"Driver.Packet.prepare_memory":18.271,"Driver.Packet.dispatch":17.595},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-15132.json.gz"}

tools/trace_digest.py on main 1 and change 1: GPU busy drops from 56.1 to 41.4 ms per frame and frame p50 from 70.5 to 56.7 ms (about 14.2 to 17.6 FPS). The queue worker that waits for the GPU (queue worker 0x3d) spends 54.3 ms per frame in Driver.Packet.memory_wait on main and 50.4 ms on this change, and the presenter waits 15.4 against 4.9 ms. The 1754 ms frame in change 2 is one Vulkan.GraphicsPipelineLibrary creation (1643 ms) for a pipeline the title first uses there: with the faster build, 110 s after start falls later in the title animation (present 2494 against 2171 on main), and no other frame of the change captures exceeds 192 ms.

Before this merge, a local GPU pass timer (not part of this change) measured the two particle passes on main e2a511883 at 16.6 and 14.7 ms of GPU time per frame, 17.7 and 16.0 ms with the NaN branch alone, and 8.6-9.0 and 6.2-6.5 ms with both changes.

tools/trace_digest.py, main 1

seconds 110:20 from present 2171: 283 presents, frame p50 70.5 / p90 73.8 / p99 77.1 / max 81.7 ms, GPU busy 56.2 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit e4da19aff0, dropped: no

{"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2171,"ms":20022.129},"presents":283,"frame_ms":{"p50":70.459,"p90":73.799,"p99":77.083,"max":81.656},"gpu_busy_ms_per_present":56.152,"worker_busy_pct":{"queue worker 0x0":99.375,"queue worker 0x3d":99.712,"queue worker 0x52":0.0},"top_phases_ms_per_frame":{"Driver.Packet":140.625,"Driver.Packet.memory_wait":56.227,"Driver.Packet.dispatch":26.511,"Driver.Dispatch":25.967,"Vulkan.Dispatch":23.921,"Vulkan.Dispatch.shader_resources":23.665,"Driver.Packet.draw":19.713,"Driver.Draw":19.604},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-40620.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 2230: 81.7 ms at 4073 ms: Driver.Packet (queue worker 0x3d) 81.5, Driver.Packet (queue worker 0x0) 76.9, batch (gpu) 64.4, Driver.Packet.memory_wait (queue worker 0x3d) 56.1
  • present 2295: 81.5 ms at 8780 ms: Driver.Packet (queue worker 0x3d) 81.3, Driver.Packet (queue worker 0x0) 76.8, batch (gpu) 58.9, Driver.Packet.memory_wait (queue worker 0x3d) 57.7
  • present 2288: 77.1 ms at 8265 ms: Driver.Packet (queue worker 0x3d) 76.9, Driver.Packet (queue worker 0x0) 72.7, batch (gpu) 61.5, Driver.Packet.memory_wait (queue worker 0x3d) 50.6
  • present 2329: 76.9 ms at 11207 ms: Driver.Packet (queue worker 0x3d) 76.7, Driver.Packet (queue worker 0x0) 71.9, batch (gpu) 59.5, Driver.Packet.memory_wait (queue worker 0x3d) 53.1
  • present 2269: 76.9 ms at 6886 ms: Driver.Packet (queue worker 0x3d) 76.7, Driver.Packet (queue worker 0x0) 72.5, batch (gpu) 59.3, Driver.Packet.memory_wait (queue worker 0x3d) 51.3

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 48.4 (68 %) 18.1 (26 %) 4.2 15.5 Driver.Packet 66.3, Driver.EndSubmission 0.1
title 0.1 (0 %) 0.0 (0 %) 70.7 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0
title 0.1 (0 %) 0.0 (0 %) 70.7 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0
title 0.1 (0 %) 0.0 (0 %) 70.7 0.3 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
draw committer 21.0 (30 %) 13.5 (19 %) 36.3 4.8 Graphics.Draw 13.2, Vulkan.DrawFromRecipe 6.4
queue worker 0x3d 16.1 (23 %) 54.3 (77 %) 0.4 0.6 Driver.Packet 70.4, Recorder.Submit 0.0
presenter 0.9 (1 %) 15.4 (22 %) 54.5 0.1 VideoOut.Flip 16.2, Driver.Present 0.0
title 0.0 (0 %) 0.0 (0 %) 70.7 0.0 Shader.ResolveGraphicsStagesAbi 0.0
gpu 56.1 (79 %) 0.0 (0 %) 14.6 0.0 batch 56.1

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 136.7, Driver.Packet.memory_wait 56.2, batch 56.1, Driver.Packet.dispatch 26.5, Driver.Dispatch 25.9, Vulkan.Dispatch 23.9, Vulkan.Dispatch.shader_resources 23.6, Driver.Packet.draw 18.2, Driver.Draw 18.1, Driver.Packet.prepare_memory 17.9

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x3d) 59.3 ms at 4105 ms, present 2230
  • Driver.Packet.memory_wait (queue worker 0x3d) 57.1 ms at 8810 ms, present 2295
  • Driver.Packet.memory_wait (queue worker 0x3d) 56.5 ms at 8004 ms, present 2284
  • Driver.Packet.memory_wait (queue worker 0x3d) 54.7 ms at 11237 ms, present 2329
  • Driver.Packet.memory_wait (queue worker 0x3d) 54.7 ms at 7068 ms, present 2271
  • Driver.Packet.memory_wait (queue worker 0x3d) 54.0 ms at 8298 ms, present 2288
  • Driver.Packet.memory_wait (queue worker 0x3d) 53.0 ms at 6769 ms, present 2267
  • Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 12121 ms, present 2341
  • Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 4181 ms, present 2231
  • Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 9453 ms, present 2304

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

  • batch 12290: 17.4 ms at 15028 ms, present 2382: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Recorder.Submit (draw committer) 0.0
  • batch 3409: 17.0 ms at 4070 ms, present 2229: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.9, Recorder.Submit (draw committer) 0.0, Graphics.Draw.validate (draw committer) 0.0
  • batch 14557: 16.8 ms at 17771 ms, present 2421: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Recorder.Submit (draw committer) 0.0
  • batch 14791: 16.6 ms at 18052 ms, present 2425: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.7, Recorder.Submit (draw committer) 0.0
  • batch 9270: 16.6 ms at 11356 ms, present 2330: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.0, Graphics.Draw.validate (draw committer) 0.0
tools/trace_digest.py, change 1

seconds 110:20 from present 2036: 351 presents, frame p50 56.7 / p90 59.7 / p99 64.3 / max 66.5 ms, GPU busy 41.5 ms per present
NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 0c620add72, dropped: no

{"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2036,"ms":20054.828},"presents":351,"frame_ms":{"p50":56.749,"p90":59.722,"p99":64.314,"max":66.495},"gpu_busy_ms_per_present":41.454,"worker_busy_pct":{"queue worker 0x0":99.196,"queue worker 0x3d":99.723,"queue worker 0x52":0.0},"top_phases_ms_per_frame":{"Driver.Packet":113.493,"Driver.Packet.memory_wait":52.147,"Driver.Packet.dispatch":16.624,"Driver.Dispatch":16.07,"Graphics.Draw":15.212,"Vulkan.Dispatch":14.22,"Vulkan.Dispatch.shader_resources":13.968,"Driver.Packet.draw":13.903},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-22844.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 2036: 66.5 ms at 0 ms: Driver.Packet (queue worker 0x0) 61.8, Driver.Packet (queue worker 0x3d) 55.7, Driver.Packet.memory_wait (queue worker 0x3d) 43.8, batch (gpu) 42.0
  • present 2068: 65.5 ms at 1852 ms: Driver.Packet (queue worker 0x3d) 65.2, Driver.Packet (queue worker 0x0) 60.7, Driver.Packet.memory_wait (queue worker 0x3d) 51.1, batch (gpu) 40.6
  • present 2125: 64.6 ms at 5086 ms: Driver.Packet (queue worker 0x3d) 64.4, Driver.Packet (queue worker 0x0) 60.7, Driver.Packet.memory_wait (queue worker 0x3d) 51.2, batch (gpu) 40.5
  • present 2037: 64.3 ms at 66 ms: Driver.Packet (queue worker 0x3d) 64.1, Driver.Packet (queue worker 0x0) 59.2, Driver.Packet.memory_wait (queue worker 0x3d) 51.0, batch (gpu) 39.6
  • present 2158: 63.8 ms at 6985 ms: Driver.Packet (queue worker 0x3d) 63.7, Driver.Packet (queue worker 0x0) 59.0, Driver.Packet.memory_wait (queue worker 0x3d) 50.9, batch (gpu) 43.3

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 40.1 (70 %) 12.9 (23 %) 4.2 15.6 Driver.Packet 52.8, Driver.EndSubmission 0.1
title 0.1 (0 %) 0.0 (0 %) 57.1 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0
title 0.1 (0 %) 0.0 (0 %) 57.0 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0
title 0.1 (0 %) 0.0 (0 %) 57.1 0.3 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0
draw committer 22.0 (38 %) 4.0 (7 %) 31.2 4.8 Graphics.Draw 13.5, Vulkan.DrawFromRecipe 6.8
queue worker 0x3d 6.4 (11 %) 50.4 (88 %) 0.3 0.6 Driver.Packet 56.8, Driver.EndSubmission 0.0
presenter 0.9 (1 %) 4.9 (9 %) 51.4 0.1 VideoOut.Flip 5.8, Driver.Present 0.0
title 0.0 (0 %) 0.0 (0 %) 57.1 0.0 Shader.ResolveGraphicsStagesAbi 0.0
gpu 41.4 (73 %) 0.0 (0 %) 15.7 0.0 batch 41.4

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 109.6, Driver.Packet.memory_wait 52.1, batch 41.4, Driver.Packet.dispatch 16.6, Driver.Dispatch 16.0, Vulkan.Dispatch 14.2, Vulkan.Dispatch.shader_resources 13.9, Graphics.Draw 13.8, Driver.Packet.prepare_memory 12.9, Driver.Packet.draw 12.4

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x3d) 56.1 ms at 23 ms, present 2036
  • Driver.Packet.memory_wait (queue worker 0x3d) 54.9 ms at 17766 ms, present 2347
  • Driver.Packet.memory_wait (queue worker 0x3d) 52.6 ms at 9412 ms, present 2200
  • Driver.Packet.memory_wait (queue worker 0x3d) 51.4 ms at 1812 ms, present 2067
  • Driver.Packet.memory_wait (queue worker 0x3d) 51.3 ms at 7007 ms, present 2158
  • Driver.Packet.memory_wait (queue worker 0x3d) 50.0 ms at 5050 ms, present 2124
  • Driver.Packet.memory_wait (queue worker 0x3d) 48.5 ms at 5335 ms, present 2129
  • Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 554 ms, present 2045
  • Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 12094 ms, present 2247
  • Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 9180 ms, present 2196

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

  • batch 4315: 10.5 ms at 4246 ms, present 2110: GPU no ranges; recorded by Driver.Packet (queue worker 0x3d) 12.1, Driver.Packet.prepare_memory (queue worker 0x3d) 10.7, Recorder.WaitSerial (queue worker 0x3d) 10.6, Driver.Packet.dispatch (queue worker 0x3d) 1.4
  • batch 10631: 10.0 ms at 10530 ms, present 2219: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 28.2, Driver.Packet.dispatch (queue worker 0x0) 11.5, Driver.Dispatch (queue worker 0x0) 11.5, Vulkan.Dispatch (queue worker 0x0) 10.8
  • batch 10676: 10.0 ms at 10565 ms, present 2220: GPU no ranges; recorded by Driver.Packet (queue worker 0x3d) 12.7, Driver.Packet.prepare_memory (queue worker 0x3d) 10.2, Recorder.WaitSerial (queue worker 0x3d) 10.1, Driver.Packet.dispatch (queue worker 0x3d) 2.5
  • batch 1890: 9.9 ms at 1892 ms, present 2068: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 29.1, Driver.Packet.dispatch (queue worker 0x0) 12.6, Driver.Dispatch (queue worker 0x0) 12.6, Vulkan.Dispatch (queue worker 0x0) 12.0
  • batch 10574: 9.9 ms at 10471 ms, present 2218: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 27.8, Driver.Packet.dispatch (queue worker 0x0) 11.1, Driver.Dispatch (queue worker 0x0) 11.1, Vulkan.Dispatch (queue worker 0x0) 10.5

Traces (slice timings only; they open in ui.perfetto.dev):

aps5-trace-0c620add72d2-22844.json.gz
aps5-trace-e4da19aff06e-35696.json.gz
aps5-trace-e4da19aff06e-40620.json.gz
aps5-trace-0c620add72d2-15132.json.gz

Overlap: this is offered in place of #4287, which reduces the same nanResultF32 select chain to one quiet and one fallback select and has been waiting for title numbers; this change keeps the NaN rule out of the common path instead and brings those numbers. #10720 changes the same lines behind APS5_FAST_F32; #12233 touches the neighbouring line of docs/dev/debt/shader.md and #12324 a line of Recompiler.cpp next to the new pass.

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 5070, driver 616.64, Windows 11 Pro 26200
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5056220655 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12548). Originally posted by [josealissonbr](https://github.com/josealissonbr) on 2026-10-28T19:11:52Z. --- ### What The f32 add, sub, mul and fma NaN rule (`nanResultF32`) selected over every source after every operation: one compare and one select per source on each of these instructions. The new IR opcode `NanPropagateF32` keeps the same result bits but checks the sources in a branch taken only when the host result is NaN. That is exact because every module declares f32 `SignedZeroInfNanPreserve`, so a NaN source always gives a NaN host result, and the tiny-product flush needs finite factors and a zero addend. Immediate sources are emitted as integer constants, since a float constant bitcast quiets a signaling NaN on NVIDIA. The SRT evaluator evaluates the opcode with the same rule, and the passes that inspect selects (masked select, redundant value, tessellation lowering, denormal flush) know it. `VectorWindowIndexNarrower` lists the few values a relative read index can take (adds, shifts, masks, bit-field extracts and selects of known values, at most 16) and, when every relative access of a window is such a read and every listed value is inside the window, reads the listed constant slots and selects between them, so the window needs no indexed access. It changes nothing when any window access is a store or has an index it cannot bound. Each change alone made no difference in the measured scene; together they shorten the two particle passes of the PPSA01325 title screen. The behaviour is generic: no title, shader or address is matched. `docs/dev/debt/shader.md` records both, including that the SRT tape compiler does not know the new opcode and falls back to the interpreter. Tests: `ShaderMemory` covers the evaluator with NaN, signaling NaN, IEEE and non-IEEE sources and the invalid product; `VectorWindow` covers the narrowed shape of a dynamic function access; the new GPU test `execution/RelativeIndexingBoundedValues` runs relative reads whose index takes a small set of values and checks every lane. ### Tested Windows 11 Pro 26200, Intel Core i5-14400, NVIDIA GeForce RTX 5070 (driver 616.64), MinGW GCC 15.2 Release build. - Full CTest suite with `ANYPS5_REQUIRE_VULKAN=1` and `ANYPS5_NO_SHADER_CACHE=1`: 2862 of 2862 passed on this head (4dee5b5e32, `main` 319621ba2e merged), and 2857 of 2857 on 0c620add72 (`main` e4da19aff0 merged). The 65 `main` commits between them change one file of the recompiler (`ControlFlow/src/GraphBuilder.cpp`) and add one AGC test; neither touches the code of this change. - Validation: the `agc_` tests with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Khronos layer built from b2b44c0, API 1.4.366), `ANYPS5_REQUIRE_VULKAN=1` and `ANYPS5_NO_SHADER_CACHE=1`, `ctest -R "^agc_" -V`, on `main` e4da19aff0 and on 0c620add72, same machine and GPU: 1138 of 1138 and 1139 of 1139 passed (the extra one is the new test). Neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`; the same 20 tests log validation messages on both, with the same IDs, and this change adds no new `VUID-` ID. - PPSA01325 01.905.000 (Astro's Playroom), relinked with `--windows --windows-gui --to-intel`, from start without input to the title screen, 3840x2160. `main` e4da19aff0 against 0c620add72 (this branch before the merge of `main` 319621ba2e), both built in the same session on the same machine. Each capture is 20 s from 110 s after start (`APS5_TRACE_SECONDS=110:20`, no other switch, log not redirected), after one warm-up run of each build; captures ran alternating main 1, change 1, main 2, change 2. All four windows are on the looping title screen animation. | capture | commit | presents in 20 s | frame p50 / p90 / p99 / max (ms) | GPU busy per present | |---|---|---|---|---| | main 1 | e4da19aff0 | 283 | 70.5 / 73.8 / 77.1 / 81.7 | 56.2 ms | | change 1 | 0c620add72 | 351 | 56.7 / 59.7 / 64.3 / 66.5 | 41.5 ms | | main 2 | e4da19aff0 | 284 | 70.1 / 72.8 / 76.1 / 88.6 | 55.5 ms | | change 2 | 0c620add72 | 312 | 58.0 / 62.0 / 70.3 / 1754.4 | 42.4 ms | Summary lines: ```json {"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2171,"ms":20022.129},"presents":283,"frame_ms":{"p50":70.459,"p90":73.799,"p99":77.083,"max":81.656},"gpu_busy_ms_per_present":56.152,"worker_busy_pct":{"queue worker 0x0":99.375,"queue worker 0x3d":99.712,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":140.625,"Driver.Packet.memory_wait":56.227,"Driver.Packet.dispatch":26.511,"Driver.Dispatch":25.967,"Vulkan.Dispatch":23.921,"Vulkan.Dispatch.shader_resources":23.665,"Driver.Packet.draw":19.713,"Driver.Draw":19.604},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-40620.json.gz"} {"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2036,"ms":20054.828},"presents":351,"frame_ms":{"p50":56.749,"p90":59.722,"p99":64.314,"max":66.495},"gpu_busy_ms_per_present":41.454,"worker_busy_pct":{"queue worker 0x0":99.196,"queue worker 0x3d":99.723,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":113.493,"Driver.Packet.memory_wait":52.147,"Driver.Packet.dispatch":16.624,"Driver.Dispatch":16.070,"Graphics.Draw":15.212,"Vulkan.Dispatch":14.220,"Vulkan.Dispatch.shader_resources":13.968,"Driver.Packet.draw":13.903},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-22844.json.gz"} {"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2173,"ms":20028.327},"presents":284,"frame_ms":{"p50":70.110,"p90":72.849,"p99":76.116,"max":88.590},"gpu_busy_ms_per_present":55.493,"worker_busy_pct":{"queue worker 0x0":99.379,"queue worker 0x3d":99.696,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":140.232,"Driver.Packet.memory_wait":55.518,"Driver.Packet.dispatch":26.931,"Driver.Dispatch":26.399,"Vulkan.Dispatch":24.206,"Vulkan.Dispatch.shader_resources":23.942,"Driver.Packet.draw":19.938,"Driver.Draw":19.831},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-35696.json.gz"} {"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2410,"ms":20011.073},"presents":312,"frame_ms":{"p50":58.020,"p90":61.977,"p99":70.254,"max":1754.371},"gpu_busy_ms_per_present":42.432,"worker_busy_pct":{"queue worker 0x0":99.261,"queue worker 0x3d":99.474,"queue worker 0x52":0.000},"top_phases_ms_per_frame":{"Driver.Packet":127.268,"Driver.Packet.memory_wait":52.553,"Graphics.Draw":22.970,"Driver.Packet.draw":21.051,"Driver.Draw":20.935,"Graphics.Draw.draw_and_resource_release":20.802,"Driver.Packet.prepare_memory":18.271,"Driver.Packet.dispatch":17.595},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-15132.json.gz"} ``` `tools/trace_digest.py` on main 1 and change 1: GPU busy drops from 56.1 to 41.4 ms per frame and frame p50 from 70.5 to 56.7 ms (about 14.2 to 17.6 FPS). The queue worker that waits for the GPU (`queue worker 0x3d`) spends 54.3 ms per frame in `Driver.Packet.memory_wait` on `main` and 50.4 ms on this change, and the presenter waits 15.4 against 4.9 ms. The 1754 ms frame in change 2 is one `Vulkan.GraphicsPipelineLibrary` creation (1643 ms) for a pipeline the title first uses there: with the faster build, 110 s after start falls later in the title animation (present 2494 against 2171 on `main`), and no other frame of the change captures exceeds 192 ms. Before this merge, a local GPU pass timer (not part of this change) measured the two particle passes on `main` e2a511883 at 16.6 and 14.7 ms of GPU time per frame, 17.7 and 16.0 ms with the NaN branch alone, and 8.6-9.0 and 6.2-6.5 ms with both changes. <details><summary><code>tools/trace_digest.py</code>, main 1</summary> **seconds 110:20** from present 2171: 283 presents, frame p50 70.5 / p90 73.8 / p99 77.1 / max 81.7 ms, GPU busy 56.2 ms per present NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit e4da19aff06e, dropped: no ```json {"commit":"e4da19aff06e","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2171,"ms":20022.129},"presents":283,"frame_ms":{"p50":70.459,"p90":73.799,"p99":77.083,"max":81.656},"gpu_busy_ms_per_present":56.152,"worker_busy_pct":{"queue worker 0x0":99.375,"queue worker 0x3d":99.712,"queue worker 0x52":0.0},"top_phases_ms_per_frame":{"Driver.Packet":140.625,"Driver.Packet.memory_wait":56.227,"Driver.Packet.dispatch":26.511,"Driver.Dispatch":25.967,"Vulkan.Dispatch":23.921,"Vulkan.Dispatch.shader_resources":23.665,"Driver.Packet.draw":19.713,"Driver.Draw":19.604},"trace_dropped":false,"trace":"aps5-trace-e4da19aff06e-40620.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 2230: 81.7 ms at 4073 ms: Driver.Packet (queue worker 0x3d) 81.5, Driver.Packet (queue worker 0x0) 76.9, batch (gpu) 64.4, Driver.Packet.memory_wait (queue worker 0x3d) 56.1 - present 2295: 81.5 ms at 8780 ms: Driver.Packet (queue worker 0x3d) 81.3, Driver.Packet (queue worker 0x0) 76.8, batch (gpu) 58.9, Driver.Packet.memory_wait (queue worker 0x3d) 57.7 - present 2288: 77.1 ms at 8265 ms: Driver.Packet (queue worker 0x3d) 76.9, Driver.Packet (queue worker 0x0) 72.7, batch (gpu) 61.5, Driver.Packet.memory_wait (queue worker 0x3d) 50.6 - present 2329: 76.9 ms at 11207 ms: Driver.Packet (queue worker 0x3d) 76.7, Driver.Packet (queue worker 0x0) 71.9, batch (gpu) 59.5, Driver.Packet.memory_wait (queue worker 0x3d) 53.1 - present 2269: 76.9 ms at 6886 ms: Driver.Packet (queue worker 0x3d) 76.7, Driver.Packet (queue worker 0x0) 72.5, batch (gpu) 59.3, Driver.Packet.memory_wait (queue worker 0x3d) 51.3 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 48.4 (68 %) | 18.1 (26 %) | 4.2 | 15.5 | Driver.Packet 66.3, Driver.EndSubmission 0.1 | | title | 0.1 (0 %) | 0.0 (0 %) | 70.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0 | | title | 0.1 (0 %) | 0.0 (0 %) | 70.7 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0 | | title | 0.1 (0 %) | 0.0 (0 %) | 70.7 | 0.3 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | draw committer | 21.0 (30 %) | 13.5 (19 %) | 36.3 | 4.8 | Graphics.Draw 13.2, Vulkan.DrawFromRecipe 6.4 | | queue worker 0x3d | 16.1 (23 %) | 54.3 (77 %) | 0.4 | 0.6 | Driver.Packet 70.4, Recorder.Submit 0.0 | | presenter | 0.9 (1 %) | 15.4 (22 %) | 54.5 | 0.1 | VideoOut.Flip 16.2, Driver.Present 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 70.7 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | gpu | 56.1 (79 %) | 0.0 (0 %) | 14.6 | 0.0 | batch 56.1 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 136.7, Driver.Packet.memory_wait 56.2, batch 56.1, Driver.Packet.dispatch 26.5, Driver.Dispatch 25.9, Vulkan.Dispatch 23.9, Vulkan.Dispatch.shader_resources 23.6, Driver.Packet.draw 18.2, Driver.Draw 18.1, Driver.Packet.prepare_memory 17.9 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x3d) 59.3 ms at 4105 ms, present 2230 - Driver.Packet.memory_wait (queue worker 0x3d) 57.1 ms at 8810 ms, present 2295 - Driver.Packet.memory_wait (queue worker 0x3d) 56.5 ms at 8004 ms, present 2284 - Driver.Packet.memory_wait (queue worker 0x3d) 54.7 ms at 11237 ms, present 2329 - Driver.Packet.memory_wait (queue worker 0x3d) 54.7 ms at 7068 ms, present 2271 - Driver.Packet.memory_wait (queue worker 0x3d) 54.0 ms at 8298 ms, present 2288 - Driver.Packet.memory_wait (queue worker 0x3d) 53.0 ms at 6769 ms, present 2267 - Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 12121 ms, present 2341 - Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 4181 ms, present 2231 - Driver.Packet.memory_wait (queue worker 0x3d) 52.8 ms at 9453 ms, present 2304 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 12290: 17.4 ms at 15028 ms, present 2382: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Recorder.Submit (draw committer) 0.0 - batch 3409: 17.0 ms at 4070 ms, present 2229: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.9, Recorder.Submit (draw committer) 0.0, Graphics.Draw.validate (draw committer) 0.0 - batch 14557: 16.8 ms at 17771 ms, present 2421: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.4, Graphics.Draw.draw_and_resource_release (draw committer) 0.4, Recorder.Submit (draw committer) 0.0 - batch 14791: 16.6 ms at 18052 ms, present 2425: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.7, Recorder.Submit (draw committer) 0.0 - batch 9270: 16.6 ms at 11356 ms, present 2330: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.0, Graphics.Draw.validate (draw committer) 0.0 </details> <details><summary><code>tools/trace_digest.py</code>, change 1</summary> **seconds 110:20** from present 2036: 351 presents, frame p50 56.7 / p90 59.7 / p99 64.3 / max 66.5 ms, GPU busy 41.5 ms per present NVIDIA GeForce RTX 5070, NVIDIA 616.64, Windows 10.0.26200, 3840x2160, commit 0c620add72d2, dropped: no ```json {"commit":"0c620add72d2","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"110:20"},"gpu":"NVIDIA GeForce RTX 5070","driver":"NVIDIA 616.64","os":"Windows 10.0.26200","cpu":"Intel(R) Core(TM) i5-14400","cpu_threads":16,"memory_mib":32452,"title_id":"PPSA01325","title":"ASTRO's PLAYROOM","content_version":"01.905.000","resolution":"3840x2160","window":{"spec":"seconds 110:20","first_present":2036,"ms":20054.828},"presents":351,"frame_ms":{"p50":56.749,"p90":59.722,"p99":64.314,"max":66.495},"gpu_busy_ms_per_present":41.454,"worker_busy_pct":{"queue worker 0x0":99.196,"queue worker 0x3d":99.723,"queue worker 0x52":0.0},"top_phases_ms_per_frame":{"Driver.Packet":113.493,"Driver.Packet.memory_wait":52.147,"Driver.Packet.dispatch":16.624,"Driver.Dispatch":16.07,"Graphics.Draw":15.212,"Vulkan.Dispatch":14.22,"Vulkan.Dispatch.shader_resources":13.968,"Driver.Packet.draw":13.903},"trace_dropped":false,"trace":"aps5-trace-0c620add72d2-22844.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 2036: 66.5 ms at 0 ms: Driver.Packet (queue worker 0x0) 61.8, Driver.Packet (queue worker 0x3d) 55.7, Driver.Packet.memory_wait (queue worker 0x3d) 43.8, batch (gpu) 42.0 - present 2068: 65.5 ms at 1852 ms: Driver.Packet (queue worker 0x3d) 65.2, Driver.Packet (queue worker 0x0) 60.7, Driver.Packet.memory_wait (queue worker 0x3d) 51.1, batch (gpu) 40.6 - present 2125: 64.6 ms at 5086 ms: Driver.Packet (queue worker 0x3d) 64.4, Driver.Packet (queue worker 0x0) 60.7, Driver.Packet.memory_wait (queue worker 0x3d) 51.2, batch (gpu) 40.5 - present 2037: 64.3 ms at 66 ms: Driver.Packet (queue worker 0x3d) 64.1, Driver.Packet (queue worker 0x0) 59.2, Driver.Packet.memory_wait (queue worker 0x3d) 51.0, batch (gpu) 39.6 - present 2158: 63.8 ms at 6985 ms: Driver.Packet (queue worker 0x3d) 63.7, Driver.Packet (queue worker 0x0) 59.0, Driver.Packet.memory_wait (queue worker 0x3d) 50.9, batch (gpu) 43.3 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 40.1 (70 %) | 12.9 (23 %) | 4.2 | 15.6 | Driver.Packet 52.8, Driver.EndSubmission 0.1 | | title | 0.1 (0 %) | 0.0 (0 %) | 57.1 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0 | | title | 0.1 (0 %) | 0.0 (0 %) | 57.0 | 0.1 | Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.0 | | title | 0.1 (0 %) | 0.0 (0 %) | 57.1 | 0.3 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | draw committer | 22.0 (38 %) | 4.0 (7 %) | 31.2 | 4.8 | Graphics.Draw 13.5, Vulkan.DrawFromRecipe 6.8 | | queue worker 0x3d | 6.4 (11 %) | 50.4 (88 %) | 0.3 | 0.6 | Driver.Packet 56.8, Driver.EndSubmission 0.0 | | presenter | 0.9 (1 %) | 4.9 (9 %) | 51.4 | 0.1 | VideoOut.Flip 5.8, Driver.Present 0.0 | | title | 0.0 (0 %) | 0.0 (0 %) | 57.1 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0 | | gpu | 41.4 (73 %) | 0.0 (0 %) | 15.7 | 0.0 | batch 41.4 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 109.6, Driver.Packet.memory_wait 52.1, batch 41.4, Driver.Packet.dispatch 16.6, Driver.Dispatch 16.0, Vulkan.Dispatch 14.2, Vulkan.Dispatch.shader_resources 13.9, Graphics.Draw 13.8, Driver.Packet.prepare_memory 12.9, Driver.Packet.draw 12.4 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x3d) 56.1 ms at 23 ms, present 2036 - Driver.Packet.memory_wait (queue worker 0x3d) 54.9 ms at 17766 ms, present 2347 - Driver.Packet.memory_wait (queue worker 0x3d) 52.6 ms at 9412 ms, present 2200 - Driver.Packet.memory_wait (queue worker 0x3d) 51.4 ms at 1812 ms, present 2067 - Driver.Packet.memory_wait (queue worker 0x3d) 51.3 ms at 7007 ms, present 2158 - Driver.Packet.memory_wait (queue worker 0x3d) 50.0 ms at 5050 ms, present 2124 - Driver.Packet.memory_wait (queue worker 0x3d) 48.5 ms at 5335 ms, present 2129 - Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 554 ms, present 2045 - Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 12094 ms, present 2247 - Driver.Packet.memory_wait (queue worker 0x3d) 48.1 ms at 9180 ms, present 2196 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4315: 10.5 ms at 4246 ms, present 2110: GPU no ranges; recorded by Driver.Packet (queue worker 0x3d) 12.1, Driver.Packet.prepare_memory (queue worker 0x3d) 10.7, Recorder.WaitSerial (queue worker 0x3d) 10.6, Driver.Packet.dispatch (queue worker 0x3d) 1.4 - batch 10631: 10.0 ms at 10530 ms, present 2219: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 28.2, Driver.Packet.dispatch (queue worker 0x0) 11.5, Driver.Dispatch (queue worker 0x0) 11.5, Vulkan.Dispatch (queue worker 0x0) 10.8 - batch 10676: 10.0 ms at 10565 ms, present 2220: GPU no ranges; recorded by Driver.Packet (queue worker 0x3d) 12.7, Driver.Packet.prepare_memory (queue worker 0x3d) 10.2, Recorder.WaitSerial (queue worker 0x3d) 10.1, Driver.Packet.dispatch (queue worker 0x3d) 2.5 - batch 1890: 9.9 ms at 1892 ms, present 2068: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 29.1, Driver.Packet.dispatch (queue worker 0x0) 12.6, Driver.Dispatch (queue worker 0x0) 12.6, Vulkan.Dispatch (queue worker 0x0) 12.0 - batch 10574: 9.9 ms at 10471 ms, present 2218: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 27.8, Driver.Packet.dispatch (queue worker 0x0) 11.1, Driver.Dispatch (queue worker 0x0) 11.1, Vulkan.Dispatch (queue worker 0x0) 10.5 </details> Traces (slice timings only; they open in ui.perfetto.dev): [aps5-trace-0c620add72d2-22844.json.gz](https://github.com/user-attachments/files/34097497/aps5-trace-0c620add72d2-22844.json.gz) [aps5-trace-e4da19aff06e-35696.json.gz](https://github.com/user-attachments/files/34097514/aps5-trace-e4da19aff06e-35696.json.gz) [aps5-trace-e4da19aff06e-40620.json.gz](https://github.com/user-attachments/files/34097515/aps5-trace-e4da19aff06e-40620.json.gz) [aps5-trace-0c620add72d2-15132.json.gz](https://github.com/user-attachments/files/34097520/aps5-trace-0c620add72d2-15132.json.gz) Overlap: this is offered in place of #4287, which reduces the same `nanResultF32` select chain to one quiet and one fallback select and has been waiting for title numbers; this change keeps the NaN rule out of the common path instead and brings those numbers. #10720 changes the same lines behind `APS5_FAST_F32`; #12233 touches the neighbouring line of `docs/dev/debt/shader.md` and #12324 a line of `Recompiler.cpp` next to the new pass. ### 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 5070, driver 616.64, Windows 11 Pro 26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-28 19:46:27 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Reviewed — changes requested

The performance evidence is present, but this branch overlaps open PRs #4287 and #10720 without recording an agreed integration order; combining it with #10720 produces a source conflict.

What I ran

  • Reviewed exact head 4dee5b5e3296c643731e19eca13ddad80d1e49ab against base 319621ba2e578bd053b0baba2877fe70520e0737; current-main merge tree db3ff82497c56456347fdd03f9822d02a37bb553 is clean.
  • Ran git diff --check refs/review/current-main...refs/review/12548 — pass, no output.
  • Compared both declared related PRs: #4287 is open and changes the same nanResultF32 behavior; #10720 is open and changes the same operand-access logic. Pairwise merge with #4287 is clean, but pairwise merge with #10720 reports a content conflict in OperandAccess.cpp.
  • Inspected the new NaN-propagation emitter/evaluator and finite-set vector-window narrowing logic. No separate correctness defect was established in that source inspection.
  • Refreshed hosted checks: Windows, Ubuntu/Windows relinker, relinker ASan, conventions, eligibility, labels and report pass; Linux product and specialized jobs are skipped; macOS relinker checks are pending.

Results

Check Result
Current-main merge preview Clean
Diff check Pass
Merge preview with #4287 Clean tree; same NaN-result logic is being proposed
Merge preview with #10720 Content conflict in OperandAccess.cpp
Performance report requirements Body includes paired same-scene summaries, four attached traces and trace_digest.py output; captures report no dropped events
Hosted Windows and Ubuntu/Windows relinker, ASan, policy Pass
Hosted Linux product Skipped
Hosted macOS relinker Pending
Focused Vulkan/performance runs Reported by author; not independently run
Raw combined-merge output with #10720
CONFLICT (content): Merge conflict in core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp

Negative control

Assertion Change under test Result
The NaN and vector-window changes preserve behavior and improve the reported title workload Author reports current-main versus change runs, full Vulkan CTest, and validation-layer comparison Evidence and raw summaries are included in the PR body; I did not run the GPU control locally

Findings

Blocking

  • Coordinate and declare the overlapping work. #4287 remains open and changes the same nanResultF32 NaN selection behavior; the PR says this is offered in its place, but no agreement or supersession order is recorded. #10720 also remains open, and a combined merge preview with its current head conflicts in OperandAccess.cpp. The repository requires authors of overlapping PRs to agree on landing order and record it with Depends on. Please coordinate with the affected authors and update the checklist/body to state the agreed order or replacement plan; rebase and rerun overlap checks where required. This request is about integration, not pressure to close either PR.

Non-blocking

The performance report is substantially complete: paired captures use the same title, scene, machine, driver and resolution; the four trace files and digest output are attached. I did not independently validate those trace binaries or reproduce the Vulkan measurements.

Sources

Not verified

I did not run the full CTest suite, Vulkan validation tests, GPU capture, the SRT tape path, or console/title tests. Hosted product Linux is skipped and macOS relinker checks were still pending. Author-reported test runs and trace measurements are not my own runs.

To get this to a good state

Record an author-agreed integration order/replacement plan for #4287 and #10720, then rebase and rerun the overlap check. I will review the updated head and retest the affected integration paths.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5688739314 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12548#pullrequestreview-5688739314). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T19:46:27Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The performance evidence is present, but this branch overlaps open PRs #4287 and #10720 without recording an agreed integration order; combining it with #10720 produces a source conflict. ## What I ran - Reviewed exact head `4dee5b5e3296c643731e19eca13ddad80d1e49ab` against base `319621ba2e578bd053b0baba2877fe70520e0737`; current-main merge tree `db3ff82497c56456347fdd03f9822d02a37bb553` is clean. - Ran `git diff --check refs/review/current-main...refs/review/12548` — pass, no output. - Compared both declared related PRs: #4287 is open and changes the same `nanResultF32` behavior; #10720 is open and changes the same operand-access logic. Pairwise merge with #4287 is clean, but pairwise merge with #10720 reports a content conflict in `OperandAccess.cpp`. - Inspected the new NaN-propagation emitter/evaluator and finite-set vector-window narrowing logic. No separate correctness defect was established in that source inspection. - Refreshed hosted checks: Windows, Ubuntu/Windows relinker, relinker ASan, conventions, eligibility, labels and report pass; Linux product and specialized jobs are skipped; macOS relinker checks are pending. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Diff check | Pass | | Merge preview with #4287 | Clean tree; same NaN-result logic is being proposed | | Merge preview with #10720 | Content conflict in `OperandAccess.cpp` | | Performance report requirements | Body includes paired same-scene summaries, four attached traces and `trace_digest.py` output; captures report no dropped events | | Hosted Windows and Ubuntu/Windows relinker, ASan, policy | Pass | | Hosted Linux product | Skipped | | Hosted macOS relinker | Pending | | Focused Vulkan/performance runs | Reported by author; not independently run | <details> <summary>Raw combined-merge output with #10720</summary> ```text CONFLICT (content): Merge conflict in core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp ``` </details> ## Negative control | Assertion | Change under test | Result | |---|---|---| | The NaN and vector-window changes preserve behavior and improve the reported title workload | Author reports current-main versus change runs, full Vulkan CTest, and validation-layer comparison | Evidence and raw summaries are included in the PR body; I did not run the GPU control locally | ## Findings ### Blocking - **Coordinate and declare the overlapping work.** #4287 remains open and changes the same `nanResultF32` NaN selection behavior; the PR says this is offered in its place, but no agreement or supersession order is recorded. #10720 also remains open, and a combined merge preview with its current head conflicts in `OperandAccess.cpp`. The repository requires authors of overlapping PRs to agree on landing order and record it with `Depends on`. Please coordinate with the affected authors and update the checklist/body to state the agreed order or replacement plan; rebase and rerun overlap checks where required. This request is about integration, not pressure to close either PR. ### Non-blocking The performance report is substantially complete: paired captures use the same title, scene, machine, driver and resolution; the four trace files and digest output are attached. I did not independently validate those trace binaries or reproduce the Vulkan measurements. ## Sources - [NaN propagation and window narrowing changes at this PR head](https://github.com/boykopovar/AnyPS5/blob/4dee5b5e3296c643731e19eca13ddad80d1e49ab/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp) - [Window-index analysis at this PR head](https://github.com/boykopovar/AnyPS5/blob/4dee5b5e3296c643731e19eca13ddad80d1e49ab/core/shader/recompiler/Optimization/src/VectorWindowIndexNarrower.cpp) - [Open competing NaN-result PR #4287](https://github.com/boykopovar/AnyPS5/pull/4287) - [Open related fast-f32 PR #10720](https://github.com/boykopovar/AnyPS5/pull/10720) - [Contribution rule for overlapping PRs](https://github.com/boykopovar/AnyPS5/blob/319621ba2e578bd053b0baba2877fe70520e0737/CONTRIBUTING.md) ## Not verified I did not run the full CTest suite, Vulkan validation tests, GPU capture, the SRT tape path, or console/title tests. Hosted product Linux is skipped and macOS relinker checks were still pending. Author-reported test runs and trace measurements are not my own runs. ## To get this to a good state Record an author-agreed integration order/replacement plan for #4287 and #10720, then rebase and rerun the overlap check. I will review the updated head and retest the affected integration paths.
adriadam10 commented 2026-10-28 19:51:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T19:51:20Z.

Review: CHANGES_REQUESTED


Checked the diff against the existing nanResultF32 rule. The NaN branch keeps the same bits (the legacy mul/mad forms zero the factors before the call, the invalid-product guard for a NaN addend is kept, the SRT evaluator applies the same order), and the window narrower falls back whenever any access is a store or an index is unbounded. The numbers are clear. Two things block the merge:

  • Overlap, no order. OperandAccess.cpp:345-351 rewrites the same nanResultF32 body that #4287 reduces (waiting for title numbers, with @oneandonlydean's ordering "#4287 first, then #10720 rebases onto it"), and #10720 changes the same lines behind APS5_FAST_F32. Please say which of the three lands and how: either list #4287/#10720 in Depends on and rebase on the one that goes first, or state that this replaces #4287 and why the branch version is better, and show that it still merges with #10720 (it conflicts today, as MarcZX10 reported).
  • Unrelated behaviour change. SrtEvaluator.cpp:372 turns if (value.ArgumentCount() < *arguments) return true; into return false; for every opcode in evaluatedArguments, not only NanPropagateF32. Drop it, or explain why it is needed and add a test where it changes the result.

Smaller: docs/dev/debt/shader.md is accurate, but the 16-value limit of the narrower and the compare-chain cost are unmeasured; a line in Tested on a program with many listed reads would settle that.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5688796713 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12548#pullrequestreview-5688796713). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T19:51:20Z. **Review:** CHANGES_REQUESTED --- Checked the diff against the existing `nanResultF32` rule. The NaN branch keeps the same bits (the legacy mul/mad forms zero the factors before the call, the invalid-product guard for a NaN addend is kept, the SRT evaluator applies the same order), and the window narrower falls back whenever any access is a store or an index is unbounded. The numbers are clear. Two things block the merge: - **Overlap, no order.** `OperandAccess.cpp:345-351` rewrites the same `nanResultF32` body that #4287 reduces (waiting for title numbers, with @oneandonlydean's ordering "#4287 first, then #10720 rebases onto it"), and #10720 changes the same lines behind `APS5_FAST_F32`. Please say which of the three lands and how: either list #4287/#10720 in **Depends on** and rebase on the one that goes first, or state that this replaces #4287 and why the branch version is better, and show that it still merges with #10720 (it conflicts today, as MarcZX10 reported). - **Unrelated behaviour change.** `SrtEvaluator.cpp:372` turns `if (value.ArgumentCount() < *arguments) return true;` into `return false;` for every opcode in `evaluatedArguments`, not only `NanPropagateF32`. Drop it, or explain why it is needed and add a test where it changes the result. Smaller: `docs/dev/debt/shader.md` is accurate, but the 16-value limit of the narrower and the compare-chain cost are unmeasured; a line in Tested on a program with many listed reads would settle that.
adriadam10 commented 2026-10-31 17:18:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-31T17:18:27Z.

Review: CHANGES_REQUESTED


Checked the new head against our last review. The SrtEvaluator.cpp change is fixed in 965b8775d8: the short-argument path is back to return true and only NanPropagateF32 takes the new case.

One point is still open:

  • Overlap, no order. OperandAccess.cpp (the nanResultF32 rewrite) still conflicts with #4287 and with #10720 (git merge-tree against current heads), and the body says Depends on: none. Please say which of the three lands and how: either list the one that goes first in Depends on and rebase onto it, or state that this replaces #4287 and why, and show that it still merges with #10720.

Smaller, optional: a line in Tested on a program with many listed reads would settle the 16-value limit of the narrower and its compare-chain cost.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724024898 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12548#pullrequestreview-5724024898). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-31T17:18:27Z. **Review:** CHANGES_REQUESTED --- Checked the new head against our last review. The `SrtEvaluator.cpp` change is fixed in 965b8775d8: the short-argument path is back to `return true` and only `NanPropagateF32` takes the new case. One point is still open: - **Overlap, no order.** `OperandAccess.cpp` (the `nanResultF32` rewrite) still conflicts with #4287 and with #10720 (`git merge-tree` against current heads), and the body says `Depends on: none`. Please say which of the three lands and how: either list the one that goes first in **Depends on** and rebase onto it, or state that this replaces #4287 and why, and show that it still merges with #10720. Smaller, optional: a line in Tested on a program with many listed reads would settle the 16-value limit of the narrower and its compare-chain cost.

Pull request closed

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!12548
No description provided.