Skip to content

perf(shader): let APS5_FAST_F32 compile f32 arithmetic with host float rules - #10720

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
Meh7an:perf/shader-fast-f32
Nov 1, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
Meh7an:perf/shader-fast-f32

Conversation

@Meh7an

@Meh7an Meh7an commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

APS5_FAST_F32 (set to anything but 0) compiles f32 arithmetic with the host GPU's float rules instead of emulating RDNA's.

  • nanResultF32 returns the instruction's host result. On main it picks RDNA's NaN: the first NaN source, quieted in IEEE mode; else 0xffc00000 when the result is NaN.
  • f32DenormalFlushFor asks for no software flush. On main it emulates RDNA's denormal flush in software wherever the device's own flush (ProbeFloat32FlushToZero) does not cover the instruction.
  • The shader disk cache keeps the two modes apart (SourceVersion differs).

Results differ from RDNA's only when a result is a NaN (its sign and payload bits) or a denormal (the host's rules decide whether it is flushed). The switch is off by default, so nothing changes unless it is set.

A question for the maintainers. On the page measured below, the exact rules cost about a quarter of the GPU time. Would you take host rules as the default, with an exact opt-in, the way v_rcp_f32 uses the driver's division unless APS5_EXACT_RCP is set? I kept it opt-in here so that is your call. If you'd rather have it as the default, I'll flip it in this PR and rename the switch.

Test. agc_driver_f32_arithmetic_nan_fast (new) runs the f32 NaN program of agc_driver_f32_arithmetic_nan with APS5_FAST_F32=1. Every non-NaN result must match RDNA as before; a result that RDNA gives as a NaN only has to be a NaN. Without that allowance it fails at lane 0's v_add_f32, which returns 0x7fffffff (NVIDIA's NaN) where RDNA returns 0x7f812345. The default test is unchanged.

Related. Both of these stay exact; this switch is for users who accept host NaN payloads and denormals:

tools/pr_overlap.py lists one conflict: #4287 rewrites the body of nanResultF32, where this PR adds an early return as the first line. The proposed order is #4287 first (comment). Once it merges, this PR rebases onto it and keeps that line as the function's first statement. It found no other overlap. Of the PRs it could not compare, #5925, #6858 and #6924 only call ShaderDiskCache::SourceVersion(), which returns each mode's own version.

Tested

Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 2080 Ti, driver 617.14, i9-9900K, on main 29f539a.

Sonic Origins Plus (PPSA05324), Sonic 2 page of the main menu, main's defaults otherwise. One build, two arms: the default (exact) and APS5_FAST_F32=1. Each arm got one warm-up boot (each mode has its own shader cache version), then one traced round (APS5_TRACE_SECONDS=200:15). The build is 991731d42276, which differs from this PR's head only in the test and its registration.

frame p50 (ms) GPU busy per present (ms) Driver.Packet (ms/frame) title FPS (median of six)
default (exact) 82.9 68.7 81.8 12.99
APS5_FAST_F32=1 82.5 50.5 82.3 12.75
  • GPU busy per present drops by 18.2 ms (-26 %).
  • The queue worker is about 97 % busy in both arms, so on this page the frame time stays bound by it. The warm-up boots read 12.57 (exact) and 13.02 (fast) FPS: the title readings move within noise.
  • The scene renders the same in both arms (per-reading thumbnails).
  • ctest (2159 tests) on main plus this PR: everything passes except agc_driver_depth_plane_partial_store ("repeated lookups of the first layer of an unchanged array proved no refresh"), which fails the same way on plain main 29f539a on this machine.
  • ctest --test-dir build -R "f32|f16|nan|denormal|rcp|float|fma" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 88/88 on main, 89/89 on this PR (the extra one is agc_driver_f32_arithmetic_nan_fast). Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- line.

The two summaries and their digests (both traces are attached):

fast-f32-s2-traces.zip

default (exact)

seconds 200:15 from present 3536: 179 presents, frame p50 82.9 / p90 91.5 / p99 99.3 / max 100.9 ms, GPU busy 68.7 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 991731d42276, dropped: yes

{"commit":"991731d42276","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3536,"ms":15057.73},"presents":179,"frame_ms":{"p50":82.867,"p90":91.489,"p99":99.282,"max":100.922},"gpu_busy_ms_per_present":68.708,"worker_busy_pct":{"queue worker 0x0":97.332},"top_phases_ms_per_frame":{"Driver.Packet":81.817,"Driver.Packet.draw":63.141,"Graphics.Draw":62.47,"Driver.Draw":62.079,"Graphics.Draw.draw_and_resource_release":51.314,"Driver.Draw.shader_compile_and_link":41.913,"Shader.DrawStage":31.065,"Driver.Present":27.175},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.65,"events_lost":424742,"totals_full":false},"draw committer":{"events_full_after_s":12.969,"events_lost":42124,"totals_full":false}},"trace":"aps5-trace-991731d42276-35344.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 3693: 100.9 ms at 13186 ms: batch (gpu) 68.3, VideoOut.Flip (presenter) 25.3, VideoOut.Flip.present (presenter) 25.1, Driver.Present (presenter) 25.1
  • present 3599: 99.3 ms at 5215 ms: batch (gpu) 67.7, Driver.Packet (queue worker 0x0) 60.9, Graphics.Draw (draw committer) 50.5, Driver.Packet.draw (queue worker 0x0) 49.2
  • present 3641: 97.4 ms at 8800 ms: batch (gpu) 68.8, Graphics.Draw (draw committer) 48.7, Graphics.Draw.draw_and_resource_release (draw committer) 42.8, VideoOut.Flip (presenter) 28.0
  • present 3709: 97.0 ms at 14541 ms: batch (gpu) 69.7, VideoOut.Flip (presenter) 27.2, VideoOut.Flip.present (presenter) 27.1, Driver.Present (presenter) 27.1
  • present 3603: 96.7 ms at 5570 ms: batch (gpu) 70.1, Graphics.Draw (draw committer) 51.9, Graphics.Draw.draw_and_resource_release (draw committer) 44.8, Driver.Packet (queue worker 0x0) 41.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.7 (1 %) 0.0 (0 %) 83.4 0.6 Shader.ResolveGraphicsStagesAbi 0.3, Shader.ResolveGraphicsAbi 0.3
queue worker 0x0 16.3 (19 %) 0.0 (0 %) 67.8 73.6 Driver.Packet 16.3, Driver.Completion 0.0
draw committer 32.6 (39 %) 0.4 (1 %) 51.0 50.7 Graphics.Draw 30.9, Recorder.Submit 1.2
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
presenter 0.7 (1 %) 26.7 (32 %) 56.8 0.0 VideoOut.Flip 27.2, Driver.Present 0.2
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsStagesAbi 0.1, Shader.ResolveGraphicsAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 83.9 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
gpu 68.6 (82 %) 0.0 (0 %) 15.5 0.0 batch 68.6

Largest slices (ms per frame, inclusive, all threads): batch 68.6, Graphics.Draw 30.9, Driver.Present 27.2, VideoOut.Flip 27.2, VideoOut.Flip.present 27.0, Driver.Present.render_fence_wait 26.6, Vulkan.Retire 26.6, Vulkan.Retire.wait 26.6, Graphics.Draw.draw_and_resource_release 25.1, Driver.Packet 16.3

Longest waits

  • Driver.Present.render_fence_wait (presenter) 33.0 ms at 1 ms, present 3536
  • Driver.Present.render_fence_wait (presenter) 31.1 ms at 498 ms, present 3542
  • Driver.Present.render_fence_wait (presenter) 30.6 ms at 3151 ms, present 3574
  • Driver.Present.render_fence_wait (presenter) 30.6 ms at 4471 ms, present 3590
  • Driver.Present.render_fence_wait (presenter) 30.2 ms at 4631 ms, present 3592
  • Driver.Present.render_fence_wait (presenter) 30.0 ms at 3316 ms, present 3576
  • Driver.Present.render_fence_wait (presenter) 30.0 ms at 4550 ms, present 3591
  • Driver.Present.render_fence_wait (presenter) 29.8 ms at 659 ms, present 3544
  • Driver.Present.render_fence_wait (presenter) 29.8 ms at 3230 ms, present 3575
  • Driver.Present.render_fence_wait (presenter) 29.8 ms at 579 ms, present 3543

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

  • batch 4018: 13.5 ms at 4629 ms, present 3591: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 1.1, Driver.Packet.dispatch (queue worker 0x0) 0.5, Driver.Dispatch (queue worker 0x0) 0.5, Vulkan.Dispatch (queue worker 0x0) 0.3
  • batch 9869: 13.5 ms at 11519 ms, present 3672: GPU no ranges; recorded by no CPU slices
  • batch 11537: 13.4 ms at 13453 ms, present 3695: GPU no ranges; recorded by no CPU slices
  • batch 11612: 13.4 ms at 13537 ms, present 3696: GPU no ranges; recorded by no CPU slices
  • batch 11031: 13.4 ms at 12847 ms, present 3688: GPU no ranges; recorded by no CPU slices

APS5_FAST_F32=1

seconds 200:15 from present 3652: 177 presents, frame p50 82.5 / p90 94.9 / p99 110.9 / max 115.6 ms, GPU busy 50.5 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 991731d42276, dropped: yes

{"commit":"991731d42276","dirty":false,"env":{"APS5_FAST_F32":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":3652,"ms":15012.498},"presents":177,"frame_ms":{"p50":82.519,"p90":94.855,"p99":110.893,"max":115.578},"gpu_busy_ms_per_present":50.452,"worker_busy_pct":{"queue worker 0x0":97.16},"top_phases_ms_per_frame":{"Driver.Packet":82.34,"Driver.Packet.draw":63.581,"Driver.Draw":62.584,"Graphics.Draw":62.527,"Graphics.Draw.draw_and_resource_release":51.211,"Driver.Draw.shader_compile_and_link":42.519,"Shader.DrawStage":31.644,"Shader.DrawStage.materialize":19.099},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.696,"events_lost":427832,"totals_full":false},"draw committer":{"events_full_after_s":13.125,"events_lost":37963,"totals_full":false}},"trace":"aps5-trace-991731d42276-33916.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 3724: 115.6 ms at 6102 ms: Graphics.Draw (draw committer) 55.1, batch (gpu) 51.0, Graphics.Draw.draw_and_resource_release (draw committer) 49.5, VideoOut.Flip (presenter) 18.1
  • present 3727: 110.9 ms at 6395 ms: Graphics.Draw (draw committer) 63.5, batch (gpu) 51.9, Graphics.Draw.draw_and_resource_release (draw committer) 44.2, VideoOut.Flip (presenter) 15.2
  • present 3808: 108.3 ms at 13233 ms: batch (gpu) 51.6, VideoOut.Flip (presenter) 16.8, VideoOut.Flip.present (presenter) 16.7, Driver.Present (presenter) 16.7
  • present 3762: 107.5 ms at 9314 ms: Graphics.Draw (draw committer) 60.8, batch (gpu) 51.7, Graphics.Draw.draw_and_resource_release (draw committer) 51.6, VideoOut.Flip (presenter) 19.2
  • present 3676: 107.3 ms at 2035 ms: Driver.Packet (queue worker 0x0) 71.6, Driver.Packet.draw (queue worker 0x0) 61.2, Driver.Draw (queue worker 0x0) 60.6, Graphics.Draw (draw committer) 54.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.7 (1 %) 0.0 (0 %) 84.1 0.7 Shader.ResolveGraphicsAbi 0.3, Shader.ResolveGraphicsStagesAbi 0.3
queue worker 0x0 17.0 (20 %) 0.0 (0 %) 67.8 74.7 Driver.Packet 17.0, Driver.Completion 0.0
draw committer 34.0 (40 %) 0.4 (0 %) 50.4 49.9 Graphics.Draw 32.1, Recorder.Submit 1.4
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
presenter 0.6 (1 %) 17.3 (20 %) 67.0 0.1 VideoOut.Flip 17.7, Driver.Present 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.3 (0 %) 0.0 (0 %) 84.5 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
title 0.2 (0 %) 0.0 (0 %) 84.6 0.1 Shader.ResolveGraphicsAbi 0.1, Shader.ResolveGraphicsStagesAbi 0.1
gpu 50.4 (59 %) 0.0 (0 %) 34.4 0.0 batch 50.4

Largest slices (ms per frame, inclusive, all threads): batch 50.4, Graphics.Draw 32.1, Graphics.Draw.draw_and_resource_release 26.4, Driver.Present 17.7, VideoOut.Flip 17.7, VideoOut.Flip.present 17.6, Driver.Present.render_fence_wait 17.2, Vulkan.Retire 17.2, Vulkan.Retire.wait 17.2, Driver.Packet 17.0

Longest waits

  • Driver.Present.render_fence_wait (presenter) 20.4 ms at 2 ms, present 3652
  • Driver.Present.render_fence_wait (presenter) 19.6 ms at 14079 ms, present 3818
  • Driver.Present.render_fence_wait (presenter) 19.0 ms at 14600 ms, present 3824
  • Driver.Present.render_fence_wait (presenter) 18.9 ms at 12529 ms, present 3800
  • Driver.Present.render_fence_wait (presenter) 18.9 ms at 14180 ms, present 3819
  • Driver.Present.render_fence_wait (presenter) 18.6 ms at 9908 ms, present 3769
  • Driver.Present.render_fence_wait (presenter) 18.6 ms at 9314 ms, present 3762
  • Driver.Present.render_fence_wait (presenter) 18.5 ms at 4997 ms, present 3711
  • Driver.Present.render_fence_wait (presenter) 18.5 ms at 9588 ms, present 3765
  • Driver.Present.render_fence_wait (presenter) 18.5 ms at 7247 ms, present 3737

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

  • batch 10046: 10.9 ms at 11748 ms, present 3790: GPU no ranges; recorded by Graphics.Draw (draw committer) 2.0, Graphics.Draw.draw_and_resource_release (draw committer) 1.9, Recorder.Submit (draw committer) 0.1, Resources.Prepare (draw committer) 0.1
  • batch 9469: 10.9 ms at 11068 ms, present 3782: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.6, Graphics.Draw.draw_and_resource_release (draw committer) 3.2, Graphics.Draw.validate (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 493: 10.9 ms at 617 ms, present 3658: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.9, Graphics.Draw.draw_and_resource_release (draw committer) 3.5, Graphics.Draw.validate (draw committer) 0.2, Recorder.Submit (draw committer) 0.2
  • batch 6645: 10.8 ms at 7830 ms, present 3743: GPU no ranges; recorded by Graphics.Draw (draw committer) 2.1, Graphics.Draw.draw_and_resource_release (draw committer) 2.0, Resources.Prepare (draw committer) 0.1, Recorder.Submit (draw committer) 0.1
  • batch 6574: 10.7 ms at 7751 ms, present 3742: GPU no ranges; recorded by Graphics.Draw (draw committer) 2.2, Graphics.Draw.draw_and_resource_release (draw committer) 2.0, Recorder.Submit (draw committer) 0.1, Resources.Prepare (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: perf(shader): pick the f32 NaN result with one quiet and one fallback select #4287
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11 Pro 10.0.26300
  • AI-assisted: yes

@github-actions github-actions Bot added perf Performance change perf numbers missing perf pull request without a before and after summary line labels Oct 24, 2026
@github-actions

Copy link
Copy Markdown

This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 7d6cc57fdf7fb9b6ad5e683807329d4a8a24d50a. The opt-in switch is applied consistently to NaN-result selection, denormal handling, and shader-cache versioning; the PR reports paired focused Vulkan tests and performance traces. Local diff-check and conventions pass; I could not run the GPU tests in this environment. One integration blocker remains: open #4287 changes the body of nanResultF32, where this PR adds its early return. The description says whichever lands second should preserve the line, but the checklist says Depends on: none and does not record an agreed order. CONTRIBUTING requires coordinating overlapping changes and recording the dependency/order. Please confirm the plan with the other author and update the checklist.

@Meh7an

Meh7an commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Thanks. I proposed the order on #4287 (comment): #4287 goes first and this PR rebases onto it, so the checklist now says Depends on: #4287. The description's overlap paragraph says the same. I'll rebase as soon as #4287 merges.

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Linux/RADV, first AMD run — APS5_FAST_F32 checks out on three AMD architectures, including the one that emulates the f32 denormal flush.

main 50757b01c vs this PR 7d6cc57fd, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -V, RADV Mesa 25.2.8, kernel 6.8.

GPU (RADV) agc_driver_f32_arithmetic_nan (exact, main & PR) agc_driver_f32_arithmetic_nan_fast (PR)
RX 7900 GRE (NAVI31, 1002:744c, RDNA3) pass pass
Ryzen 7 7800X3D iGPU (RAPHAEL, 1002:164e, RDNA2) pass pass
RX Vega 56 (VEGA10, 1002:687f, GCN5) pass pass

No VUID- error on any arm. The fast path does engage: its startup probe reports f32 denormal flush: emulated (969-975 of 5472 probe results differ from the emulated flush), against 0 on NAVI31/RAPHAEL (hardware flush) and 6 on VEGA10 (emulated) in exact mode — yet every non-NaN result still matches RDNA, so the NaN program passes. The Vega is the case worth calling out: it's the AMD part that emulates the denormal flush (and the one with the GCN5 transcendental quirks in #3882), and APS5_FAST_F32 is correct there too.

On the default-vs-opt-in question: at least for this test, host rules are correct on RADV across GCN5/RDNA2/RDNA3. I can't speak to the perf tradeoff without trace_digest numbers from a title.

AI-assisted: yes.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 12548 core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp L344-355

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1896 docs/dev/ENVIRONMENT.md
PR 4472 docs/dev/ENVIRONMENT.md
PR 5609 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6188 core/shader/recompiler/Recompiler.hpp
PR 6235 core/shader/recompiler/Recompiler.hpp
PR 6280 core/shader/recompiler/ShaderDiskCache.cpp
PR 6412 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6488 core/shader/recompiler/ShaderDiskCache.cpp
PR 6501 docs/dev/ENVIRONMENT.md
PR 6858 core/shader/recompiler/ShaderDiskCache.cpp
PR 6924 core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 7223 core/shader/recompiler/ShaderDiskCache.cpp
PR 7410 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/Translation/src/DispatchInstructions.cpp
core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp
PR 7449 docs/dev/ENVIRONMENT.md
PR 7457 docs/dev/ENVIRONMENT.md
PR 7514 docs/dev/ENVIRONMENT.md
PR 7604 docs/dev/ENVIRONMENT.md
PR 7642 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 7684 core/shader/recompiler/ShaderDiskCache.cpp
PR 7689 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 7694 core/shader/recompiler/ShaderDiskCache.cpp
PR 7922 docs/dev/ENVIRONMENT.md
PR 8004 core/shader/recompiler/Recompiler.hpp
docs/dev/ENVIRONMENT.md
PR 8484 docs/dev/ENVIRONMENT.md
PR 8542 docs/dev/ENVIRONMENT.md
PR 8939 core/shader/recompiler/ShaderDiskCache.cpp
PR 9012 docs/dev/ENVIRONMENT.md
PR 9020 core/shader/recompiler/Recompiler.hpp
PR 9176 docs/dev/ENVIRONMENT.md
PR 9183 core/shader/recompiler/ShaderDiskCache.cpp
PR 9248 docs/dev/ENVIRONMENT.md
PR 9287 docs/dev/ENVIRONMENT.md
PR 9289 docs/dev/ENVIRONMENT.md
PR 9335 core/shader/recompiler/Recompiler.hpp
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 9387 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 9712 docs/dev/ENVIRONMENT.md
PR 9748 core/shader/recompiler/Recompiler.hpp
PR 9790 core/shader/recompiler/ShaderDiskCache.cpp
PR 9852 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 9898 docs/dev/ENVIRONMENT.md
PR 9969 core/shader/recompiler/ShaderDiskCache.cpp
PR 10026 docs/dev/ENVIRONMENT.md
PR 10069 docs/dev/ENVIRONMENT.md
PR 10193 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 10351 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 10359 core/shader/recompiler/Recompiler.hpp
PR 10382 docs/dev/ENVIRONMENT.md
PR 10442 docs/dev/ENVIRONMENT.md
PR 10547 core/shader/recompiler/Recompiler.hpp
docs/dev/ENVIRONMENT.md
PR 10652 core/shader/recompiler/Recompiler.hpp
PR 10846 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 10941 core/shader/recompiler/Translation/src/VectorInstructions.cpp
PR 11351 core/shader/recompiler/Recompiler.hpp
docs/dev/ENVIRONMENT.md
PR 11435 docs/dev/ENVIRONMENT.md
PR 11436 docs/dev/ENVIRONMENT.md
PR 11483 core/shader/recompiler/Recompiler.hpp
PR 11490 core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp
PR 11551 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 12323 docs/dev/ENVIRONMENT.md
PR 12544 docs/dev/ENVIRONMENT.md
PR 12746 docs/dev/ENVIRONMENT.md
PR 12828 core/shader/recompiler/Recompiler.hpp
PR 13263 docs/dev/ENVIRONMENT.md
PR 13793 docs/dev/ENVIRONMENT.md
PR 13809 docs/dev/ENVIRONMENT.md
PR 13863 docs/dev/ENVIRONMENT.md
PR 13920 docs/dev/ENVIRONMENT.md
PR 13928 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 13929 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/ENVIRONMENT.md
PR 14051 docs/dev/ENVIRONMENT.md
PR 14235 docs/dev/ENVIRONMENT.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is opt-in, changes the shader cache key, and the author reports paired focused Vulkan runs with validation enabled and no VUIDs, so the change itself is well scoped. I would keep the default decision with maintainers as the PR does. One evidence caveat for the performance data: both trace captures say trace_dropped: true, with hundreds of thousands of lost events on the queue worker and draw committer. GPU-busy-per-present is still reported by the trace tool, but please clarify whether that aggregate remains complete when event buffers fill, and attach/compare tools/trace_digest.py summaries as the repository performance rule requires. The current PR text has detailed summaries but no visible trace-digest output in the body; I cannot validate the 26% GPU-busy claim from the pasted excerpts alone. I am leaving this as a non-blocking comment pending that clarification.

@github-actions github-actions Bot added build shader core/shader docs agc libSceAgc* labels Oct 24, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor

I downloaded the attached trace archive and ran python3 tools/trace_digest.py on both captures. The digest reproduces the submitted summary values: exact 68.708 ms GPU busy/present and p50 82.867 ms; fast 50.452 ms GPU busy/present and p50 82.519 ms (about 26.6% lower GPU busy, with essentially unchanged p50). It also confirms both captures are marked dropped: the exact trace lost 424,742 queue-worker and 42,124 draw-committer events; the fast trace lost 427,832 and 37,963 respectively. The fast capture p90/p99 are higher (94.855/110.893 ms vs 91.489/99.282 ms).

Please include the digest outputs in the PR report and clarify whether gpu_busy_ms_per_present remains complete when those event buffers fill; if it does not, please recapture with sufficient trace capacity before using the 26% value as evidence. I did not run a new title benchmark. I would describe the present result as lower reported GPU busy time with unchanged median frame time, not a demonstrated frame-time gain.

@oneandonlydean oneandonlydean self-assigned this Oct 25, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 7d6cc57fdf7fb9b6ad5e683807329d4a8a24d50a. The checklist now records Depends on: #4287, matching the stated merge order. The attached archive and body include the trace_digest.py summaries for both arms, with dropped-event counts and the higher p90/p99 for the fast arm disclosed. I checked the current trace implementation: gpu_busy_ms_per_present is derived from the Vulkan present counters, which accumulate completed GPU timestamp batch durations; it does not use the bounded per-thread event buffers that dropped queue-worker and draw-committer slices in these traces. The JSON also does not report the GPU range snapshot as dropped. That supports the reported aggregate GPU-busy metric while limiting the dropped traces’ completeness for CPU slice attribution. The PR reports paired main/change validation runs and no VUIDs on the RTX 2080 Ti; I did not rerun the Vulkan tests locally. Product jobs are skipped by hosted PR policy. The opt-in remains off by default as described. No remaining review blocker found.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Meh7an Thanks for asking. Exact stays the default: titles should get RDNA's results unless someone opts out, and a quarter of the GPU time on one page doesn't change that for me. Host rules are fine as the opt-in through APS5_FAST_F32, as this PR has it. Your order works: #4287 first, then this PR rebases onto it.

CPritch added a commit to CPritch/AnyPS5 that referenced this pull request Oct 26, 2026
…nversions

boykopovar#10720 skips the emulated f32 denormal flush with an early return near the
end of f32DenormalFlushFor. On boykopovar#10720's base, v_min_f32, v_max_f32,
v_min3_f32, v_max3_f32, v_med3_f32 and the f32 conversions (v_cvt_i32_f32,
v_cvt_u32_f32, v_cvt_rpi_i32_f32, v_cvt_flr_i32_f32, v_frexp_exp_i32_f32,
v_cvt_f64_f32, v_cvt_pknorm_i16_f32, v_cvt_pknorm_u16_f32, v_cvt_pk_u8_f32,
v_cvt_pkrtz_f16_f32 and v_cvt_f16_f32) reached that return. Since boykopovar#6009
(min and max in f32 denormal modes 1 and 2) and boykopovar#10595 (conversions in the
same modes) they return from the switch first, so with APS5_FAST_F32 set
they still flushed.

Under APS5_FAST_F32 they now return no flush where they returned one, as on
boykopovar#10720's base. The f32 compares, which share the conversions' return since
boykopovar#10595, get their own return again and keep their flush, as they did on
boykopovar#10720's base; so do the legacy mad and mac forms and the add, sub and mul
forms in denormal modes 1 and 2. With the switch off the translation is
unchanged.
@Betr0x

Betr0x commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

A macOS data point for the opt-in, with a title where the exact rules dominate the frame: SudokuZen (PPSA50001) runs its main menu 2.6× faster with APS5_FAST_F32=1 on Apple Silicon.

Setup: Apple M4, macOS 27.0.1, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), x86-64 Release under Rosetta 2. The tree is main c547deaac plus the macOS PRs I need locally, #9356, #9387 and my write-watch change, with this PR's head 7d6cc57fd merged on top (no conflicts). Main menu at 3840×2160. Each mode got one warm-up boot, then a traced round (APS5_TRACE_SECONDS=20:10), from one build, back to back in the same session.

{"commit":"642de4f3cf0a","dirty":false,"env":{"APS5_TRACE_SECONDS":"20:10"},"gpu":"Apple M4","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","title_id":"PPSA50001","resolution":"3840x2160","presents":166,"frame_ms":{"p50":59.764,"p90":62.323,"p99":67.39,"max":67.85},"gpu_busy_ms_per_present":58.065,"trace_dropped":false}
{"commit":"642de4f3cf0a","dirty":false,"env":{"APS5_FAST_F32":"1","APS5_TRACE_SECONDS":"20:10"},"gpu":"Apple M4","driver":"MoltenVK 1.4.2","os":"Darwin 27.0.0","title_id":"PPSA50001","resolution":"3840x2160","presents":433,"frame_ms":{"p50":22.946,"p90":24.499,"p99":26.495,"max":43.458},"gpu_busy_ms_per_present":21.001,"trace_dropped":false}

Frame p50 59.8 → 22.9 ms (16.7 → 43.7 FPS), GPU busy per present 58.1 → 21.0 ms. Neither trace dropped events. The two .json.gz traces are available if you want them attached.

Where the time goes. The menu's animated backdrop is one pixel shader (code at 0x21ebe9000, about 21.6 KB of ISA). Leaving out only that draw (a local experiment, not part of anything) takes the exact mode from about 16 to 60 FPS. After the resources pass its IR has 54,666 values. Only about 4,100 of them are float arithmetic (1,796 FPMul32, 1,427 FPAdd32, 441 FPSub32, 420 FPFract32). Most of the rest is nanResultF32's pattern: an and 0x7fffffff, a compare with 0x7f800000 and a select for the result and for each source (12,793 BitwiseAnd32, 11,436 SelectU32, 10,405 UGreaterThan32). The menu looks the same in both modes.

Tests on the same build with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: agc_driver_f32_arithmetic_nan and agc_driver_f32_arithmetic_nan_fast pass. The layer loaded, and the log has no VUID- messages.

A note for anyone profiling this on MoltenVK: APS5_PROFILE_GPU_DRAWS attributed this backdrop draw about 4 ms of a 58 ms frame and put 29 ms on a fullscreen fill in the same frame. Only leaving draws out found the real one, so per-draw GPU times on Apple hardware are worth checking that way.

AI-assisted: yes

@TechLevelZero

TechLevelZero commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 7d6cc57 merged onto main 73f4f7e · tested 2026-10-31 18:59 UTC · 27 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,432 passed · 4 failed (0 new, 4 also fail on main) · 50 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,486 of 3,072 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (925 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 47.5 s, ⚠️ agc_driver_graphics 30.5 s, ⚠️ agc_driver_graphics_maps_fallback 30.5 s
Failing on main too (4, not counted against this PR)
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (1, not in the main baseline's validation pass)
agc_driver_f32_arithmetic_nan_fast
Validation IDs already present on main (4 IDs in 426 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (426 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 418 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
Skipped (50)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or pla
Reproduce
git fetch origin 7d6cc57fdf7fb9b6ad5e683807329d4a8a24d50a 73f4f7e06e4f210a8c6570e335fd654dc0a86134
git checkout 73f4f7e06e4f210a8c6570e335fd654dc0a86134 && git merge --no-ff 7d6cc57fdf7fb9b6ad5e683807329d4a8a24d50a
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 31, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@oneandonlydean
oneandonlydean merged commit 5d3ad21 into boykopovar:main Nov 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs perf numbers missing perf pull request without a before and after summary line perf Performance change shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants