Skip to content

perf(shader): leave out the both-zero select of f16 min and max - #7516

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:perf/f16-minmax-ordered-zero
Oct 20, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:perf/f16-minmax-ordered-zero

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What

TranslationContext::minMaxF16Bits picks the result of an f16 min or max by comparing the halves as ordered integers: the low 16 bits sign-extended, with the 15 magnitude bits of a negative half inverted. After that it handled one more case. When both halves were zero (((a | b) & 0x7fff) == 0), it replaced the result with a & b for max and a | b for min.

The ordered integers already handle zeros. +0 maps to 0 and −0 maps to −1, so the compare picks +0 for a max of +0 and −0, and −0 for a min. That is what a & b and a | b give. Every caller passes halves with their upper 16 bits clear: readF16Bits masks them, and the packed path extracts them with BitFieldUExtract. The nested min/max of med3 only feeds those halves back in. So the both-zero select never changes a bit. This PR removes it, which is five instructions fewer per pair (or, and, compare, and/or, select) in every f16 min, max, min3, max3 and med3, scalar and packed.

I checked the equivalence exhaustively on the CPU. The C function below runs the old and the new body on all 2³² pairs of 16-bit halves, for max and for min. The result is pairs=8589934592 diffs=0.

check.c
#include <stdint.h>
#include <stdio.h>
static int32_t order(uint32_t x) { int32_t v = (int32_t)(int16_t)(x & 0xffffu); return v ^ ((v >> 31) & 0x7fff); }
static uint32_t old_(int maxv, uint32_t a, uint32_t b) {
    int ordered = maxv ? order(a) >= order(b) : order(a) < order(b);
    uint32_t either = a | b;
    int bothZero = (either & 0x7fffu) == 0u;
    uint32_t zero = maxv ? (a & b) : either;
    return bothZero ? zero : (ordered ? a : b);
}
static uint32_t new_(int maxv, uint32_t a, uint32_t b) {
    int ordered = maxv ? order(a) >= order(b) : order(a) < order(b);
    return ordered ? a : b;
}
int main(void) {
    unsigned long long diffs = 0, pairs = 0;
    for (int maxv = 0; maxv < 2; ++maxv)
        for (uint32_t a = 0; a < 65536u; ++a)
            for (uint32_t b = 0; b < 65536u; ++b) {
                ++pairs;
                if (old_(maxv, a, b) != new_(maxv, a, b)) ++diffs;
            }
    printf("pairs=%llu diffs=%llu\n", pairs, diffs);
    return diffs != 0;
}

Float16MinMaxBits.cpp's CPU reference keeps its both-zero rule. The test draws ±0 for about one operand in nine, and it now checks the shorter lowering against that rule on the GPU.

Tested

Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02.

  • ctest -R "^agc_|^shader_ir" on 9caecfd: 709/709 pass (3 skipped: host import sparse, sparse dma-buf import, stencil ref export). Among them are the 35 tests matching f16|float16|f32_min_max|half, including agc_driver_float16_min_max_bits and agc_driver_f16_min_max_nan.

SPIR-V size, from agc_shader_replay (Release, ANYPS5_ENABLE_SPIRV_TOOLS off, ANYPS5_NO_SHADER_CACHE=1) on 420 shader requests I had dumped with APS5_DUMP_SHADERS: 355 from MXGP 26 (PPSA30839), 61 from PPSA31162 and 4 from another app. Nine of them change, all from PPSA30839, with 100,279 fewer words in total (−0.28%). The largest is shader_10f9f30000, at 1,130,170 → 1,041,550 words (−7.8%). PPSA31162's largest compute shader (0x1e401c0000, from a separate dump) goes from 1,056,287 to 974,911 words (−7.7%).

Replay CPU time (perf stat -e task-clock), 25 runs per build, interleaved:

Shader main 9caecfd this PR
PPSA31162 0x1e401c0000 1141.0 ± 17.5 ms (median 1135.3) 999.7 ± 13.3 ms (median 999.1)
PPSA30839 0x10f9f30000 1263.1 ± 15.1 ms (median 1261.5) 1100.9 ± 14.0 ms (median 1099.5)

That is 12.4% and 12.8%, more than the size drop. The removed instructions are also work that the passes after translation no longer do.

GPU time of that dispatch. I ran PPSA31162 for 180 s per run with pad input and APS5_PROFILE_GPU=1, using Release libraries of main 9caecfd and of this PR. I did one warm-up run with this PR first, since its SPIR-V makes new shader cache entries, then interleaved the builds. The figures add up the by program entries of every [gputime] line of a run.

Run Presents 0x1e401c0000 dispatches GPU time per dispatch
main 614 493 20.64 ms
this PR 618 509 18.52 ms
main 577 471 21.34 ms
this PR 964 852 15.24 ms

The last run reached a lighter part of the game (964 presents, 122.5 ms of GPU batch time per present against 137 to 145 ms in the others), so it doesn't compare directly. The two runs that reached the same part (614 and 618 presents) put this PR about 10% below main for that dispatch. A main run from earlier the same night gave 20.63 ms over 373 dispatches. That is one comparable run per build, so I'm not claiming a frame time change.

tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists only conflicting PRs that it could not compare on FloatInstructions.cpp. #4072 has the packed path's minMaxLane as a context line. #7332's bothZero is in its own FMA emulation, not this function. #5021 doesn't touch either.

Title capture

As the perf label asks, these are captures of one title and scene on one machine. MXGP26 (PPSA30839) ran from boot with APS5_TRACE_SECONDS=0:60, ANYPS5_NO_SHADER_CACHE=1 and a fresh run directory (cold AnyPS5 and NVIDIA caches), so the shaders compile inside the window. NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04, release libs, Xvfb display, no input. main dbac9fa was captured five times: before the PR captures, after them, and three more times in a row after that. Each PR capture and the first two main captures followed a rebuild of the release libraries; the last three main captures did not, and they came out lower. The change is main with this PR merged on top as a local merge commit (d1c895bb2229). The time is the wall time of the Shader.PrepareArtifact slices on the shader prepare threads in each trace.

capture presents frame p50 / p90 artifacts prepared prepare time, total per artifact, mean / median
main 1 194 16.7 / 32.8 ms 935 87.3 s 93.4 / 27.7 ms
main 2 195 16.7 / 34.0 ms 956 91.4 s 95.6 / 29.6 ms
main 3 166 16.7 / 28.4 ms 961 82.1 s 85.4 / 27.3 ms
main 4 161 16.7 / 27.9 ms 946 77.6 s 82.1 / 24.7 ms
main 5 183 16.7 / 22.7 ms 939 78.4 s 83.5 / 22.8 ms
this PR 185 16.7 / 36.7 ms 925 94.0 s 101.6 / 26.4 ms

The five main captures span 17.7% in total prepare time, and the 13 prepare threads run in parallel with the title, so a title capture can't resolve a recompiler change of a few percent. The replay measurement above is this change's measurement. This PR's capture is above all five main captures in total prepare time. With one capture of the change I can't tell that apart from noise, and the replay measurement above points the other way. I can repeat the capture if that would help.

main 1 trace, digest, main 2 trace, digest, main 3 trace, digest, main 4 trace, digest, main 5 trace, digest, this PR trace, digest

{"commit":"dbac9fa15b61","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":120148.301},"presents":194,"frame_ms":{"p50":16.686,"p90":32.765,"p99":2921.590,"max":112847.624},"gpu_busy_ms_per_present":6.483,"worker_busy_pct":{"queue worker 0x0":88.481,"queue worker 0x20":73.127},"top_phases_ms_per_frame":{"Driver.Packet":1000.862,"Driver.Packet.dispatch":503.561,"Driver.Dispatch":503.451,"Shader.PrepareArtifact":450.125,"Driver.Packet.memory_wait":424.003,"Vulkan.GraphicsPipeline":132.519,"Vulkan.GraphicsPipelineLibrary":126.497,"Vulkan.GraphicsPipelinePrebuild":77.312},"trace_dropped":false,"trace":"aps5-trace-dbac9fa15b61-3.json.gz"}
{"commit":"d1c895bb2229","dirty":false,"env":{"APS5_TRACE_SECONDS":"0:60"},"gpu":"NVIDIA GeForce RTX 4070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 6.8.0-147-generic","resolution":"3840x2160","window":{"spec":"seconds 0:60","first_present":0,"ms":114990.441},"presents":185,"frame_ms":{"p50":16.695,"p90":36.741,"p99":2157.530,"max":108482.339},"gpu_busy_ms_per_present":5.337,"worker_busy_pct":{"queue worker 0x0":88.570,"queue worker 0x20":73.887},"top_phases_ms_per_frame":{"Driver.Packet":1009.773,"Shader.PrepareArtifact":508.047,"Driver.Packet.dispatch":502.516,"Driver.Dispatch":502.453,"Driver.Packet.memory_wait":429.927,"Vulkan.GraphicsPipeline":133.420,"Vulkan.GraphicsPipelineLibrary":126.557,"Vulkan.GraphicsPipelinePrebuild":76.412},"trace_dropped":false,"trace":"aps5-trace-d1c895bb2229-3.json.gz"}

