perf(shader): pick the f32 NaN result with one quiet and one fallback select #4287

Merged
karanvora2599 merged 3 commits from upstream-pr/4287 into main 2026-11-14 17:32:13 +00:00
karanvora2599 commented 2026-10-12 04:22:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-12T04:22:51Z.


What

nanResultF32 now picks the AMD NaN result for an f32 instruction with one quieting step and one final select, instead of quieting and selecting once per source. It also tests sources for NaN with FPIsNan32 instead of an integer and + compare.

Background. These instructions go through nanResultF32 so that a NaN result matches AMD hardware rather than the host GPU:

  • v_add_f32, v_sub_f32, v_subrev_f32 and v_mul_f32;
  • v_fma_f32 and v_fma_mix_f32 with f32 sources;
  • v_mul_legacy_f32 and the legacy mad/mac/fma forms;
  • v_div_fmas_f32.

The rule is:

  • the first NaN source, quieted in IEEE mode;
  • else the default NaN 0xffc00000 when the result is NaN;
  • else the result.

For a fused multiply-add whose product is 0 × ∞, the addend doesn't count as a source.

Before, the function started from the fallback and then, for each source from last to first:

  • tested it for NaN with (bits & 0x7fffffff) > 0x7f800000;
  • quieted it with its own or;
  • selected it over what it had so far.

The addend's test was also combined with the inverse of the invalid-product flag.

How.

  • The chain now carries only source bits:
    • The addend starts it, replaced by 0 when the product is 0 × ∞.
    • Each earlier source that FPIsNan32 finds NaN takes its place.
  • The fallback is isNan(result) ? 0xffc00000 : result.
  • The result is isNan(candidate) ? quiet(candidate) : fallback. So the quieting or and the final select happen once.

Why results don't change. The candidate is NaN exactly when some eligible source is NaN, and it is then the first eligible NaN source, in the same order as before:

  • If no eligible source is NaN, the candidate is the last source or 0. Neither is NaN, so the result is the fallback, as before.
  • The 0 × ∞ case can't pick the addend, because 0 isn't NaN.

agc_driver_f32_arithmetic_nan checks 16 forms and pins both cases:

  • the source order (with the order reversed it fails: v_fmaak_f32 is 0xffc12345, expected 0x7f812345);
  • the 0 × ∞ product with a quiet or signaling NaN addend (row {+inf, 0, 0x7fc00003} expects 0xffc00000 from v_fma_f32).

v_mac_f32 and v_mad_f32 don't go through nanResultF32 and are unchanged.

Before / after on an RTX 4060 Laptop (Ada, driver 591.86). SASS instructions per instruction are derived from the APS5_PIPELINE_STATS binary size over a chain of 16 instructions, with FLOAT_MODE 0xc0, DX10 clamp on and IEEE mode off:

Instruction SASS before SASS after
v_mul_f32 18.0 16.5
v_add_f32 12.0 10.5
v_add_f32 DPP row_shr:1 15.5 14.0
v_subrev_f32 13.0 11.5
v_sub_f32 12.0 11.0
v_fma_f32 23.5 22.5
v_fma_mix_f32 (f32 sources) 23.5 22.5
v_div_fmas_f32 13.0 12.0
v_mac_legacy_f32 46.5 45.0
v_mul_legacy_f32 20.5 20.0
v_mad_legacy_f32 49.5 49.0
  • Of the 363 swept opcodes, 11 got smaller and none got bigger.
  • With IEEE mode on, the old code also had one quieting or per source where the new code has one in total. That case wasn't measured.
  • In the census from #4061 (11 titles, 837 shaders), these instructions appear 63,869 times: v_mul_f32 42,491, v_add_f32 11,247, v_sub_f32 7,746, v_subrev_f32 1,770, v_fma_f32 615. Weighted by the counts above, that's about 91,600 fewer SASS instructions across the corpus, as a static count.
    • The census also has 79 v_fma_mix_f32, listed as VOP3P v_fma_f32 in the histogram. Only those with f32 sources change, so they're left out of the estimate.
  • The SASS counts are from Ada. The translation change is the same on every GPU.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release, this branch on main at d146ec1b6. Devices:

  • RTX 4060 Laptop (Ada, driver 591.86)
  • Intel UHD Graphics (Raptor Lake, driver 101.6790)
  • lavapipe from Mesa 25.2.8 (llvmpipe, LLVM 21.1.7): the version CI installs; Windows build with GALLIUM_OVERRIDE_CPU_CAPS=avx.

No new test. The existing tests already pin what this change has to keep. As a check, I made the chain keep a later NaN source over an earlier one. agc_driver_f32_arithmetic_nan then failed with lane 0 no float mode v_fmaak_f32 is 0xffc12345, expected 0x7f812345.

f32 and NaN tests. These pass on all three devices, except the division modifier tests, which the Intel UHD skips for a missing feature:

  • agc_driver_f32_arithmetic_nan, agc_driver_nan_quieting, agc_driver_f32_min_max_nan, agc_driver_fma_rounding, agc_driver_fma_legacy;
  • agc_driver_division*, agc_driver_f32_output_modifier, agc_driver_f32_result_clamp, agc_driver_f32_denormal_flush, agc_driver_f32_constant_factor_tininess;
  • vector_fused_multiply_add, vector_mad_legacy, agc_denormal_flush_elimination.

Shader and driver tests (agc_driver_*, agc_shader_*, agc_spirv_*, vector_*, agc_masked_select, agc_validate_program, agc_denormal*, agc_float16_*; 338 tests):

  • RTX 4060: all pass. I left out the BDA tests that lose the device on driver 591.86 (#3291): agc_driver_flat_loads*, agc_driver_global_loads*, agc_driver_flat_apertures*, agc_driver_pixel_interlock.
  • Intel UHD: everything passes or is skipped for missing features, except agc_driver_ds_swizzle and agc_driver_f32_dot2_rounding, which fail the same way on main.
  • lavapipe 25.2.8: everything passes or is skipped for missing features.

Op sweep. All 363 swept opcodes, compiled from main and from this branch, gave the table above.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4824897056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-12T04:22:51Z. --- ### What `nanResultF32` now picks the AMD NaN result for an f32 instruction with one quieting step and one final select, instead of quieting and selecting once per source. It also tests sources for NaN with `FPIsNan32` instead of an integer `and` + compare. **Background.** These instructions go through `nanResultF32` so that a NaN result matches AMD hardware rather than the host GPU: - `v_add_f32`, `v_sub_f32`, `v_subrev_f32` and `v_mul_f32`; - `v_fma_f32` and `v_fma_mix_f32` with f32 sources; - `v_mul_legacy_f32` and the legacy `mad`/`mac`/`fma` forms; - `v_div_fmas_f32`. The rule is: - the first NaN source, quieted in IEEE mode; - else the default NaN `0xffc00000` when the result is NaN; - else the result. For a fused multiply-add whose product is 0 × ∞, the addend doesn't count as a source. Before, the function started from the fallback and then, for each source from last to first: - tested it for NaN with `(bits & 0x7fffffff) > 0x7f800000`; - quieted it with its own `or`; - selected it over what it had so far. The addend's test was also combined with the inverse of the invalid-product flag. **How.** - The chain now carries only source bits: - The addend starts it, replaced by 0 when the product is 0 × ∞. - Each earlier source that `FPIsNan32` finds NaN takes its place. - The fallback is `isNan(result) ? 0xffc00000 : result`. - The result is `isNan(candidate) ? quiet(candidate) : fallback`. So the quieting `or` and the final select happen once. **Why results don't change.** The candidate is NaN exactly when some eligible source is NaN, and it is then the first eligible NaN source, in the same order as before: - If no eligible source is NaN, the candidate is the last source or 0. Neither is NaN, so the result is the fallback, as before. - The 0 × ∞ case can't pick the addend, because 0 isn't NaN. `agc_driver_f32_arithmetic_nan` checks 16 forms and pins both cases: - the source order (with the order reversed it fails: `v_fmaak_f32 is 0xffc12345, expected 0x7f812345`); - the 0 × ∞ product with a quiet or signaling NaN addend (row `{+inf, 0, 0x7fc00003}` expects `0xffc00000` from `v_fma_f32`). `v_mac_f32` and `v_mad_f32` don't go through `nanResultF32` and are unchanged. **Before / after** on an RTX 4060 Laptop (Ada, driver 591.86). SASS instructions per instruction are derived from the `APS5_PIPELINE_STATS` binary size over a chain of 16 instructions, with `FLOAT_MODE` 0xc0, DX10 clamp on and IEEE mode off: | Instruction | SASS before | SASS after | |---|---|---| | `v_mul_f32` | 18.0 | 16.5 | | `v_add_f32` | 12.0 | 10.5 | | `v_add_f32` DPP `row_shr:1` | 15.5 | 14.0 | | `v_subrev_f32` | 13.0 | 11.5 | | `v_sub_f32` | 12.0 | 11.0 | | `v_fma_f32` | 23.5 | 22.5 | | `v_fma_mix_f32` (f32 sources) | 23.5 | 22.5 | | `v_div_fmas_f32` | 13.0 | 12.0 | | `v_mac_legacy_f32` | 46.5 | 45.0 | | `v_mul_legacy_f32` | 20.5 | 20.0 | | `v_mad_legacy_f32` | 49.5 | 49.0 | - Of the 363 swept opcodes, 11 got smaller and none got bigger. - With IEEE mode on, the old code also had one quieting `or` per source where the new code has one in total. That case wasn't measured. - In the census from #4061 (11 titles, 837 shaders), these instructions appear 63,869 times: `v_mul_f32` 42,491, `v_add_f32` 11,247, `v_sub_f32` 7,746, `v_subrev_f32` 1,770, `v_fma_f32` 615. Weighted by the counts above, that's about 91,600 fewer SASS instructions across the corpus, as a static count. - The census also has 79 `v_fma_mix_f32`, listed as VOP3P `v_fma_f32` in the histogram. Only those with f32 sources change, so they're left out of the estimate. - The SASS counts are from Ada. The translation change is the same on every GPU. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Release, this branch on `main` at d146ec1b6. Devices: - RTX 4060 Laptop (Ada, driver 591.86) - Intel UHD Graphics (Raptor Lake, driver 101.6790) - lavapipe from Mesa 25.2.8 (llvmpipe, LLVM 21.1.7): the version CI installs; Windows build with `GALLIUM_OVERRIDE_CPU_CAPS=avx`. **No new test.** The existing tests already pin what this change has to keep. As a check, I made the chain keep a later NaN source over an earlier one. `agc_driver_f32_arithmetic_nan` then failed with `lane 0 no float mode v_fmaak_f32 is 0xffc12345, expected 0x7f812345`. **f32 and NaN tests.** These pass on all three devices, except the division modifier tests, which the Intel UHD skips for a missing feature: - `agc_driver_f32_arithmetic_nan`, `agc_driver_nan_quieting`, `agc_driver_f32_min_max_nan`, `agc_driver_fma_rounding`, `agc_driver_fma_legacy`; - `agc_driver_division*`, `agc_driver_f32_output_modifier`, `agc_driver_f32_result_clamp`, `agc_driver_f32_denormal_flush`, `agc_driver_f32_constant_factor_tininess`; - `vector_fused_multiply_add`, `vector_mad_legacy`, `agc_denormal_flush_elimination`. **Shader and driver tests** (`agc_driver_*`, `agc_shader_*`, `agc_spirv_*`, `vector_*`, `agc_masked_select`, `agc_validate_program`, `agc_denormal*`, `agc_float16_*`; 338 tests): - RTX 4060: all pass. I left out the BDA tests that lose the device on driver 591.86 (#3291): `agc_driver_flat_loads*`, `agc_driver_global_loads*`, `agc_driver_flat_apertures*`, `agc_driver_pixel_interlock`. - Intel UHD: everything passes or is skipped for missing features, except `agc_driver_ds_swizzle` and `agc_driver_f32_dot2_rounding`, which fail the same way on `main`. - lavapipe 25.2.8: everything passes or is skipped for missing features. **Op sweep.** All 363 swept opcodes, compiled from `main` and from this branch, gave the table above. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Raghav314 commented 2026-10-12 05:21:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-12T05:21:01Z.


Tested on my machine (RTX 4090, Linux), on main d146ec1b6 + this PR.

  • agc_driver_f32_arithmetic_nan passes.
  • How much titles use these instructions: I dumped every shader two titles registered and counted opcodes the way @fma-rc's census does (agc_shader_replay --asm, the decoder's names). The f32 add/sub/subrev/mul/mad/mac/fma family this PR changes is 21.9% of Hades II's instructions (PPSA36082, 263 shaders into gameplay, 23,327 instructions; v_mac_f32 1,375, v_mul_f32 1,206, v_mad_f32 1,116, v_add_f32 850) and 40.7% of Demon's Souls' (PPSA01341, 2,388 shaders from its first two minutes, 1,051,140 instructions; v_mul_f32 180,261, v_mac_f32 82,766, v_mad_f32 70,470). Every one of those shaders is wave64.
  • SPIR-V size, the 58 largest compute and 58 largest graphics shaders of Demon's Souls recompiled offline with and without it (on #4152's head, because that's what I dumped them with): compute 36,449,268 -> 35,886,165 words (-1.5%), graphics 7,483,093 -> 7,472,831 (-0.1%).
  • Hades II gameplay with it, together with #2169, #2121 and #2132: it looked the same as without it, with no driver errors and no GPU faults in the log.

Looks good to me, and since it's in the hot path of both titles, I'd like to see it merged.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118256576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6118256576). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-12T05:21:01Z. --- Tested on my machine (RTX 4090, Linux), on main d146ec1b6 + this PR. - `agc_driver_f32_arithmetic_nan` passes. - How much titles use these instructions: I dumped every shader two titles registered and counted opcodes the way @fma-rc's census does (`agc_shader_replay --asm`, the decoder's names). The f32 add/sub/subrev/mul/mad/mac/fma family this PR changes is 21.9% of Hades II's instructions (PPSA36082, 263 shaders into gameplay, 23,327 instructions; `v_mac_f32` 1,375, `v_mul_f32` 1,206, `v_mad_f32` 1,116, `v_add_f32` 850) and 40.7% of Demon's Souls' (PPSA01341, 2,388 shaders from its first two minutes, 1,051,140 instructions; `v_mul_f32` 180,261, `v_mac_f32` 82,766, `v_mad_f32` 70,470). Every one of those shaders is wave64. - SPIR-V size, the 58 largest compute and 58 largest graphics shaders of Demon's Souls recompiled offline with and without it (on #4152's head, because that's what I dumped them with): compute 36,449,268 -> 35,886,165 words (-1.5%), graphics 7,483,093 -> 7,472,831 (-0.1%). - Hades II gameplay with it, together with #2169, #2121 and #2132: it looked the same as without it, with no driver errors and no GPU faults in the log. Looks good to me, and since it's in the hot path of both titles, I'd like to see it merged. LLM assistance used.
karanvora2599 commented 2026-10-12 13:01:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-12T13:01:38Z.


Thanks @Raghav314, especially for Demon's Souls: it's the first title in these counts with that much f32 math.

One correction to the share. This PR changes only the instructions that go through nanResultF32: v_add/sub/subrev/mul_f32, v_fma_f32 and its other encodings, the legacy forms, v_div_fmas_f32 and v_fma_mix_f32 with f32 sources. v_mac_f32 and v_mad_f32 become FPMad32 without it, so they don't change. Taking them out of your counts leaves about 11% of Hades II's instructions and about 26% of Demon's Souls', still with v_mul_f32 the largest (1,206 and 180,261).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124793951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6124793951). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-12T13:01:38Z. --- Thanks @Raghav314, especially for Demon's Souls: it's the first title in these counts with that much f32 math. One correction to the share. This PR changes only the instructions that go through `nanResultF32`: `v_add/sub/subrev/mul_f32`, `v_fma_f32` and its other encodings, the legacy forms, `v_div_fmas_f32` and `v_fma_mix_f32` with f32 sources. `v_mac_f32` and `v_mad_f32` become `FPMad32` without it, so they don't change. Taking them out of your counts leaves about 11% of Hades II's instructions and about 26% of Demon's Souls', still with `v_mul_f32` the largest (1,206 and 180,261).
oneandonlydean commented 2026-10-13 02:42:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:42:51Z.


Could you add a frame-time comparison on a title, main against main plus this PR alone, same machine and scene? The SASS and SPIR-V sizes show less code, but a perf( PR needs the run-time numbers from the Performance report form. Going by Raghav314's counts, Demon's Souls (PPSA01341) is the title where it should show.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137036572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6137036572). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T02:42:51Z. --- Could you add a frame-time comparison on a title, `main` against `main` plus this PR alone, same machine and scene? The SASS and SPIR-V sizes show less code, but a `perf(` PR needs the run-time numbers from the Performance report form. Going by Raghav314's counts, Demon's Souls (PPSA01341) is the title where it should show.
adriadam10 commented 2026-10-13 14:07:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:07:49Z.

Review: DISMISSED


Checked the new chain against the old one: same result (first NaN source, quieted in IEEE mode; 0×∞ drops the addend; fallback 0xffc00000). agc_driver_f32_arithmetic_nan, agc_driver_nan_quieting, agc_driver_fma_*, agc_driver_division* and agc_driver_f32_min_max_nan pass here on CI's lavapipe.

One thing is missing, and @oneandonlydean already asked for it: a perf( PR needs run-time numbers. The SASS counts show less code but not that a frame gets faster. Please add main vs main + this PR on a title (Demon's Souls, per Raghav314's counts), same machine and scene, with the Performance report form. Once that is in, this is ready to merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5504811301 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#pullrequestreview-5504811301). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T14:07:49Z. **Review:** DISMISSED --- Checked the new chain against the old one: same result (first NaN source, quieted in IEEE mode; 0×∞ drops the addend; fallback `0xffc00000`). `agc_driver_f32_arithmetic_nan`, `agc_driver_nan_quieting`, `agc_driver_fma_*`, `agc_driver_division*` and `agc_driver_f32_min_max_nan` pass here on CI's lavapipe. One thing is missing, and @oneandonlydean already asked for it: a `perf(` PR needs run-time numbers. The SASS counts show less code but not that a frame gets faster. Please add `main` vs `main` + this PR on a title (Demon's Souls, per Raghav314's counts), same machine and scene, with the Performance report form. Once that is in, this is ready to merge.
karanvora2599 commented 2026-10-13 15:56:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-13T15:56:36Z.


@Raghav314, the review needs one more thing before this can merge: a run-time comparison on a title. Your counts showed the most f32 math in Demon's Souls, so that's the title to measure. Could you capture it?

  • Build main (d146ec1b6, this PR's base) and this PR (7aea3fe29).
  • Run the scene once and restart the title, so the caches are warm.
  • Capture each build in the same scene with APS5_TRACE_FRAMES=<start>:<count>. Set no other APS5_TRACE_* or APS5_PROFILE_* switch, as the Performance report form describes.
  • Post the two aps5-summary.jsonl lines and attach the two aps5-trace-*.json.gz files.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149623600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6149623600). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-13T15:56:36Z. --- @Raghav314, the review needs one more thing before this can merge: a run-time comparison on a title. Your counts showed the most f32 math in Demon's Souls, so that's the title to measure. Could you capture it? - Build `main` (d146ec1b6, this PR's base) and this PR (7aea3fe29). - Run the scene once and restart the title, so the caches are warm. - Capture each build in the same scene with `APS5_TRACE_FRAMES=<start>:<count>`. Set no other `APS5_TRACE_*` or `APS5_PROFILE_*` switch, as the [Performance report](https://github.com/boykopovar/AnyPS5/blob/main/.github/ISSUE_TEMPLATE/performance.yml) form describes. - Post the two `aps5-summary.jsonl` lines and attach the two `aps5-trace-*.json.gz` files.
adriadam10 commented 2026-10-14 14:14:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T14:14:30Z.

Review: DISMISSED


Rechecked the head (7aea3fe29): the new chain gives the same result as the old one (first NaN source, quieted in IEEE mode; 0×∞ drops the addend; fallback 0xffc00000), and the f32/NaN/fma/division tests pass here. The code is fine.

One thing is still missing and it is the only blocker: a perf( PR needs run-time numbers, as @oneandonlydean asked. The SASS counts show less code, not a faster frame. Please add main vs main + this PR on a title (Demon's Souls, per Raghav314's counts), same machine and scene, using the Performance report form. We can't run titles on our side, so this has to come from someone who can. Once it is in, this is ready to merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5519342010 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#pullrequestreview-5519342010). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T14:14:30Z. **Review:** DISMISSED --- Rechecked the head (7aea3fe29): the new chain gives the same result as the old one (first NaN source, quieted in IEEE mode; 0×∞ drops the addend; fallback `0xffc00000`), and the f32/NaN/fma/division tests pass here. The code is fine. One thing is still missing and it is the only blocker: a `perf(` PR needs run-time numbers, as @oneandonlydean asked. The SASS counts show less code, not a faster frame. Please add `main` vs `main` + this PR on a title (Demon's Souls, per Raghav314's counts), same machine and scene, using the Performance report form. We can't run titles on our side, so this has to come from someone who can. Once it is in, this is ready to merge.
Raghav314 commented 2026-10-14 15:34:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-14T15:34:52Z.


I can't test this in Demon's Souls yet, so I ran the comparison on my machine in Hades II (PPSA36082) instead. Why Demon's Souls doesn't work for this right now:

  • d146ec1 can't run Demon's Souls here: it aborts after about 13 s on "DB_RENDER_CONTROL ... resummarize unsupported", which #4049 fixed later. So both builds are current main (84b01f9cd), one plain and one with this PR merged in (203bb7730, clean merge).
  • On current main, Demon's Souls was still on a black screen after 4 minutes of cold shader compiles (about 1,160 shaders compiled, no presents yet), so I had no scene to capture.

Hades II is in the counts too (about 11% of its instructions after your correction). Scene: the hub, standing still at the same spot, 1920x1080. Each build ran once to the hub and was restarted, then captured with APS5_TRACE_SECONDS=200:15 and no other trace or profile switch. Same machine, same session, one capture each:

{"commit":"84b01f9cd042","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"6784","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 615.78.08","os":"Linux 7.2.9-2-cachyos","resolution":"1920x1080","window":{"spec":"seconds 200:15","first_present":8318,"ms":15011.593},"presents":586,"frame_ms":{"p50":25.428,"p90":27.641,"p99":29.832,"max":35.781},"gpu_busy_ms_per_present":5.689,"worker_busy_pct":{"queue worker 0x0":98.846},"top_phases_ms_per_frame":{"Driver.Packet":25.314,"Driver.Packet.draw":22.919,"Driver.Draw":22.774,"Driver.Draw.shader_compile_and_link":10.298,"Driver.Draw.draw_and_resource_release":9.393,"Graphics.Draw":9.228,"Shader.DrawStage":8.260,"Graphics.Draw.draw_and_resource_release":7.506},"trace_dropped":true,"trace":"aps5-trace-84b01f9cd042-378348.json.gz"}
  • main + this PR (203bb7730):
{"commit":"203bb7730f97","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"6784","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 615.78.08","os":"Linux 7.2.9-2-cachyos","resolution":"1920x1080","window":{"spec":"seconds 200:15","first_present":8257,"ms":15007.671},"presents":580,"frame_ms":{"p50":25.619,"p90":27.970,"p99":29.458,"max":30.311},"gpu_busy_ms_per_present":5.590,"worker_busy_pct":{"queue worker 0x0":98.876},"top_phases_ms_per_frame":{"Driver.Packet":25.577,"Driver.Packet.draw":23.159,"Driver.Draw":23.008,"Driver.Draw.shader_compile_and_link":10.393,"Driver.Draw.draw_and_resource_release":9.515,"Graphics.Draw":9.341,"Shader.DrawStage":8.356,"Graphics.Draw.draw_and_resource_release":7.592},"trace_dropped":true,"trace":"aps5-trace-203bb7730f97-379144.json.gz"}

GPU busy per present goes from 5.689 to 5.590 ms (-1.7%). Frame time doesn't move (p50 25.4 vs 25.6 ms) because the hub on main is bound by the queue worker (99% busy), not the GPU, so a shader-side change can't show up there. For scale: two earlier captures of mine in the same session with builds that don't touch shader code gave GPU busy 8.630 and 8.631 ms, so 0.1 ms is more than the run-to-run spread I've seen, but this is one capture each. A GPU-bound scene would be the better test, which is what Demon's Souls would have been.

I will attach the two traces below.

aps5-trace-84b01f9cd042-378348.json.gz
aps5-trace-203bb7730f97-379144.json.gz

Traces: aps5-trace-84b01f9cd042-378348.json.gz = main 84b01f9cd, aps5-trace-203bb7730f97-379144.json.gz = main + this PR (203bb7730).

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6172063408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6172063408). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-14T15:34:52Z. --- I can't test this in Demon's Souls yet, so I ran the comparison on my machine in Hades II (PPSA36082) instead. Why Demon's Souls doesn't work for this right now: - d146ec1 can't run Demon's Souls here: it aborts after about 13 s on "DB_RENDER_CONTROL ... resummarize unsupported", which #4049 fixed later. So both builds are current `main` (84b01f9cd), one plain and one with this PR merged in (203bb7730, clean merge). - On current `main`, Demon's Souls was still on a black screen after 4 minutes of cold shader compiles (about 1,160 shaders compiled, no presents yet), so I had no scene to capture. Hades II is in the counts too (about 11% of its instructions after your correction). Scene: the hub, standing still at the same spot, 1920x1080. Each build ran once to the hub and was restarted, then captured with `APS5_TRACE_SECONDS=200:15` and no other trace or profile switch. Same machine, same session, one capture each: - `main` 84b01f9cd: ```json {"commit":"84b01f9cd042","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"6784","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 615.78.08","os":"Linux 7.2.9-2-cachyos","resolution":"1920x1080","window":{"spec":"seconds 200:15","first_present":8318,"ms":15011.593},"presents":586,"frame_ms":{"p50":25.428,"p90":27.641,"p99":29.832,"max":35.781},"gpu_busy_ms_per_present":5.689,"worker_busy_pct":{"queue worker 0x0":98.846},"top_phases_ms_per_frame":{"Driver.Packet":25.314,"Driver.Packet.draw":22.919,"Driver.Draw":22.774,"Driver.Draw.shader_compile_and_link":10.298,"Driver.Draw.draw_and_resource_release":9.393,"Graphics.Draw":9.228,"Shader.DrawStage":8.260,"Graphics.Draw.draw_and_resource_release":7.506},"trace_dropped":true,"trace":"aps5-trace-84b01f9cd042-378348.json.gz"} ``` - `main` + this PR (203bb7730): ```json {"commit":"203bb7730f97","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"6784","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 615.78.08","os":"Linux 7.2.9-2-cachyos","resolution":"1920x1080","window":{"spec":"seconds 200:15","first_present":8257,"ms":15007.671},"presents":580,"frame_ms":{"p50":25.619,"p90":27.970,"p99":29.458,"max":30.311},"gpu_busy_ms_per_present":5.590,"worker_busy_pct":{"queue worker 0x0":98.876},"top_phases_ms_per_frame":{"Driver.Packet":25.577,"Driver.Packet.draw":23.159,"Driver.Draw":23.008,"Driver.Draw.shader_compile_and_link":10.393,"Driver.Draw.draw_and_resource_release":9.515,"Graphics.Draw":9.341,"Shader.DrawStage":8.356,"Graphics.Draw.draw_and_resource_release":7.592},"trace_dropped":true,"trace":"aps5-trace-203bb7730f97-379144.json.gz"} ``` GPU busy per present goes from 5.689 to 5.590 ms (-1.7%). Frame time doesn't move (p50 25.4 vs 25.6 ms) because the hub on `main` is bound by the queue worker (99% busy), not the GPU, so a shader-side change can't show up there. For scale: two earlier captures of mine in the same session with builds that don't touch shader code gave GPU busy 8.630 and 8.631 ms, so 0.1 ms is more than the run-to-run spread I've seen, but this is one capture each. A GPU-bound scene would be the better test, which is what Demon's Souls would have been. I will attach the two traces below. [aps5-trace-84b01f9cd042-378348.json.gz](https://github.com/user-attachments/files/33443782/aps5-trace-84b01f9cd042-378348.json.gz) [aps5-trace-203bb7730f97-379144.json.gz](https://github.com/user-attachments/files/33443785/aps5-trace-203bb7730f97-379144.json.gz) Traces: aps5-trace-84b01f9cd042-378348.json.gz = main 84b01f9cd, aps5-trace-203bb7730f97-379144.json.gz = main + this PR (203bb7730). LLM assistance used.
fma-rc commented 2026-10-14 17:14:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-14T17:14:44Z.


I ran Demon's Souls (PPSA01341) on Linux with an RTX 5080 (NVIDIA 615.78.08), on main a453108cf and on the same commit with this PR (7aea3fe29) merged.

With the PR the title stops on the language select screen. It did so in both runs that lasted long enough, at 379 s and at 589 s after start:

compute shader 0x248946900: bindless image table: 17 distinct keys exceed the 16 slots

main without the PR reaches the same screen and does not print that line in any of six runs, two of them 600 s long. On the language select main has a frame time p50 of 29.9 ms (trace window 280:3 from the first present, trace_digest.py, warm shader cache). I don't have a number for the PR yet, because both of its long runs threw before or inside that window.

I haven't looked into why the f32 NaN change would change the image keys of that compute shader.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174032803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6174032803). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-14T17:14:44Z. --- I ran Demon's Souls (PPSA01341) on Linux with an RTX 5080 (NVIDIA 615.78.08), on `main` a453108cf and on the same commit with this PR (7aea3fe29) merged. With the PR the title stops on the language select screen. It did so in both runs that lasted long enough, at 379 s and at 589 s after start: ``` compute shader 0x248946900: bindless image table: 17 distinct keys exceed the 16 slots ``` `main` without the PR reaches the same screen and does not print that line in any of six runs, two of them 600 s long. On the language select `main` has a frame time p50 of 29.9 ms (trace window 280:3 from the first present, `trace_digest.py`, warm shader cache). I don't have a number for the PR yet, because both of its long runs threw before or inside that window. I haven't looked into why the f32 NaN change would change the image keys of that compute shader.
milescoviello commented 2026-10-17 16:36:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T16:36:42Z.


A compile-time data point for this change. It's not the frame-time comparison the review asked for.

Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.02. Base is main 66702f1cf; the PR is 7aea3fe29 merged onto it cleanly.

The shader is the largest fragment shader of Afterglow (PPSA47770, homebrew built on the PS5 OpenGL stack). It has 19,373 guest instructions, about 8.2k of them v_mul_f32, 6.2k v_add_f32 and 1.4k v_sub_f32, at the default float mode (f32 denormals flushed, IEEE off). I recompiled its dumped request with agc_shader_replay and timed NVIDIA building its fragment-shader library part in the title. The timer is local, around that vkCreateGraphicsPipelines call. Cache was cold, two runs per build:

Build SPIR-V words Part build
main 2,167,462 24.9 s, 25.9 s
main + this PR 2,143,013 22.8 s, 22.9 s

Words drop 1.1%, but the compile drops about 10%.

To show where this shader's compile time goes, I also ran local switches that skip one piece of the f32 emulation each. They change results, so they're for measurement only, not a proposal. One run each, base 24.8 s in that series:

Skipped SPIR-V words Part build
nothing 2,167,462 24.8 s
NaN result selection (nanResultF32) 1,585,252 13.8 s
f32 denormal flushes (flushF32Denormal) 1,687,775 16.5 s
tiny-product check (flushTinyProduct) 1,784,863 20.0 s
all three 715,161 3.9 s

In this shader the NaN selection is the largest single part of the compile time.

The title exits on a cold cache either way: its own watchdog stops waiting on that submission after about 2 s.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6236778782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6236778782). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-17T16:36:42Z. --- A compile-time data point for this change. It's not the frame-time comparison the review asked for. Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.02. Base is `main` 66702f1cf; the PR is 7aea3fe29 merged onto it cleanly. The shader is the largest fragment shader of Afterglow (PPSA47770, homebrew built on the PS5 OpenGL stack). It has 19,373 guest instructions, about 8.2k of them `v_mul_f32`, 6.2k `v_add_f32` and 1.4k `v_sub_f32`, at the default float mode (f32 denormals flushed, IEEE off). I recompiled its dumped request with `agc_shader_replay` and timed NVIDIA building its fragment-shader library part in the title. The timer is local, around that `vkCreateGraphicsPipelines` call. Cache was cold, two runs per build: | Build | SPIR-V words | Part build | |---|---|---| | `main` | 2,167,462 | 24.9 s, 25.9 s | | `main` + this PR | 2,143,013 | 22.8 s, 22.9 s | Words drop 1.1%, but the compile drops about 10%. To show where this shader's compile time goes, I also ran local switches that skip one piece of the f32 emulation each. They change results, so they're for measurement only, not a proposal. One run each, base 24.8 s in that series: | Skipped | SPIR-V words | Part build | |---|---|---| | nothing | 2,167,462 | 24.8 s | | NaN result selection (`nanResultF32`) | 1,585,252 | 13.8 s | | f32 denormal flushes (`flushF32Denormal`) | 1,687,775 | 16.5 s | | tiny-product check (`flushTinyProduct`) | 1,784,863 | 20.0 s | | all three | 715,161 | 3.9 s | In this shader the NaN selection is the largest single part of the compile time. The title exits on a cold cache either way: its own watchdog stops waiting on that submission after about 2 s. AI-assisted: yes (Claude Code)
karanvora2599 commented 2026-10-18 00:57:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-18T00:57:58Z.


Thanks @milescoviello. A 10% shorter build of Afterglow's (PPSA47770) largest fragment shader is a title measurement I couldn't produce here. The breakdown showing NaN selection as the largest single part of that compile is useful too.

@fma-rc, thanks for the Demon's Souls run. Your base, a453108cf, predates @Celegans12's d9e47d1e9, which replaced the 16-slot bindless image table with runtime-indexed image and sampler tables. Since then, main has no "distinct keys exceed the 16 slots" stop. I still don't see how this change, which only rewrites how nanResultF32 picks the NaN result, could change that shader's image keys. But a stop main doesn't have needs explaining before this merges.

Could you rerun Demon's Souls on current main with this PR? If it still stops or misrenders there, I'd need that compute shader's dumped request (APS5_DUMP_SHADERS=1, the request for 0x248946900) and the APS5_TRACE_IMAGE_TABLE=1 lines before the stop. I can't run Demon's Souls here, so with those I would replay the shader with agc_shader_replay on main and with this PR and compare.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6243971740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6243971740). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-18T00:57:58Z. --- Thanks @milescoviello. A 10% shorter build of Afterglow's (PPSA47770) largest fragment shader is a title measurement I couldn't produce here. The breakdown showing NaN selection as the largest single part of that compile is useful too. @fma-rc, thanks for the Demon's Souls run. Your base, a453108cf, predates @Celegans12's d9e47d1e9, which replaced the 16-slot bindless image table with runtime-indexed image and sampler tables. Since then, `main` has no "distinct keys exceed the 16 slots" stop. I still don't see how this change, which only rewrites how `nanResultF32` picks the NaN result, could change that shader's image keys. But a stop `main` doesn't have needs explaining before this merges. Could you rerun Demon's Souls on current `main` with this PR? If it still stops or misrenders there, I'd need that compute shader's dumped request (`APS5_DUMP_SHADERS=1`, the request for 0x248946900) and the `APS5_TRACE_IMAGE_TABLE=1` lines before the stop. I can't run Demon's Souls here, so with those I would replay the shader with `agc_shader_replay` on `main` and with this PR and compare.
fma-rc commented 2026-10-18 08:56:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T08:56:15Z.


I reran Demon's Souls (PPSA01341) on main b39d90bf1 and on the same commit with this PR merged, RTX 5080 on Linux, 700 s per run. Neither of the two PR runs stopped, and the 17 distinct keys exceed the 16 slots line is gone; main ran three runs without a stop as well. So the stop I reported came from the old base, as you thought. With APS5_TRACE_IMAGE_TABLE=1, shader 0x248946900 resolves its 256-record table thousands of times per run on both builds. I didn't capture frames in these runs, so this says nothing about rendering.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6247942495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6247942495). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-18T08:56:15Z. --- I reran Demon's Souls (PPSA01341) on `main` b39d90bf1 and on the same commit with this PR merged, RTX 5080 on Linux, 700 s per run. Neither of the two PR runs stopped, and the `17 distinct keys exceed the 16 slots` line is gone; `main` ran three runs without a stop as well. So the stop I reported came from the old base, as you thought. With `APS5_TRACE_IMAGE_TABLE=1`, shader 0x248946900 resolves its 256-record table thousands of times per run on both builds. I didn't capture frames in these runs, so this says nothing about rendering.
jotitadev commented 2026-10-19 00:01:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T00:01:00Z.


Apple GPU / MoltenVK data point on the switch to FPIsNan32. The perf question is still open; this is about correctness on Metal.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 7aea3fe29. Method: macos-port @ b7eb6b6b + ImportWatched + PR diff, not main (main doesn't build on macOS yet). The PR applies cleanly.

The port tests NaN with the bits in EmitFPIsNan32 ((bits & 0x7fffffff) > 0x7f800000, from mugurc's macOS commit 47bf3675a), where main emits OpFUnordNotEqual(x, x). So I also ran with main's EmitFPIsNan32 put back into the port, which is what this PR gets on main. Tests: agc_driver_f32_arithmetic_nan, agc_driver_nan_quieting, agc_driver_f32_min_max_nan, agc_driver_fma_legacy, agc_driver_fma_rounding, agc_driver_division and the other agc_driver_f32_*. "pass" below means: same as the unchanged port. Four f32 denormal/tininess tests (f32_constant_factor_tininess, f32_denormal_flush, f32_dot2_rounding, f32_output_modifier) fail there in every row, because MoltenVK doesn't preserve f32 denormals.

Tree MoltenVK 1.4.2 default MVK_CONFIG_FAST_MATH_ENABLED=1
port + main's EmitFPIsNan32 pass f32_min_max_nan fails
same + this PR pass f32_arithmetic_nan, division, fma_legacy and f32_min_max_nan fail

With fast math forced, the failures with the PR are all a canonical NaN where an AMD NaN was expected:

  • v_add_f32 is 0x7fc00000, expected 0x7f812345

  • v_div_fmas_f32 is 0x7fc00000, expected 0xffc00001

  • v_mad_legacy_f32 |src0| -src2 is 0x7fc00000, expected 0xffc00000

  • Default configuration: no change. MoltenVK compiles the test shaders with MathMode Safe (its log), since the module declares SignedZeroInfNanPreserve. MoltenVK main + SPIRV-Cross #2704 also passes.

  • The difference: the current integer test in nanResultF32 gives the same results with Metal fast math on. After this PR, the NaN source selection depends on Metal keeping x != x true for a NaN, which fast math doesn't guarantee. The port's commit also reports x != x as false through MoltenVK for a NaN converted from f16, even with fast math off.

  • With the port's bit test (the PR on the port as is), all of these pass in both modes, and so do agc_driver_f32_arithmetic_nan's order and 0 × ∞ rows.

So on Apple this is fine as long as safe math stays on. A bit-based FPIsNan32 on main would remove the dependency, but that's a separate change.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704 for the default case)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6256794074 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6256794074). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T00:01:00Z. --- <!-- head: 7aea3fe29 --> Apple GPU / MoltenVK data point on the switch to `FPIsNan32`. The perf question is still open; this is about correctness on Metal. Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 7aea3fe29. Method: macos-port @ b7eb6b6b + ImportWatched + PR diff, not main (main doesn't build on macOS yet). The PR applies cleanly. The port tests NaN with the bits in `EmitFPIsNan32` (`(bits & 0x7fffffff) > 0x7f800000`, from mugurc's macOS commit 47bf3675a), where main emits `OpFUnordNotEqual(x, x)`. So I also ran with main's `EmitFPIsNan32` put back into the port, which is what this PR gets on main. Tests: `agc_driver_f32_arithmetic_nan`, `agc_driver_nan_quieting`, `agc_driver_f32_min_max_nan`, `agc_driver_fma_legacy`, `agc_driver_fma_rounding`, `agc_driver_division` and the other `agc_driver_f32_*`. "pass" below means: same as the unchanged port. Four f32 denormal/tininess tests (`f32_constant_factor_tininess`, `f32_denormal_flush`, `f32_dot2_rounding`, `f32_output_modifier`) fail there in every row, because MoltenVK doesn't preserve f32 denormals. | Tree | MoltenVK 1.4.2 default | `MVK_CONFIG_FAST_MATH_ENABLED=1` | |---|---|---| | port + main's `EmitFPIsNan32` | pass | `f32_min_max_nan` fails | | same + this PR | pass | `f32_arithmetic_nan`, `division`, `fma_legacy` and `f32_min_max_nan` fail | With fast math forced, the failures with the PR are all a canonical NaN where an AMD NaN was expected: - `v_add_f32 is 0x7fc00000, expected 0x7f812345` - `v_div_fmas_f32 is 0x7fc00000, expected 0xffc00001` - `v_mad_legacy_f32 |src0| -src2 is 0x7fc00000, expected 0xffc00000` - **Default configuration: no change.** MoltenVK compiles the test shaders with `MathMode Safe` (its log), since the module declares `SignedZeroInfNanPreserve`. MoltenVK main + SPIRV-Cross #2704 also passes. - **The difference:** the current integer test in `nanResultF32` gives the same results with Metal fast math on. After this PR, the NaN source selection depends on Metal keeping `x != x` true for a NaN, which fast math doesn't guarantee. The port's commit also reports `x != x` as false through MoltenVK for a NaN converted from f16, even with fast math off. - With the port's bit test (the PR on the port as is), all of these pass in both modes, and so do `agc_driver_f32_arithmetic_nan`'s order and 0 × ∞ rows. So on Apple this is fine as long as safe math stays on. A bit-based `FPIsNan32` on main would remove the dependency, but that's a separate change. GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704 for the default case) Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
CPritch commented 2026-10-20 07:24:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CPritch on 2026-10-20T07:24:29Z.


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 eaa5c9238 against main eaa5c9238 + #4287 at 7aea3fe29, same machine and session, two runs each in the order A B A B, window frames 3700: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 3510 (APS5_DUMP_FRAMES=117, every 30 presents), which stop before the window.

Frame p50: main 81.1, 81.4 ms, with #4287 76.3, 76.4 ms (-4.9 ms, -6.0 %). GPU busy per present: 64.8 and 60.3 ms.
p99: main 110.2, 114.8 ms, with #4287 133.9, 133.5 ms. The slowest 1 % of frames got slower in both pairs; what those frames hold was not examined.
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":"117","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3700: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 3700:700","first_present":3700,"ms":57698.898},"presents":700,"frame_ms":{"p50":81.055,"p90":90.76,"p99":110.229,"max":124.741},"gpu_busy_ms_per_present":64.773,"worker_busy_pct":{"queue worker 0x0":3671.574},"top_phases_ms_per_frame":{"Driver.EndSubmission":2960.755,"Driver.Packet":63.333,"Graphics.Draw":60.468,"Graphics.Draw.draw_and_resource_release":56.906,"Driver.Packet.draw":50.259,"Driver.Draw":50.046,"VideoOut.Flip":26.034,"Driver.Present":26.017},"trace_dropped":false,"trace":"aps5-trace-eaa5c9238687-1297376.json.gz"}
{"commit":"9a357994eac7","dirty":false,"env":{"APS5_DUMP_FRAMES":"117","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3700: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 3700:700","first_present":3700,"ms":55508.153},"presents":700,"frame_ms":{"p50":76.253,"p90":86.708,"p99":133.868,"max":163.939},"gpu_busy_ms_per_present":60.265,"worker_busy_pct":{"queue worker 0x0":3695.605},"top_phases_ms_per_frame":{"Driver.EndSubmission":2865.206,"Driver.Packet":63.012,"Graphics.Draw":58.603,"Graphics.Draw.draw_and_resource_release":54.679,"Driver.Packet.draw":50.972,"Driver.Draw":50.751,"Driver.Draw.shader_compile_and_link":23.759,"VideoOut.Flip":23.52},"trace_dropped":false,"trace":"aps5-trace-9a357994eac7-1305787.json.gz"}

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285682656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6285682656). Originally posted by [CPritch](https://github.com/CPritch) on 2026-10-20T07:24:29Z. --- 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 eaa5c9238 against main eaa5c9238 + #4287 at 7aea3fe29, same machine and session, two runs each in the order A B A B, window frames 3700: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 3510 (APS5_DUMP_FRAMES=117, every 30 presents), which stop before the window. Frame p50: main 81.1, 81.4 ms, with #4287 76.3, 76.4 ms (-4.9 ms, -6.0 %). GPU busy per present: 64.8 and 60.3 ms. p99: main 110.2, 114.8 ms, with #4287 133.9, 133.5 ms. The slowest 1 % of frames got slower in both pairs; what those frames hold was not examined. 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":"117","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3700: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 3700:700","first_present":3700,"ms":57698.898},"presents":700,"frame_ms":{"p50":81.055,"p90":90.76,"p99":110.229,"max":124.741},"gpu_busy_ms_per_present":64.773,"worker_busy_pct":{"queue worker 0x0":3671.574},"top_phases_ms_per_frame":{"Driver.EndSubmission":2960.755,"Driver.Packet":63.333,"Graphics.Draw":60.468,"Graphics.Draw.draw_and_resource_release":56.906,"Driver.Packet.draw":50.259,"Driver.Draw":50.046,"VideoOut.Flip":26.034,"Driver.Present":26.017},"trace_dropped":false,"trace":"aps5-trace-eaa5c9238687-1297376.json.gz"} {"commit":"9a357994eac7","dirty":false,"env":{"APS5_DUMP_FRAMES":"117","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3700: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 3700:700","first_present":3700,"ms":55508.153},"presents":700,"frame_ms":{"p50":76.253,"p90":86.708,"p99":133.868,"max":163.939},"gpu_busy_ms_per_present":60.265,"worker_busy_pct":{"queue worker 0x0":3695.605},"top_phases_ms_per_frame":{"Driver.EndSubmission":2865.206,"Driver.Packet":63.012,"Graphics.Draw":58.603,"Graphics.Draw.draw_and_resource_release":54.679,"Driver.Packet.draw":50.972,"Driver.Draw":50.751,"Driver.Draw.shader_compile_and_link":23.759,"VideoOut.Flip":23.52},"trace_dropped":false,"trace":"aps5-trace-9a357994eac7-1305787.json.gz"}
oneandonlydean commented 2026-10-20 15:37:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T15:37:53Z.


@adriadam10 your remaining point on this PR was a performance number. CPritch has since posted one: p50 about 6% slower, with a worse p99. That run looks like it included first-use shader compiles in its window, though, so it may be measuring a cold cache rather than the change. We've reviewed the current head 7aea3fe29f. On an RTX 4090, main and this PR each pass the 17 f32/NaN/fma/division execution tests, and a mutant that drops the NaN result handling fails 5 of them. We'll also run our own paired GPU test against main on a warm cache and post the result. Could you re-review when you have a moment?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294741447 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6294741447). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T15:37:53Z. --- @adriadam10 your remaining point on this PR was a performance number. CPritch has since posted one: p50 about 6% slower, with a worse p99. That run looks like it included first-use shader compiles in its window, though, so it may be measuring a cold cache rather than the change. We've reviewed the current head `7aea3fe29f`. On an RTX 4090, main and this PR each pass the 17 f32/NaN/fma/division execution tests, and a mutant that drops the NaN result handling fails 5 of them. We'll also run our own paired GPU test against main on a warm cache and post the result. Could you re-review when you have a moment?
CPritch commented 2026-10-21 07:23:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CPritch on 2026-10-21T07:23:58Z.


@adriadam10 @karanvora2599 the main vs main + this PR run you asked for is in my comment above (https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6285682656): GTA V on Linux, RTX 5060 Laptop, captured as the Performance report form describes, both summary lines included. Frame p50 81.1, 81.4 -> 76.3, 76.4 ms. p99 rose in both pairs (110.2, 114.8 -> 133.9, 133.5 ms), which I haven't looked into.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310468178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6310468178). Originally posted by [CPritch](https://github.com/CPritch) on 2026-10-21T07:23:58Z. --- @adriadam10 @karanvora2599 the main vs main + this PR run you asked for is in my comment above (https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6285682656): GTA V on Linux, RTX 5060 Laptop, captured as the Performance report form describes, both summary lines included. Frame p50 81.1, 81.4 -> 76.3, 76.4 ms. p99 rose in both pairs (110.2, 114.8 -> 133.9, 133.5 ms), which I haven't looked into. AI-assisted: yes
imellag commented 2026-10-21 13:34:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-21T13:34:17Z.


Apple GPU / MoltenVK run-time numbers for head 7aea3fe29, on two titles.

Machine: Apple M4 Pro (24 GB), macOS 27.0.1, x86-64 build under Rosetta 2, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), on AC power.

Base: not main, because main does not run titles on macOS yet. The base is the community macOS branch at 7cf8c610c (the closed #7332) plus #8578, #8567 and the transcendental follow-up of #8612. This PR applies to it cleanly. On that branch EmitFPIsNan32 is the integer test (bits & 0x7fffffff) > 0x7f800000, as in the earlier MoltenVK note above, so these numbers cover the shorter select chain only, not main's OpFUnordNotEqual lowering.

Method: fixed scene reached with scripted pad input and no input during the window, warm caches (one warm-up run per arm, a separate ANYPS5_SHADER_CACHE_DIR per arm), arms alternated A B A B, two runs each, frame data from APS5_TRACE_SUMMARY_EVERY summary lines.

Title, scene Build fps frame p50 GPU busy per present
God of War Sons of Sparta (PPSA28997), first fight (116-141 s) base 39.83, 40.03 24.8, 24.6 ms 22.6, 22.7 ms
+ #4287 39.94, 39.85 24.6, 24.7 ms 22.8, 22.6 ms
Planet of Lana (PPSA19450), village, standing still (110-190 s) base 30.52, 30.41 32.5, 32.7 ms 17.8, 18.8 ms
+ #4287 30.38, 30.24 32.8, 32.8 ms 17.5, 21.0 ms

No measurable change on this GPU. God of War is GPU-bound here, so a shorter shader would show in its GPU time. Planet of Lana is bound by the queue worker, so its fps cannot show a GPU change.

Tests (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1) on the base + this PR: agc_driver_f32_arithmetic_nan, agc_driver_nan_quieting (f64 part skipped, no shaderFloat64), agc_driver_f32_min_max_nan, agc_driver_fma_legacy, agc_driver_fma_rounding, agc_driver_float16_fma_rounding and agc_driver_division pass.

Not checked: main (titles do not run on macOS there), the VK_LAYER_KHRONOS_validation comparison, the generated Metal code (so I can't say whether the Metal compiler already folds the old chain), and other titles.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6317405098 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6317405098). Originally posted by [imellag](https://github.com/imellag) on 2026-10-21T13:34:17Z. --- Apple GPU / MoltenVK run-time numbers for head `7aea3fe29`, on two titles. **Machine:** Apple M4 Pro (24 GB), macOS 27.0.1, x86-64 build under Rosetta 2, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), on AC power. **Base:** not `main`, because `main` does not run titles on macOS yet. The base is the community macOS branch at `7cf8c610c` (the closed #7332) plus #8578, #8567 and the transcendental follow-up of #8612. This PR applies to it cleanly. On that branch `EmitFPIsNan32` is the integer test `(bits & 0x7fffffff) > 0x7f800000`, as in the earlier MoltenVK note above, so these numbers cover the shorter select chain only, not `main`'s `OpFUnordNotEqual` lowering. **Method:** fixed scene reached with scripted pad input and no input during the window, warm caches (one warm-up run per arm, a separate `ANYPS5_SHADER_CACHE_DIR` per arm), arms alternated A B A B, two runs each, frame data from `APS5_TRACE_SUMMARY_EVERY` summary lines. | Title, scene | Build | fps | frame p50 | GPU busy per present | |---|---|---|---|---| | God of War Sons of Sparta (PPSA28997), first fight (116-141 s) | base | 39.83, 40.03 | 24.8, 24.6 ms | 22.6, 22.7 ms | | | + #4287 | 39.94, 39.85 | 24.6, 24.7 ms | 22.8, 22.6 ms | | Planet of Lana (PPSA19450), village, standing still (110-190 s) | base | 30.52, 30.41 | 32.5, 32.7 ms | 17.8, 18.8 ms | | | + #4287 | 30.38, 30.24 | 32.8, 32.8 ms | 17.5, 21.0 ms | No measurable change on this GPU. God of War is GPU-bound here, so a shorter shader would show in its GPU time. Planet of Lana is bound by the queue worker, so its fps cannot show a GPU change. **Tests** (`ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`) on the base + this PR: `agc_driver_f32_arithmetic_nan`, `agc_driver_nan_quieting` (f64 part skipped, no `shaderFloat64`), `agc_driver_f32_min_max_nan`, `agc_driver_fma_legacy`, `agc_driver_fma_rounding`, `agc_driver_float16_fma_rounding` and `agc_driver_division` pass. **Not checked:** `main` (titles do not run on macOS there), the `VK_LAYER_KHRONOS_validation` comparison, the generated Metal code (so I can't say whether the Metal compiler already folds the old chain), and other titles. AI-assisted: yes
oneandonlydean commented 2026-10-22 04:04:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T04:04:16Z.


I'm picking this up alongside @adriadam10 because it is part of a stack that gets PPSA04263 further on current main. I've started a fresh full CI run on 7aea3fe29f merged into current main, and it goes into a gate with the rest of that stack. @karanvora2599, nothing is needed from you unless the run shows a problem; I'll post the result here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332398908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6332398908). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T04:04:16Z. --- I'm picking this up alongside @adriadam10 because it is part of a stack that gets PPSA04263 further on current `main`. I've started a fresh full CI run on 7aea3fe29f merged into current `main`, and it goes into a gate with the rest of that stack. @karanvora2599, nothing is needed from you unless the run shows a problem; I'll post the result here.
CPritch commented 2026-10-22 13:00:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CPritch on 2026-10-22T13:00:18Z.


A second run, on current main, agrees with my first: #4287 is faster on this machine, not slower. In my first run above the p50 went from 81.1, 81.4 to 76.3, 76.4 ms.

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 4777caca3 + #9730 at ed8a900ca, against that + #4287 at 7aea3fe29. #9730 is on both sides because main alone aborts GTA V at start-up in sceVoiceSetThreadsParams. Same machine and session, two runs each in the order A B A B, window frames 3300:700, APS5_TRACE_EVENTS=4194304. Each side was warmed until it stopped building pipelines, and no timed run built one.

Frame p50: 79.1, 79.0 ms, with #4287 73.8, 74.0 ms (-5.1 ms, -6.5 %). GPU busy per present: 62.9, 62.6 -> 58.9, 58.6 ms.
p99: 104.7, 113.0 ms, with #4287 107.2, 113.1 ms, so no clear change. The p99 rise in my first run did not repeat, here or in a run last night on main 0c6a5bd59 (p50 78.2, 77.3 -> 72.6, 72.3 ms; p99 110.7, 110.9 -> 106.1, 103.5 ms).

On the cold-cache question: Driver.Draw.shader_compile_and_link is in main's top phases too (24.4 ms per frame in its second run here; 23.8 and 24.3 with #4287). Its mark (Draw.cpp:437 at 4777caca3) closes the span that starts at prepare and includes the draw-cache lookup, so draws that hit the cache are timed in it as well. Its presence alone doesn't show a cold cache.

Not tested: other scenes, Fidelity mode, other GPUs.
AI-assisted: yes

Summary lines (main + #9730, then with #4287):

{"commit":"c49fa17ee046","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":56318.040},"presents":700,"frame_ms":{"p50":79.112,"p90":88.929,"p99":104.717,"max":145.852},"gpu_busy_ms_per_present":62.912,"worker_busy_pct":{"queue worker 0x0":98.157},"top_phases_ms_per_frame":{"Driver.Packet":75.488,"Graphics.Draw":58.821,"Graphics.Draw.draw_and_resource_release":55.496,"Driver.Packet.draw":49.992,"Driver.Draw":49.791,"VideoOut.Flip":24.200,"Driver.Present":24.178,"VideoOut.Flip.present":24.153},"trace_dropped":false,"trace":"aps5-trace-c49fa17ee046-3.json.gz"}
{"commit":"c49fa17ee046","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":56543.114},"presents":700,"frame_ms":{"p50":79.046,"p90":90.581,"p99":113.019,"max":133.382},"gpu_busy_ms_per_present":62.574,"worker_busy_pct":{"queue worker 0x0":98.151},"top_phases_ms_per_frame":{"Driver.Packet":75.227,"Graphics.Draw":58.857,"Graphics.Draw.draw_and_resource_release":55.504,"Driver.Packet.draw":50.637,"Driver.Draw":50.434,"Driver.Draw.shader_compile_and_link":24.409,"VideoOut.Flip":23.787,"Driver.Present":23.768},"trace_dropped":false,"trace":"aps5-trace-c49fa17ee046-3.json.gz"}
{"commit":"08a87661ab9a","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":53407.930},"presents":700,"frame_ms":{"p50":73.822,"p90":84.569,"p99":107.245,"max":120.435},"gpu_busy_ms_per_present":58.883,"worker_busy_pct":{"queue worker 0x0":98.068},"top_phases_ms_per_frame":{"Driver.Packet":71.392,"Graphics.Draw":55.262,"Graphics.Draw.draw_and_resource_release":51.992,"Driver.Packet.draw":48.750,"Driver.Draw":48.553,"Driver.Draw.shader_compile_and_link":23.787,"VideoOut.Flip":21.706,"Driver.Present":21.680},"trace_dropped":false,"trace":"aps5-trace-08a87661ab9a-3.json.gz"}
{"commit":"08a87661ab9a","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":53661.936},"presents":700,"frame_ms":{"p50":74.042,"p90":85.171,"p99":113.053,"max":122.728},"gpu_busy_ms_per_present":58.572,"worker_busy_pct":{"queue worker 0x0":98.073},"top_phases_ms_per_frame":{"Driver.Packet":71.748,"Graphics.Draw":55.556,"Graphics.Draw.draw_and_resource_release":52.234,"Driver.Packet.draw":50.312,"Driver.Draw":50.111,"Driver.Draw.shader_compile_and_link":24.289,"VideoOut.Flip":21.274,"Driver.Present":21.249},"trace_dropped":false,"trace":"aps5-trace-08a87661ab9a-3.json.gz"}
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341370965 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4287#issuecomment-6341370965). Originally posted by [CPritch](https://github.com/CPritch) on 2026-10-22T13:00:18Z. --- A second run, on current main, agrees with my first: #4287 is faster on this machine, not slower. In my first run above the p50 went from 81.1, 81.4 to 76.3, 76.4 ms. 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 4777caca3 + #9730 at ed8a900ca, against that + #4287 at 7aea3fe29. #9730 is on both sides because main alone aborts GTA V at start-up in `sceVoiceSetThreadsParams`. Same machine and session, two runs each in the order A B A B, window frames 3300:700, APS5_TRACE_EVENTS=4194304. Each side was warmed until it stopped building pipelines, and no timed run built one. Frame p50: 79.1, 79.0 ms, with #4287 73.8, 74.0 ms (-5.1 ms, -6.5 %). GPU busy per present: 62.9, 62.6 -> 58.9, 58.6 ms. p99: 104.7, 113.0 ms, with #4287 107.2, 113.1 ms, so no clear change. The p99 rise in my first run did not repeat, here or in a run last night on main 0c6a5bd59 (p50 78.2, 77.3 -> 72.6, 72.3 ms; p99 110.7, 110.9 -> 106.1, 103.5 ms). On the cold-cache question: `Driver.Draw.shader_compile_and_link` is in main's top phases too (24.4 ms per frame in its second run here; 23.8 and 24.3 with #4287). Its mark (`Draw.cpp:437` at 4777caca3) closes the span that starts at `prepare` and includes the draw-cache lookup, so draws that hit the cache are timed in it as well. Its presence alone doesn't show a cold cache. Not tested: other scenes, Fidelity mode, other GPUs. AI-assisted: yes Summary lines (main + #9730, then with #4287): ``` {"commit":"c49fa17ee046","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":56318.040},"presents":700,"frame_ms":{"p50":79.112,"p90":88.929,"p99":104.717,"max":145.852},"gpu_busy_ms_per_present":62.912,"worker_busy_pct":{"queue worker 0x0":98.157},"top_phases_ms_per_frame":{"Driver.Packet":75.488,"Graphics.Draw":58.821,"Graphics.Draw.draw_and_resource_release":55.496,"Driver.Packet.draw":49.992,"Driver.Draw":49.791,"VideoOut.Flip":24.200,"Driver.Present":24.178,"VideoOut.Flip.present":24.153},"trace_dropped":false,"trace":"aps5-trace-c49fa17ee046-3.json.gz"} {"commit":"c49fa17ee046","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":56543.114},"presents":700,"frame_ms":{"p50":79.046,"p90":90.581,"p99":113.019,"max":133.382},"gpu_busy_ms_per_present":62.574,"worker_busy_pct":{"queue worker 0x0":98.151},"top_phases_ms_per_frame":{"Driver.Packet":75.227,"Graphics.Draw":58.857,"Graphics.Draw.draw_and_resource_release":55.504,"Driver.Packet.draw":50.637,"Driver.Draw":50.434,"Driver.Draw.shader_compile_and_link":24.409,"VideoOut.Flip":23.787,"Driver.Present":23.768},"trace_dropped":false,"trace":"aps5-trace-c49fa17ee046-3.json.gz"} {"commit":"08a87661ab9a","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":53407.930},"presents":700,"frame_ms":{"p50":73.822,"p90":84.569,"p99":107.245,"max":120.435},"gpu_busy_ms_per_present":58.883,"worker_busy_pct":{"queue worker 0x0":98.068},"top_phases_ms_per_frame":{"Driver.Packet":71.392,"Graphics.Draw":55.262,"Graphics.Draw.draw_and_resource_release":51.992,"Driver.Packet.draw":48.750,"Driver.Draw":48.553,"Driver.Draw.shader_compile_and_link":23.787,"VideoOut.Flip":21.706,"Driver.Present":21.680},"trace_dropped":false,"trace":"aps5-trace-08a87661ab9a-3.json.gz"} {"commit":"08a87661ab9a","dirty":false,"env":{"APS5_DUMP_FRAMES":"103","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3300:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3300:700","first_present":3300,"ms":53661.936},"presents":700,"frame_ms":{"p50":74.042,"p90":85.171,"p99":113.053,"max":122.728},"gpu_busy_ms_per_present":58.572,"worker_busy_pct":{"queue worker 0x0":98.073},"top_phases_ms_per_frame":{"Driver.Packet":71.748,"Graphics.Draw":55.556,"Graphics.Draw.draw_and_resource_release":52.234,"Driver.Packet.draw":50.312,"Driver.Draw":50.111,"Driver.Draw.shader_compile_and_link":24.289,"VideoOut.Flip":21.274,"Driver.Present":21.249},"trace_dropped":false,"trace":"aps5-trace-08a87661ab9a-3.json.gz"} ```
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!4287
No description provided.