shader: lower binary64 comparisons and class tests in direct compute #3624

Merged
Ammmae0x merged 6 commits from upstream-pr/3624 into main 2026-12-01 00:19:57 +00:00
Ammmae0x commented 2026-11-30 16:20:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-30T16:20:50Z.


Lower v_cmp_*_f64, v_cmpx_*_f64 (all 16 predicates) and v_cmp_class_f64 / v_cmpx_class_f64 in the direct C++ compute path (src/gfx1013_direct_compute.inl), following PR #3529 (v_ldexp_f64), PR #3530 (v_min_f64/v_max_f64) and tools/pixel_aot.py (cmp_f64).

Refs #2935, #3518

What changed

  • Pure 32-bit integer arithmetic only: no DXIL double, no i64, no fcmp, and neither DoublePrecisionFloatShaderOps nor Int64ShaderOps.
  • Each operand maps to an unsigned two-word key (negative values invert both words, non-negative values set the sign bit, both signed zeros share the key (0, 0x80000000)), so the 16 predicates reduce to unsigned 32-bit comparisons. -0.0 == +0.0; NaNs are unordered except for u and the negated predicates; f/tru return constant false/true.
  • The class test returns a 10-bit mask (sNaN 0x001, qNaN 0x002, -Inf 0x004, -normal 0x008, -subnormal 0x010, -0 0x020, +0 0x040, +subnormal 0x080, +normal 0x100, +Inf 0x200); -0 stays distinct from +0, and abs/neg on src[0] flips the sign bit before the check.
  • Accepted only under the default MODE (denormals kept, round-to-nearest-even); the opcodes join the half_binary MODE tracking, so a flushing or conditional MODE is refused.
  • Accepted sources: VGPR pairs, aligned even SGPR pairs, integer 0 (+0.0) and inline binary64 constants 240..247. Refused: 248 (1/(2*pi)), integer inline constants 129..208 and 239, odd SGPR pairs, VCC/EXEC pairs, v255, 32-bit literals, clamp, omod, op_sel, subword, neg/abs on the class mask source, and the pixel stage / graphics input.
  • Results go through write_ballot, so v_cmp_* writes VCC (or an SGPR) and v_cmpx_* writes EXEC, in wave32 and wave64.

Fixture

tests/native_cmp_f64_check.py model|ir|controls|hardware, registered in tests/cmake/native_cmp_f64.cmake and tests/checks/python-linux/native_cmp_f64.txt. docs/experiments/native-direct-cmp-f64.md has the full note.

  • model (Linux): 10,842 predicate/class rows cross-checked against Python float semantics over boundary values, abs/neg modifiers checked, word builders round-tripped through decoders, ten self-mutations killed.
  • ir: 82 cases through all 16 e32 predicates, 22 cases through all 16 e64 predicates, both class forms, three cmpx forms, SGPR pairs, inline constants and modifiers (1,812 ballot stores at contiguous addresses), plus the same program as a wave64 container (the exchange is present). No double, no i64, no fcmp in the @main() body (the module metadata carries the DXIL shader-flags bitmask as i64 524304, so the i64 / fcmp checks are scoped to the body). The class path pins the exact icmp uge i32 <ssa>, 2146435072 line, so mutating that uge back to eq fails even before hardware. The IR interpreter cannot value-check a ballot, so values are verified by model and hardware.
  • controls: all 34 forms compile; 17 refusals checked with an exact error substring and a non-zero exit code. The compiled module contains no double, no i64, no fcmp, and contains the ballot and integer key-comparison idioms.
  • hardware: 15 dispatches (four e32 predicate groups, four e64 groups with VGPR/SGPR/inline/modifier sources, class, three cmpx groups, one lane-varying lt, one wave64 dispatch, one e64 dispatch covering all eight inline constants 240..247) compared word for word against the reference. The wave64 dispatch saves EXEC to s[14:15] and restores it to all ones before storing the v_cmpx masks, with two cmpx cases (lt, all-zeros mask; eq, all-ones mask).

Mutation audit

Every guard, condition and constant added in src/gfx1013_direct_compute.inl is pinned by a named test (100% kill by design; verified on Windows MSVC + RTX 4050 in WIN-VERIFY below):

  • Gate (v_cmp_/v_cmpx_ + _f64): dropping either alternative routes that form to comparison() ("direct comparison width") — killed by the controls positive program (all 34 forms).
  • Modifier gate: each disjunct has a controls refusal — clamp, omod, op_sel, subword (SDWA), abs on src2, neg/abs on the class mask source. (pixel_stage/graphics_input/dpp_control/permuted are not constructible through compile_dxil compute; the Encoding::Vopc check is provably redundant — the decoder only produces Vopc for these opcodes.)
  • MODE gate (!half_mode_known, mode_bits ^ 0xf0u, mask 0x8000ccu): dropping either check lets the flushing or conditional MODE program compile — killed by the two MODE refusals; changing 0xf0u refuses the default MODE in the positive program.
  • pair(): VGPR bound < 511 pinned by the v255 refusal; SGPR bound <= 104 and evenness pinned by the odd-SGPR and VCC-pair refusals; 128 pinned by the ir inline cases; 240..247 bounds pinned by the 248 and 239 refusals; each inline table entry pinned by the hardware e64 inline cases.
  • apply_mods: the and 0x7FFFFFFF / xor 0x80000000 constants and the per-source bit test are pinned by the hardware e64 modifier cases and by the model abs/neg cross-check.
  • Class path: magnitude mask 0x7FFFFFFF, quiet bit 0x80000, Inf bound 0x7FF00000, subnormal bound 0x00100000 and all ten class bit values are pinned by the hardware class dispatch (32 combos, one single-bit mask per value) and by the model mutations (quiet-inverted, zero-swapped, Inf-bound, subnormal-bound). The Inf arm uses a separate a_lo == 0 check, not empty — using empty would classify Inf as NaN.
  • Value path: the NaN bound is pinned by the model mutation (NaN-includes-Inf) and the hardware NaN cases; zero canonicalisation by the model mutation and the hardware +0/-0 cases; the key sign bit by the model mutation and the hardware sign cases; high-first comparison by the model mutation (low-first) and the hardware high-equal/low-differ cases; high+low equality by the model mutation (high-only) and the same hardware cases; each of the 16 predicate expressions by the hardware e32+e64 dispatches and the exhaustive model cross-check against float semantics.
  • MODE loop (half_binary): dropping the addition lets the conditional-MODE program compile — killed by the two conditional-MODE refusals (one cmp, one cmpx).
  • write_ballot / return: dropping either leaves the result unwritten or double-lowers the form — killed by the hardware dispatches / the controls positive program.

Model mutations killed on Linux (10): no-zero-canonicalisation, inverted sign handling, NaN-includes-Inf, low-word-first comparison, inverted quiet-bit test, swapped zero class bits, missing key sign bit, high-word-only equality, wrong Inf bound, wrong subnormal bound.

Fix (first WIN-VERIFY round)

The first Windows run (RTX 4050, SHA 29f7131e) caught one real C++ bug and three fixture bugs, all fixed in 2df3a4e7 (plus a merge of origin/main cf43986d, clean, no conflicts):

  • class64 tested magnitude == 0x7FF00000, so a quiet NaN whose high-word payload bits make the magnitude larger (e.g. 0x7FF8000000001234) fell through to normal instead of qNaN / sNaN (hardware dispatches 8 and 11). Fixed with is_inf_or_nan = magnitude >= 0x7FF00000 and a separate is_inf (magnitude == 0x7FF00000 && lo == 0). The class dispatch now also covers a sNaN with high-word payload bits (0x7FF4000000000000) and a qNaN with a zero low word (0x7FF8000000000000), replacing the two redundant normal cases (SMALLEST_NORMAL, NEG_DBL_MAX) in the 32-combo row, and ir() / controls() pin the icmp uge i32 line so the mutation fails before hardware.
  • ir() asserted 'i64 ' over the whole module, but the DXIL metadata carries the shader-flags bitmask as i64 524304. The i64 / fcmp checks are now scoped to the @main() body (as controls() already did); 'double' is still checked over the whole module.
  • The unconditional s_denorm_mode in the flushing MODE refusal refuses at the mode write itself with the binary16 message, so the expected substring is now rounding or denormal mode (as in native_ldexp_f64_check.py / native_minmax_f64_check.py); the conditional MODE refusals still expect the binary64 message.
  • request64() bound 7 user SGPRs, shifting group.x to s7 while the wave64 prologue reads it from s5 (unbound numeric SGPR s5 on the wave64 dispatch). It now binds 5, like request().
  • Also covers the remaining inline binary64 constants (241, 243, 245, 247) in the ir program and in the new e64 hardware dispatch over all eight inline constants.

Fix (second WIN-VERIFY round)

The second Windows run (MSVC + RTX 4050, SHA 2df3a4e7) passed native_cmp_f64_controls (all 34 forms compile, all 17 refusals with exact messages) and hardware dispatches 0..12 (including hw_class and cmpx_class), and caught two remaining fixture bugs, both fixed in 930bdf16 (plus a merge of origin/main 7f13a4cd, clean, no conflicts):

  • F.store masks offsets to 12 bits, so the 1,812-store ir program wrapped offsets >= 4096 back onto 0 and F.interpret returned duplicate addresses. ir_program is factored into Parts 1/2/3 and ir() now dumps the wave32 program in three chunks of <= 1,024 stores each (the e32 sweep in two chunks of 64 and 18 cases, Parts 2+3 in their own dump), each asserting contiguous addresses from 0; the wave64 program (852 stores, no sweep) still fits in one dump. The value-path needles are checked on every chunk; the class needles and the icmp uge pin only on the e64 chunk, the only one with class forms.
  • hw_wave64 stored EXEC (s126/s127) right after v_cmpx_lt_f64, which sets EXEC = 0 (+0.0 < -0.0 is false), so the stores were predicated off and slots 8 & 9 stayed SENTINEL. EXEC is now saved to s[14:15] and restored to all ones before storing the mask, as hw_cmpx() does, and a second v_cmpx_eq_f64 case (all-ones mask) is added, keeping the dispatch at exactly 16 slots.

Fix (third WIN-VERIFY round)

The third Windows run (MSVC + RTX 4050, SHA 930bdf16) passed native_cmp_f64_controls, all 15
hardware dispatches (including hw_wave64) and all three wave32 ir chunks; only the wave64
container dump remained, failing at +0x8 with native compute +0x8: direct descriptor address outside bound table. Fixed in cd7efc5e:

  • container_compute binds the descriptor table at s0 (words(3, 0, 1, 0, 0)), but
    F.preamble() reads the table from s4 and group.x from s5. The wave64 dump now builds its
    container with a new wave64_container() matching F.compute_container's s4/0x8a layout:
    words(3, 0, 1, 0, 4), 0 at record + 20 (wave32 flag clear) and (0x8a, 64, 1, 1) at
    record + 120. The layout is pinned on Linux by decoding the DXBC (_dxbc_body) and asserting
    the table entry, the flag and the group; the old s0 layout fails the pin.
  • EXEC is also set with the 64-bit form sop1(4, 126, 193) in code64: sop1(3, 126, 193) is
    s_mov_b32 and only sets EXEC_LO, leaving lanes 32..63 inactive. ir_program takes an
    exec_init parameter (defaulting to the wave32 form); only the wave64 program overrides it.
    The wave64 program differs from the old one in exactly that one word (right after the
    12-word preamble).

Measurement

Measured on 30.11.2026, main 7f13a4cd plus this change, on Linux: tests/native_cmp_f64_check.py model passes (10,842 rows, ten mutations killed); full run_checks_parallel.py --from-dir tests/checks/python-linux 71/71; form_coverage_check.py, docs_links_check.py (189 files / 740 links), bidi_controls_check.py (2,738 files) pass; diff --check clean; git merge-tree --write-tree origin/main HEAD exits 0. The ir, controls and hardware modes need a Windows build and are not measured here. The third Windows run passed controls, all 15 hardware dispatches and the three wave32 ir chunks on 930bdf16; re-verified on Windows below.

Windows Verification (cd7efc5e)

  • Commit: cd7efc5e85d547c0b51e03ac162971e54cd9f2e5 (git merge-tree --write-tree upstream/main HEAD exit 0, git diff --check exit 0).
  • Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (vendor=10de device=28e1, driver 32.0.15.9186).
  • Commands (XBOX2WINDOWS_ADAPTER=NVIDIA):
ctest --preset dev --no-tests=error -R "^native_cmp_f64_" --output-on-failure
ctest --preset release --no-tests=error -R "^native_cmp_f64_" -E "cpu_native_archive_" --output-on-failure
  • dev: 3/3 passed in 7.51 s (native_cmp_f64_ir 1.62 s, native_cmp_f64_controls 1.07 s, native_cmp_f64_hardware 4.68 s — 15/15 dispatches matched 2064 words each).
  • release: 3/3 passed in 6.43 s (native_cmp_f64_ir 0.74 s, native_cmp_f64_controls 1.02 s, native_cmp_f64_hardware 4.56 s).
  • Checks: native_cmp_f64_check.py model (10842 rows, 10 mutations killed), form_coverage_check.py, docs_links_check.py (189 files, 740 links), bidi_controls_check.py (2738 files) all passed.
  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5569212057 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3624). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-30T16:20:50Z. --- Lower `v_cmp_*_f64`, `v_cmpx_*_f64` (all 16 predicates) and `v_cmp_class_f64` / `v_cmpx_class_f64` in the direct C++ compute path (`src/gfx1013_direct_compute.inl`), following PR #3529 (`v_ldexp_f64`), PR #3530 (`v_min_f64`/`v_max_f64`) and `tools/pixel_aot.py` (`cmp_f64`). Refs #2935, #3518 ## What changed - Pure 32-bit integer arithmetic only: no DXIL `double`, no `i64`, no `fcmp`, and neither `DoublePrecisionFloatShaderOps` nor `Int64ShaderOps`. - Each operand maps to an unsigned two-word key (negative values invert both words, non-negative values set the sign bit, both signed zeros share the key `(0, 0x80000000)`), so the 16 predicates reduce to unsigned 32-bit comparisons. `-0.0 == +0.0`; NaNs are unordered except for `u` and the negated predicates; `f`/`tru` return constant false/true. - The class test returns a 10-bit mask (sNaN `0x001`, qNaN `0x002`, -Inf `0x004`, -normal `0x008`, -subnormal `0x010`, -0 `0x020`, +0 `0x040`, +subnormal `0x080`, +normal `0x100`, +Inf `0x200`); `-0` stays distinct from `+0`, and `abs`/`neg` on `src[0]` flips the sign bit before the check. - Accepted only under the default MODE (denormals kept, round-to-nearest-even); the opcodes join the `half_binary` MODE tracking, so a flushing or conditional MODE is refused. - Accepted sources: VGPR pairs, aligned even SGPR pairs, integer `0` (`+0.0`) and inline binary64 constants `240..247`. Refused: `248` (`1/(2*pi)`), integer inline constants `129..208` and `239`, odd SGPR pairs, VCC/EXEC pairs, `v255`, 32-bit literals, `clamp`, `omod`, `op_sel`, `subword`, `neg`/`abs` on the class mask source, and the pixel stage / graphics input. - Results go through `write_ballot`, so `v_cmp_*` writes VCC (or an SGPR) and `v_cmpx_*` writes EXEC, in wave32 and wave64. ## Fixture `tests/native_cmp_f64_check.py model|ir|controls|hardware`, registered in `tests/cmake/native_cmp_f64.cmake` and `tests/checks/python-linux/native_cmp_f64.txt`. `docs/experiments/native-direct-cmp-f64.md` has the full note. - `model` (Linux): 10,842 predicate/class rows cross-checked against Python float semantics over boundary values, abs/neg modifiers checked, word builders round-tripped through decoders, ten self-mutations killed. - `ir`: 82 cases through all 16 e32 predicates, 22 cases through all 16 e64 predicates, both class forms, three cmpx forms, SGPR pairs, inline constants and modifiers (1,812 ballot stores at contiguous addresses), plus the same program as a wave64 container (the exchange is present). No `double`, no `i64`, no `fcmp` in the `@main()` body (the module metadata carries the DXIL shader-flags bitmask as `i64 524304`, so the `i64` / `fcmp` checks are scoped to the body). The class path pins the exact `icmp uge i32 <ssa>, 2146435072` line, so mutating that `uge` back to `eq` fails even before hardware. The IR interpreter cannot value-check a ballot, so values are verified by `model` and `hardware`. - `controls`: all 34 forms compile; 17 refusals checked with an exact error substring and a non-zero exit code. The compiled module contains no `double`, no `i64`, no `fcmp`, and contains the ballot and integer key-comparison idioms. - `hardware`: 15 dispatches (four e32 predicate groups, four e64 groups with VGPR/SGPR/inline/modifier sources, class, three cmpx groups, one lane-varying `lt`, one wave64 dispatch, one e64 dispatch covering all eight inline constants `240..247`) compared word for word against the reference. The wave64 dispatch saves EXEC to `s[14:15]` and restores it to all ones before storing the `v_cmpx` masks, with two cmpx cases (`lt`, all-zeros mask; `eq`, all-ones mask). ## Mutation audit Every guard, condition and constant added in `src/gfx1013_direct_compute.inl` is pinned by a named test (100% kill by design; verified on Windows MSVC + RTX 4050 in WIN-VERIFY below): - Gate (`v_cmp_`/`v_cmpx_` + `_f64`): dropping either alternative routes that form to `comparison()` ("direct comparison width") — killed by the controls positive program (all 34 forms). - Modifier gate: each disjunct has a controls refusal — `clamp`, `omod`, `op_sel`, `subword` (SDWA), `abs` on src2, `neg`/`abs` on the class mask source. (`pixel_stage`/`graphics_input`/`dpp_control`/`permuted` are not constructible through `compile_dxil` compute; the `Encoding::Vopc` check is provably redundant — the decoder only produces `Vopc` for these opcodes.) - MODE gate (`!half_mode_known`, `mode_bits ^ 0xf0u`, mask `0x8000ccu`): dropping either check lets the flushing or conditional MODE program compile — killed by the two MODE refusals; changing `0xf0u` refuses the default MODE in the positive program. - `pair()`: VGPR bound `< 511` pinned by the `v255` refusal; SGPR bound `<= 104` and evenness pinned by the odd-SGPR and VCC-pair refusals; `128` pinned by the ir inline cases; `240..247` bounds pinned by the `248` and `239` refusals; each inline table entry pinned by the hardware e64 inline cases. - `apply_mods`: the `and 0x7FFFFFFF` / `xor 0x80000000` constants and the per-source bit test are pinned by the hardware e64 modifier cases and by the model abs/neg cross-check. - Class path: magnitude mask `0x7FFFFFFF`, quiet bit `0x80000`, Inf bound `0x7FF00000`, subnormal bound `0x00100000` and all ten class bit values are pinned by the hardware class dispatch (32 combos, one single-bit mask per value) and by the model mutations (quiet-inverted, zero-swapped, Inf-bound, subnormal-bound). The Inf arm uses a separate `a_lo == 0` check, not `empty` — using `empty` would classify Inf as NaN. - Value path: the NaN bound is pinned by the model mutation (NaN-includes-Inf) and the hardware NaN cases; zero canonicalisation by the model mutation and the hardware `+0`/`-0` cases; the key sign bit by the model mutation and the hardware sign cases; high-first comparison by the model mutation (low-first) and the hardware high-equal/low-differ cases; high+low equality by the model mutation (high-only) and the same hardware cases; each of the 16 predicate expressions by the hardware e32+e64 dispatches and the exhaustive model cross-check against float semantics. - MODE loop (`half_binary`): dropping the addition lets the conditional-MODE program compile — killed by the two conditional-MODE refusals (one `cmp`, one `cmpx`). - `write_ballot` / `return`: dropping either leaves the result unwritten or double-lowers the form — killed by the hardware dispatches / the controls positive program. Model mutations killed on Linux (10): no-zero-canonicalisation, inverted sign handling, NaN-includes-Inf, low-word-first comparison, inverted quiet-bit test, swapped zero class bits, missing key sign bit, high-word-only equality, wrong Inf bound, wrong subnormal bound. ## Fix (first WIN-VERIFY round) The first Windows run (RTX 4050, SHA `29f7131e`) caught one real C++ bug and three fixture bugs, all fixed in `2df3a4e7` (plus a merge of `origin/main` `cf43986d`, clean, no conflicts): - `class64` tested `magnitude == 0x7FF00000`, so a quiet NaN whose high-word payload bits make the magnitude larger (e.g. `0x7FF8000000001234`) fell through to `normal` instead of `qNaN` / `sNaN` (hardware dispatches 8 and 11). Fixed with `is_inf_or_nan = magnitude >= 0x7FF00000` and a separate `is_inf` (`magnitude == 0x7FF00000 && lo == 0`). The class dispatch now also covers a sNaN with high-word payload bits (`0x7FF4000000000000`) and a qNaN with a zero low word (`0x7FF8000000000000`), replacing the two redundant normal cases (`SMALLEST_NORMAL`, `NEG_DBL_MAX`) in the 32-combo row, and `ir()` / `controls()` pin the `icmp uge i32` line so the mutation fails before hardware. - `ir()` asserted `'i64 '` over the whole module, but the DXIL metadata carries the shader-flags bitmask as `i64 524304`. The `i64` / `fcmp` checks are now scoped to the `@main()` body (as `controls()` already did); `'double'` is still checked over the whole module. - The unconditional `s_denorm_mode` in the `flushing MODE` refusal refuses at the mode write itself with the binary16 message, so the expected substring is now `rounding or denormal mode` (as in `native_ldexp_f64_check.py` / `native_minmax_f64_check.py`); the conditional MODE refusals still expect the binary64 message. - `request64()` bound 7 user SGPRs, shifting `group.x` to `s7` while the wave64 prologue reads it from `s5` (`unbound numeric SGPR s5` on the wave64 dispatch). It now binds 5, like `request()`. - Also covers the remaining inline binary64 constants (`241`, `243`, `245`, `247`) in the ir program and in the new e64 hardware dispatch over all eight inline constants. ## Fix (second WIN-VERIFY round) The second Windows run (MSVC + RTX 4050, SHA `2df3a4e7`) passed `native_cmp_f64_controls` (all 34 forms compile, all 17 refusals with exact messages) and hardware dispatches 0..12 (including `hw_class` and `cmpx_class`), and caught two remaining fixture bugs, both fixed in `930bdf16` (plus a merge of `origin/main` `7f13a4cd`, clean, no conflicts): - `F.store` masks offsets to 12 bits, so the 1,812-store ir program wrapped offsets `>= 4096` back onto 0 and `F.interpret` returned duplicate addresses. `ir_program` is factored into Parts 1/2/3 and `ir()` now dumps the wave32 program in three chunks of `<= 1,024` stores each (the e32 sweep in two chunks of 64 and 18 cases, Parts 2+3 in their own dump), each asserting contiguous addresses from 0; the wave64 program (852 stores, no sweep) still fits in one dump. The value-path needles are checked on every chunk; the class needles and the `icmp uge` pin only on the e64 chunk, the only one with class forms. - `hw_wave64` stored EXEC (`s126`/`s127`) right after `v_cmpx_lt_f64`, which sets EXEC = 0 (`+0.0 < -0.0` is false), so the stores were predicated off and slots 8 & 9 stayed `SENTINEL`. EXEC is now saved to `s[14:15]` and restored to all ones before storing the mask, as `hw_cmpx()` does, and a second `v_cmpx_eq_f64` case (all-ones mask) is added, keeping the dispatch at exactly 16 slots. ## Fix (third WIN-VERIFY round) The third Windows run (MSVC + RTX 4050, SHA `930bdf16`) passed `native_cmp_f64_controls`, all 15 hardware dispatches (including `hw_wave64`) and all three wave32 ir chunks; only the wave64 container dump remained, failing at `+0x8` with `native compute +0x8: direct descriptor address outside bound table`. Fixed in `cd7efc5e`: - `container_compute` binds the descriptor table at `s0` (`words(3, 0, 1, 0, 0)`), but `F.preamble()` reads the table from `s4` and `group.x` from `s5`. The wave64 dump now builds its container with a new `wave64_container()` matching `F.compute_container`'s `s4`/`0x8a` layout: `words(3, 0, 1, 0, 4)`, `0` at `record + 20` (wave32 flag clear) and `(0x8a, 64, 1, 1)` at `record + 120`. The layout is pinned on Linux by decoding the DXBC (`_dxbc_body`) and asserting the table entry, the flag and the group; the old `s0` layout fails the pin. - EXEC is also set with the 64-bit form `sop1(4, 126, 193)` in `code64`: `sop1(3, 126, 193)` is `s_mov_b32` and only sets `EXEC_LO`, leaving lanes 32..63 inactive. `ir_program` takes an `exec_init` parameter (defaulting to the wave32 form); only the wave64 program overrides it. The wave64 program differs from the old one in exactly that one word (right after the 12-word preamble). ## Measurement Measured on 30.11.2026, `main` `7f13a4cd` plus this change, on Linux: `tests/native_cmp_f64_check.py model` passes (10,842 rows, ten mutations killed); full `run_checks_parallel.py --from-dir tests/checks/python-linux` 71/71; `form_coverage_check.py`, `docs_links_check.py` (189 files / 740 links), `bidi_controls_check.py` (2,738 files) pass; `diff --check` clean; `git merge-tree --write-tree origin/main HEAD` exits 0. The `ir`, `controls` and `hardware` modes need a Windows build and are not measured here. The third Windows run passed controls, all 15 hardware dispatches and the three wave32 ir chunks on `930bdf16`; re-verified on Windows below. <!-- WIN-VERIFY: passed | sha=cd7efc5e85d547c0b51e03ac162971e54cd9f2e5 | targets=compile_dxil native_compute_ir_dump native_store_replay | ctest=^native_cmp_f64_ | release=true --> ### Windows Verification (`cd7efc5e`) - Commit: `cd7efc5e85d547c0b51e03ac162971e54cd9f2e5` (`git merge-tree --write-tree upstream/main HEAD` exit `0`, `git diff --check` exit `0`). - Adapter: `NVIDIA GeForce RTX 4050 Laptop GPU` (`vendor=10de device=28e1`, driver `32.0.15.9186`). - Commands (`XBOX2WINDOWS_ADAPTER=NVIDIA`): ```text ctest --preset dev --no-tests=error -R "^native_cmp_f64_" --output-on-failure ctest --preset release --no-tests=error -R "^native_cmp_f64_" -E "cpu_native_archive_" --output-on-failure ``` - `dev`: **3/3 passed** in `7.51 s` (`native_cmp_f64_ir` `1.62 s`, `native_cmp_f64_controls` `1.07 s`, `native_cmp_f64_hardware` `4.68 s` — 15/15 dispatches matched 2064 words each). - `release`: **3/3 passed** in `6.43 s` (`native_cmp_f64_ir` `0.74 s`, `native_cmp_f64_controls` `1.02 s`, `native_cmp_f64_hardware` `4.56 s`). - Checks: `native_cmp_f64_check.py model` (`10842` rows, 10 mutations killed), `form_coverage_check.py`, `docs_links_check.py` (189 files, 740 links), `bidi_controls_check.py` (2738 files) all passed. - AI-assisted.
lukaslw-lab commented 2026-11-30 20:26:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T20:26:33Z.

Review: APPROVED


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

Verdict: approve. All 16 predicates and the class mask match the binary64 rules, and the guards are conservative. No MUST, no SHOULD.

  • Checked, no finding:
    • Predicates (src/gfx1013_direct_compute.inl:4149-4180): the ordered ones are ordered && rel, and nge/ngt/nle/nlg/nlt/neq are !(ordered && rel), so they are true on NaN. Truth table checked row by row.
    • Key order: a negative value inverts both words and a non-negative one sets the sign bit, so ordering by the high word then the low word is numeric order. Forcing both zeros to (0, 0x80000000) makes -0 == +0, and -min_subnormal still keys below zero.
    • NaN test: magnitude > 0x7FF00000 || (== && lo != 0), the same as v_min_f64.
    • Class (:4092-4108): the >= 0x7FF00000 fix with a separate is_inf (== && lo == 0) is right. Quiet is hi bit 19 (bit 51 of the value), normal is magnitude >= 0x00100000, and the ten bit values match the class32 order. abs/neg are allowed on the value source and refused on the mask source.
    • write_ballot(i.dst, ...) is used the same way as the existing _i64 compare path, so VCC/SGPR destinations, v_cmpx → EXEC and the wave64 pair checks are shared.
    • Gate: _f64 VOPC only, with literal 255, odd SGPRs, VCC/EXEC pairs and v255 refused. The MODE gate also refuses a non-default rounding mode, which a comparison never reads.

Tests: model checks 10,842 rows against Python float semantics, with ten self-mutations. ir is structural: the interpreter cannot value-check a ballot, so it pins the integer-only IR, the icmp uge class line and the store layout. controls compiles all 34 forms and pins 17 refusals. hardware runs 15 dispatches word for word, including a lane-varying lt, wave64 and all eight inline constants, so it is the only value check of the C++ lowering. CI ran only model. The native_cmp_f64_* CTest entries are not in the Windows pr preset filter, so ir/controls/hardware have only the author's RTX 4050 run at this head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6119948535 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3624#pullrequestreview-6119948535). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T20:26:33Z. **Review:** APPROVED --- Reviewed `cd7efc5e` by reading the diff; not built or run. **Verdict: approve.** All 16 predicates and the class mask match the binary64 rules, and the guards are conservative. No MUST, no SHOULD. - Checked, no finding: - Predicates (`src/gfx1013_direct_compute.inl:4149-4180`): the ordered ones are `ordered && rel`, and `nge/ngt/nle/nlg/nlt/neq` are `!(ordered && rel)`, so they are true on NaN. Truth table checked row by row. - Key order: a negative value inverts both words and a non-negative one sets the sign bit, so ordering by the high word then the low word is numeric order. Forcing both zeros to `(0, 0x80000000)` makes `-0 == +0`, and `-min_subnormal` still keys below zero. - NaN test: `magnitude > 0x7FF00000 || (== && lo != 0)`, the same as `v_min_f64`. - Class (`:4092-4108`): the `>= 0x7FF00000` fix with a separate `is_inf` (`== && lo == 0`) is right. Quiet is hi bit 19 (bit 51 of the value), normal is `magnitude >= 0x00100000`, and the ten bit values match the class32 order. `abs`/`neg` are allowed on the value source and refused on the mask source. - `write_ballot(i.dst, ...)` is used the same way as the existing `_i64` compare path, so VCC/SGPR destinations, `v_cmpx` → EXEC and the wave64 pair checks are shared. - Gate: `_f64` VOPC only, with literal `255`, odd SGPRs, VCC/EXEC pairs and `v255` refused. The MODE gate also refuses a non-default rounding mode, which a comparison never reads. Tests: `model` checks 10,842 rows against Python float semantics, with ten self-mutations. `ir` is structural: the interpreter cannot value-check a ballot, so it pins the integer-only IR, the `icmp uge` class line and the store layout. `controls` compiles all 34 forms and pins 17 refusals. `hardware` runs 15 dispatches word for word, including a lane-varying `lt`, wave64 and all eight inline constants, so it is the only value check of the C++ lowering. CI ran only `model`. The `native_cmp_f64_*` CTest entries are not in the Windows `pr` preset filter, so `ir`/`controls`/`hardware` have only the author's RTX 4050 run at this head.
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!3624
No description provided.