GTA V capture, by @CPritch (comment): PPSA04263 01.010.002, NVIDIA GeForce RTX 5060 Laptop GPU, driver 615.71.09, Linux 7.2.8-zen1-2-zen, Performance mode, the Story prologue after Resume Story with no input. main eaa5c92 against main + this PR at f099292, two runs each in the order A B A B, frames 3500:700, warm caches. Frame p50 was 80.8 and 81.5 ms on main and 79.4 and 79.9 ms with this PR (−1.5 ms, −1.8%). GPU busy per present was 64.5 and 63.3 ms. Other scenes, Fidelity mode and other GPUs were not tested. Summary lines (main, then this PR):

{"commit":"eaa5c9238687","dirty":false,"env":{"APS5_DUMP_FRAMES":"110","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3500:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","resolution":"3840x2160","window":{"spec":"frames 3500:700","first_present":3500,"ms":58017.608},"presents":700,"frame_ms":{"p50":80.761,"p90":92.46,"p99":113.753,"max":122.312},"gpu_busy_ms_per_present":64.223,"worker_busy_pct":{"queue worker 0x0":3675.407},"top_phases_ms_per_frame":{"Driver.EndSubmission":2979.433,"Driver.Packet":64.514,"Graphics.Draw":61.281,"Graphics.Draw.draw_and_resource_release":57.427,"Driver.Packet.draw":51.271,"Driver.Draw":51.055,"VideoOut.Flip":25.73,"Driver.Present":25.713},"trace_dropped":false,"trace":"aps5-trace-eaa5c9238687-1236137.json.gz"}
{"commit":"f4607d9a850d","dirty":false,"env":{"APS5_DUMP_FRAMES":"110","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3500:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","resolution":"3840x2160","window":{"spec":"frames 3500:700","first_present":3500,"ms":56857.493},"presents":700,"frame_ms":{"p50":79.445,"p90":89.182,"p99":112.998,"max":131.95},"gpu_busy_ms_per_present":63.37,"worker_busy_pct":{"queue worker 0x0":3676.402},"top_phases_ms_per_frame":{"Driver.EndSubmission":2919.788,"Driver.Packet":64.085,"Graphics.Draw":59.569,"Graphics.Draw.draw_and_resource_release":55.942,"Driver.Packet.draw":51.03,"Driver.Draw":50.815,"VideoOut.Flip":24.949,"Driver.Present":24.936},"trace_dropped":false,"trace":"aps5-trace-f4607d9a850d-1244055.json.gz"}
  • Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_' -V on main e2a2914 and on main + this PR (f099292, a local merge). main: 815 of 815 pass. With this PR, 814 of 815 pass: agc_driver_compute_user_data_calls aborted in the dynamic loader before the test began (Inconsistency detected by ld.so: ... elf_machine_rela_relative: Assertion ... failed). A test in another PR's run hit the same assertion that evening, so it isn't this change. Rerun 5 times under the layer on the same merge, agc_driver_compute_user_data_calls and its _registered form pass 5 of 5 with no VUIDs. Neither log reports the layer missing. VUIDs on main and with this PR: VUID-vkCmdCopyBuffer-srcBuffer-00118 ×2, VUID-vkCmdDraw-multisampledRenderToSingleSampled-07285 ×2, VUID-vkCmdWaitEvents-srcStageMask-01158 ×2, VUID-VkImageViewCreateInfo-usage-02275 ×6, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 ×18, VUID-vkSetEvent-event-09543 ×2. None is new with this PR.
  • Windows 11 Pro 26220, RTX 4070 (NVIDIA 596.21), WinLibs GCC 15.2 r7, Release, by @screamm (comment): merged with perf(shader): end dead code elimination when no released value is left dead #7494 on main 1d41645 (and with perf(shader): keep one use list per IR value #7520/perf(shader): leave out the dead code pass after masked-select elimination #7522 in a second arm): the 41-test shader and f16/f32 min/max GPU set passes 3 of 3; identical shader-cache entries and replay hashes against two main runs (Showcase PPSA99005, RetroArch PPSA99169, vkQuake PPSA99010), static frames bit-identical, and draw-path recompile time within main's spread.

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 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8); NVIDIA RTX 4070 (596.21), Windows 11 (@screamm)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

minMaxF16Bits compares the halves as ordered integers (the low 16 bits
sign-extended, with the magnitude bits of a negative half inverted),
then replaced the result when both halves were zero: max took a & b and
min took a | b. The ordered integers already put -0 (-1) below +0 (0),
so the compare picks +0 for max and -0 for min, which is what the
both-zero select produced. Every caller passes halves with their upper
16 bits clear (readF16Bits masks them, the packed path extracts them),
and for those all 2^32 pairs of each give the same bits with and
without the select. Each f16 min, max, min3, max3 and med3 now emits
five instructions fewer per pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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 4072 core/shader/recompiler/Translation/src/FloatInstructions.cpp
PR 5021 core/shader/recompiler/Translation/src/FloatInstructions.cpp

@milescoviello

Copy link
Copy Markdown
Contributor Author

The title capture the perf label asks for is now in the description, with both summary lines, the traces and the digests: MXGP26 from boot, a cold shader cache, main dbac9fa against main + this PR (d1c895bb2229). The five main captures span 17.7% in total shader prepare time, so the capture can't resolve this change, and the replay measurement in the description is still its measurement. This PR's capture is above all five main captures in total prepare time. With one capture of the change I can't tell that apart from noise, and the replay measurement above points the other way. I can repeat the capture if that would help.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot removed the perf numbers missing perf pull request without a before and after summary line label Oct 19, 2026
@CPritch

CPritch commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Ran this on GTA V (PPSA04263 01.010.002), Linux 7.2.8-zen1-2-zen, NVIDIA GeForce RTX 5060 Laptop GPU, NVIDIA 615.71.09, Graphics Mode Performance, the Story prologue after Resume Story, with no input.
main eaa5c92 against main eaa5c92 + #7516 at f099292, same machine and session, two runs each in the order A B A B, window frames 3500:700, caches warm, APS5_TRACE_EVENTS=4194304 (BUILD.md's remedy for full trace buffers), no other APS5_TRACE_* or APS5_PROFILE_* switch, log not redirected. The harness navigates the menus from frame dumps in boot and load to present 3300 (APS5_DUMP_FRAMES=110, every 30 presents), which stop before the window.

Frame p50: main 80.8, 81.5 ms, with #7516 79.4, 79.9 ms (-1.5 ms, -1.8 %). GPU busy per present: 64.5 and 63.3 ms.
Not tested: other scenes, Fidelity mode, other GPUs.
Written with AI assistance (Claude Code); measured on the machine above.

Summary lines (main, then the PR):
{"commit":"eaa5c9238687","dirty":false,"env":{"APS5_DUMP_FRAMES":"110","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3500:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","resolution":"3840x2160","window":{"spec":"frames 3500:700","first_present":3500,"ms":58017.608},"presents":700,"frame_ms":{"p50":80.761,"p90":92.46,"p99":113.753,"max":122.312},"gpu_busy_ms_per_present":64.223,"worker_busy_pct":{"queue worker 0x0":3675.407},"top_phases_ms_per_frame":{"Driver.EndSubmission":2979.433,"Driver.Packet":64.514,"Graphics.Draw":61.281,"Graphics.Draw.draw_and_resource_release":57.427,"Driver.Packet.draw":51.271,"Driver.Draw":51.055,"VideoOut.Flip":25.73,"Driver.Present":25.713},"trace_dropped":false,"trace":"aps5-trace-eaa5c9238687-1236137.json.gz"}
{"commit":"f4607d9a850d","dirty":false,"env":{"APS5_DUMP_FRAMES":"110","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3500:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","resolution":"3840x2160","window":{"spec":"frames 3500:700","first_present":3500,"ms":56857.493},"presents":700,"frame_ms":{"p50":79.445,"p90":89.182,"p99":112.998,"max":131.95},"gpu_busy_ms_per_present":63.37,"worker_busy_pct":{"queue worker 0x0":3676.402},"top_phases_ms_per_frame":{"Driver.EndSubmission":2919.788,"Driver.Packet":64.085,"Graphics.Draw":59.569,"Graphics.Draw.draw_and_resource_release":55.942,"Driver.Packet.draw":51.03,"Driver.Draw":50.815,"VideoOut.Flip":24.949,"Driver.Present":24.936},"trace_dropped":false,"trace":"aps5-trace-f4607d9a850d-1244055.json.gz"}

@milescoviello

Copy link
Copy Markdown
Contributor Author

@CPritch thank you for the GTA V run. A B A B order with warm caches on the same session is exactly the comparison this change needed, and a second GPU and title help a lot after my MXGP captures couldn't resolve it. I added your numbers and both summary lines to the description, credited to you, with a link to your comment: frame p50 −1.5 ms (−1.8%) in the prologue on the RTX 5060 Laptop, plus what you list as not tested.

AI-assisted: yes (Claude Code)

@screamm

screamm commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Second GPU and title run, Windows. Host: Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 driver 596.21, Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2 r7, Release. This PR at f099292f8 was merged with #7494 (0aab6c1f3; they share no file) on main 1d4164552 (arm A). A second arm added #7520 (d484281b6) and #7522 (cabf6ad53). All merges were clean. Targeted build: the shader and AGC test targets plus libs.

  • Tests, --repeat until-fail:3, 41 tests: the ^shader_|^agc_shader_ set, agc_driver_float16_min_max_bits, agc_driver_f16_min_max_nan, agc_driver_f32_min_max_nan, agc_driver_float16_ternary_clamp, agc_driver_packed_float16_native, vector_min_max_med16, agc_ir_reclaim, agc_masked_select, agc_constant_phi. All pass 3 of 3 on both arms, none skipped. The exception was shader_cache_runtime_sources on arm A, which hit its 180 s limit once on a loaded host and passed 3 of 3 serially (68 to 108 s).
  • Shader output, three homebrews, fresh shader cache directory per run, 60 s: Showcase PPSA99005 52 cache entries (31 with SPIR-V), RetroArch PPSA99169 24 (12), vkQuake PPSA99010 52 (26). Entry count, keys and payloads are the same for two main runs, arm A and arm B. I matched keys with the source-version word masked and compared payloads with host pointers masked: 5 Showcase entries hold a host address and differ between two main runs too. The two compute requests Showcase dumps with APS5_DUMP_SHADERS replay (agc_shader_replay --spv) to identical SHA-256 on all three builds. Since this PR changes the SPIR-V of every f16 min/max, none of these titles has one. So the title runs below are a no-regression check for this PR, not a measurement of it. The GPU tests above are what exercise the shorter lowering on this card.
  • Cold-cache A B A B, main, A, main, A, then one B run, 90 s each. Settings: ANYPS5_NO_SHADER_CACHE=1, a freshly relinked run directory each time, APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_TRACE_SUMMARY_EVERY=10, APS5_TRACE_SECONDS=0:50. 15 runs with no stop line; every run was still rendering at the timeout. These titles have no Shader.PrepareArtifact slices: their shaders compile on the draw path. So I summed the draw-path "recompile" row of the [draw] driver phases lines over each whole run:
    • vkQuake: main 2594.5 / 2223.2 ms (16.7% apart), arm A 2530.6 / 2473.1 ms (+3.9% on the mean), arm B 2245.5 ms. Presents: 6368 / 6463, A 6581 / 6515, B 6688.
    • Showcase: main 46.8 / 35.0 ms, arm A 42.2 ms, arm B 39.7 ms. The other arm A run (14.1 ms, 126 presents against 700 to 805) ran during a load spike on the host and is not usable.
    • RetroArch: 8924 to 9147 presents per run, p50 8.34 ms in every run. Its phase lines go to the picker child's log, which my harness does not collect.
    • Every arm A and arm B value is within the main spread, which here is about the 17.7% you saw on MXGP26. At this size of prepare work a title capture can't resolve the change on Windows either.
  • Frame dumps (APS5_DUMP_FRAMES, every 10 presents): vkQuake's four static console and loading screens are bit-identical between main and both arms, and frame 0 is identical in all 9 runs. Later frames, and all of Showcase and RetroArch, are animated and differ between two main runs as well, so they can't be compared.
  • A negative control doesn't apply to a bit-exact optimisation. The identical cache entries and replay hashes stand in for it.
  • tools/check_conventions.py --base origin/main and git diff --check: pass on both arms.

Not checked: a full build, the agc_driver_ GPU suite, a title whose shaders use f16 min/max, AMD/Intel, Linux.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @screamm, the first Windows title runs of this one, and the identical cache entries and replay hashes are the right check for a bit-exact change. Added to the description.

AI-assisted: yes (Claude Code)

@adriadam10
adriadam10 merged commit b41a5ff into boykopovar:main Oct 20, 2026
17 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked that every caller passes halves with the upper 16 bits clear (readF16Bits, laneBits via BitFieldUExtract, nested min/max in med3), and that the ordered compare already yields +0 for max and −0 for min on ±0 pairs, so the both-zero select never changed a bit. Replay numbers and @CPritch's GTA V run back the gain; merged.

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @adriadam10 for checking the callers and for the merge.

AI-assisted: yes (Claude Code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf Performance change shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants