shader: lower v_div_fixup_f64 #3675

Open
github-bot wants to merge 6 commits from github-bot/gh-3673 into main AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 23:50 UTC · original
lambirou:shader/div-fixup-f64 → main · +497 −0 · 7 files · 6 commits · open

Problem

The pixel AOT path still refused v_div_fixup_f64, while the coverage references list the VOP3 form in both gfx1013 and gfx1030. The direct-compute path has its own f16/f32 fixup handling, but the pixel path had no integer lowering or draw record for the binary64 form.

Change

  • Adds div_fixup64(l0, h0, l1, h1, l2, h2), a uint2 helper over the two raw binary64 words. No HLSL double, Int64ShaderOps or DoublePrecisionFloatShaderOps are required.
  • Implements the ISA section 12.12, opcode 352 rules in order: Quiet(S2), Quiet(S1), canonical negative qNaN for 0/0 and Inf/Inf, signed infinity for S1 zero or S2 infinity, signed zero for S1 infinity or S2 zero, signed zero below the exponent(S2) - exponent(S1) < -1075 boundary, else sign(S1) ^ sign(S2) | abs(S0).
  • Accepts the plain VOP3A spelling, even-aligned VGPR destination pairs, and aligned tracked VGPR or SGPR source pairs. It refuses literals, inline constants, abs/neg, clamp, omod, op_sel, DPP, SDWA, non-entry masks, unknown binary64 denormal entry state, sample overlaps and unaligned or untracked pairs.
  • Adds the source-built draw-div-fixup-f64 fixture
  • Keeps the fixture constants under a DIV64_ prefix: the later min/max fixture redefines F64_ONE/F64_TWO as 64-bit integers, which made the div-fixup rows pass an integer to div_fixup64_words., translation controls, a Python model, mutations, the coverage pin, CTest entries and documentation.

Tests

Commands run in the worktree:

python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/rdna2_tools_check.py
ctest --test-dir out/build/dev --no-tests=error -R ^pixel_aot_div_fixup_f64_ -V

Results:

  • form_coverage_check.py: form coverage checks passed.
  • docs_links_check.py: self-test passed; 192 Markdown files and 745 links checked.
  • rdna2_tools_check.py: 161 tests OK, with 19 LLVM-dependent capability skips reported separately.
  • pixel_aot_div_fixup_f64_hardware and _warp: 2/2 passed, no skips. Five one-line mutations each reported mismatch on both adapters.
  • Hardware: AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 build 26300, debug layer unavailable. WARP: Microsoft Basic Render Driver 10.0.26100.10068.

Coverage delta

The record contains exactly v_div_fixup_f64, mapped to one VOP3 row in both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv: +1 gfx1013 and +1 gfx1030 in the isolated measurement.

Limits

This is desktop DXIL translation evidence, not a console measurement. It does not establish the console's NaN payload, subnormal, or rounding behavior. The lowering covers plain register-pair VOP3A only; modifiers, DPP, SDWA and literals remain out of scope.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 23:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673) `lambirou:shader/div-fixup-f64` → `main` · +497 −0 · 7 files · 6 commits · open ## Problem The pixel AOT path still refused v_div_fixup_f64, while the coverage references list the VOP3 form in both gfx1013 and gfx1030. The direct-compute path has its own f16/f32 fixup handling, but the pixel path had no integer lowering or draw record for the binary64 form. ## Change - Adds div_fixup64(l0, h0, l1, h1, l2, h2), a uint2 helper over the two raw binary64 words. No HLSL double, Int64ShaderOps or DoublePrecisionFloatShaderOps are required. - Implements the ISA section 12.12, opcode 352 rules in order: Quiet(S2), Quiet(S1), canonical negative qNaN for 0/0 and Inf/Inf, signed infinity for S1 zero or S2 infinity, signed zero for S1 infinity or S2 zero, signed zero below the exponent(S2) - exponent(S1) < -1075 boundary, else sign(S1) ^ sign(S2) | abs(S0). - Accepts the plain VOP3A spelling, even-aligned VGPR destination pairs, and aligned tracked VGPR or SGPR source pairs. It refuses literals, inline constants, abs/neg, clamp, omod, op_sel, DPP, SDWA, non-entry masks, unknown binary64 denormal entry state, sample overlaps and unaligned or untracked pairs. - Adds the source-built draw-div-fixup-f64 fixture - Keeps the fixture constants under a `DIV64_` prefix: the later min/max fixture redefines `F64_ONE`/`F64_TWO` as 64-bit integers, which made the div-fixup rows pass an integer to `div_fixup64_words`., translation controls, a Python model, mutations, the coverage pin, CTest entries and documentation. ## Tests Commands run in the worktree: python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/rdna2_tools_check.py ctest --test-dir out/build/dev --no-tests=error -R ^pixel_aot_div_fixup_f64_ -V Results: - form_coverage_check.py: form coverage checks passed. - docs_links_check.py: self-test passed; 192 Markdown files and 745 links checked. - rdna2_tools_check.py: 161 tests OK, with 19 LLVM-dependent capability skips reported separately. - pixel_aot_div_fixup_f64_hardware and _warp: 2/2 passed, no skips. Five one-line mutations each reported mismatch on both adapters. - Hardware: AMD Radeon RX 9060 XT, driver 32.0.32029.2010, Windows 11 build 26300, debug layer unavailable. WARP: Microsoft Basic Render Driver 10.0.26100.10068. ## Coverage delta The record contains exactly v_div_fixup_f64, mapped to one VOP3 row in both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv: +1 gfx1013 and +1 gfx1030 in the isolated measurement. ## Limits This is desktop DXIL translation evidence, not a console measurement. It does not establish the console's NaN payload, subnormal, or rounding behavior. The lowering covers plain register-pair VOP3A only; modifiers, DPP, SDWA and literals remain out of scope. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 23:54:39 +00:00
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-12-01 02:37 UTC · original · reviewed

Reviewed e0833669 by reading the diff; not built or run.

Verdict: comment. The lowering is correct and I would approve it. As on #3659, the docs block carries a personal path, which is better fixed before merge. No MUST.

  • SHOULD The new docs/experiments.md block sets -DINTAKE_PYTHON= to an absolute path inside the author's own user folder (docs/experiments.md:18350). Use out/pe-env/Scripts/python.exe like the neighbouring commands, or drop the flag.
  • NIT #3659 and this PR add their helpers and the helpers emit lines at the same spots in tools/pixel_aot.py (after DIV_FMAS_HELPERS), so whichever lands second needs a small rebase.
  • Checked, no finding:
    • div_fixup64 (tools/pixel_aot.py:693) is the f32 rule on raw (low, high) words: NaN needs the low word (m == 0x7ff00000 && l != 0), quieting sets high bit 19, the canonical NaN is 0xfff80000_00000000, and zero and infinity test both words. The underflow bound −1075 is the binary64 analogue of −150 (bias + mantissa bits) on the 11-bit exponent m >> 20. The result copies S0's low word and |high| under the sign XOR. The unreachable exponent(S1) == 2047 branch is correctly omitted.
    • Operands: only aligned VGPR/SGPR pairs, every half tracked, and pending values refused through int_operand. A destination that partially overlaps a source pair is refused (:8319), and an exact overlap is safe because the sources are read into the helper call first. A non-entry mask, a pending sample and an unknown binary64 denormal entry state (:8315) are refused.

Tests: the draw-div-fixup-f64 rows (18 rows, 144 words, lossless readback) prove each rule bit for bit, including NaN payloads in both words and the exponent boundary. The five mutations show the rows can fail. CI ran pixel_aot_check.py, form_coverage_check.py and rdna2_tools_check.py at this head. The WARP/hardware draws are outside the pr filter and rest on the author's WARP and RX 9060 XT runs.

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673#pullrequestreview-6124183752) · **reviewed** Reviewed `e0833669` by reading the diff; not built or run. **Verdict: comment.** The lowering is correct and I would approve it. As on #3659, the docs block carries a personal path, which is better fixed before merge. No MUST. - **SHOULD** The new `docs/experiments.md` block sets `-DINTAKE_PYTHON=` to an absolute path inside the author's own user folder (`docs/experiments.md:18350`). Use `out/pe-env/Scripts/python.exe` like the neighbouring commands, or drop the flag. - **NIT** #3659 and this PR add their helpers and the `helpers` emit lines at the same spots in `tools/pixel_aot.py` (after `DIV_FMAS_HELPERS`), so whichever lands second needs a small rebase. - Checked, no finding: - `div_fixup64` (`tools/pixel_aot.py:693`) is the f32 rule on raw (low, high) words: NaN needs the low word (`m == 0x7ff00000 && l != 0`), quieting sets high bit 19, the canonical NaN is `0xfff80000_00000000`, and zero and infinity test both words. The underflow bound −1075 is the binary64 analogue of −150 (bias + mantissa bits) on the 11-bit exponent `m >> 20`. The result copies S0's low word and |high| under the sign XOR. The unreachable `exponent(S1) == 2047` branch is correctly omitted. - Operands: only aligned VGPR/SGPR pairs, every half tracked, and pending values refused through `int_operand`. A destination that partially overlaps a source pair is refused (`:8319`), and an exact overlap is safe because the sources are read into the helper call first. A non-entry mask, a pending sample and an unknown binary64 denormal entry state (`:8315`) are refused. Tests: the `draw-div-fixup-f64` rows (18 rows, 144 words, lossless readback) prove each rule bit for bit, including NaN payloads in both words and the exponent boundary. The five mutations show the rows can fail. CI ran `pixel_aot_check.py`, `form_coverage_check.py` and `rdna2_tools_check.py` at this head. The WARP/hardware draws are outside the `pr` filter and rest on the author's WARP and RX 9060 XT runs.
The module-level F64_ONE and F64_TWO names are redefined later as 64-bit integers for the min/max fixture, so the div-fixup rows passed integers to div_fixup64_words. Use DIV64_ prefixed tuples inside this fixture.

Refs #3518
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 19:17 UTC · original · requested changes

Both focused cases fail at a32c9c01 before the GPU draw. Independent Windows/MSVC Debug ctest --preset dev --no-tests=error -V -j 1 -R '^pixel_aot_div_fixup_f64_(warp|hardware)$' reports TypeError: cannot unpack non-iterable int object at div_fixup64_words(F64_THREE, F64_TWO, F64_SIX) in check_div_fixup64_draw. The merged file defines F64_TWO as an integer whereas the helper requires a (low, high) tuple. Please use a local/prefixed fixture constant and run both selectors after the fix. Please also use a checkout-relative interpreter path in the reproduction command.

**@⁠R0Y00** on GitHub · 2026-12-02 19:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673#pullrequestreview-6157263580) · **requested changes** Both focused cases fail at `a32c9c01` before the GPU draw. Independent Windows/MSVC Debug `ctest --preset dev --no-tests=error -V -j 1 -R '^pixel_aot_div_fixup_f64_(warp|hardware)$'` reports `TypeError: cannot unpack non-iterable int object` at `div_fixup64_words(F64_THREE, F64_TWO, F64_SIX)` in `check_div_fixup64_draw`. The merged file defines `F64_TWO` as an integer whereas the helper requires a `(low, high)` tuple. Please use a local/prefixed fixture constant and run both selectors after the fix. Please also use a checkout-relative interpreter path in the reproduction command.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 23:10 UTC · original · reviewed

The fixture constant collision is fixed on e71963c7. The Windows MSVC Debug pixel_aot_div_fixup_f64_(warp|hardware) tests passed 2/2, and all five built-in mutations produced the expected mismatch on each adapter. pixel_aot_check.py and form_coverage_check.py passed. rdna2_tools_check.py completed 165 cases with 19 capability skips. I also resolved the sole merge conflict locally against main c42b7ce3 by keeping the heap-token paragraph, appending the new section, and using out/pe-env/Scripts/python.exe in the docs command. On that combined tree, both GPU tests and mutation sets passed again, as did form coverage and the 968-link docs check. Please carry the docs resolution into your branch so the required CI can run.

**@⁠R0Y00** on GitHub · 2026-12-02 23:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673#pullrequestreview-6160686851) · **reviewed** The fixture constant collision is fixed on `e71963c7`. The Windows MSVC Debug `pixel_aot_div_fixup_f64_(warp|hardware)` tests passed 2/2, and all five built-in mutations produced the expected mismatch on each adapter. `pixel_aot_check.py` and `form_coverage_check.py` passed. `rdna2_tools_check.py` completed 165 cases with 19 capability skips. I also resolved the sole merge conflict locally against `main` `c42b7ce3` by keeping the heap-token paragraph, appending the new section, and using `out/pe-env/Scripts/python.exe` in the docs command. On that combined tree, both GPU tests and mutation sets passed again, as did form coverage and the 968-link docs check. Please carry the docs resolution into your branch so the required CI can run.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 23:28 UTC · original · reviewed

Thanks for merging main. The current head resolves the docs conflict. The remaining documentation line below still points to a machine-specific interpreter.

**@⁠R0Y00** on GitHub · 2026-12-02 23:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673#pullrequestreview-6160918476) · **reviewed** Thanks for merging main. The current head resolves the docs conflict. The remaining documentation line below still points to a machine-specific interpreter.
@ -18651,0 +18706,4 @@
```powershell
.\tools\dev.ps1
cmake --preset dev -DINTAKE_PYTHON=C:/Users/rolandedi/dev/labs/xbox-recomp/Xbox2Windows/out/pe-env/Scripts/python.exe
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 23:28 UTC · original

Use the interpreter path relative to the checkout so a contributor can run this command as written.

cmake --preset dev -DINTAKE_PYTHON=out/pe-env/Scripts/python.exe
**@⁠R0Y00** on GitHub · 2026-12-02 23:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3673#discussion_r4777615508) Use the interpreter path relative to the checkout so a contributor can run this command as written. ```suggestion cmake --preset dev -DINTAKE_PYTHON=out/pe-env/Scripts/python.exe ```
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3675/head:github-bot/gh-3673'
git switch 'github-bot/gh-3673'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3673'
git switch 'github-bot/gh-3673'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3673'
git switch 'github-bot/gh-3673'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3673'
git switch 'main'
git merge --squash 'github-bot/gh-3673'
git switch 'main'
git merge --ff-only 'github-bot/gh-3673'
git switch 'main'
git merge 'github-bot/gh-3673'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.