shader: lower compute v_ldexp_f32 #1911

Open
henriazz10 wants to merge 2 commits from upstream-pr/1918 into main
henriazz10 commented 2026-11-24 21:09:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-24T21:09:08Z.


Change

Refs #721. This is item 4 (v_ldexp_f32) claimed in https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7143412663. It touches only tools/compute_store_aot.py, tests/compute_store_check.py, CMakeLists.txt and docs/experiments.md.

  • v_ldexp_f32 vD, S0, S1 (VOP3A opcode 0x362, RDNA2 D.f32 = ldexp(S0.f32, S1.i32) = S0.f32 * (2 ** S1.i32)) lowers to f32_ldexp(S0, S1), emitted in F32_HELPERS only when used:
    • S0 uses the existing float_word profile (VGPR, known SGPR, inline float constant, 0, or finite normal 32-bit literal; NaN, infinity and denormal constants are refused with Unverified float operand, while runtime words from memory or integer ALU may carry any bit pattern).
    • S1 is any known alu_word (VGPR, known SGPR, integer inline constant, or 32-bit literal).
    • f32_ldexp operates on uint bit patterns: preserves +/-0 and +/-Inf, quiets sNaN and preserves qNaN payloads, normalizes denormal S0 inputs via firstbithigh, clamps the signed S1 exponent delta to [-512, 512] to prevent int wraparound, overflows to +/-Inf, and rounds subnormal results to nearest-even. Denormal inputs and results assume binary32 denormals are enabled (IEEE mode); with flush-to-zero in MODE (FP_DENORM), console hardware would flush them, which is not modelled and MODE is not read by the translator.
  • Refused, each with its own control:
    • other spelling (v_ldexp_f32_e64), clamp, omod (mul:2), - and |...| modifiers on S0 or S1, register ranges (v[10:11]), and a float literal in S1 (1.0);
    • unknown or pending S0 (v40, s30, s12), non-finite/denormal constant S0 (0x7fc00000, 0xff800000, 0x00000001, -1, 5, 1.5, and scalar move s_mov_b32 s5, 0x00400000), and vD above v255 (v256) with Unverified float operand;
    • unknown, pending, or out-of-range S1 (v40, s30, s12, 0x100000000) with Unverified ALU operand;
    • expression chains exceeding ALU_EXPRESSION_LIMIT (ALU expression too large).

Mode gate (after review). v_ldexp_f32 is lowered only under the new caller statement f32_mode="ieee-rne-denorm" (--f32-mode ieee-rne-denorm): binary32 round-to-nearest-even with denormals preserved. With no statement it is refused with v_ldexp_f32 requires a declared f32 mode, and any other mode, including flush-to-zero, is refused with Unsupported f32 mode. Other operations keep their default. A no-profile refusal and an FTZ-mode refusal are translation controls. Non-folded per-lane inputs at word 1 (a denormal input) and word 20 (a normal input underflowing to denormal) separate preserved denormals from FTZ: an FTZ reference model and a recompiled-HLSL FTZ mutation must both mismatch, and do.

Verification

Commit b5e1fa8f (gate) on e2bb9920, rebased onto 246a875d. The draws, controls() and the LLVM 15 round trip were re-run on b5e1fa8f. Windows 11, DXC 10.0.26100.0, Python 3.12, D3D12 debug layer enabled. offscreen_check was built from origin/main; this PR does not change it.

python -B -c "import sys; sys.path.insert(0, 'tests'); import compute_store_check as c; c.controls()"
python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> warp
python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> hardware
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
git diff --check HEAD~1
Backend Adapter / driver Result
WARP Microsoft Basic Render Driver 10.0.26100.9818 exit 0, groups=1 compared_words=320 mismatches=0, debug_errors=0 debug_warnings=0
hardware NVIDIA GeForce RTX 5080, 32.0.16.1692 exit 0, groups=1 compared_words=320 mismatches=0, debug_errors=0 debug_warnings=0

Other checks:

  • controls(): exit 0.
  • docs_links_check.py: exit 0 (Checked 18 Markdown files and 376 links.).
  • bidi_controls_check.py: exit 0 (Checked 1330 tracked source, script and build/CI files: no bidirectional controls.).
  • git diff --check HEAD~1: exit 0.

LLVM 15 round trip in Docker (x2w-llvm15):

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 /usr/lib/x86_64-linux-gnu/libLLVM-15.so.1

binary_exit=0. ldexp_f32_binary() decodes the assembled fixture back to the same v_ldexp_f32 lines and requires the identical lowered HLSL.

Negative control. With tools/compute_store_aot.py from origin/main, ldexp_f32_controls() fails with ValueError: Unsupported compute instruction: v_ldexp_f32 v4, v10, v11.

Evidence

The fixture LDEXP_F32 is source-built in LLVM 15 spelling and runs one 64-thread group storing 4 words per thread (stride=16, 256 words stored, 64 sentinel words untouched). Each thread computes four v_ldexp_f32 results covering:

  1. Word 0 (v4): normal [1.5, 2.0) with sign and tie bits scaled by (tid.x - 20) * 10 (underflow to +/-0, subnormal rounding, normal-range scaling, overflow to +/-Inf).
  2. Word 1 (v5): denormal inputs ((tid.x & 1) << 31) | ((tid.x + 1) << 16) scaled by SGPR s4 = -3.
  3. Word 2 (v6): +/-0.0, +/-Inf, +/-qNaN and +/-sNaN with payloads and large exponents 0x7fffffff / 0x80000000.
  4. Word 3 (v7): subnormal tie-to-even boundary (0x00800000 | (tid.x & 1)) scaled across -26..-23 and up to 0x7fffffff (testing clamp(delta, -512, 512) against int32 wraparound).

All 320 words are compared against an independent bit-level Python model (ldexp_f32_word). The denormal, NaN and infinity draw cases check the helper against its own model on desktop, not against console hardware.

  • Translation controls. ldexp_f32_controls() checks f32_ldexp emission, the Store4 lowering, accepted source combinations (inline float, 0, hex literal, SGPR, negative inline int, positive literal), and all rejection conditions.
  • Reference controls. Each must fail at its first differing word:
    • no exponent clamp: word 243;
    • flush subnormals: word 1;
    • sNaN not quieted: word 42;
    • no denormal input normalization: word 1;
    • sentinel past group: word 256.
  • Recompiled-HLSL mutations. Each must fail on the device:
    • clamp(asint(b), -512, 512) narrowed to [-100, 100];
    • return sign | q; replaced by return sign;;
    • (a | 0x00400000u) replaced by a;
    • if (exp == 0u) { replaced by if (false) {.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed (docs/experiments.md).
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5480374284 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918). Originally posted by [henriazz10](https://github.com/henriazz10) on 2026-11-24T21:09:08Z. --- ## Change Refs #721. This is item 4 (`v_ldexp_f32`) claimed in https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7143412663. It touches only `tools/compute_store_aot.py`, `tests/compute_store_check.py`, `CMakeLists.txt` and `docs/experiments.md`. - `v_ldexp_f32 vD, S0, S1` (VOP3A opcode `0x362`, RDNA2 `D.f32 = ldexp(S0.f32, S1.i32) = S0.f32 * (2 ** S1.i32)`) lowers to `f32_ldexp(S0, S1)`, emitted in `F32_HELPERS` only when used: - `S0` uses the existing `float_word` profile (VGPR, known SGPR, inline float constant, `0`, or finite normal 32-bit literal; NaN, infinity and denormal constants are refused with `Unverified float operand`, while runtime words from memory or integer ALU may carry any bit pattern). - `S1` is any known `alu_word` (VGPR, known SGPR, integer inline constant, or 32-bit literal). - `f32_ldexp` operates on `uint` bit patterns: preserves `+/-0` and `+/-Inf`, quiets `sNaN` and preserves `qNaN` payloads, normalizes denormal `S0` inputs via `firstbithigh`, clamps the signed `S1` exponent delta to `[-512, 512]` to prevent `int` wraparound, overflows to `+/-Inf`, and rounds subnormal results to nearest-even. Denormal inputs and results assume binary32 denormals are enabled (IEEE mode); with flush-to-zero in `MODE` (`FP_DENORM`), console hardware would flush them, which is not modelled and `MODE` is not read by the translator. - Refused, each with its own control: - other spelling (`v_ldexp_f32_e64`), `clamp`, `omod` (`mul:2`), `-` and `|...|` modifiers on `S0` or `S1`, register ranges (`v[10:11]`), and a float literal in `S1` (`1.0`); - unknown or pending `S0` (`v40`, `s30`, `s12`), non-finite/denormal constant `S0` (`0x7fc00000`, `0xff800000`, `0x00000001`, `-1`, `5`, `1.5`, and scalar move `s_mov_b32 s5, 0x00400000`), and `vD` above `v255` (`v256`) with `Unverified float operand`; - unknown, pending, or out-of-range `S1` (`v40`, `s30`, `s12`, `0x100000000`) with `Unverified ALU operand`; - expression chains exceeding `ALU_EXPRESSION_LIMIT` (`ALU expression too large`). **Mode gate (after review).** `v_ldexp_f32` is lowered only under the new caller statement `f32_mode="ieee-rne-denorm"` (`--f32-mode ieee-rne-denorm`): binary32 round-to-nearest-even with denormals preserved. With no statement it is refused with `v_ldexp_f32 requires a declared f32 mode`, and any other mode, including flush-to-zero, is refused with `Unsupported f32 mode`. Other operations keep their default. A no-profile refusal and an FTZ-mode refusal are translation controls. Non-folded per-lane inputs at word 1 (a denormal input) and word 20 (a normal input underflowing to denormal) separate preserved denormals from FTZ: an FTZ reference model and a recompiled-HLSL FTZ mutation must both mismatch, and do. ## Verification Commit `b5e1fa8f` (gate) on `e2bb9920`, rebased onto `246a875d`. The draws, `controls()` and the LLVM 15 round trip were re-run on `b5e1fa8f`. Windows 11, DXC 10.0.26100.0, Python 3.12, D3D12 debug layer enabled. `offscreen_check` was built from `origin/main`; this PR does not change it. ```powershell python -B -c "import sys; sys.path.insert(0, 'tests'); import compute_store_check as c; c.controls()" python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> warp python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> hardware python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py git diff --check HEAD~1 ``` | Backend | Adapter / driver | Result | |---|---|---| | WARP | Microsoft Basic Render Driver 10.0.26100.9818 | exit 0, `groups=1 compared_words=320 mismatches=0`, `debug_errors=0 debug_warnings=0` | | hardware | NVIDIA GeForce RTX 5080, 32.0.16.1692 | exit 0, `groups=1 compared_words=320 mismatches=0`, `debug_errors=0 debug_warnings=0` | Other checks: - `controls()`: exit 0. - `docs_links_check.py`: exit 0 (`Checked 18 Markdown files and 376 links.`). - `bidi_controls_check.py`: exit 0 (`Checked 1330 tracked source, script and build/CI files: no bidirectional controls.`). - `git diff --check HEAD~1`: exit 0. LLVM 15 round trip in Docker (`x2w-llvm15`): ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 /usr/lib/x86_64-linux-gnu/libLLVM-15.so.1 ``` `binary_exit=0`. `ldexp_f32_binary()` decodes the assembled fixture back to the same `v_ldexp_f32` lines and requires the identical lowered HLSL. **Negative control.** With `tools/compute_store_aot.py` from `origin/main`, `ldexp_f32_controls()` fails with `ValueError: Unsupported compute instruction: v_ldexp_f32 v4, v10, v11`. ## Evidence The fixture `LDEXP_F32` is source-built in LLVM 15 spelling and runs one 64-thread group storing 4 words per thread (`stride=16`, 256 words stored, 64 sentinel words untouched). Each thread computes four `v_ldexp_f32` results covering: 1. Word 0 (`v4`): normal `[1.5, 2.0)` with sign and tie bits scaled by `(tid.x - 20) * 10` (underflow to `+/-0`, subnormal rounding, normal-range scaling, overflow to `+/-Inf`). 2. Word 1 (`v5`): denormal inputs `((tid.x & 1) << 31) | ((tid.x + 1) << 16)` scaled by SGPR `s4 = -3`. 3. Word 2 (`v6`): `+/-0.0`, `+/-Inf`, `+/-qNaN` and `+/-sNaN` with payloads and large exponents `0x7fffffff` / `0x80000000`. 4. Word 3 (`v7`): subnormal tie-to-even boundary `(0x00800000 | (tid.x & 1))` scaled across `-26..-23` and up to `0x7fffffff` (testing `clamp(delta, -512, 512)` against `int32` wraparound). All 320 words are compared against an independent bit-level Python model (`ldexp_f32_word`). The denormal, NaN and infinity draw cases check the helper against its own model on desktop, not against console hardware. - **Translation controls.** `ldexp_f32_controls()` checks `f32_ldexp` emission, the `Store4` lowering, accepted source combinations (inline float, `0`, hex literal, SGPR, negative inline int, positive literal), and all rejection conditions. - **Reference controls.** Each must fail at its first differing word: - no exponent clamp: word 243; - flush subnormals: word 1; - `sNaN` not quieted: word 42; - no denormal input normalization: word 1; - sentinel past group: word 256. - **Recompiled-HLSL mutations.** Each must fail on the device: - `clamp(asint(b), -512, 512)` narrowed to `[-100, 100]`; - `return sign | q;` replaced by `return sign;`; - `(a | 0x00400000u)` replaced by `a`; - `if (exp == 0u) {` replaced by `if (false) {`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed (`docs/experiments.md`). - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-24 21:13:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:13:49Z.

Review: COMMENTED


Review of head b36c718a27a9d9abd7b2c75015eb40f3c272cb2e (shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No merge from my side yet: the branch conflicts with current main.

Blocker: merge conflict. git merge-tree --write-tree --name-only origin/main HEAD reports a content conflict in tests/compute_store_check.py (CMakeLists.txt, docs/experiments.md and tools/compute_store_aot.py auto-merge). Please rebase or merge main and keep both sides. GitHub shows mergeable UNKNOWN and gh pr checks reports no checks on the branch, so there is no CI result for this head either. I did not run Win2025: it would have to be redone after the rebase.

Read of the diff (no P1/P2 in the logic as written).

  • CMakeLists.txt only adds the compute_store_aot_ldexp_f32_<adapter> test registration (timeout 45).
  • f32_ldexp keeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs (shift = 23 - firstbithigh(mant), e = 1 - shift), clamps the signed S1 delta to [-512, 512], overflows to +/-Inf at e >= 255, and rounds subnormal results to nearest even (zero below e < -23). I checked these against the independent word model in the test and found no mismatch.
  • The lowering rejects _e64, clamp/mul modifiers, abs/neg, 64-bit register ranges, float literal in S1, non-finite or denormal constant S0, unknown or pending S0/S1, and oversize expressions.
  • Documented limit: denormal behaviour assumes IEEE mode (MODE flush not modelled).

Commands run locally on this head:

  • git diff --check origin/main...HEAD: rc=0
  • python3 tests/docs_links_check.py: rc=0 (18 files, 382 links)
  • python3 tests/bidi_controls_check.py: rc=0 (1343 files)
  • python3 tests/compute_store_check.py with no mode: the controls section (which includes ldexp_f32_controls) passes; the script then stops on the missing mode argument, as expected. The binary and draw-ldexp_f32 modes need the assembler and DXC, which this Linux node does not have.

Mutations in tools/compute_store_aot.py (each reverted with git checkout -- ., tree clean after):

  1. Swap S0 and S1 in the emitted f32_ldexp(...) call: controls FAIL (AssertionError, rc=1). Killed.
  2. Drop the s0 is None rejection: controls FAIL (expected "Unverified float operand" rejection, got TypeError, rc=1). Killed.
  3. Helper-body mutations (remove the exponent clamp, drop the sticky tie rule, drop sNaN quieting, off-by-one denormal shift): the Linux controls still pass, as expected, because those change HLSL that only the draw-ldexp_f32 GPU test executes. That test carries its own mutation set for the clamp, flush, sNaN and denormal cases; it needs a Windows run after the rebase.

After the rebase: a Win2025 Debug and Release run of draw-ldexp_f32 and the CI Windows job are still needed before a merge. This is a review comment, not an approval.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6047509714 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6047509714). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:13:49Z. **Review:** COMMENTED --- Review of head `b36c718a27a9d9abd7b2c75015eb40f3c272cb2e` (shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No merge from my side yet: the branch conflicts with current main. **Blocker: merge conflict.** `git merge-tree --write-tree --name-only origin/main HEAD` reports a content conflict in `tests/compute_store_check.py` (CMakeLists.txt, docs/experiments.md and tools/compute_store_aot.py auto-merge). Please rebase or merge main and keep both sides. GitHub shows mergeable UNKNOWN and `gh pr checks` reports no checks on the branch, so there is no CI result for this head either. I did not run Win2025: it would have to be redone after the rebase. **Read of the diff (no P1/P2 in the logic as written).** - CMakeLists.txt only adds the `compute_store_aot_ldexp_f32_<adapter>` test registration (timeout 45). - `f32_ldexp` keeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs (shift = 23 - firstbithigh(mant), e = 1 - shift), clamps the signed S1 delta to [-512, 512], overflows to +/-Inf at e >= 255, and rounds subnormal results to nearest even (zero below e < -23). I checked these against the independent word model in the test and found no mismatch. - The lowering rejects _e64, clamp/mul modifiers, abs/neg, 64-bit register ranges, float literal in S1, non-finite or denormal constant S0, unknown or pending S0/S1, and oversize expressions. - Documented limit: denormal behaviour assumes IEEE mode (MODE flush not modelled). **Commands run locally on this head:** - `git diff --check origin/main...HEAD`: rc=0 - `python3 tests/docs_links_check.py`: rc=0 (18 files, 382 links) - `python3 tests/bidi_controls_check.py`: rc=0 (1343 files) - `python3 tests/compute_store_check.py` with no mode: the controls section (which includes `ldexp_f32_controls`) passes; the script then stops on the missing mode argument, as expected. The `binary` and `draw-ldexp_f32` modes need the assembler and DXC, which this Linux node does not have. **Mutations in tools/compute_store_aot.py (each reverted with `git checkout -- .`, tree clean after):** 1. Swap S0 and S1 in the emitted `f32_ldexp(...)` call: controls FAIL (AssertionError, rc=1). Killed. 2. Drop the `s0 is None` rejection: controls FAIL (expected "Unverified float operand" rejection, got TypeError, rc=1). Killed. 3. Helper-body mutations (remove the exponent clamp, drop the sticky tie rule, drop sNaN quieting, off-by-one denormal shift): the Linux controls still pass, as expected, because those change HLSL that only the `draw-ldexp_f32` GPU test executes. That test carries its own mutation set for the clamp, flush, sNaN and denormal cases; it needs a Windows run after the rebase. **After the rebase:** a Win2025 Debug and Release run of `draw-ldexp_f32` and the CI Windows job are still needed before a merge. This is a review comment, not an approval. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-24 21:26:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:26:18Z.

Review: CHANGES_REQUESTED


The new helper assumes binary32 round-to-nearest-even with denormals preserved. The PR documents that assumption, but lower() currently accepts ldexp whenever the register forms match; a shader with unknown or flush-to-zero mode silently takes the preserved-denormal path. Please gate this new lowering on an explicit, verified f32 profile for the supplied fixture or a mode proved from the input. Keep the existing default for unrelated operations, and refuse this op when its required mode is unknown or unsupported. Add a no-profile refusal and a non-folded preserve/FTZ discriminator. Continue to distinguish the emitted helper's NaN payload behavior from independently verified native behavior.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6047681343 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6047681343). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T21:26:18Z. **Review:** CHANGES_REQUESTED --- The new helper assumes binary32 round-to-nearest-even with denormals preserved. The PR documents that assumption, but lower() currently accepts ldexp whenever the register forms match; a shader with unknown or flush-to-zero mode silently takes the preserved-denormal path. Please gate this new lowering on an explicit, verified f32 profile for the supplied fixture or a mode proved from the input. Keep the existing default for unrelated operations, and refuse this op when its required mode is unknown or unsupported. Add a no-profile refusal and a non-folded preserve/FTZ discriminator. Continue to distinguish the emitted helper's NaN payload behavior from independently verified native behavior.
tedin7 commented 2026-11-24 21:31:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:31:16Z.

Review: COMMENTED


Review of head 226e0d5984439ffa1658431a12cd18c5bc8e1a2d (shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No P1, no P2. My earlier comment was on b36c718a; this head is the same change rebased onto current main, and the merge conflict I reported is gone.

Scope. git diff origin/main...HEAD: 4 files, +284 lines, 0 deleted. CMakeLists.txt only adds the compute_store_aot_ldexp_f32_<adapter> registration (timeout 45). The rest is the lowering, the HLSL helper, the independent word model and the check. git merge-tree --write-tree origin/main HEAD merges cleanly. GitHub: mergeable, state CLEAN.

Semantics (RDNA2 V_LDEXP_F32, S0.f32 * 2^S1.i32). The helper keeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs, clamps the signed S1 delta to [-512, 512] so the exponent cannot wrap, overflows to +/-Inf at e >= 255, rounds subnormal results to nearest even and returns signed zero below e < -23. It matches the independent model in the test. The lowering refuses _e64, clamp/mul modifiers, abs/neg, register ranges, a float literal in S1, a non-finite or denormal constant S0 and unknown or pending operands. Documented limit: denormal handling assumes IEEE mode and does not model a MODE flush.

Commands run locally on this head:

  • git diff --check origin/main...HEAD: rc=0
  • python3 tests/docs_links_check.py: rc=0 (18 files, 385 links)
  • python3 tests/bidi_controls_check.py: rc=0 (1346 files)
  • python3 tests/compute_store_check.py (no mode): the controls section, including ldexp_f32_controls, passes.
  • Windows Server 2025 (build 26100, MSVC 14.44, WARP), 68 of 68 downstream tests: Debug --preset dev 100% passed; Release /O2 --preset release 100% passed. compute_store_aot_ldexp_f32_warp passed in both (5.31 s and 4.75 s).
  • GitHub CI on this head: Build and test on Windows pass, Linux Python checks pass, gfx1013 fixtures pass.

Mutations in tools/compute_store_aot.py (each reverted with git checkout -- ., tree clean after):

  1. Swap S0 and S1 in the emitted f32_ldexp(...) call: controls FAIL (AssertionError, rc=1). Killed.
  2. Drop the s0 is None rejection: controls FAIL (expected "Unverified float operand", got TypeError, rc=1). Killed.
    Helper-body changes (exponent clamp, flush of subnormals, sNaN quieting, denormal normalization) are killed by the draw-ldexp_f32 run, which compiles each mutated helper and requires the readback to differ. That run passed on the Windows 2025 node above.

This is a review comment, not an approval.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6047742265 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6047742265). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:31:16Z. **Review:** COMMENTED --- Review of head `226e0d5984439ffa1658431a12cd18c5bc8e1a2d` (shader: lower compute v_ldexp_f32; CMakeLists.txt, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py). No P1, no P2. My earlier comment was on `b36c718a`; this head is the same change rebased onto current main, and the merge conflict I reported is gone. **Scope.** `git diff origin/main...HEAD`: 4 files, +284 lines, 0 deleted. CMakeLists.txt only adds the `compute_store_aot_ldexp_f32_<adapter>` registration (timeout 45). The rest is the lowering, the HLSL helper, the independent word model and the check. `git merge-tree --write-tree origin/main HEAD` merges cleanly. GitHub: mergeable, state CLEAN. **Semantics (RDNA2 V_LDEXP_F32, S0.f32 * 2^S1.i32).** The helper keeps +/-0 and +/-Inf, quiets sNaN, normalizes denormal inputs, clamps the signed S1 delta to [-512, 512] so the exponent cannot wrap, overflows to +/-Inf at e >= 255, rounds subnormal results to nearest even and returns signed zero below e < -23. It matches the independent model in the test. The lowering refuses _e64, clamp/mul modifiers, abs/neg, register ranges, a float literal in S1, a non-finite or denormal constant S0 and unknown or pending operands. Documented limit: denormal handling assumes IEEE mode and does not model a MODE flush. **Commands run locally on this head:** - `git diff --check origin/main...HEAD`: rc=0 - `python3 tests/docs_links_check.py`: rc=0 (18 files, 385 links) - `python3 tests/bidi_controls_check.py`: rc=0 (1346 files) - `python3 tests/compute_store_check.py` (no mode): the controls section, including `ldexp_f32_controls`, passes. - Windows Server 2025 (build 26100, MSVC 14.44, WARP), 68 of 68 downstream tests: Debug `--preset dev` 100% passed; Release /O2 `--preset release` 100% passed. `compute_store_aot_ldexp_f32_warp` passed in both (5.31 s and 4.75 s). - GitHub CI on this head: Build and test on Windows pass, Linux Python checks pass, gfx1013 fixtures pass. **Mutations in tools/compute_store_aot.py (each reverted with `git checkout -- .`, tree clean after):** 1. Swap S0 and S1 in the emitted `f32_ldexp(...)` call: controls FAIL (AssertionError, rc=1). Killed. 2. Drop the `s0 is None` rejection: controls FAIL (expected "Unverified float operand", got TypeError, rc=1). Killed. Helper-body changes (exponent clamp, flush of subnormals, sNaN quieting, denormal normalization) are killed by the `draw-ldexp_f32` run, which compiles each mutated helper and requires the readback to differ. That run passed on the Windows 2025 node above. This is a review comment, not an approval. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 21:31:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:31:39Z.

Review: COMMENTED


Follow-up on head 226e0d5984439ffa1658431a12cd18c5bc8e1a2d: two things changed after my review above, so the "mergeable, CLEAN" line there no longer holds and I am not merging.

  • main moved again. git merge-tree --write-tree --name-only origin/main HEAD now reports content conflicts in CMakeLists.txt, docs/experiments.md and others; GitHub shows CONFLICTING.
  • The maintainer's CHANGES_REQUESTED review (denormal and rounding mode of the new helper must be gated on a verified f32 profile, with a no-profile refusal and a non-folded preserve/FTZ discriminator) is open. I agree with the point: my review only noted that lower() does not read MODE, which is the same gap. It needs an answer before any merge.

No receipt-based merge was run (safe-merge-check: BLOCK on G2 and G6).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6047747006 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6047747006). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:31:39Z. **Review:** COMMENTED --- Follow-up on head `226e0d5984439ffa1658431a12cd18c5bc8e1a2d`: two things changed after my review above, so the "mergeable, CLEAN" line there no longer holds and I am not merging. - main moved again. `git merge-tree --write-tree --name-only origin/main HEAD` now reports content conflicts in CMakeLists.txt, docs/experiments.md and others; GitHub shows CONFLICTING. - The maintainer's CHANGES_REQUESTED review (denormal and rounding mode of the new helper must be gated on a verified f32 profile, with a no-profile refusal and a non-folded preserve/FTZ discriminator) is open. I agree with the point: my review only noted that `lower()` does not read MODE, which is the same gap. It needs an answer before any merge. No receipt-based merge was run (safe-merge-check: BLOCK on G2 and G6). AI-assisted; commands listed were executed locally.
henriazz10 commented 2026-11-25 01:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T00:44:33Z.


Thanks. The lowering is now gated, as requested. New commit b5e1fa8f (on e2bb9920, rebased onto 246a875d):

  • The gate. lower() takes a new caller statement, f32_mode (--f32-mode). v_ldexp_f32 is lowered only under f32_mode="ieee-rne-denorm": binary32 round-to-nearest-even with denormals preserved, the mode that the helper models.

    • With no f32_mode, the op is refused: v_ldexp_f32 requires a declared f32 mode.
    • Any other value is refused, including a flush-to-zero value ("ieee-rne-ftz"): Unsupported f32 mode: ....
    • Other operations keep their current default. Nothing else reads f32_mode.
  • Controls. ldexp_f32_controls() adds:

    • the no-profile refusal: the same fixture with f32_mode removed;
    • the FTZ-mode refusal.

    Both check the message.

  • Non-folded preserve/FTZ discriminator. The fixture's inputs are per-lane words, read from memory and from lane-dependent values, not constants. Two of them separate preserved denormals from FTZ:

    • word 1, a denormal input scaled by an SGPR exponent;
    • word 20, a normal input that underflows into the denormal range.

    An FTZ reference model, which flushes denormal inputs and results to a signed zero, must mismatch and does, first at word 1. A recompiled-HLSL FTZ mutation must also mismatch on the device, and does. The draw asserts that words 1 and 20 differ between the two models.

  • NaN payloads. The docs keep that the helper's NaN quieting and payload behavior is the helper's own model, checked against an independent Python model on desktop adapters. It is not verified as native console behavior.

Results on b5e1fa8f:

python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> warp       # exit 0, compared_words=320 mismatches=0, debug_errors=0
python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> hardware   # exit 0, compared_words=320 mismatches=0, debug_errors=0 (RTX 5080, 32.0.16.1692)
python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1   # binary_exit=0

draw-cvt-u32-f32 and draw-bfe also still pass on both adapters after the rebase. docs_links_check.py and git diff --check are clean.

AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change; Claude Code reviewed it, rebased it and ran the checks.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148828217 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7148828217). Originally posted by [henriazz10](https://github.com/henriazz10) on 2026-11-25T00:44:33Z. --- Thanks. The lowering is now gated, as requested. New commit `b5e1fa8f` (on `e2bb9920`, rebased onto `246a875d`): - **The gate.** `lower()` takes a new caller statement, `f32_mode` (`--f32-mode`). `v_ldexp_f32` is lowered only under `f32_mode="ieee-rne-denorm"`: binary32 round-to-nearest-even with denormals preserved, the mode that the helper models. - With no `f32_mode`, the op is refused: `v_ldexp_f32 requires a declared f32 mode`. - Any other value is refused, including a flush-to-zero value (`"ieee-rne-ftz"`): `Unsupported f32 mode: ...`. - Other operations keep their current default. Nothing else reads `f32_mode`. - **Controls.** `ldexp_f32_controls()` adds: - the no-profile refusal: the same fixture with `f32_mode` removed; - the FTZ-mode refusal. Both check the message. - **Non-folded preserve/FTZ discriminator.** The fixture's inputs are per-lane words, read from memory and from lane-dependent values, not constants. Two of them separate preserved denormals from FTZ: - word 1, a denormal input scaled by an SGPR exponent; - word 20, a normal input that underflows into the denormal range. An FTZ reference model, which flushes denormal inputs and results to a signed zero, must mismatch and does, first at word 1. A recompiled-HLSL FTZ mutation must also mismatch on the device, and does. The draw asserts that words 1 and 20 differ between the two models. - **NaN payloads.** The docs keep that the helper's NaN quieting and payload behavior is the helper's own model, checked against an independent Python model on desktop adapters. It is not verified as native console behavior. Results on `b5e1fa8f`: ``` python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> warp # exit 0, compared_words=320 mismatches=0, debug_errors=0 python -B tests/compute_store_check.py draw-ldexp_f32 <dxc> <offscreen_check> hardware # exit 0, compared_words=320 mismatches=0, debug_errors=0 (RTX 5080, 32.0.16.1692) python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 # binary_exit=0 ``` `draw-cvt-u32-f32` and `draw-bfe` also still pass on both adapters after the rebase. `docs_links_check.py` and `git diff --check` are clean. AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change; Claude Code reviewed it, rebased it and ran the checks.
tedin7 commented 2026-11-25 13:00:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:44:05Z.


@henriazz10 could you rebase this branch onto current main and force-push?

GitHub reports head 4de732c7 as conflicting with main, so it cannot be merged as is.

Files that conflict with current main (b1a644ae):

  • CMakeLists.txt
  • tests/compute_store_check.py
  • tools/compute_store_aot.py

Commands run locally:

git fetch origin main pull/1918/head
git merge-tree --write-tree --name-only origin/main FETCH_HEAD
gh pr view 1918 --json mergeable   # CONFLICTING

Once it is rebased and CI is green it will be re-checked right away.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162781102 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7162781102). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:44:05Z. --- @henriazz10 could you rebase this branch onto current `main` and force-push? GitHub reports head `4de732c7` as conflicting with `main`, so it cannot be merged as is. Files that conflict with current `main` (`b1a644ae`): - `CMakeLists.txt` - `tests/compute_store_check.py` - `tools/compute_store_aot.py` Commands run locally: ``` git fetch origin main pull/1918/head git merge-tree --write-tree --name-only origin/main FETCH_HEAD gh pr view 1918 --json mergeable # CONFLICTING ``` Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally.
henriazz10 commented 2026-11-25 15:02:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T14:54:39Z.


Rebased onto current main and force-pushed: head 4dc53965 on 14b5d514. GitHub now reports it as mergeable.

The two earlier commits are squashed into one, because the conflicts covered the same regions of CMakeLists.txt, tests/compute_store_check.py and tools/compute_store_aot.py. The behavior is unchanged: v_ldexp_f32 is accepted only with f32_mode="ieee-rne-denorm" (--f32-mode) and is refused otherwise. One addition: compute_store_aot_ldexp_f32_${adapter} now writes its FORM_COVERAGE_RECORD (14 forms, including v_ldexp_f32), like the other compute draws.

Checks on the new head (Windows 11 build 26300, DXC 10.0.26100.0, NVIDIA GeForce RTX 5080 driver 32.0.16.1692):

  • draw-ldexp_f32 on warp and on hardware: exit 0, mismatches=0, debug_errors=0;
  • draw-mac-f32 and draw-vcmp-select on warp: exit 0, because they share the edited regions;
  • tests/compute_store_check.py binary with LLVM 15: binary_exit=0;
  • tests/form_coverage_check.py and git diff --check: clean.

AI-assisted. Claude Code rebased it and ran the checks.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7166006671 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7166006671). Originally posted by [henriazz10](https://github.com/henriazz10) on 2026-11-25T14:54:39Z. --- Rebased onto current `main` and force-pushed: head `4dc53965` on `14b5d514`. GitHub now reports it as mergeable. The two earlier commits are squashed into one, because the conflicts covered the same regions of `CMakeLists.txt`, `tests/compute_store_check.py` and `tools/compute_store_aot.py`. The behavior is unchanged: `v_ldexp_f32` is accepted only with `f32_mode="ieee-rne-denorm"` (`--f32-mode`) and is refused otherwise. One addition: `compute_store_aot_ldexp_f32_${adapter}` now writes its `FORM_COVERAGE_RECORD` (14 forms, including `v_ldexp_f32`), like the other compute draws. Checks on the new head (Windows 11 build 26300, DXC 10.0.26100.0, NVIDIA GeForce RTX 5080 driver 32.0.16.1692): - `draw-ldexp_f32` on warp and on hardware: exit 0, mismatches=0, debug_errors=0; - `draw-mac-f32` and `draw-vcmp-select` on warp: exit 0, because they share the edited regions; - `tests/compute_store_check.py binary` with LLVM 15: `binary_exit=0`; - `tests/form_coverage_check.py` and `git diff --check`: clean. AI-assisted. Claude Code rebased it and ran the checks.
thepatrickworld commented 2026-11-26 08:01:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T07:12:47Z.


AMD RDNA 4 run on 89b9aa85: compute_store_aot_ldexp_f32 passes on both backends; the neighbouring compute_store_aot_*_hardware family is 78/79.

Not a code change; measurements only. A third adapter for this fixture: the evidence table above covers WARP and an RTX 5080.

Environment

  • Windows 10.0.26200.9974 (25H2, UBR 0x26f6); MSVC BuildTools toolset 14.44.35207; CMake 4.4.4.
  • DXC from Windows Kits\10\bin\10.0.26100.0\x64\, reporting dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17).
  • Adapter AMD Radeon RX 9070 XT, vendor=1002 device=7550, driver 32.0.32029.2010. The warp backend reports Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818.
  • Preset dev. Every mode line reports debug_layer=unavailable, so no API validation is involved.
  • PR head 89b9aa85 (89b9aa8530659a91ed947174eca5a7bbf1785093); git rev-parse HEAD is the second line of each log. No ldexp or f32_mode line differs between 4dc53965 (the head measured on the RTX 5080) and 89b9aa85 in tests/compute_store_check.py, tools/compute_store_aot.py and CMakeLists.txt; the head moved by a rebase onto main.

