docs(debt): correct stale f64 denormal and RSRC1 float mode statements #8281

Merged
thuanquang merged 3 commits from upstream-pr/8281 into main 2026-10-24 09:06:20 +00:00
thuanquang commented 2026-10-20 08:31:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-20T08:31:11Z.


What

Four technical-debt statements are stale: three about f64 denormals (two went stale when #7036 and #7042 merged) and one about where a raw compute program's float mode comes from.

  • docs/dev/debt/libSceAgcDriver.md, shader float mode entry: "Other f64 arithmetic does not model these denormal controls." On main the translation reads the FLOAT_MODE f16/f64 denormal field for v_min_f64 and v_max_f64 (this entry), the f64 compares, v_floor_f64, v_ceil_f64, v_fract_f64, v_frexp_mant_f64, v_frexp_exp_i32_f64, v_add_f64, v_mul_f64, v_div_fixup_f64 and ds_min/max/cmpst_f64, each with its own entry in shader.md. The sentence now names the f64 arithmetic that still does not read the field: v_fma_f64, v_div_fmas_f64, v_div_scale_f64, v_ldexp_f64, v_rcp_f64, v_rsq_f64, v_sqrt_f64 and v_trig_preop_f64.

  • docs/dev/debt/shader.md, the #7036 entry: "and 16 of them with neg and abs modifiers". The modifier run used 13 of the 23 values plus -1.5 (0xbff8000000000000), 2.75 (0x4006000000000000) and 1 - 2^-53 (0x3fefffffffffffff). The entry now says so.

  • docs/dev/debt/shader.md, the v_fma_f64 and v_div_fmas_f64 entry: "Elsewhere (including lavapipe), the driver may flush f64 subnormals, and agc_driver_f64_fma_subnormals is skipped." F64FmaSubnormals.cpp (lines 216-233 on main) skips only without a device or shaderFloat64, or when a row differs and the target has no f64 DenormPreserve; otherwise it runs. 5e00b269c (#2977) removed the unconditional skip without updating this sentence, and in main's CI run 39390834287 the linux job, which runs on lavapipe, passes it (Test #524: agc_driver_f64_fma_subnormals ... Passed 0.14 sec). The sentence now reads "Elsewhere the driver may flush f64 subnormals, and agc_driver_f64_fma_subnormals skips if it does."

  • docs/dev/debt/libSceAgcDriver.md, the same shader float mode entry: "A title that rewrites RSRC1 at run time, or a raw compute program with no header, compiles with that mode or none." Since ee1e34197 ("take an unregistered compute shader's float mode from the live COMPUTE_PGM_RSRC1", merged in #5180), Dispatch.cpp:167 builds the float mode with DispatchFloatMode (ShaderRegistry.cpp:1120-1123), which decodes the live COMPUTE_PGM_RSRC1 when the shader is not registered; testDispatchFloatMode in tests/Submit.cpp checks it. Registered shaders and draws (DrawCapture.cpp:25) still take the header's mode. The sentence now reads "A registered shader keeps that mode when a title rewrites RSRC1; a raw compute program takes the live RSRC1."

Docs only. No code changes.

Tested

Not built or run, because only docs change. What was checked:

  • main 661f8b717, by reading the code (none of the files named here changed between it and 9d6adeb550, which this branch is now on, except Dispatch.cpp, where the call is now at line 167): the field (floatMode & 0x40 / 0x80) is read in float64Operation (inputs of add, mul and frexp_exp, and add/mul results through flushTinyF64Result), float64Unary (inputs of floor, ceil, fract and frexp_mant, and the fract result), minMaxF64 and vDivFixupF64 in Float64Instructions.cpp, emitFloat64Compare in CompareInstructions.cpp, and floatAtomicFlush in MemoryResourceHelpers.cpp (the f64 shared, buffer and flat atomics). The fma (float64Operation without the flush), div_fmas, div_scale, ldexp, rcp, rsq, sqrt and trig_preop paths do not read it. The SPIR-V backend receives no guest float mode for those opcodes.
  • Left out of the list: v_trunc_f64 and v_rndne_f64 (their entry says the results are the same either way), and the conversions and v_cmp_class_f64. A local sweep from 2026-10-17 (RX 6700 XT through HIP, against the recompiler before #7036 and #7042) found that v_cvt_i32_f64, v_cvt_u32_f64 and v_cmp_class_f64 matched the GPU in all four f16/f64 denormal modes. v_cvt_f32_f64 differed on 3 of 29 rows, the same count in every f16/f64 mode, and on none with f32 denormals flushed. In the same sweep, v_ldexp_f64 and v_fma_f64 matched the GPU in mode 3 and not in modes 0 to 2. v_div_scale_f64, with src0 equal to the denominator or to the numerator, differed on 175 of 529 rows in modes 0 and 2 and on none in mode 3. v_trig_preop_f64 was not swept.
  • Modifier values: the command of the 2026-10-17 modifier run lists 16 values. It ran -v[4:5] for floor, frexp_mant and frexp_exp, |v[4:5]| for ceil and -|v[4:5]| for fract, at IEEE 0 and 1 with denorm16 0 to 3. Compared with the 23-value list of the sweep script, 13 of the 16 are among the 23 and 3 are not. That run's rows were not saved.
  • RSRC1 sentence: checked on main 865166414, and the call again on 9d6adeb550, by reading DispatchFloatMode and RegisteredFloatMode in ShaderRegistry.cpp, their callers in Dispatch.cpp and DrawCapture.cpp, and testDispatchFloatMode in tests/Submit.cpp.
  • python tools/check_conventions.py --base origin/main with this title and body: 0 errors and 2 debt-length warnings: the shader float mode entry (3249 characters; 3151 before this change) and the v_fma_f64 entry (1081 characters; 1097 before, so this change shortens it).
  • Rebased onto main e78acf4bda for the conflict with #8339 (merged) in docs/dev/debt/shader.md: main's text is kept and this PR's change is unchanged; the statements were rechecked on that commit.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4933140656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8281). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-20T08:31:11Z. --- ### What Four technical-debt statements are stale: three about f64 denormals (two went stale when #7036 and #7042 merged) and one about where a raw compute program's float mode comes from. - `docs/dev/debt/libSceAgcDriver.md`, shader float mode entry: "Other f64 arithmetic does not model these denormal controls." On `main` the translation reads the `FLOAT_MODE` f16/f64 denormal field for `v_min_f64` and `v_max_f64` (this entry), the f64 compares, `v_floor_f64`, `v_ceil_f64`, `v_fract_f64`, `v_frexp_mant_f64`, `v_frexp_exp_i32_f64`, `v_add_f64`, `v_mul_f64`, `v_div_fixup_f64` and `ds_min/max/cmpst_f64`, each with its own entry in `shader.md`. The sentence now names the f64 arithmetic that still does not read the field: `v_fma_f64`, `v_div_fmas_f64`, `v_div_scale_f64`, `v_ldexp_f64`, `v_rcp_f64`, `v_rsq_f64`, `v_sqrt_f64` and `v_trig_preop_f64`. - `docs/dev/debt/shader.md`, the #7036 entry: "and 16 of them with neg and abs modifiers". The modifier run used 13 of the 23 values plus -1.5 (`0xbff8000000000000`), 2.75 (`0x4006000000000000`) and 1 - 2^-53 (`0x3fefffffffffffff`). The entry now says so. - `docs/dev/debt/shader.md`, the `v_fma_f64` and `v_div_fmas_f64` entry: "Elsewhere (including lavapipe), the driver may flush f64 subnormals, and `agc_driver_f64_fma_subnormals` is skipped." `F64FmaSubnormals.cpp` (lines 216-233 on `main`) skips only without a device or `shaderFloat64`, or when a row differs and the target has no f64 `DenormPreserve`; otherwise it runs. 5e00b269c (#2977) removed the unconditional skip without updating this sentence, and in `main`'s CI run 39390834287 the linux job, which runs on lavapipe, passes it (`Test #524: agc_driver_f64_fma_subnormals ... Passed 0.14 sec`). The sentence now reads "Elsewhere the driver may flush f64 subnormals, and `agc_driver_f64_fma_subnormals` skips if it does." - `docs/dev/debt/libSceAgcDriver.md`, the same shader float mode entry: "A title that rewrites RSRC1 at run time, or a raw compute program with no header, compiles with that mode or none." Since ee1e34197 ("take an unregistered compute shader's float mode from the live COMPUTE_PGM_RSRC1", merged in #5180), `Dispatch.cpp:167` builds the float mode with `DispatchFloatMode` (`ShaderRegistry.cpp:1120-1123`), which decodes the live `COMPUTE_PGM_RSRC1` when the shader is not registered; `testDispatchFloatMode` in `tests/Submit.cpp` checks it. Registered shaders and draws (`DrawCapture.cpp:25`) still take the header's mode. The sentence now reads "A registered shader keeps that mode when a title rewrites RSRC1; a raw compute program takes the live RSRC1." Docs only. No code changes. ### Tested Not built or run, because only docs change. What was checked: - `main` 661f8b717, by reading the code (none of the files named here changed between it and 9d6adeb550, which this branch is now on, except `Dispatch.cpp`, where the call is now at line 167): the field (`floatMode & 0x40` / `0x80`) is read in `float64Operation` (inputs of add, mul and frexp_exp, and add/mul results through `flushTinyF64Result`), `float64Unary` (inputs of floor, ceil, fract and frexp_mant, and the fract result), `minMaxF64` and `vDivFixupF64` in `Float64Instructions.cpp`, `emitFloat64Compare` in `CompareInstructions.cpp`, and `floatAtomicFlush` in `MemoryResourceHelpers.cpp` (the f64 shared, buffer and flat atomics). The fma (`float64Operation` without the flush), div_fmas, div_scale, ldexp, rcp, rsq, sqrt and trig_preop paths do not read it. The SPIR-V backend receives no guest float mode for those opcodes. - Left out of the list: `v_trunc_f64` and `v_rndne_f64` (their entry says the results are the same either way), and the conversions and `v_cmp_class_f64`. A local sweep from 2026-10-17 (RX 6700 XT through HIP, against the recompiler before #7036 and #7042) found that `v_cvt_i32_f64`, `v_cvt_u32_f64` and `v_cmp_class_f64` matched the GPU in all four f16/f64 denormal modes. `v_cvt_f32_f64` differed on 3 of 29 rows, the same count in every f16/f64 mode, and on none with f32 denormals flushed. In the same sweep, `v_ldexp_f64` and `v_fma_f64` matched the GPU in mode 3 and not in modes 0 to 2. `v_div_scale_f64`, with src0 equal to the denominator or to the numerator, differed on 175 of 529 rows in modes 0 and 2 and on none in mode 3. `v_trig_preop_f64` was not swept. - Modifier values: the command of the 2026-10-17 modifier run lists 16 values. It ran `-v[4:5]` for floor, frexp_mant and frexp_exp, `|v[4:5]|` for ceil and `-|v[4:5]|` for fract, at IEEE 0 and 1 with denorm16 0 to 3. Compared with the 23-value list of the sweep script, 13 of the 16 are among the 23 and 3 are not. That run's rows were not saved. - RSRC1 sentence: checked on `main` 865166414, and the call again on 9d6adeb550, by reading `DispatchFloatMode` and `RegisteredFloatMode` in `ShaderRegistry.cpp`, their callers in `Dispatch.cpp` and `DrawCapture.cpp`, and `testDispatchFloatMode` in `tests/Submit.cpp`. - `python tools/check_conventions.py --base origin/main` with this title and body: 0 errors and 2 `debt-length` warnings: the shader float mode entry (3249 characters; 3151 before this change) and the `v_fma_f64` entry (1081 characters; 1097 before, so this change shortens it). - Rebased onto `main` `e78acf4bda` for the conflict with #8339 (merged) in `docs/dev/debt/shader.md`: main's text is kept and this PR's change is unchanged; the statements were rechecked on that commit. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
harisibrar1 commented 2026-10-21 05:59:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T05:59:44Z.

Review: APPROVED


Checked against main:

  • The FLOAT_MODE f16/f64 denormal field is read by add/mul (Float64Instructions.cpp:20,43), min/max (:55), floor/ceil/fract/frexp_mant (:83-88), div_fixup (:184), the f64 compares (CompareInstructions.cpp:229) and the f64 ds min/max/cmpst (SharedMemoryInstructions.cpp:216-226).
  • The new list of arithmetic that does not read it is correct. v_fma_f64, v_ldexp_f64, v_rcp_f64, v_rsq_f64, v_sqrt_f64 and v_trig_preop_f64 take the no-flush paths at VectorInstructions.cpp:966-990, and v_div_fmas_f64 and v_div_scale_f64 have no floatMode reference.
  • DispatchFloatMode (ShaderRegistry.cpp:837-840, used at Dispatch.cpp:157) returns the registered header's mode when the shader is registered and decodes the live COMPUTE_PGM_RSRC1 otherwise. Draws use RegisteredFloatMode only (DrawCapture.cpp:25). tests/Submit.cpp:715-732 pins both cases.
  • F64FmaSubnormals.cpp:216-233 skips only without Float64, or on a mismatch when the target lacks f64 DenormPreserve, so the old unconditional "is skipped" was stale. Not checked: the CI run and the 2026-10-17 sweep behind the "13 of 23" correction.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5595536322 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8281#pullrequestreview-5595536322). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-21T05:59:44Z. **Review:** APPROVED --- Checked against main: - The `FLOAT_MODE` f16/f64 denormal field is read by add/mul (`Float64Instructions.cpp:20,43`), min/max (`:55`), floor/ceil/fract/frexp_mant (`:83-88`), div_fixup (`:184`), the f64 compares (`CompareInstructions.cpp:229`) and the f64 ds min/max/cmpst (`SharedMemoryInstructions.cpp:216-226`). - The new list of arithmetic that does not read it is correct. `v_fma_f64`, `v_ldexp_f64`, `v_rcp_f64`, `v_rsq_f64`, `v_sqrt_f64` and `v_trig_preop_f64` take the no-flush paths at `VectorInstructions.cpp:966-990`, and `v_div_fmas_f64` and `v_div_scale_f64` have no floatMode reference. - `DispatchFloatMode` (`ShaderRegistry.cpp:837-840`, used at `Dispatch.cpp:157`) returns the registered header's mode when the shader is registered and decodes the live `COMPUTE_PGM_RSRC1` otherwise. Draws use `RegisteredFloatMode` only (`DrawCapture.cpp:25`). `tests/Submit.cpp:715-732` pins both cases. - `F64FmaSubnormals.cpp:216-233` skips only without Float64, or on a mismatch when the target lacks f64 DenormPreserve, so the old unconditional "is skipped" was stale. Not checked: the CI run and the 2026-10-17 sweep behind the "13 of 23" correction. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
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!8281
No description provided.