perf(shader): compute v_pk_fma_f16 and v_pk_fmac_f16 with OpFmaKHR #11265
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11265"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-25T23:06:07Z.
What
@queeeef's #4072, rebased onto current
main(it was closed only for the rebase and for the SPIR-V pins, which #11184 restored). Step 2 of #11183.v_pk_fma_f16andv_pk_fmac_f16become one f16vec2OpFmaKHRwhen the device has native f16 math (Float16, RTE, preserved denormals) andVK_KHR_shader_fmawithshaderFmaFloat16. Without it, the f32 round-to-odd path stays (#2000).OpFmaKHRas correctly rounded and among the instructions that respectDenormPreserve; the module declaresRoundingModeRTE16. So every non-NaN result isa * b + crounded once to f16, ties to even, denormals kept, which is what the f32 round-to-odd sum computes. NaN,FP16_OVFLand clamp rules run on the result bits as for #3531's add/mul. A FLOAT_MODE that flushes f16 denormals keeps the f32 path, and one that does not round f16 to nearest even still throws, as for add/mul.ShaderValidation's new parameters andVulkanDevice's float controls;FMAKHRandSPV_KHR_fmaare only accepted when the device enabledshaderFmaFloat16, as the review asked;agc_shader_replay --shader-fmaadds that capability to a saved request, like--robust2, so the numbers below can be reproduced fromAPS5_DUMP_SHADERScaptures.Tested
Windows 11 Pro, MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON(spirv-val checks every module, the configuration in which #4072 failed on RADV), onmain1e658521a0.RTX 4090 (NVIDIA 616.92,
shaderFmaFloat16= true): the 45 f16/fma tests (-R "fma|float16|f16|packed_alu|dx10_clamp|dpp8_pk_fmac|dpp16_operands") pass underVK_LAYER_KHRONOS_validationwithANYPS5_NO_SHADER_CACHE=1.agc_driver_packed_float16_nativecompiles each FLOAT_MODE withOpFmaKHR, withoutFMAKHRand without Float16, and requires the same bits from all three:packed f16 native tests passed (589824 halves, fused f16 fma).Intel UHD 770 (
ANYPS5_GPU=Intel, noVK_KHR_shader_fma): the 6 tests that failed in the RADV review pass; the native test reportsno FMAKHR(fallback path).Focused tests,
main1e658521a0vs this PRbd204f0f60(its rebase onto thatmain;git range-diffshows both commits unchanged):ctest -R "fma|float16|f16|packed_alu|dx10_clamp|dpp8_pk_fmac|dpp16_operands"(47 tests),VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(43 layer insertions per run,VK_LOADER_DEBUG=layer),ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1, spirv-val on. Both trees use SPIRV-Tools v2025.5 (pins restored by #13053).mainVUID-lines (main / PR)OpFmaKHR(589824 halves compared)VK_KHR_shader_fmaThe two Intel skips are the same on both sides (
agc_driver_f64_fma_subnormalsandagc_driver_float16_dot: that device has no Float64 or dot2).Full suite (earlier head,
ctest --timeout 120 --parallel 12 -E '^agc_driver_bda_device$'): 2389 of 2391 passed. The two failures,agc_host_import_cut_lifetimeandagc_driver_depth_plane_partial_store, also fail onmain.Size, Grand Theft Auto V compute shaders (79 requests saved in the open world,
agc_shader_replay --spv [--shader-fma]): 1,768,794 -> 1,633,289 SPIR-V words (-7.7 %). Only the two shaders with packed f16 fma change:0x25b390800-24.7 % and0x25b393000(RCAS) -12.6 %.In game (performance form), RTX 4090, NVIDIA 616.92, on
main91a69952c1.What blocks this on plain
main: GTA V stops before the menu (#11513), and then, ~60 s into Story, on #11425. Both arms therefore carry #11580 (the open fix for #11425) and a local revert of #9789, and nothing else. The measured commits are681ef43926(main arm) and02172d7ed3(main arm + this PR), on the fork branchestest/fma5-baseandtest/fma5-pr.Traces, summaries, digests (
trace_digest.pyfrom currentmain) and replay CSVs: fork release perf-11265-20261030.Pipeline creation, salted replays. Each build had one cold run with captures on (
APS5_DUMP_COMPUTE_PIPELINES,APS5_DUMP_COMPUTE_MIN_WORDS=50000, emptyANYPS5_SHADER_CACHE_DIR). The captures were then compiled 5 times each withagc_compute_pipeline_replay. Every compile carries a distinctOpSourceExtensionsalt (per build, capture and run), so the driver's own cache misses:mainwordsmainmedian ms0x25b3908000x25b393000(RCAS)Cold open-world load, the same save in every run,
APS5_TRACE_SECONDS=40:80,APS5_MIMALLOC=1, an emptyANYPS5_SHADER_CACHE_DIRper run. The order wasmain, then the PR, thenmainagain, so both arms see the same NVIDIA driver cache:Vulkan.ComputePipeline(0x25b390800, queue worker 0x0)mainmainagainThe 14-16 s max frame in every run is the load's
Driver.Packet.memory_wait, not a compile. All three traces dropped queue worker 0x0 events late in the window (after 78.3 / 75.6 / 78.6 s), after the compile slices (+53.5 to +54.3 s).{"commit":"681ef4392670","dirty":false,"env":{"APS5_MIMALLOC":"1","APS5_TRACE_DIR":"","APS5_TRACE_SECONDS":"40:80"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"13th Gen Intel(R) Core(TM) i9-13900K","cpu_threads":32,"memory_mib":65295,"title_id":"PPSA04264","title":"Grand Theft Auto V","content_version":"01.005.000","resolution":"3840x2160","window":{"spec":"seconds 40:80","first_present":454,"ms":80011.685},"presents":1919,"frame_ms":{"p50":16.811,"p90":33.618,"p99":253.639,"max":16365.273},"gpu_busy_ms_per_present":2.823,"worker_busy_pct":{"queue worker 0x0":73.392,"queue worker 0x28":2.641,"queue worker 0x20":25.167,"queue worker 0x30":12.741,"queue worker 0x38":2.257},"top_phases_ms_per_frame":{"Driver.Packet":47.958,"Driver.Packet.memory_wait":17.945,"VideoOut.Flip":17.614,"VideoOut.Flip.vblank_wait":15.645,"Graphics.Draw":13.186,"Graphics.Draw.draw_and_resource_release":12.355,"Driver.Packet.draw":11.246,"Driver.Draw":11.218},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":78.273,"events_lost":36292,"totals_full":false}},"trace":"aps5-trace-681ef4392670-21344.json.gz"}
{"commit":"02172d7ed375","dirty":false,"env":{"APS5_MIMALLOC":"1","APS5_TRACE_DIR":"","APS5_TRACE_SECONDS":"40:80"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 616.92","os":"Windows 10.0.26200","cpu":"13th Gen Intel(R) Core(TM) i9-13900K","cpu_threads":32,"memory_mib":65295,"title_id":"PPSA04264","title":"Grand Theft Auto V","content_version":"01.005.000","resolution":"3840x2160","window":{"spec":"seconds 40:80","first_present":454,"ms":80031.893},"presents":1981,"frame_ms":{"p50":16.834,"p90":34.470,"p99":236.325,"max":14174.024},"gpu_busy_ms_per_present":3.415,"worker_busy_pct":{"queue worker 0x0":73.370,"queue worker 0x20":13.755,"queue worker 0x28":22.742,"queue worker 0x30":5.947,"queue worker 0x38":1.032},"top_phases_ms_per_frame":{"Driver.Packet":46.622,"Driver.Packet.memory_wait":17.574,"VideoOut.Flip":17.149,"VideoOut.Flip.vblank_wait":15.449,"Graphics.Draw":13.481,"Graphics.Draw.draw_and_resource_release":12.445,"Driver.Packet.draw":12.111,"Driver.Draw":12.074},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":75.588,"events_lost":96457,"totals_full":false}},"trace":"aps5-trace-02172d7ed375-34488.json.gz"}
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T23:08:40Z.
Review: CHANGES_REQUESTED
The code review found the FMA path consistently gated by native f16 rounding/denorm support and
shaderFmaFloat16; the test and replay flag exercise the enabled and fallback paths. I rangit diff --checkandpython3 tools/check_conventions.py --base upstream/mainon this exact head; both pass. The PR's reported GPU comparisons are useful, but I could not independently run the Vulkan test locally, and hosted product-build jobs were skipped.The required performance evidence is still missing. The repository rule and the automated request require the
mainand changedaps5-summary.jsonllines plus two traces from the same title, scene and machine, andtools/trace_digest.pyoutput. The PR says its game windows covered different scenes and therefore are not comparable, and does not include those artifacts. Please rerun a comparable capture pair and attach both lines, traces and digest output, or get maintainer direction on an applicable exception before treating theperfreport as complete. I am requesting changes for this outstanding contribution-rule requirement; this is not a finding that the code path itself is incorrect.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T23:36:21Z.
Review: CHANGES_REQUESTED
Re-reviewed the updated performance report. The two summary lines and gzip traces are accessible from the linked fork release; I downloaded both traces and ran
tools/trace_digest.pyon each, confirming the reported 8,412.7 ms base frame and 2,651.4 ms changed-build maximum. Both captures marktrace_dropped: true, which the report discloses. The remaining policy issue is the baseline commit:abfc85162b6eis the head of open PR #11184, notmain. PR #11184 is still OPEN, and the current upstreammainisacb900c194325b9ee8c23c10768a9a491454f0b2; comparing thatmainwithabfc85162b6eshows the branches have diverged. Please provide a capture from currentmainand the changed stack on the same title/scene/machine, or obtain maintainer approval to use the parent PR as the baseline and document that exception. This request is only about satisfying the statedmainbaseline for the performance claim; I found no new code finding. Hosted policy/conventions pass; product build jobs are skipped by path policy.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T00:02:52Z.
Review: CHANGES_REQUESTED
The updated capture pair resolves my earlier baseline concern: the body now supplies current
main(acb900c19432) and PR head (61bc20017f97) summaries for the same GTA V scene/window, machine, GPU, and settings, and both published trace filenames match their summary lines. I downloaded both release traces and independently ran the currenttools/trace_digest.pyfromupstream/mainwith each summary file alongside its trace.The attached digest files do not reproduce from those published trace artifacts. For example, the main digest says the draw committer has 8.5 ms busy / 0.0 ms waiting, while the rerun reports 8.4 / 0.2; the PR digest says 7.0 / 0.0, while the rerun says 6.8 / 0.2. The reruns also include a
Largest GPU batchessection that is absent from both attached outputs. Please regenerate and replace the two digest files using the current script on these exact trace assets. The summary headers, reported frame maxima and slowest-frame rows match; this request is about making the attached full digest output reproducible from the published pair.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T00:12:44Z.
Review: CHANGES_REQUESTED
The replacement trace digests now reproduce exactly from the released traces using tools/trace_digest.py from current main; that resolves my previous evidence finding.
One required shader validation result is still missing from the report. CONTRIBUTING.md requires the same focused shader tests on main and this change, with validation enabled, for every reported GPU. The description reports the focused f16/fma runs on this PR head, but its full-suite baseline is from main
50bc72bbb, before the current rebase; I do not see the focused test results from current mainacb900c194on either the RTX 4090 or UHD 770. The hosted product jobs are skipped for this PR, so CI does not supply that comparison. Please add the focused baseline outcomes for both GPUs, including confirmation that VK_LAYER_KHRONOS_validation was inserted and the comparison found no new VUID errors.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T05:39:46Z.
Review: DISMISSED
The earlier exact-head review findings about the trace digests and focused current-main validation were addressed in the report, and I am withdrawing my request to list the five textual-conflict PRs as dependencies; #11184 is the functional dependency because this change requires its SPIR-V pins. Current upstream main has moved since those runs: this branch is 3 ahead / 196 behind
14c99b52ac, and #11184 remains open. Please refresh onto current main after #11184 lands, rerun the focused validation comparison and update the performance evidence for that exact head before this is ready to approve.Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-28T18:45:11Z.
Review: COMMENTED
macOS / MoltenVK data point. Apple M4 Pro, macOS 27.2, MoltenVK 1.4.2, x86_64 Release under Rosetta.
maindoesn't run titles on macOS yet, so the base is a support branch, notmain:main750cf6cf48+ only the macOS boot PRs #7631 #10552 #11249 #11447 #11554 #10669 #7804, + #12529 (the revert of #10337, which roughly doubles the GPU time on this GPU and would hide smaller changes). Change: that base + eight open shader performance PRs merged together (#12287 #11952 #12299 #12280 #11368 #11265 #8716 #8958, all clean merges). I did not measure each PR alone.Two alternated runs per side, warm shader cache,
APS5_TRACE_SUMMARY_EVERY=10:Together they don't raise the GPU time on MoltenVK. I'm checking open shader performance PRs on this GPU because #10337 was measured on RADV and doubled it here.
Focused tests below ran with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationon the same two trees; the layer was found and both logs have the sameVUID-lines (12VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, 20VUID-vkCreateDescriptorSetLayout-support-09582, from tests that fail the same way on the base).This PR on MoltenVK: the change is inert here. The fused path needs native f16 math and
VK_KHR_shader_fmawithshaderFmaFloat16, and MoltenVK has neither, sov_pk_fma_f16keeps the f32 round-to-odd path;agc_driver_packed_float16_nativeis skipped (the device has no native f16 with RTE rounding and kept denormals). The f32 path and its neighbours pass on the base and with the change:agc_driver_fma_rounding,agc_driver_fma_legacy,agc_driver_float16_fma_rounding,agc_driver_f16_fma_denormal_modes,agc_driver_f16_fma_invalid_nan,agc_driver_fma_mix_f16_denormal_modes,agc_driver_f32_fma_denormal_mode2,agc_driver_dpp8_pk_fmac,agc_driver_dpp16_operands,agc_driver_packed_alu. It built withmain's SPIR-V pins. No GPU regression in the group. Nothing on macOS for or against the change itself.AI-assisted: yes (Claude Code ran the builds, runs and tests and drafted this review)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:04:20Z.
Review: CHANGES_REQUESTED
Re-checked — changes requested
What I checked
a9027a0f325ffaf2456283ee3953b471ceb26829against fetchedmain2960e9a6e7.ShaderReplay.cpp. Hosted relinker, conventions, labels, eligibility, and report checks pass; product Windows/Linux and specialized GPU jobs were skipped.Blocking current-head evidence
The PR body still contains performance summaries and trace files for head
61bc20017f97, while the current head isa9027a0f325f; the new head's AMD title data in the discussion is not a same-scenemain/current-head report pair. The branch is 576 commits behind fetchedmain, and its merge preview conflicts. Please refresh onto currentmain, resolve the replay conflict, rerun the focused f16/FMA validation comparison with the required layer on the current baseline and change, and update the paired performance artifacts and digests for the refreshed head.The new AMD run is useful supporting evidence. I cannot renew the previous review while the exact-head report and integration remain stale; I did not run GPU tests locally.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:34:12Z.
Review: CHANGES_REQUESTED
Re-reviewed exact head
69a8ebdd3549e6c58c14988d57bca8d35152b6a4against currentupstream/main4c7d275bef89d309313d16bc2bc05d37a1b50be2. The refreshed report addresses the earlier stale trace/digest concern for its tested pair, and #11184 is merged. The branch still has an older main ancestor (edf6804cf5); current main has since changedcore/shader/recompiler/Recompiler.cpp, which this PR also changes. The merge preview is clean, but this shared source change means the current-main integration needs the focused f16/FMA validation rerun. The latest focused and performance reports name main3a40945e62and PRa9027a0f32, not the current 4c7 baseline and integrated head. Please rerun the focused comparison and refresh the matched performance artifacts/digests on the current integration.git diff --checkand conventions pass. I did not run Vulkan/GPU tests locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T03:38:05Z.
Review: APPROVED
Re-checked — new head, looks good
The updated exact-head GPU comparison and reproducible performance artifacts resolve my prior review blockers; I found no blocking issue in the current diff.
What I ran
Reviewed head
8d84578a43058c8ca30606335ad7a9a702af2658against PR base08a10d225306ad102b57408e2ef7566bcfb829b2. The merge preview against that base was clean (tree57e164f31b2aced81bc98f57a34a475ccffc9ba0).git diff --checkand repository conventions passed. I downloaded the three released traces and summaries and rerantools/trace_digest.pyfrom currentmain; all three generated digests exactly match the attacheddigests.txtsections. I did not run a build or GPU tests locally.Results
57e164f31b2aced81bc98f57a34a475ccffc9ba0digests.txtUnedited local check output
Findings
Blocking
None found in the reviewed diff. The earlier missing current-baseline focused comparison and trace-digest reproducibility issues are resolved in the updated report.
Non-blocking
mainat91a69952c1; currentmainhas advanced to08a10d2253. The merge preview is clean, and none of the interveningmaincommits changes a file touched by this PR.Sources
Not verified
I did not build the project or run Vulkan/GPU tests locally. The hosted Linux job was skipped and the two macOS relinker checks were still pending; no RADV/AMD run is reported.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T11:23:54Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The exact-head NVIDIA validation report shows nine new Vulkan validation IDs on this PR, including unsupported
FMAKHRcapability andSPV_KHR_fmaextension declarations.What I ran
Reviewed head
8d84578a43058c8ca30606335ad7a9a702af2658against PR base08a10d225306ad102b57408e2ef7566bcfb829b2; the merge preview against currentmainwas clean. Local environment: Linux x86_64, Python 3.11.2. I inspected the shader capability detection/emission and the exact-head GPU report. No local build or GPU test was run.Results
agc_driver_dpp16_operands,agc_driver_dpp8_pk_fmac, andagc_driver_dx10_clamp; each was reproduced when rerun aloneThe report identifies
VUID-VkShaderModuleCreateInfo-pCode-08739for an unsupported SPIR-V capability andVUID-VkShaderModuleCreateInfo-pCode-08741for unsupportedSPV_KHR_fma; it also reports08737from SPIR-V validation. The PR tests completed, but those passing exits do not make the validation errors harmless. The no-build precheck's ABI/test-quality steps could not start because workspace-local helper scripts were absent in its isolated checkout; those results do not affect this Vulkan finding.Negative control
Findings
Blocking
FMAKHRandSPV_KHR_fmaare emitted only when actually supported and enabled, retaining the existing fallback otherwise. Then rerun the same three tests with validation enabled and confirm zero new IDs against main.Non-blocking
None.
Sources
Not verified
I did not reproduce the NVIDIA GPU run locally or build this PR. The reported failing GPU is an RTX 2000 Ada; the author's separate RTX 4090 run and Intel fallback run do not cover this reported device-specific failure.
To get this to a good state
Fix the capability/extension path or keep the fallback on devices that do not support it, then rerun the reported validation tests and compare them with main. I will rerun the same available no-build checks and reassess the exact new head.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T20:14:29Z.
Review: COMMENTED
Confirming tibzejoker's explanation of the NVIDIA report: the bot's layer is Vulkan-ValidationLayers 1.3.275 (Ubuntu 24.04's package), and the nine IDs come from that layer.
pNext-pNextmessage in its "already present on main" list (428 tests) says "based on the Valid Usage documentation for version 275 of the Vulkan header". The "Vulkan 1.4.329" in the report header is the driver's API version: my 3070 on the same 595.99.02 driver reportsapiVersion = 1.4.329.VK_KHR_shader_fmawithshaderFmaFloat16 = true, so the fused path is taken on NVIDIA. The 1.3.275 layer'sspirv-valrejects it withInvalid capability operand: 6030(6030 isFMAKHR).I reproduced it with
8d84578a43merged ontomain16345cad6a, on Ubuntu 26.04 with GCC 15.2, Release and-DANYPS5_ENABLE_SPIRV_TOOLS=ON. The run usedANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,-j1, and the three testsagc_driver_dpp16_operands,agc_driver_dpp8_pk_fmacandagc_driver_dx10_clamp..debfrom Ubuntu 24.04)08739and08741on all three tests in both runs;08737in the first run only. Same IDs as the botVK_LOADER_DEBUG=layer)On
mainwith VVL 1.3.275, the same three tests only log thepNext-pNextthat is already on main. So the PR's gating holds on NVIDIA. These IDs come from the old layer and are gone with 1.4.341.GPUs tested: NVIDIA RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.