Commands

set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
ctest --preset dev --no-tests=error -R "^compute_store_aot_ldexp_f32_" -V
python -B tests\compute_store_check.py draw-ldexp_f32 "<dxc.exe>" "out\build\dev\offscreen_check.exe" hardware
python -B -c "import sys; sys.path.insert(0,'tests'); import compute_store_check as c; c.ldexp_f32_controls()"
ctest --preset dev --no-tests=error -R "^compute_store_aot_.*_hardware$"

Observed

1387: backend=hardware debug_layer=unavailable
1387: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
1387: driver=32.0.32029.2010
1387: max_view_descriptor_heap_size=33554432
1387: groups=1 compared_words=320 mismatches=0
1/2 Test #1387: compute_store_aot_ldexp_f32_hardware ...   Passed    4.51 sec
1610: backend=warp debug_layer=unavailable
1610: adapter=Microsoft Basic Render Driver vendor=1414 device=008c
1610: driver=10.0.26100.9818
1610: groups=1 compared_words=320 mismatches=0
2/2 Test #1610: compute_store_aot_ldexp_f32_warp .......   Passed    2.90 sec
100% tests passed out of 2

Two further direct draw-ldexp_f32 … hardware runs printed the same four lines and exited 0. ldexp_f32_controls() exited 0; that is the translation side only (accept/refuse messages), not the device.

What compared_words=320 covers on this fixture: 256 words written by the 64 threads (four per tid.x) compared word for word against ldexp_f32_words(), plus the 64 guard words after them that must still read 0xc5c5c5c5. 320 is the renderer's capacity constant, not a count of results.

ldexp_f32_draw does not print the control outcomes; it raises unless each control misbehaves on the backend it was given. On this run the six altered references (no exponent clamp, FTZ model, flushed subnormals, sNaN not quieted, no denormal input normalisation, sentinel past the group) and the five recompiled-HLSL mutations (narrowed exponent clamp, FTZ, flushed subnormals, sNaN not quieted, no denormal input normalisation) therefore each exited 1 on hardware, with word=N expected= for a reference and Compute readback differs for a mutation.

Regression

Whole neighbouring family on the same adapter, 99% tests passed, 1 tests failed out of 79 in 514.57 s:

20/79 Test #1399: compute_store_aot_mac_f32_hardware ...................***Failed    3.08 sec
1399: groups=1 compared_words=320 mismatches=0
1399: AssertionError: mac_f32: mutation 'fused mad() instead of unfused multiply+add' escaped detection

That entry's own word comparison passes; only its fused mad() control is not separable on this adapter, which is the control tracked in #2730 (seen there on RDNA 1). It is not attributable to this PR: the change adds F32_HELPERS["ldexp"] and one lower() branch, and its only two removed lines are the lower() signature line and the main() call site (f32_mode), so the MAC_F32 path and its fixture are untouched at this head.

What this establishes, and what it does not

  • Establishes: on this adapter and driver, the emitted integer helper compiles as cs_6_0, executes, and its 256 produced words are bit-identical to the fixture's Python model, with the 64 guard words untouched.
  • The reason no denormal mode can enter the compared words is that no compared word passes through a floating-point operation: the emitted HLSL contains no float instruction and no float literal (bitcasts on a/b, firstbithigh, an integer clamp, Store4 of a uint4 into a RWByteAddressBuffer), and the fixture builds its inputs with integer ALU ops. Denormals are produced and rounded explicitly in integers, so neither the compiler's nor the driver's FTZ can change a word. f32_mode="ieee-rne-denorm" is required for the op to be lowered and does not change the emission.
  • Does not establish the semantics of v_ldexp_f32 itself. The shader is an integer emulation compared against this repository's own model of the instruction: the instruction is never executed and there is no console comparison. A miscompile or a driver bug in the helper would be caught here; a wrong model would not.

Limits

One adapter and one driver; debug layer absent; cs_6_0; a single 64-thread group; integer outputs only; the 320-word expectation comes from the PR's own ldexp_f32_word model, not from an external oracle.

AI-assisted; runs executed on the machine above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7185213584 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7185213584). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T07:12:47Z. --- **AMD RDNA 4 run on `89b9aa85`: `compute_store_aot_ldexp_f32` passes on both backends; the neighbouring `compute_store_aot_*_hardware` family is 78/79.** Not a code change; measurements only. A third adapter for this fixture: the evidence table above covers WARP and an RTX 5080. ### Environment - Windows `10.0.26200.9974` (25H2, UBR `0x26f6`); MSVC BuildTools toolset `14.44.35207`; CMake `4.4.4`. - DXC from `Windows Kits\10\bin\10.0.26100.0\x64\`, reporting `dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17)`. - Adapter `AMD Radeon RX 9070 XT`, `vendor=1002 device=7550`, driver `32.0.32029.2010`. The `warp` backend reports `Microsoft Basic Render Driver vendor=1414 device=008c`, driver `10.0.26100.9818`. - Preset `dev`. Every mode line reports `debug_layer=unavailable`, so no API validation is involved. - PR head `89b9aa85` (`89b9aa8530659a91ed947174eca5a7bbf1785093`); `git rev-parse HEAD` is the second line of each log. No `ldexp` or `f32_mode` line differs between `4dc53965` (the head measured on the RTX 5080) and `89b9aa85` in `tests/compute_store_check.py`, `tools/compute_store_aot.py` and `CMakeLists.txt`; the head moved by a rebase onto `main`. ### Commands ``` set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT" ctest --preset dev --no-tests=error -R "^compute_store_aot_ldexp_f32_" -V python -B tests\compute_store_check.py draw-ldexp_f32 "<dxc.exe>" "out\build\dev\offscreen_check.exe" hardware python -B -c "import sys; sys.path.insert(0,'tests'); import compute_store_check as c; c.ldexp_f32_controls()" ctest --preset dev --no-tests=error -R "^compute_store_aot_.*_hardware$" ``` ### Observed ``` 1387: backend=hardware debug_layer=unavailable 1387: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 1387: driver=32.0.32029.2010 1387: max_view_descriptor_heap_size=33554432 1387: groups=1 compared_words=320 mismatches=0 1/2 Test #1387: compute_store_aot_ldexp_f32_hardware ... Passed 4.51 sec 1610: backend=warp debug_layer=unavailable 1610: adapter=Microsoft Basic Render Driver vendor=1414 device=008c 1610: driver=10.0.26100.9818 1610: groups=1 compared_words=320 mismatches=0 2/2 Test #1610: compute_store_aot_ldexp_f32_warp ....... Passed 2.90 sec 100% tests passed out of 2 ``` Two further direct `draw-ldexp_f32 … hardware` runs printed the same four lines and exited 0. `ldexp_f32_controls()` exited 0; that is the translation side only (accept/refuse messages), not the device. What `compared_words=320` covers on this fixture: 256 words written by the 64 threads (four per `tid.x`) compared word for word against `ldexp_f32_words()`, plus the 64 guard words after them that must still read `0xc5c5c5c5`. `320` is the renderer's `capacity` constant, not a count of results. `ldexp_f32_draw` does not print the control outcomes; it raises unless each control misbehaves on the backend it was given. On this run the six altered references (no exponent clamp, FTZ model, flushed subnormals, sNaN not quieted, no denormal input normalisation, sentinel past the group) and the five recompiled-HLSL mutations (narrowed exponent clamp, FTZ, flushed subnormals, sNaN not quieted, no denormal input normalisation) therefore each exited 1 on `hardware`, with `word=N expected=` for a reference and `Compute readback differs` for a mutation. ### Regression Whole neighbouring family on the same adapter, `99% tests passed, 1 tests failed out of 79` in 514.57 s: ``` 20/79 Test #1399: compute_store_aot_mac_f32_hardware ...................***Failed 3.08 sec 1399: groups=1 compared_words=320 mismatches=0 1399: AssertionError: mac_f32: mutation 'fused mad() instead of unfused multiply+add' escaped detection ``` That entry's own word comparison passes; only its fused `mad()` control is not separable on this adapter, which is the control tracked in #2730 (seen there on RDNA 1). It is not attributable to this PR: the change adds `F32_HELPERS["ldexp"]` and one `lower()` branch, and its only two removed lines are the `lower()` signature line and the `main()` call site (`f32_mode`), so the `MAC_F32` path and its fixture are untouched at this head. ### What this establishes, and what it does not - Establishes: on this adapter and driver, the emitted integer helper compiles as `cs_6_0`, executes, and its 256 produced words are bit-identical to the fixture's Python model, with the 64 guard words untouched. - The reason no denormal mode can enter the compared words is that no compared word passes through a floating-point operation: the emitted HLSL contains no float instruction and no float literal (bitcasts on `a`/`b`, `firstbithigh`, an integer `clamp`, `Store4` of a `uint4` into a `RWByteAddressBuffer`), and the fixture builds its inputs with integer ALU ops. Denormals are produced and rounded explicitly in integers, so neither the compiler's nor the driver's FTZ can change a word. `f32_mode="ieee-rne-denorm"` is required for the op to be lowered and does not change the emission. - Does not establish the semantics of `v_ldexp_f32` itself. The shader is an integer emulation compared against this repository's own model of the instruction: the instruction is never executed and there is no console comparison. A miscompile or a driver bug in the helper would be caught here; a wrong model would not. ### Limits One adapter and one driver; debug layer absent; `cs_6_0`; a single 64-thread group; integer outputs only; the 320-word expectation comes from the PR's own `ldexp_f32_word` model, not from an external oracle. _AI-assisted; runs executed on the machine above._
tedin7 commented 2026-11-27 09:36:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T09:36:40Z.


