Skip to content

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

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
thuanquang:docs/f64-denormal-debt
Oct 24, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
thuanquang:docs/f64-denormal-debt

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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 fix(shader): flush f64 floor, ceil, fract and frexp denormal inputs #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. 5e00b26 (fix(shader): preserve f64 denormals when supported by Vulkan #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 ee1e341 ("take an unregistered compute shader's float mode from the live COMPUTE_PGM_RSRC1", merged in feat(shader): track MODE rounding changes through the control flow graph #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 661f8b7, by reading the code (none of the files named here changed between it and 9d6adeb, 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 fix(shader): flush f64 floor, ceil, fract and frexp denormal inputs #7036 and fix(shader): flush v_add_f64 and v_mul_f64 denormals by the f64 field #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 8651664, and the call again on 9d6adeb, 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 feat(agc): emulate barycentrics in rect-list draws #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

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7446 docs/dev/debt/libSceAgcDriver.md L144-145
PR 9193 docs/dev/debt/shader.md L110-112

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

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5021 docs/dev/debt/shader.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 docs/dev/debt/shader.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 docs/dev/debt/shader.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6488 docs/dev/debt/shader.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6924 docs/dev/debt/shader.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7223 docs/dev/debt/shader.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7395 docs/dev/debt/shader.md
PR 7410 docs/dev/debt/shader.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7484 docs/dev/debt/shader.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7618 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7684 docs/dev/debt/shader.md
PR 7844 docs/dev/debt/libSceAgcDriver.md
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 7922 docs/dev/debt/shader.md
PR 7942 docs/dev/debt/shader.md
PR 8004 docs/dev/debt/shader.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8077 docs/dev/debt/shader.md
PR 8223 docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8365 docs/dev/debt/libSceAgcDriver.md
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8939 docs/dev/debt/shader.md
PR 9348 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9431 docs/dev/debt/libSceAgcDriver.md
PR 9432 docs/dev/debt/libSceAgcDriver.md
PR 9457 docs/dev/debt/shader.md
PR 9508 docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9633 docs/dev/debt/shader.md
PR 9672 docs/dev/debt/libSceAgcDriver.md
PR 9673 docs/dev/debt/libSceAgcDriver.md
PR 9674 docs/dev/debt/libSceAgcDriver.md
PR 9675 docs/dev/debt/libSceAgcDriver.md
PR 9676 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
docs/dev/debt/shader.md
PR 9749 docs/dev/debt/shader.md
PR 9790 docs/dev/debt/shader.md
PR 9842 docs/dev/debt/libSceAgcDriver.md
PR 9889 docs/dev/debt/shader.md
PR 9891 docs/dev/debt/libSceAgcDriver.md
PR 9892 docs/dev/debt/libSceAgcDriver.md
PR 9893 docs/dev/debt/libSceAgcDriver.md
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9898 docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 9969 docs/dev/debt/shader.md
PR 10193 docs/dev/debt/libSceAgcDriver.md
PR 10420 docs/dev/debt/libSceAgcDriver.md

@github-actions github-actions Bot added the docs label Oct 20, 2026
@thuanquang thuanquang changed the title docs(debt): correct two stale f64 denormal statements docs(debt): correct three stale f64 denormal statements Oct 20, 2026
@thuanquang thuanquang changed the title docs(debt): correct three stale f64 denormal statements docs(debt): correct stale f64 denormal and RSRC1 float mode statements Oct 20, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 20, 2026
@thuanquang
thuanquang force-pushed the docs/f64-denormal-debt branch from d393d26 to 921c8c2 Compare October 20, 2026 16:43
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 20, 2026

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
@thuanquang
thuanquang force-pushed the docs/f64-denormal-debt branch from 921c8c2 to 5fa23eb Compare October 21, 2026 11:50
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@thuanquang
thuanquang force-pushed the docs/f64-denormal-debt branch from 5fa23eb to 571f687 Compare October 23, 2026 04:44
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 23, 2026
thuanquang and others added 3 commits October 24, 2026 01:43
The shader float mode entry said "Other f64 arithmetic does not model
these denormal controls". On main, v_add_f64, v_mul_f64, v_floor_f64,
v_ceil_f64, v_fract_f64, v_frexp_mant_f64, v_frexp_exp_i32_f64,
v_div_fixup_f64, the f64 compares and ds_min/max/cmpst_f64 read the
f16/f64 denormal field, and each has its own entry. The sentence now
names the f64 arithmetic whose translation still does not read it.

The v_floor_f64 entry said its modifier run used 16 of the 23 measured
values. The run's list holds 13 of them plus -1.5, 2.75 and 1 - 2^-53.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
… mode

Co-Authored-By: Claude <noreply@anthropic.com>
@thuanquang
thuanquang force-pushed the docs/f64-denormal-debt branch from 571f687 to 2e874e6 Compare October 23, 2026 18:48
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@adriadam10 adriadam10 self-assigned this Oct 24, 2026
@adriadam10
adriadam10 merged commit 2b2055f into boykopovar:main Oct 24, 2026
10 of 11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the three rewritten debt statements against main: DispatchFloatMode takes the live RSRC1 for an unregistered shader (ShaderRegistry.cpp:1142, Dispatch.cpp:167), F64FmaSubnormals.cpp only skips without shaderFloat64 or on a mismatch without f64 DenormPreserve, and the listed f64 ops do not read the denormal field. Docs only, Conventions green, approved by @harisibrar1; merged.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants