shader: lower VOP3 binary64 frexp in pixel AOT #3674

Open
github-bot wants to merge 4 commits from github-bot/gh-3672 into main AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 23:46 UTC · original
lambirou:shader/frexp-f64-pixel → main · +557 −0 · 7 files · 4 commits · open

Problem

The gfx1013 and gfx1030 form lists still report VOP3 v_frexp_exp_i32_f64_e64 and VOP3 v_frexp_mant_f64_e64 as unobserved. PR #3636 already merged the direct-compute lowering and its tests/native_frexp_f64_check.py; this change adapts that exact bit semantics to the pixel_aot path instead of duplicating the work. I checked the open PR list and found no PR covering the two pixel forms.

Change

  • tools/pixel_aot.py lowers the VOP3 _e64 spellings of v_frexp_exp_i32_f64 and v_frexp_mant_f64 with two uint-only helpers. They transcribe the direct-compute keep rule, the 1022 bias and the six-step subnormal normalizer; the generated DXIL contains no double, i64 or fcmp.
  • The exponent form writes one VGPR (v255 allowed); the mantissa form writes a VGPR pair (v[254:255] maximum). Sources are consecutive VGPR pairs or even-aligned SGPR pairs. Literals, modifiers, clamp/omod/op_sel, DPP/SDWA, an outstanding sample destination, a pending scalar load, a non-entry mask and invalid pairs are refused.
  • tests/pixel_aot_check.py controls-frexp-f64 covers signed zero, Inf/NaN payloads, normals at several exponents, the smallest normals, every normalizer step, the 2097151/2097152 k=32 boundary, MAX_SUB, DBL_MAX, readers, the two maximum destinations and every refusal. Eleven model mutations must differ from the canonical table.
  • tests/pixel_aot_check.py draw-frexp-f64 compares the exact exponent and mantissa words on the integer target and checks four helper mutations: unbiased exponent, lost normalizer shift, modified zero mantissa and swapped source words.
  • Adds the CTest fragment, the Linux check list entry, and docs/experiments/pixel-frexp-f64.md.

Verification

  • python -B tests/pixel_aot_check.py controls-frexp-f64: passed.
  • WARP draw: passed on Microsoft Basic Render Driver 10.0.26100.10068, Windows 11 build 26300, debug layer unavailable.
  • Hardware draw: passed on AMD Radeon RX 9060 XT (vendor 1002, device 7590), driver 32.0.32029.2010, Windows 11 build 26300, debug layer unavailable; 4096 pixels, max_absolute_error=0.
  • tests/form_coverage_check.py: passed.
  • tests/rdna2_tools_check.py: passed (161 tests, 19 capability skips).
  • tests/run_checks_parallel_check.py and tests/docs_links_check.py: passed.
  • cmake --preset dev and cmake --build --preset dev: configured and built on MSVC 19.44.
  • ctest --preset dev --no-tests=error -R '^pixel_aot_frexp_f64_' -V: 3/3 passed (controls, WARP, hardware).

Coverage delta

Each form adds one gfx1013 row and one gfx1030 row. Against the records present in the workspace, the covered totals move from 1480 to 1482 for gfx1013 and from 1471 to 1473 for gfx1030; the new rows are exactly VOP3 v_frexp_exp_i32_f64_e64 and VOP3 v_frexp_mant_f64_e64.

tests/form_coverage_check.py now pins both rows in gfx1013.tsv and rdna2.tsv and checks that adding the two fixtures to a baseline of other f64 programs adds exactly those rows.

Limits

The draw runs are desktop-adapter evidence for the lowering, not console gfx1013/gfx1030 measurements. The VOP1 _e32 spellings remain outside this change. The host has no D3D12 debug layer, so debug-layer validation is unavailable here.

AI-assisted (OpenAI Codex).

**@⁠lambirou** on GitHub · 2026-11-30 23:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672) `lambirou:shader/frexp-f64-pixel` → `main` · +557 −0 · 7 files · 4 commits · open ## Problem The gfx1013 and gfx1030 form lists still report `VOP3 v_frexp_exp_i32_f64_e64` and `VOP3 v_frexp_mant_f64_e64` as unobserved. PR #3636 already merged the direct-compute lowering and its `tests/native_frexp_f64_check.py`; this change adapts that exact bit semantics to the `pixel_aot` path instead of duplicating the work. I checked the open PR list and found no PR covering the two pixel forms. ## Change - `tools/pixel_aot.py` lowers the VOP3 `_e64` spellings of `v_frexp_exp_i32_f64` and `v_frexp_mant_f64` with two uint-only helpers. They transcribe the direct-compute keep rule, the 1022 bias and the six-step subnormal normalizer; the generated DXIL contains no `double`, `i64` or `fcmp`. - The exponent form writes one VGPR (v255 allowed); the mantissa form writes a VGPR pair (v[254:255] maximum). Sources are consecutive VGPR pairs or even-aligned SGPR pairs. Literals, modifiers, clamp/omod/op_sel, DPP/SDWA, an outstanding sample destination, a pending scalar load, a non-entry mask and invalid pairs are refused. - `tests/pixel_aot_check.py controls-frexp-f64` covers signed zero, Inf/NaN payloads, normals at several exponents, the smallest normals, every normalizer step, the 2097151/2097152 k=32 boundary, MAX_SUB, DBL_MAX, readers, the two maximum destinations and every refusal. Eleven model mutations must differ from the canonical table. - `tests/pixel_aot_check.py draw-frexp-f64` compares the exact exponent and mantissa words on the integer target and checks four helper mutations: unbiased exponent, lost normalizer shift, modified zero mantissa and swapped source words. - Adds the CTest fragment, the Linux check list entry, and `docs/experiments/pixel-frexp-f64.md`. ## Verification - `python -B tests/pixel_aot_check.py controls-frexp-f64`: passed. - WARP draw: passed on Microsoft Basic Render Driver 10.0.26100.10068, Windows 11 build 26300, debug layer unavailable. - Hardware draw: passed on AMD Radeon RX 9060 XT (vendor 1002, device 7590), driver 32.0.32029.2010, Windows 11 build 26300, debug layer unavailable; 4096 pixels, `max_absolute_error=0`. - `tests/form_coverage_check.py`: passed. - `tests/rdna2_tools_check.py`: passed (161 tests, 19 capability skips). - `tests/run_checks_parallel_check.py` and `tests/docs_links_check.py`: passed. - `cmake --preset dev` and `cmake --build --preset dev`: configured and built on MSVC 19.44. - `ctest --preset dev --no-tests=error -R '^pixel_aot_frexp_f64_' -V`: 3/3 passed (controls, WARP, hardware). ## Coverage delta Each form adds one gfx1013 row and one gfx1030 row. Against the records present in the workspace, the covered totals move from 1480 to 1482 for gfx1013 and from 1471 to 1473 for gfx1030; the new rows are exactly `VOP3 v_frexp_exp_i32_f64_e64` and `VOP3 v_frexp_mant_f64_e64`. `tests/form_coverage_check.py` now pins both rows in `gfx1013.tsv` and `rdna2.tsv` and checks that adding the two fixtures to a baseline of other f64 programs adds exactly those rows. ## Limits The draw runs are desktop-adapter evidence for the lowering, not console gfx1013/gfx1030 measurements. The VOP1 `_e32` spellings remain outside this change. The host has no D3D12 debug layer, so debug-layer validation is unavailable here. AI-assisted (OpenAI Codex).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 23:48:44 +00:00
github-bot force-pushed github-bot/gh-3672 from ebff56d1dc to 1d4c603120 2026-11-30 23:54:43 +00:00 Compare
Keep both appended coverage checks: check_frexp_f64_forms from this branch and check_f64_minmax_ldexp_forms from main. Keep both helper blocks in tools/pixel_aot.py: frexp_exp64/frexp_mant64 and main's minmax_f64/ldexp_f64.
Author
Owner

@⁠Alexofbulgaria on GitHub · 2026-12-01 01:26 UTC · original

Retested current head a7cfdcb7b0633f1e7545d16f4430a74572dbfd14 on Windows 26300.10075 with a clean Release build (MSVC 19.44.35230.0, DXC 1.9.2602.17). All three pixel_aot_frexp_f64_* checks passed.

Check Result
CPU controls Passed
Intel Arc A770, driver 32.0.101.9175 Passed
Microsoft WARP, driver 10.0.26100.10068 Passed

The D3D12 debug layer was active during both renderer replays, with zero errors and warnings across 98 checks per backend. Both backends passed the bit-exact exponent and mantissa draws and detected the four expected negative-control mismatches. The repository form coverage check also passed.

**@⁠Alexofbulgaria** on GitHub · 2026-12-01 01:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672#issuecomment-7297508419) Retested current head `a7cfdcb7b0633f1e7545d16f4430a74572dbfd14` on Windows `26300.10075` with a clean Release build (MSVC `19.44.35230.0`, DXC `1.9.2602.17`). All three `pixel_aot_frexp_f64_*` checks passed. | Check | Result | | --- | --- | | CPU controls | Passed | | Intel Arc A770, driver `32.0.101.9175` | Passed | | Microsoft WARP, driver `10.0.26100.10068` | Passed | The D3D12 debug layer was active during both renderer replays, with zero errors and warnings across 98 checks per backend. Both backends passed the bit-exact exponent and mantissa draws and detected the four expected negative-control mismatches. The repository form coverage check also passed.
Author
Owner

@⁠lambirou on GitHub · 2026-12-01 03:11 UTC · original · reviewed

Reviewed a7cfdcb7 by reading the diff and running python -B tests/pixel_aot_check.py controls-frexp-f64.

Verdict: approve. The two helpers transcribe the direct-compute model, the guards match the pixel binary64 readers, and the controls pin the special values and normalization boundaries. The controls pass locally.

  • Checked, no finding:
    • frexp_exp64 returns 0 for zero, infinity and NaN; exponent - 1022 for normals; and (53 - steps) - 1074 for subnormals. The six steps and the 2097152 k=32 threshold match the direct-compute lowering.
    • frexp_mant64 preserves zero/Inf/NaN words, keeps the sign and the 0x3FE00000 exponent for normals, and uses the normalized word for subnormals. The large FREXP64_VALUES table is cross-checked against math.frexp, so the model is not its own only reference.
    • v255 is accepted for the exponent destination; v[254:255] is accepted for the mantissa; v255 as a mantissa start, v256, malformed pairs, literals and modifiers are refused. The destination/source overlap cases read both words before writing.
    • The helper calls are emitted only when used, and the draw checks the exact words through the integer target.

Tests: controls-frexp-f64 passes. The WARP/hardware draws are outside the pr filter, so they remain the author's desktop evidence, as the body says; the translation-time model itself is exercised by the controls.

**@⁠lambirou** on GitHub · 2026-12-01 03:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672#pullrequestreview-6124499479) · **reviewed** Reviewed `a7cfdcb7` by reading the diff and running `python -B tests/pixel_aot_check.py controls-frexp-f64`. **Verdict: approve.** The two helpers transcribe the direct-compute model, the guards match the pixel binary64 readers, and the controls pin the special values and normalization boundaries. The controls pass locally. - Checked, no finding: - `frexp_exp64` returns 0 for zero, infinity and NaN; `exponent - 1022` for normals; and `(53 - steps) - 1074` for subnormals. The six steps and the `2097152` k=32 threshold match the direct-compute lowering. - `frexp_mant64` preserves zero/Inf/NaN words, keeps the sign and the `0x3FE00000` exponent for normals, and uses the normalized word for subnormals. The large `FREXP64_VALUES` table is cross-checked against `math.frexp`, so the model is not its own only reference. - v255 is accepted for the exponent destination; v[254:255] is accepted for the mantissa; v255 as a mantissa start, v256, malformed pairs, literals and modifiers are refused. The destination/source overlap cases read both words before writing. - The helper calls are emitted only when used, and the draw checks the exact words through the integer target. Tests: `controls-frexp-f64` passes. The WARP/hardware draws are outside the `pr` filter, so they remain the author's desktop evidence, as the body says; the translation-time model itself is exercised by the controls.
Author
Owner

@⁠Leyukaka on GitHub · 2026-12-01 15:19 UTC · original · reviewed

All 88 inputs in FREXP64_VALUES still produce the correct mantissa if the low-to-high carry is removed from any one of the 8-, 4- or 2-bit normalization steps. Could you add these subnormal inputs to the existing CPU and GPU table? Each distinguishes the corresponding missing carry.

Shift Input bits Expected mantissa bits
8 0x00001000fedcba98 0x3fe000fedcba9800
4 0x00010000fedcba98 0x3fe0000fedcba980
2 0x00040000fedcba98 0x3fe00003fb72ea60

In tests/cmake/pixel_frexp_f64.cmake, both draw tests also invoke INTAKE_PYTHON. Please include EXISTS "${INTAKE_PYTHON}" in their registration guard so a configure with DXC and no intake interpreter does not register unlaunchable tests.

**@⁠Leyukaka** on GitHub · 2026-12-01 15:19 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672#pullrequestreview-6134230570) · **reviewed** All 88 inputs in `FREXP64_VALUES` still produce the correct mantissa if the low-to-high carry is removed from any one of the 8-, 4- or 2-bit normalization steps. Could you add these subnormal inputs to the existing CPU and GPU table? Each distinguishes the corresponding missing carry. | Shift | Input bits | Expected mantissa bits | | --- | --- | --- | | 8 | `0x00001000fedcba98` | `0x3fe000fedcba9800` | | 4 | `0x00010000fedcba98` | `0x3fe0000fedcba980` | | 2 | `0x00040000fedcba98` | `0x3fe00003fb72ea60` | In `tests/cmake/pixel_frexp_f64.cmake`, both draw tests also invoke `INTAKE_PYTHON`. Please include `EXISTS "${INTAKE_PYTHON}"` in their registration guard so a configure with DXC and no intake interpreter does not register unlaunchable tests.
Author
Owner

@⁠lambirou on GitHub · 2026-12-02 14:46 UTC · original · reviewed

Follow-up after Leyukaka's carry note on a7cfdcb7.

Verdict: comment. The three proposed subnormal inputs are worth adding: each one crosses a different normalization shift, so a missing low-to-high carry in the 8-, 4- or 2-bit step would otherwise still pass all 88 existing values. Add the three rows to FREXP64_VALUES and to the draw table; the CPU model and the exact-word draw should both use them.

  • SHOULD In tests/cmake/pixel_frexp_f64.cmake, the draw registrations guard on TARGET offscreen_check AND EXISTS "${DXC_EXECUTABLE}" but not on EXISTS "${INTAKE_PYTHON}", unlike the controls block. A configure with DXC but no intake interpreter registers tests that cannot launch. Add the same INTAKE_PYTHON guard.
  • Checked, no finding: the helper itself carries the low word into the high word at each normalization step; the gap is in the table, not in the implemented shift.

This keeps the approval conditional on the added boundary rows; no production-code change is required.

**@⁠lambirou** on GitHub · 2026-12-02 14:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672#pullrequestreview-6153078895) · **reviewed** Follow-up after Leyukaka's carry note on `a7cfdcb7`. **Verdict: comment.** The three proposed subnormal inputs are worth adding: each one crosses a different normalization shift, so a missing low-to-high carry in the 8-, 4- or 2-bit step would otherwise still pass all 88 existing values. Add the three rows to `FREXP64_VALUES` and to the draw table; the CPU model and the exact-word draw should both use them. - **SHOULD** In `tests/cmake/pixel_frexp_f64.cmake`, the draw registrations guard on `TARGET offscreen_check AND EXISTS "${DXC_EXECUTABLE}"` but not on `EXISTS "${INTAKE_PYTHON}"`, unlike the controls block. A configure with DXC but no intake interpreter registers tests that cannot launch. Add the same `INTAKE_PYTHON` guard. - Checked, no finding: the helper itself carries the low word into the high word at each normalization step; the gap is in the table, not in the implemented shift. This keeps the approval conditional on the added boundary rows; no production-code change is required.
github-bot force-pushed github-bot/gh-3672 from a7cfdcb7b0 to b00bea16fc 2026-12-02 14:58:21 +00:00 Compare
Author
Owner

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

Independent Windows/MSVC Debug ctest --preset dev --no-tests=error -V -j 1 -R '^pixel_aot_frexp_f64_(controls|warp|hardware)$' passed 3/3 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The current merge still lacks the three subnormal inputs from Leyukaka's review and still registers the GPU Python tests without checking INTAKE_PYTHON exists. Please add the 8-, 4-, and 2-bit carry cases to both the CPU and draw inputs, and add the interpreter guard to the GPU registration.

**@⁠R0Y00** on GitHub · 2026-12-02 19:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3672#pullrequestreview-6157266280) · **requested changes** Independent Windows/MSVC Debug `ctest --preset dev --no-tests=error -V -j 1 -R '^pixel_aot_frexp_f64_(controls|warp|hardware)$'` passed 3/3 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The current merge still lacks the three subnormal inputs from Leyukaka's review and still registers the GPU Python tests without checking `INTAKE_PYTHON` exists. Please add the 8-, 4-, and 2-bit carry cases to both the CPU and draw inputs, and add the interpreter guard to the GPU registration.
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/3674/head:github-bot/gh-3672'
git switch 'github-bot/gh-3672'

Merge

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