This PR now conflicts with main. Conflicting files:

  • CMakeLists.txt
  • tools/compute_store_aot.py

Could you merge main into your branch (a merge commit, no force push needed) and resolve these? Thank you.

AI-assisted; commands listed were executed locally. (git merge-tree origin/main <head>)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7214884170 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7214884170). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T09:36:40Z. --- This PR now conflicts with `main`. Conflicting files: - `CMakeLists.txt` - `tools/compute_store_aot.py` Could you merge `main` into your branch (a merge commit, no force push needed) and resolve these? Thank you. AI-assisted; commands listed were executed locally. (`git merge-tree origin/main <head>`)
pigalot commented 2026-11-28 01:41:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:41:36Z.


I merged main 86beae95 into this branch as 90b39c31 (a merge commit, no rebase or force-push), as tedin7 asked. Two files conflicted:

  • CMakeLists.txt: main added the compute_store_aot_alu_bfm_{warp,hardware} tests at the place where this branch adds compute_store_aot_ldexp_f32_{warp,hardware}. I kept both blocks, main's first.
  • tools/compute_store_aot.py:
    • Docstring: I kept main's wave_size text (wave64 is now allowed with group-shared LDS), followed by this branch's f32_mode sentences.
    • Argument checks: main moved the wave_size check further down and widened it to wave_size not in (None, 32) and not (wave_size == 64 and shared_lds). In the conflict I kept only this branch's f32_mode check, so main's later wave_size check is the one that applies.

main has no other v_ldexp_f32 or f32_mode code, so the lowering itself is unchanged. git diff --check origin/main...HEAD is clean.

What I ran on 90b39c31. I did a full build in dev and release, then ran every test that compute_store_aot.py feeds (-R '(compute_store|compute_alu|ldexp)', excluding startup_audio_*):

  • 120 non-hardware tests: all pass in Release. In Debug, 4 _warp tests timed out under -j 8 (compute_store_aot_mimg_load, _mimg_mip, _lds_arithmetic, _lds_qword); each passes on its own at -j 1.
  • 114 _hardware tests at -j 1: all pass in Debug and Release, including compute_store_aot_ldexp_f32_hardware.

This is a merge only. I haven't re-reviewed the change; another reviewer will.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC; Python 3.12.10.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231851066 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7231851066). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T01:41:36Z. --- I merged `main` `86beae95` into this branch as `90b39c31` (a merge commit, no rebase or force-push), as tedin7 asked. Two files conflicted: - **`CMakeLists.txt`:** `main` added the `compute_store_aot_alu_bfm_{warp,hardware}` tests at the place where this branch adds `compute_store_aot_ldexp_f32_{warp,hardware}`. I kept both blocks, `main`'s first. - **`tools/compute_store_aot.py`:** - **Docstring:** I kept `main`'s `wave_size` text (wave64 is now allowed with group-shared LDS), followed by this branch's `f32_mode` sentences. - **Argument checks:** `main` moved the `wave_size` check further down and widened it to `wave_size not in (None, 32) and not (wave_size == 64 and shared_lds)`. In the conflict I kept only this branch's `f32_mode` check, so `main`'s later `wave_size` check is the one that applies. `main` has no other `v_ldexp_f32` or `f32_mode` code, so the lowering itself is unchanged. `git diff --check origin/main...HEAD` is clean. **What I ran on `90b39c31`.** I did a full build in `dev` and `release`, then ran every test that `compute_store_aot.py` feeds (`-R '(compute_store|compute_alu|ldexp)'`, excluding `startup_audio_*`): - 120 non-hardware tests: all pass in Release. In Debug, 4 `_warp` tests timed out under `-j 8` (`compute_store_aot_mimg_load`, `_mimg_mip`, `_lds_arithmetic`, `_lds_qword`); each passes on its own at `-j 1`. - 114 `_hardware` tests at `-j 1`: all pass in Debug and Release, including `compute_store_aot_ldexp_f32_hardware`. This is a merge only. I haven't re-reviewed the change; another reviewer will. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC; Python 3.12.10. This reply was AI-assisted.
akimfomin commented 2026-11-28 02:03:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-28T02:03:26Z.


A reference input for the explicit float lowering is VIctory #3221's signed zero boundary. Try a negative finite operand scaling just below the smallest subnormal, alongside the smallest representable negative result and a positive-zero control. Record the raw output bits to make the sign and flush policy visible apart from ordinary numerical equality.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7232099773 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7232099773). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T02:03:26Z. --- A reference input for the explicit float lowering is [VIctory #3221](https://github.com/Marvisak/VIctory/pull/3221)'s signed zero boundary. Try a negative finite operand scaling just below the smallest subnormal, alongside the smallest representable negative result and a positive-zero control. Record the raw output bits to make the sign and flush policy visible apart from ordinary numerical equality.
pigalot commented 2026-11-28 02:22:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:22:58Z.

Review: APPROVED


Reviewed 90b39c31 merged over current main 50e4f763. The merge is clean (tree 8086192f) and git diff --cached --check is clean.

The main merge in 90b39c31. I checked it with git show --remerge-diff 90b39c31:

  • CMakeLists.txt: the compute_store_aot_ldexp_f32_* registration now sits after main's compute_store_aot_alu_bfm_* block. Neither block lost anything.
  • tools/compute_store_aot.py: the docstring keeps main's wave64 sentence and then adds the f32_mode one. In the argument checks, the branch's old wave_size not in (None, 32) check was dropped. main's wider check, wave_size not in (None, 32) and not (wave_size == 64 and shared_lds), still applies further down (line 1259). That is the right outcome; keeping the old check would have refused main's wave64 LDS case again.

R0Y00's changes request on 226e0d59. As far as I can see, all four points are addressed on this head:

  • Gate: v_ldexp_f32 lowers only with the caller statement f32_mode="ieee-rne-denorm". With no statement it refuses (v_ldexp_f32 requires a declared f32 mode). Any other value refuses with Unsupported f32 mode, both in the argument check and at the op. Unrelated ops keep their default.
  • A mode set inside the program:
    • The declared mode cannot be contradicted from inside the program. Adding s_denorm_mode 0, s_round_mode 3, s_setreg_imm32_b32 hwreg(HW_REG_MODE, 4, 4), 0 or s_setreg_b32 hwreg(HW_REG_MODE, 0, 8), s4 to LDEXP_F32 each refuses with Unsupported compute instruction.
    • The new gate isn't what refuses them: no MODE write is accepted on this path at all.
  • Controls: the no-profile and ieee-rne-ftz refusals are both controls in ldexp_f32_controls().
  • Non-folded discriminator: words 1 and 20 are per-lane runtime values, and preserve and FTZ give different results there. ldexp_f32_draw asserts that, and the FTZ reference control fails at word 1.
  • NaN payload: docs/experiments.md now says the NaN-payload, denormal and infinity cases check the helper against its own model on desktop, not native console behaviour.

What I ran.

  • Builds: full dev and release /O2.
  • CPU tests: ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '(compute_store|compute_alu|ldexp)' -E '(startup_audio|_hardware$)' runs 120 tests per preset.
    • All pass, including compute_store_aot_ldexp_f32_warp, native_ldexp_controls, startup_gfx2hlsl_ldexp_controls and pixel_aot_f16_fmac_ldexp_warp.
    • Four _warp tests timed out under -j 4: guard_read, lds_packed and lds_qword in dev, mimg_mip in release. Each passes when rerun alone at -j 1.
  • Hardware: compute_store_aot_ldexp_f32_hardware at -j 1 passes in both presets, with no skip.

Mutants of tools/compute_store_aot.py, each run against ldexp_f32_controls() and compute_store_aot_ldexp_f32_warp, after an unmutated baseline that passes both:

Mutant Result
no-profile refusal removed killed (controls)
both mode checks accept ieee-rne-ftz killed (controls)
a subnormal tie rounds up instead of to even killed (draw)
denormal normalisation shift off by one killed (draw)
underflow cut at e < -22 killed (draw)
sNaN/qNaN payload replaced by the canonical quiet NaN killed (draw)
overflow test e >= 255 → e > 255 survives

Restored afterwards; git diff --quiet is clean.

Non-blocking.

  1. The e == 255 boundary isn't exercised. No lane reaches a biased exponent of exactly 255. With e > 255, a result there is built as sign | (255 << 23) | mant: NaN when mant != 0, or Inf only by accident when mant == 0. A lane with S0 exponent 127 and a non-zero mantissa, with S1 = 128, would pin it.
  2. Only one of the two mode checks is pinned. The op-level check is backed up by the argument check. Widening the argument check alone survives, because both raise Unsupported f32 mode.

Verdict: approve on 90b39c31. R0Y00's changes-requested review on 226e0d59 still needs R0Y00's own re-review, so I'm not merging.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 90b39c31.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6095175199 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6095175199). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T02:22:58Z. **Review:** APPROVED --- Reviewed `90b39c31` merged over current `main` `50e4f763`. The merge is clean (tree `8086192f`) and `git diff --cached --check` is clean. **The `main` merge in `90b39c31`.** I checked it with `git show --remerge-diff 90b39c31`: - `CMakeLists.txt`: the `compute_store_aot_ldexp_f32_*` registration now sits after `main`'s `compute_store_aot_alu_bfm_*` block. Neither block lost anything. - `tools/compute_store_aot.py`: the docstring keeps `main`'s wave64 sentence and then adds the `f32_mode` one. In the argument checks, the branch's old `wave_size not in (None, 32)` check was dropped. `main`'s wider check, `wave_size not in (None, 32) and not (wave_size == 64 and shared_lds)`, still applies further down (line 1259). That is the right outcome; keeping the old check would have refused `main`'s wave64 LDS case again. **R0Y00's changes request on `226e0d59`.** As far as I can see, all four points are addressed on this head: - **Gate:** `v_ldexp_f32` lowers only with the caller statement `f32_mode="ieee-rne-denorm"`. With no statement it refuses (`v_ldexp_f32 requires a declared f32 mode`). Any other value refuses with `Unsupported f32 mode`, both in the argument check and at the op. Unrelated ops keep their default. - **A mode set inside the program:** - The declared mode cannot be contradicted from inside the program. Adding `s_denorm_mode 0`, `s_round_mode 3`, `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 4, 4), 0` or `s_setreg_b32 hwreg(HW_REG_MODE, 0, 8), s4` to `LDEXP_F32` each refuses with `Unsupported compute instruction`. - The new gate isn't what refuses them: no MODE write is accepted on this path at all. - **Controls:** the no-profile and `ieee-rne-ftz` refusals are both controls in `ldexp_f32_controls()`. - **Non-folded discriminator:** words 1 and 20 are per-lane runtime values, and preserve and FTZ give different results there. `ldexp_f32_draw` asserts that, and the FTZ reference control fails at word 1. - **NaN payload:** `docs/experiments.md` now says the NaN-payload, denormal and infinity cases check the helper against its own model on desktop, not native console behaviour. **What I ran.** - **Builds:** full `dev` and `release` `/O2`. - **CPU tests:** `ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '(compute_store|compute_alu|ldexp)' -E '(startup_audio|_hardware$)'` runs 120 tests per preset. - All pass, including `compute_store_aot_ldexp_f32_warp`, `native_ldexp_controls`, `startup_gfx2hlsl_ldexp_controls` and `pixel_aot_f16_fmac_ldexp_warp`. - Four `_warp` tests timed out under `-j 4`: `guard_read`, `lds_packed` and `lds_qword` in `dev`, `mimg_mip` in `release`. Each passes when rerun alone at `-j 1`. - **Hardware:** `compute_store_aot_ldexp_f32_hardware` at `-j 1` passes in both presets, with no skip. **Mutants** of `tools/compute_store_aot.py`, each run against `ldexp_f32_controls()` and `compute_store_aot_ldexp_f32_warp`, after an unmutated baseline that passes both: | Mutant | Result | |---|---| | no-profile refusal removed | killed (controls) | | both mode checks accept `ieee-rne-ftz` | killed (controls) | | a subnormal tie rounds up instead of to even | killed (draw) | | denormal normalisation shift off by one | killed (draw) | | underflow cut at `e < -22` | killed (draw) | | sNaN/qNaN payload replaced by the canonical quiet NaN | killed (draw) | | overflow test `e >= 255` → `e > 255` | **survives** | Restored afterwards; `git diff --quiet` is clean. **Non-blocking.** 1. **The `e == 255` boundary isn't exercised.** No lane reaches a biased exponent of exactly 255. With `e > 255`, a result there is built as `sign | (255 << 23) | mant`: NaN when `mant != 0`, or Inf only by accident when `mant == 0`. A lane with `S0` exponent 127 and a non-zero mantissa, with `S1 = 128`, would pin it. 2. **Only one of the two mode checks is pinned.** The op-level check is backed up by the argument check. Widening the argument check alone survives, because both raise `Unsupported f32 mode`. **Verdict:** approve on `90b39c31`. R0Y00's changes-requested review on `226e0d59` still needs R0Y00's own re-review, so I'm not merging. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `90b39c31`. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-28 07:00:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:00:05Z.


Thanks for the gate work. On 90b39c31, R0Y00's four asks look addressed to me. v_ldexp_f32 refuses without f32_mode="ieee-rne-denorm", and unrelated ops keep their default. The no-profile and FTZ refusals are controls, and words 1 and 20 separate preserve from FTZ. The docs keep the NaN-payload caveat. MODE writes inside the program are refused too (s_denorm_mode 0, s_round_mode 3 and both s_setreg forms → Unsupported compute instruction). ldexp_f32_controls() and the full controls() pass on this head merged into main bbf4687b.

One test gap remains from my side: two boundaries of f32_ldexp aren't reached by any fixture word. I checked this with an int32 transliteration of the emitted helper, which matches ldexp_f32_words() on all 256 words. The draw compares words exactly, so a helper mutant that produces the same 256 words passes it.

  1. if (e >= 255) → if (e > 255) (pigalot's note 1): 0 fixture words change. With S0=0x3fffffff, S1=128, the mutant returns 0x7fffffff (NaN) where the right result is 0x7f800000.
  2. Dropping the lower clamp (clamp(asint(b), -512, 512) → min(asint(b), 512)): 0 fixture words change. With S0=0x00000001, S1=0x80000000, the int wraps and the mutant returns 0x7f800000 where the right result is 0x00000000. An upper-clamp-only mutant does change words 243 and 247, so only that side is pinned.

Could you add a lane for each of those two inputs, expecting 0x7f800000 and 0x00000000? Adding both edits as recompiled-HLSL mutations in ldexp_f32_draw would also show they're caught.

A small one while you're there: the comment above F32_HELPERS["ldexp"] still says "the translator does not read MODE". It could mention that lowering now requires f32_mode="ieee-rne-denorm".

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7235649692 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7235649692). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T07:00:05Z. --- Thanks for the gate work. On `90b39c31`, R0Y00's four asks look addressed to me. `v_ldexp_f32` refuses without `f32_mode="ieee-rne-denorm"`, and unrelated ops keep their default. The no-profile and FTZ refusals are controls, and words 1 and 20 separate preserve from FTZ. The docs keep the NaN-payload caveat. MODE writes inside the program are refused too (`s_denorm_mode 0`, `s_round_mode 3` and both `s_setreg` forms → `Unsupported compute instruction`). `ldexp_f32_controls()` and the full `controls()` pass on this head merged into main `bbf4687b`. One test gap remains from my side: two boundaries of `f32_ldexp` aren't reached by any fixture word. I checked this with an int32 transliteration of the emitted helper, which matches `ldexp_f32_words()` on all 256 words. The draw compares words exactly, so a helper mutant that produces the same 256 words passes it. 1. `if (e >= 255)` → `if (e > 255)` (pigalot's note 1): 0 fixture words change. With S0=`0x3fffffff`, S1=`128`, the mutant returns `0x7fffffff` (NaN) where the right result is `0x7f800000`. 2. Dropping the lower clamp (`clamp(asint(b), -512, 512)` → `min(asint(b), 512)`): 0 fixture words change. With S0=`0x00000001`, S1=`0x80000000`, the int wraps and the mutant returns `0x7f800000` where the right result is `0x00000000`. An upper-clamp-only mutant does change words 243 and 247, so only that side is pinned. Could you add a lane for each of those two inputs, expecting `0x7f800000` and `0x00000000`? Adding both edits as recompiled-HLSL mutations in `ldexp_f32_draw` would also show they're caught. A small one while you're there: the comment above `F32_HELPERS["ldexp"]` still says "the translator does not read MODE". It could mention that lowering now requires `f32_mode="ieee-rne-denorm"`. This comment was AI-assisted.
Leyukaka commented 2026-11-28 20:09:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T20:09:16Z.

Review: CHANGES_REQUESTED


Reviewed 90b39c31.

Run on a release build of main f2972840 with this PR and 17 other open PRs merged locally, Windows Sandbox, network off, vGPU:

  • compute_store_aot_ldexp_f32_warp (WARP) and compute_store_aot_ldexp_f32_hardware (NVIDIA GeForce RTX 5080) pass, with 320 words compared and 0 mismatches.

  • Changing the subnormal tie rule (q & 1u) != 0u to == 0u (tools/compute_store_aot.py:192) made both fail.

  • In the wider run at -j 6, compute_store_aot_lds_arithmetic_hardware and compute_store_aot_lds_qword_hardware hit their 45 s timeout, while their _warp variants passed. This PR's compute_store_aot.py change does not plausibly cause that:

    • the helper is emitted only when f32_ldexp( is in the body;
    • f32_mode raises only when it is set to another value;
    • the new branch matches only v_ldexp_f32 lines.

    So the HLSL of those two programs is unchanged. Parallel load is the likelier cause: in pigalot's Debug run, the _warp variants of _lds_arithmetic and _lds_qword also timed out under -j 8, and both passed alone. They were not rerun alone here.

Already raised and not repeated here:

  • R0Y00's CHANGES_REQUESTED on 226e0d59 is still open.
  • pigalot approved 90b39c31 and listed the e >= 255 -> e > 255 survivor and the unpinned argument-level mode check.
  • JohnConnorNPC asked for the e == 255 and lower-clamp lanes and the comment fix.
  • akimfomin suggested a negative signed-zero underflow input.

The last three have no author reply yet.

Test gap:

  1. No fixture word reaches a result exponent of exactly e == 0. w0 gives e = 127 + 10k, w1 gives -9..-3, w2 returns early, and w3 gives -25..-10 or a ±512 clamp. Mutation: tools/compute_store_aot.py:184 if (e <= 0) { -> if (e < 0) {, which returns sign | mant without the implicit bit or rounding. Add a lane with S0 = 0x3fc00000 (1.5) and S1 = -127, expecting 0x00600000 (the mutant gives 0x00400000). Add the same edit to the recompiled-HLSL mutations in ldexp_f32_draw.

Request changes for the test gap above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6099897106 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#pullrequestreview-6099897106). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T20:09:16Z. **Review:** CHANGES_REQUESTED --- Reviewed `90b39c31`. Run on a release build of `main` `f2972840` with this PR and 17 other open PRs merged locally, Windows Sandbox, network off, vGPU: - `compute_store_aot_ldexp_f32_warp` (WARP) and `compute_store_aot_ldexp_f32_hardware` (NVIDIA GeForce RTX 5080) pass, with 320 words compared and 0 mismatches. - Changing the subnormal tie rule `(q & 1u) != 0u` to `== 0u` (`tools/compute_store_aot.py:192`) made both fail. - In the wider run at `-j 6`, `compute_store_aot_lds_arithmetic_hardware` and `compute_store_aot_lds_qword_hardware` hit their 45 s timeout, while their `_warp` variants passed. This PR's `compute_store_aot.py` change does not plausibly cause that: - the helper is emitted only when `f32_ldexp(` is in the body; - `f32_mode` raises only when it is set to another value; - the new branch matches only `v_ldexp_f32` lines. So the HLSL of those two programs is unchanged. Parallel load is the likelier cause: in pigalot's Debug run, the `_warp` variants of `_lds_arithmetic` and `_lds_qword` also timed out under `-j 8`, and both passed alone. They were not rerun alone here. Already raised and not repeated here: - R0Y00's CHANGES_REQUESTED on `226e0d59` is still open. - pigalot approved `90b39c31` and listed the `e >= 255` -> `e > 255` survivor and the unpinned argument-level mode check. - JohnConnorNPC asked for the `e == 255` and lower-clamp lanes and the comment fix. - akimfomin suggested a negative signed-zero underflow input. The last three have no author reply yet. Test gap: 1. No fixture word reaches a result exponent of exactly `e == 0`. `w0` gives `e = 127 + 10k`, `w1` gives -9..-3, `w2` returns early, and `w3` gives -25..-10 or a ±512 clamp. Mutation: `tools/compute_store_aot.py:184` `if (e <= 0) {` -> `if (e < 0) {`, which returns `sign | mant` without the implicit bit or rounding. Add a lane with S0 = `0x3fc00000` (1.5) and S1 = `-127`, expecting `0x00600000` (the mutant gives `0x00400000`). Add the same edit to the recompiled-HLSL mutations in `ldexp_f32_draw`. Request changes for the test gap above.
JohnConnorNPC commented 2026-11-29 12:55:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:32Z.


Status on 90b39c31 against main 77d1ba4d. Verdict: hold for the open change requests. The head hasn't changed since my 07:00 comment.

  • It still merges cleanly onto main, which has moved 341 commits past its base (git merge-tree --write-tree origin/main 90b39c31 → tree be0edeb5).
  • On that tree, compute_store_check.controls() and ldexp_f32_controls() pass (controls ok, ldexp ok, exit 0; Linux, Python 3.13).
  • The change is in tools/compute_store_aot.py only, an offline tool, so it doesn't touch the runtime or the default native launcher path.

MUST

  1. Leyukaka's change request on this head (a lane with S0 0x3fc00000, S1 -127, expecting 0x00600000, plus the matching recompiled-HLSL mutation) is open.
  2. R0Y00's change request on 226e0d59 still needs R0Y00's re-review. The four points look addressed, as pigalot and I said earlier.

SHOULD

  1. The two lanes from my 07:00 comment are still open: S0 0x3fffffff with S1 128 expecting 0x7f800000 (the e >= 255 edge), and S0 0x00000001 with S1 0x80000000 expecting 0x00000000 (the lower clamp). So is the comment above F32_HELPERS["ldexp"].

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256161488 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7256161488). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T12:55:32Z. --- Status on `90b39c31` against main `77d1ba4d`. **Verdict: hold for the open change requests.** The head hasn't changed since my 07:00 comment. - It still merges cleanly onto main, which has moved 341 commits past its base (`git merge-tree --write-tree origin/main 90b39c31` → tree `be0edeb5`). - On that tree, `compute_store_check.controls()` and `ldexp_f32_controls()` pass (`controls ok`, `ldexp ok`, exit 0; Linux, Python 3.13). - The change is in `tools/compute_store_aot.py` only, an offline tool, so it doesn't touch the runtime or the default native launcher path. **MUST** 1. Leyukaka's change request on this head (a lane with S0 `0x3fc00000`, S1 `-127`, expecting `0x00600000`, plus the matching recompiled-HLSL mutation) is open. 2. R0Y00's change request on `226e0d59` still needs R0Y00's re-review. The four points look addressed, as pigalot and I said earlier. **SHOULD** 1. The two lanes from my 07:00 comment are still open: S0 `0x3fffffff` with S1 `128` expecting `0x7f800000` (the `e >= 255` edge), and S0 `0x00000001` with S1 `0x80000000` expecting `0x00000000` (the lower clamp). So is the comment above `F32_HELPERS["ldexp"]`. AI-assisted.
Leyukaka commented 2026-12-02 18:40:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T18:40:16Z.


Thank you for this work, @henriazz10. Since the branch conflicts with main, I carried your commit into #3882 on current main and added the e == 0 lane from my review; if you would rather continue here, say so and I will close mine.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7354969710 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1918#issuecomment-7354969710). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-02T18:40:16Z. --- Thank you for this work, @henriazz10. Since the branch conflicts with `main`, I carried your commit into #3882 on current `main` and added the `e == 0` lane from my review; if you would rather continue here, say so and I will close mine.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1918:upstream-pr/1918'
git switch 'upstream-pr/1918'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1918'
git switch 'upstream-pr/1918'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1918'
git switch 'upstream-pr/1918'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1918'
git switch 'main'
git merge --squash 'upstream-pr/1918'
git switch 'main'
git merge --ff-only 'upstream-pr/1918'
git switch 'main'
git merge 'upstream-pr/1918'
git push origin 'main'
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
R0Y00/Xbox2Windows!1911
No description provided.