pixel_aot: lower 10 binary16 cvt_norm forms across VOP1/VOP3/DPP16/DPP8/SDWA #2849

Merged
KomaGuy merged 5 commits from upstream-pr/2857 into main 2026-11-27 19:50:37 +00:00
KomaGuy commented 2026-11-26 14:37:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-26T14:37:11Z.


Summary

Adds 10 exact binary16 normalized integer conversion forms (v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16) across all 5 encodings (VOP1, VOP3 _e64, DPP16, DPP8, SDWA) in tools/pixel_aot.py, advancing #839 and leaving only transcendentals + v_dot2c_f32_f16 uncovered in DPP16/DPP8.

Lowered Forms (+10 in both docs/coverage/gfx1013.tsv and docs/coverage/rdna2.tsv)

  • v_cvt_norm_i16_f16: VOP1 (_e32/bare), VOP3 (_e64), DPP16, DPP8, SDWA (5 forms)
  • v_cvt_norm_u16_f16: VOP1 (_e32/bare), VOP3 (_e64), DPP16, DPP8, SDWA (5 forms)

Contract & Exact Semantics

  • Entry profile & rounding mode: Requires explicit half_denorm="preserve" and refuses HALF_RTZ across all 5 encodings.
  • Static finite-proof contract (#839): Requires statically proven finite binary16 operands (half16_arith_source / half16_dpp_source / half16_sdwa_source), refusing Inf/NaN and unproven runtime sources.
  • Low-16 destination contract: Plain/e64, DPP16/DPP8, and SDWA dst_sel:DWORD tag destinations as ("low16", alu) (accepted by audited 16-bit integer readers, refused by binary16 and high-half readers). SDWA WORD_0/WORD_1 with UNUSED_PAD/UNUSED_PRESERVE define all 32 bits and refuse UNUSED_SEXT and BYTE_*.
  • Exact 32-bit integer arithmetic (cvt_norm_i16_f16, cvt_norm_u16_f16): Computes round_rne(clamp(x, -1, 1) * 32767) and round_rne(clamp(x, 0, 1) * 65535) directly in exact uint arithmetic (mant * scale shifted by 25 - exp or 24 for subnormals), eliminating binary32 double-rounding errors on 0x3801..0x3804 / 0xb801..0xb802 and preserving subnormals under DXC -denorm ftz.

Tests & Verification

  • Added F16_CVT_NORM_PROGRAMS (plain_e32, plain_e64, dpp16, dpp8, sdwa), f16_cvt_norm_reference (independent fractions.Fraction model verified exhaustively against pixel_aot.f16_cvt_norm_result across all 63,488 finite binary16 inputs), check_f16_cvt_norm_controls, check_f16_cvt_norm_draw (default + -denorm ftz + 4 mutations per program), pixel_aot_binary registration, CTest targets pixel_aot_f16_cvt_norm_{warp,hardware}, and form_coverage_check.check_f16_cvt_norm_forms.
  • Ran locally on Linux:
    • python3 tests/pixel_aot_check.py — pass (including exhaustive 63,488-value finite check)
    • form_coverage_check (check_shader_records, check_f16_cvt_norm_forms, and all sibling binary16/SDWA/DPP checks) — pass
    • python3 tests/docs_links_check.py — pass (28 files, 544 links)
    • python3 tests/bidi_controls_check.py — pass (2044 files)
    • python3 tests/rdna2_tools_check.py — pass (158 tests, 19 skipped)
    • git diff --check origin/main — clean
  • Left to CI: Ubuntu LLVM 15 pixel_aot_binary round-trips and Windows WARP/hardware pixel_aot_f16_cvt_norm_{warp,hardware} D3D12 draws.

AI-assisted; all Linux checks listed above were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5511973649 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857). Originally posted by [KomaGuy](https://github.com/KomaGuy) on 2026-11-26T14:37:11Z. --- ## Summary Adds 10 exact binary16 normalized integer conversion forms (`v_cvt_norm_i16_f16` and `v_cvt_norm_u16_f16`) across all 5 encodings (`VOP1`, `VOP3` `_e64`, `DPP16`, `DPP8`, `SDWA`) in `tools/pixel_aot.py`, advancing #839 and leaving only transcendentals + `v_dot2c_f32_f16` uncovered in `DPP16`/`DPP8`. ### Lowered Forms (+10 in both `docs/coverage/gfx1013.tsv` and `docs/coverage/rdna2.tsv`) - `v_cvt_norm_i16_f16`: `VOP1` (`_e32`/bare), `VOP3` (`_e64`), `DPP16`, `DPP8`, `SDWA` (5 forms) - `v_cvt_norm_u16_f16`: `VOP1` (`_e32`/bare), `VOP3` (`_e64`), `DPP16`, `DPP8`, `SDWA` (5 forms) ### Contract & Exact Semantics - **Entry profile & rounding mode:** Requires explicit `half_denorm="preserve"` and refuses `HALF_RTZ` across all 5 encodings. - **Static finite-proof contract (#839):** Requires statically proven finite binary16 operands (`half16_arith_source` / `half16_dpp_source` / `half16_sdwa_source`), refusing `Inf`/`NaN` and unproven runtime sources. - **Low-16 destination contract:** Plain/e64, DPP16/DPP8, and SDWA `dst_sel:DWORD` tag destinations as `("low16", alu)` (accepted by audited 16-bit integer readers, refused by binary16 and high-half readers). SDWA `WORD_0`/`WORD_1` with `UNUSED_PAD`/`UNUSED_PRESERVE` define all 32 bits and refuse `UNUSED_SEXT` and `BYTE_*`. - **Exact 32-bit integer arithmetic (`cvt_norm_i16_f16`, `cvt_norm_u16_f16`):** Computes `round_rne(clamp(x, -1, 1) * 32767)` and `round_rne(clamp(x, 0, 1) * 65535)` directly in exact `uint` arithmetic (`mant * scale` shifted by `25 - exp` or `24` for subnormals), eliminating binary32 double-rounding errors on `0x3801..0x3804` / `0xb801..0xb802` and preserving subnormals under DXC `-denorm ftz`. ### Tests & Verification - Added `F16_CVT_NORM_PROGRAMS` (`plain_e32`, `plain_e64`, `dpp16`, `dpp8`, `sdwa`), `f16_cvt_norm_reference` (independent `fractions.Fraction` model verified exhaustively against `pixel_aot.f16_cvt_norm_result` across all 63,488 finite binary16 inputs), `check_f16_cvt_norm_controls`, `check_f16_cvt_norm_draw` (default + `-denorm ftz` + 4 mutations per program), `pixel_aot_binary` registration, CTest targets `pixel_aot_f16_cvt_norm_{warp,hardware}`, and `form_coverage_check.check_f16_cvt_norm_forms`. - **Ran locally on Linux:** - `python3 tests/pixel_aot_check.py` — pass (including exhaustive 63,488-value finite check) - `form_coverage_check` (`check_shader_records`, `check_f16_cvt_norm_forms`, and all sibling binary16/SDWA/DPP checks) — pass - `python3 tests/docs_links_check.py` — pass (28 files, 544 links) - `python3 tests/bidi_controls_check.py` — pass (2044 files) - `python3 tests/rdna2_tools_check.py` — pass (158 tests, 19 skipped) - `git diff --check origin/main` — clean - **Left to CI:** Ubuntu LLVM 15 `pixel_aot_binary` round-trips and Windows WARP/hardware `pixel_aot_f16_cvt_norm_{warp,hardware}` D3D12 draws. AI-assisted; all Linux checks listed above were executed locally.
KelboLive commented 2026-11-26 16:01:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-26T16:01:26Z.

Review: APPROVED


Review: pixel_aot: lower 10 binary16 cvt_norm forms

This PR is a solid addition — it brings complete coverage of v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 across all 5 encodings (VOP1, VOP3, DPP16, DPP8, SDWA), which is exactly the kind of systematic work the project needs.

What's good

  • Complete encoding coverage: All 5 instruction encodings are handled in parallel. The fixtures in F16_CVT_NORM_PROGRAMS exercise each form with realistic operands (subnormals, exact ties, clamping thresholds, double-rounding discriminators).
  • Exact arithmetic contract: The use of fractions.Fraction for exhaustive verification against all 63,488 finite binary16 inputs is thorough and gives strong guarantees about the implementation's correctness. The double-rounding discrimination on 0x3801..0x3804 / 0xb801..0xb802 is an important edge case.
  • Correct contract enforcement: half_denorm="preserve", refusal of HALF_RTZ, and the static finite-proof contract (half16_arith_source / half16_dpp_source / half16_sdwa_source) are all properly specified — consistent with the project's approach for transcendentals and f16 operations.
  • Clean coverage update: The check_f16_cvt_norm_forms() test in form_coverage_check.py correctly removes cvt_norm from cvt_f32_excluded, adds appropriate neighbor forms (rcp, rsq, sin), and validates both inclusion and non-interference with neighboring forms.
  • Test fixture hygiene: The SDWA test fixtures use dst_sel:WORD_0/WORD_1 with UNUSED_PAD/UNUSED_PRESERVE as expected, and the DPP fixtures use both |vN| (no modifier) and -vN (negate) variants.

Minor notes

  1. Commit message: Consider making the commit message subject a bit more specific. 10/50 chars remaining on the 50-char limit — could squeeze in the encoding list, e.g. pixel_aot: lower 10 binary16 cvt_norm forms (VOP1/VOP3/DPP/SDWA).
  2. Exclusion set cleanup: The cvt_f32_excluded removal is correct. For the review, just confirming that v_rcp_f16_sdwa, v_rsq_f16_sdwa being the new entries in cvt_f32_excluded is intentional per their own implementation status.
  3. Draw test: The pixel_aot_f16_cvt_norm_{warp,hardware} CMake tests will validate end-to-end rendering under DXC — good that these are included.

Verdict

This is ready to merge. The implementation is thorough, the tests are comprehensive, and the coverage bookkeeping is correct. Approving.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6077195124 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#pullrequestreview-6077195124). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-26T16:01:26Z. **Review:** APPROVED --- ## Review: pixel_aot: lower 10 binary16 cvt_norm forms This PR is a solid addition — it brings complete coverage of `v_cvt_norm_i16_f16` and `v_cvt_norm_u16_f16` across all 5 encodings (VOP1, VOP3, DPP16, DPP8, SDWA), which is exactly the kind of systematic work the project needs. ### What's good - **Complete encoding coverage**: All 5 instruction encodings are handled in parallel. The fixtures in `F16_CVT_NORM_PROGRAMS` exercise each form with realistic operands (subnormals, exact ties, clamping thresholds, double-rounding discriminators). - **Exact arithmetic contract**: The use of `fractions.Fraction` for exhaustive verification against all 63,488 finite binary16 inputs is thorough and gives strong guarantees about the implementation's correctness. The double-rounding discrimination on `0x3801..0x3804 / 0xb801..0xb802` is an important edge case. - **Correct contract enforcement**: `half_denorm="preserve"`, refusal of `HALF_RTZ`, and the static finite-proof contract (`half16_arith_source` / `half16_dpp_source` / `half16_sdwa_source`) are all properly specified — consistent with the project's approach for transcendentals and f16 operations. - **Clean coverage update**: The `check_f16_cvt_norm_forms()` test in `form_coverage_check.py` correctly removes cvt_norm from `cvt_f32_excluded`, adds appropriate neighbor forms (rcp, rsq, sin), and validates both inclusion and non-interference with neighboring forms. - **Test fixture hygiene**: The SDWA test fixtures use `dst_sel:WORD_0/WORD_1` with `UNUSED_PAD`/`UNUSED_PRESERVE` as expected, and the DPP fixtures use both `|vN|` (no modifier) and `-vN` (negate) variants. ### Minor notes 1. **Commit message**: Consider making the commit message subject a bit more specific. 10/50 chars remaining on the 50-char limit — could squeeze in the encoding list, e.g. `pixel_aot: lower 10 binary16 cvt_norm forms (VOP1/VOP3/DPP/SDWA)`. 2. **Exclusion set cleanup**: The `cvt_f32_excluded` removal is correct. For the review, just confirming that `v_rcp_f16_sdwa`, `v_rsq_f16_sdwa` being the new entries in `cvt_f32_excluded` is intentional per their own implementation status. 3. **Draw test**: The `pixel_aot_f16_cvt_norm_{warp,hardware}` CMake tests will validate end-to-end rendering under DXC — good that these are included. ### Verdict This is ready to merge. The implementation is thorough, the tests are comprehensive, and the coverage bookkeeping is correct. Approving.
thepatrickworld commented 2026-11-26 16:04:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T15:23:29Z.


Independent AMD RDNA 4 result on bd8f6f42: the two f16_cvt_norm entries, and what the draw compiles to
Not a code change; measurements only.

Environment

  • Windows 11 10.0.26200.9974 x64, MSVC 19.44.35230 (VCToolsVersion 14.44.35207), Windows SDK 10.0.26100.0, DXC 1.9.2602.17
  • AMD Radeon RX 9070 XT (1002:7550), driver 32.0.32029.2010
  • debug_layer=unavailable (the D3D12 debug layer is not installed on this machine; nothing below is API validation)
  • worktree at bd8f6f4215e2a1d6914eebc49c08151d4f53ccfe, git status --porcelain --untracked-files=no empty, preset dev

Commands

git worktree add <dir> panam/pr2857
cmake --preset dev "-DINTAKE_PYTHON=<venv>/Scripts/python.exe"
cmake --build --preset dev --target offscreen_check
set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
ctest --preset dev --no-tests=error -R "^pixel_aot_f16_cvt_norm_" -V

Observed

Three identical runs (the -V logs differ only in the per-test durations), exit status 0:

1/2 Test #1971: pixel_aot_f16_cvt_norm_hardware ...   Passed   12.91 sec
2/2 Test #2221: pixel_aot_f16_cvt_norm_warp .......   Passed    7.57 sec
100% tests passed out of 2

The fixture does not surface the renderer identity (it captures the renderer output and only prints it on failure), so the lines below come from replaying check_f16_cvt_norm_draw with subprocess.run logged:

backend=hardware debug_layer=unavailable
adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
pixels=4096 channels=16384 max_absolute_error=0
case=0 status=pass

The comparison is bit-level (expected_bits != actual_bits, tests/pixel_aot_render.cpp:490), so max_absolute_error=0 is exact word equality, not a tolerance. From the same replay, all twenty mutation draws (four per program) come back statuses ['mismatch'], so the comparator is not vacuous on this adapter.

What the five programs compile to

dxc -dumpbin on the unmutated programs, translated and compiled through the fixture's own flags (tests/pixel_aot_check.py:358: -Gis -denorm preserve -T ps_6_2):

  • plain_e32, plain_e64, sdwa: main is four storeOutput calls with immediates and ret void, no arithmetic. For plain_e32 the immediates are 0x80004000, 0x0000c000, 0x801f400f, 0x00040002, exactly F16_CVT_NORM_EXPECTED['plain_e32']. DXC folds the emitted expression, so these draws store constants: the pass confirms the DXIL immediates equal the expected words and that the readback returns them unchanged. The folding itself is read off the disassembly, not off the test result.
  • dpp16, dpp8: the integer path stays in the DXIL (mul, lshr, shl, the round-to-even branch), fed by dx.op.quadOp / dx.op.quadReadLaneAt and dx.op.waveGetLaneIndex. That is where the emitted conversion is really evaluated — but retention is a DXC choice, the operands are uniform literals, and a driver JIT is free to collapse them, so this is not proof of device evaluation either.
  • Recompiling plain_e32 with -Od restores the arithmetic (24 lshr, 8 mul, the same four storeOutput), so the removal is the optimiser's, in DXC 1.9.2602.17.
  • -denorm preserve and -denorm ftz give byte-identical main bodies for all five programs (diff empty), so the fixture's ftz pass repeats the preserve run: with operands that are integer encodings, nothing reaches a binary32 denormal path.

What these entries do not cover

  • Eleven distinct binary16 operand encodings across the five programs (0x0100 0x03ff 0x3800 0x3801 0x3802 0x4000 0x83ff 0xb800 0xb801 0xbc00 0xc000), plus the |v| / -v modifiers. The exhaustive side — 63,488 finite encodings, the for bits in range(0x10000) loop that skips exponent 0x1f at tests/pixel_aot_check.py:11771 — is Python-side against a fractions.Fraction model; none of it is replayed on the device.
  • Every operand is a per-lane uniform literal, so a quad_perm / dpp8 decoding error would not change a single word here; these words separate the source modifiers and the arithmetic, nothing else.
  • half16_arith_source (tools/pixel_aot.py:2192) refuses any operand that is not statically known (binary16 operand lacks a finite proof, :2231), so no shader can drive these opcodes from a runtime value today, and the plain forms are measurable only at folding time.

CI coverage on this head

The Windows job runs ctest --preset pr, and that preset's include.name filter (CMakePresets.json) lists sixteen name patterns, none of them pixel_aot_*. Build and test on Windows is success on bd8f6f42, so neither new entry ran there — flagging it only so that "left to CI" is not read as already covered.

Limits

One machine, one adapter, one driver, no debug layer. The folded immediates and their identity are a property of DXC 1.9.2602.17; the -Od build shows the optimiser, not the translator, removes them. Three runs establish identical results, not determinism.

Conclusion

  • Both entries pass on the RX 9070 XT at bd8f6f42, three times, with all twenty mutation draws rejected.
  • Three of the five programs compile to folded constants, so the WARP/hardware split carries no adapter-dependent signal for plain_e32, plain_e64 and sdwa; what their pass establishes is that the emitted HLSL folds to the expected words under this DXC, with the readback returning them intact.
  • dpp16 / dpp8 keep the integer path in the DXIL; that is the closest this fixture gets to evaluating the conversion, and it matches the table.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7196200555 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7196200555). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T15:23:29Z. --- **Independent AMD RDNA 4 result on `bd8f6f42`: the two `f16_cvt_norm` entries, and what the draw compiles to** _Not a code change; measurements only._ ### Environment - Windows 11 `10.0.26200.9974` x64, MSVC `19.44.35230` (`VCToolsVersion` `14.44.35207`), Windows SDK `10.0.26100.0`, DXC `1.9.2602.17` - `AMD Radeon RX 9070 XT` (`1002:7550`), driver `32.0.32029.2010` - `debug_layer=unavailable` (the D3D12 debug layer is not installed on this machine; nothing below is API validation) - worktree at `bd8f6f4215e2a1d6914eebc49c08151d4f53ccfe`, `git status --porcelain --untracked-files=no` empty, preset `dev` ### Commands ``` git worktree add <dir> panam/pr2857 cmake --preset dev "-DINTAKE_PYTHON=<venv>/Scripts/python.exe" cmake --build --preset dev --target offscreen_check set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT" ctest --preset dev --no-tests=error -R "^pixel_aot_f16_cvt_norm_" -V ``` ### Observed Three identical runs (the `-V` logs differ only in the per-test durations), exit status 0: ``` 1/2 Test #1971: pixel_aot_f16_cvt_norm_hardware ... Passed 12.91 sec 2/2 Test #2221: pixel_aot_f16_cvt_norm_warp ....... Passed 7.57 sec 100% tests passed out of 2 ``` The fixture does not surface the renderer identity (it captures the renderer output and only prints it on failure), so the lines below come from replaying `check_f16_cvt_norm_draw` with `subprocess.run` logged: ``` backend=hardware debug_layer=unavailable adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 pixels=4096 channels=16384 max_absolute_error=0 case=0 status=pass ``` The comparison is bit-level (`expected_bits != actual_bits`, `tests/pixel_aot_render.cpp:490`), so `max_absolute_error=0` is exact word equality, not a tolerance. From the same replay, all twenty mutation draws (four per program) come back `statuses ['mismatch']`, so the comparator is not vacuous on this adapter. ### What the five programs compile to `dxc -dumpbin` on the unmutated programs, translated and compiled through the fixture's own flags (`tests/pixel_aot_check.py:358`: `-Gis -denorm preserve -T ps_6_2`): - `plain_e32`, `plain_e64`, `sdwa`: `main` is four `storeOutput` calls with immediates and `ret void`, no arithmetic. For `plain_e32` the immediates are `0x80004000`, `0x0000c000`, `0x801f400f`, `0x00040002`, exactly `F16_CVT_NORM_EXPECTED['plain_e32']`. DXC folds the emitted expression, so these draws store constants: the pass confirms the DXIL immediates equal the expected words and that the readback returns them unchanged. The folding itself is read off the disassembly, not off the test result. - `dpp16`, `dpp8`: the integer path stays in the DXIL (`mul`, `lshr`, `shl`, the round-to-even branch), fed by `dx.op.quadOp` / `dx.op.quadReadLaneAt` and `dx.op.waveGetLaneIndex`. That is where the emitted conversion is really evaluated — but retention is a DXC choice, the operands are uniform literals, and a driver JIT is free to collapse them, so this is not proof of device evaluation either. - Recompiling `plain_e32` with `-Od` restores the arithmetic (24 `lshr`, 8 `mul`, the same four `storeOutput`), so the removal is the optimiser's, in DXC `1.9.2602.17`. - `-denorm preserve` and `-denorm ftz` give byte-identical `main` bodies for all five programs (diff empty), so the fixture's ftz pass repeats the preserve run: with operands that are integer encodings, nothing reaches a binary32 denormal path. ### What these entries do not cover - Eleven distinct binary16 operand encodings across the five programs (`0x0100 0x03ff 0x3800 0x3801 0x3802 0x4000 0x83ff 0xb800 0xb801 0xbc00 0xc000`), plus the `|v|` / `-v` modifiers. The exhaustive side — 63,488 finite encodings, the `for bits in range(0x10000)` loop that skips exponent `0x1f` at `tests/pixel_aot_check.py:11771` — is Python-side against a `fractions.Fraction` model; none of it is replayed on the device. - Every operand is a per-lane uniform literal, so a `quad_perm` / `dpp8` decoding error would not change a single word here; these words separate the source modifiers and the arithmetic, nothing else. - `half16_arith_source` (`tools/pixel_aot.py:2192`) refuses any operand that is not statically known (`binary16 operand lacks a finite proof`, `:2231`), so no shader can drive these opcodes from a runtime value today, and the plain forms are measurable only at folding time. ### CI coverage on this head The Windows job runs `ctest --preset pr`, and that preset's `include.name` filter (`CMakePresets.json`) lists sixteen name patterns, none of them `pixel_aot_*`. `Build and test on Windows` is `success` on `bd8f6f42`, so neither new entry ran there — flagging it only so that "left to CI" is not read as already covered. ### Limits One machine, one adapter, one driver, no debug layer. The folded immediates and their identity are a property of DXC `1.9.2602.17`; the `-Od` build shows the optimiser, not the translator, removes them. Three runs establish identical results, not determinism. ### Conclusion - Both entries pass on the RX 9070 XT at `bd8f6f42`, three times, with all twenty mutation draws rejected. - Three of the five programs compile to folded constants, so the WARP/hardware split carries no adapter-dependent signal for `plain_e32`, `plain_e64` and `sdwa`; what their pass establishes is that the emitted HLSL folds to the expected words under this DXC, with the readback returning them intact. - `dpp16` / `dpp8` keep the integer path in the DXIL; that is the closest this fixture gets to evaluating the conversion, and it matches the table. _AI-assisted._
KomaGuy commented 2026-11-26 17:59:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-26T17:59:02Z.


Thanks @thepatrickworld for the thorough RX 9070 XT / DXIL disassembly measurement and @KelboLive for the review!

Addressed the feedback in 3100f363:

  1. DXC constant folding on plain_e32 / plain_e64 / sdwa (@thepatrickworld): Added an optional unoptimized=False (-Od) parameter to compile_shader in tests/pixel_aot_check.py and switched the second pass in check_f16_cvt_norm_draw to compile_shader(..., mode="ftz", unoptimized=True). That keeps the integer conversion arithmetic (mul/lshr/shl/RNE branch) in DXIL instead of folding to immediate stores while still checking -denorm ftz invariance in the same pass.
  2. DPP16/DPP8 permutation coverage (@thepatrickworld): Kept #839's static finite-proof contract intact (half16_dpp_source requires statically known finite inputs, so per-lane values stay uniform in the draw fixture), and added static permutation-mutation checks in check_f16_cvt_norm_controls (quad_perm:[1,0,3,2] → [2,3,0,1], dpp8:[1,2,3,0,5,6,7,4] → [3,0,1,2,7,4,5,6]) verifying that changing the quad permutation changes the emitted HLSL swizzle indices.
  3. CI scope & measurement limits in docs/experiments.md (@thepatrickworld): Clarified that pixel_aot_f16_cvt_norm_{warp,hardware} runs under dev/release presets and main CI (not ctest --preset pr), recorded the RX 9070 XT / WARP measurements from bd8f6f42 with their limits (debug_layer=unavailable, uniform-operand DPP, Python-side exhaustive 63,488-value check).
  4. Exclusion set & commit message (@KelboLive): Confirmed v_rcp_f16_sdwa / v_rsq_f16_sdwa in cvt_f32_excluded are intentional (still unlowered transcendentals). Kept bd8f6f42 intact as a normal follow-up commit rather than force-pushing; happy to shorten the squash title on merge if preferred.

Re-verified locally on Linux (tests/pixel_aot_check.py, form_coverage_check, tests/docs_links_check.py, tests/bidi_controls_check.py, tests/rdna2_tools_check.py, git diff --check origin/main).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7199918925 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7199918925). Originally posted by [KomaGuy](https://github.com/KomaGuy) on 2026-11-26T17:59:02Z. --- Thanks @thepatrickworld for the thorough RX 9070 XT / DXIL disassembly measurement and @KelboLive for the review! Addressed the feedback in `3100f363`: 1. **DXC constant folding on `plain_e32` / `plain_e64` / `sdwa` (@thepatrickworld):** Added an optional `unoptimized=False` (`-Od`) parameter to `compile_shader` in `tests/pixel_aot_check.py` and switched the second pass in `check_f16_cvt_norm_draw` to `compile_shader(..., mode="ftz", unoptimized=True)`. That keeps the integer conversion arithmetic (`mul`/`lshr`/`shl`/RNE branch) in DXIL instead of folding to immediate stores while still checking `-denorm ftz` invariance in the same pass. 2. **DPP16/DPP8 permutation coverage (@thepatrickworld):** Kept `#839`'s static finite-proof contract intact (`half16_dpp_source` requires statically known finite inputs, so per-lane values stay uniform in the draw fixture), and added static permutation-mutation checks in `check_f16_cvt_norm_controls` (`quad_perm:[1,0,3,2]` → `[2,3,0,1]`, `dpp8:[1,2,3,0,5,6,7,4]` → `[3,0,1,2,7,4,5,6]`) verifying that changing the quad permutation changes the emitted HLSL swizzle indices. 3. **CI scope & measurement limits in `docs/experiments.md` (@thepatrickworld):** Clarified that `pixel_aot_f16_cvt_norm_{warp,hardware}` runs under `dev`/`release` presets and `main` CI (not `ctest --preset pr`), recorded the RX 9070 XT / WARP measurements from `bd8f6f42` with their limits (`debug_layer=unavailable`, uniform-operand DPP, Python-side exhaustive 63,488-value check). 4. **Exclusion set & commit message (@KelboLive):** Confirmed `v_rcp_f16_sdwa` / `v_rsq_f16_sdwa` in `cvt_f32_excluded` are intentional (still unlowered transcendentals). Kept `bd8f6f42` intact as a normal follow-up commit rather than force-pushing; happy to shorten the squash title on merge if preferred. Re-verified locally on Linux (`tests/pixel_aot_check.py`, `form_coverage_check`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/rdna2_tools_check.py`, `git diff --check origin/main`).
thepatrickworld commented 2026-11-26 18:46:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T18:46:56Z.


Independent AMD RDNA 4 result on 3100f363: the optimized and -Od compile passes, and what the new permutation control pins
Not a code change; measurements only.

Environment

  • Windows 11 10.0.26200.9974 x64, MSVC 19.44.35230 (VCToolsVersion 14.44.35207), Windows SDK 10.0.26100.0 (the DXC used is the one from Windows Kits\10\bin\10.0.26100.0\x64), DXC 1.9.2602.17
  • AMD Radeon RX 9070 XT (1002:7550), driver 32.0.32029.2010, from the drawing invocation: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550, driver=32.0.32029.2010, backend=hardware, debug_layer=unavailable (the D3D12 debug layer is not installed here; nothing below is API validation)
  • worktree at 3100f363808bb67d154e8f9c850147bbf8b50ff5, git status --porcelain --untracked-files=no empty, preset dev; certutil SHA-256 of the checked-out files: tools/pixel_aot.py fb813fae1b1a8b63f5df1e295b63d883835fed9ee8586ba56c9044f1bfa2436c, tests/pixel_aot_check.py 84ebd57157689617bec74adc3f49c7aab6120040e2e205db5592d9afcae8bfe5

Commands

git worktree add --detach <dir> refs/panam/2857
cmake --preset dev "-DINTAKE_PYTHON=<venv>/Scripts/python.exe"
cmake --build --preset dev --target offscreen_check
set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
ctest --preset dev --no-tests=error -R "^pixel_aot_f16_cvt_norm_" -V

# disassembly of the CSOs the fixture itself wrote, same flags by construction
dxc -dumpbin <prog>_opt.cso  > <prog>_opt.asm
dxc -dumpbin <prog>_od.cso   > <prog>_od.asm

Instruction counts below are re.findall(r"\bmul\b", dump) over those dumps, so fmul/smul are not counted (checked: the mul i32 line count equals the \bmul\b count). Fifteen dumps kept, one per program per variant (optimized, -Od -denorm preserve, -Od -denorm ftz).

Observed: both entries on this head

1/2 Test #1971: pixel_aot_f16_cvt_norm_hardware ...   Passed   12.09 sec
2/2 Test #2221: pixel_aot_f16_cvt_norm_warp .......   Passed    7.24 sec

100% tests passed out of 2

Twenty mutation draws per entry, statuses ['mismatch'] for all twenty, on both backends.

Observed: the -Od pass is now a different measurement

program optimized -denorm preserve -Od -denorm ftz
plain_e32 mul 0, lshr 0, shl 0 mul 8, lshr 24, shl 24
plain_e64 mul 0, lshr 0, shl 0 mul 3, lshr 14, shl 14
sdwa mul 0, lshr 0, shl 0 mul 6, lshr 17, shl 19
dpp16 mul 8, lshr 16, shl 20 mul 8, lshr 24, shl 24
dpp8 mul 8, lshr 24, shl 20 mul 8, lshr 32, shl 24

The decisive part is not the count but the operands, in plain_e32:

optimized   call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 0, i32 -2147467264)
            call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 1, i32 49152)
            call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 2, i32 -2145435633)
            call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 3, i32 262146)
-Od         call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 0, i32 %667)   ; … i8 3, i32 %673
            %61 = mul i32 %52, 32767
            %64 = lshr i32 %61, %63

plain_e32 holds four v_cvt_norm_i16 and four v_cvt_norm_u16 operations, and the -Od dump has four mul i32 …, 32767 and four mul i32 …, 65535 — one multiply per conversion. So the three programs whose optimized dump holds no arithmetic (plain_e32 quoted above; plain_e64 and sdwa by their zero mul/lshr/shl) now carry the integer conversion in the DXIL, and the five pass draws still return F16_CVT_NORM_EXPECTED. The DXIL side of that review point is answered; which unit evaluates the arithmetic is not (see Limits).

-Od is what changed the body, not the denorm flag: -Od -denorm preserve and -Od -denorm ftz give the same instruction counts for all five programs, and the two dumps differ by exactly two lines — the ; shader hash comment and attributes #0 = { "fp32-denorm-mode"="preserve" } vs "ftz":

plain_e32 1079/1079 lines, 2 changed   plain_e64 690/690, 2   dpp16 1095/1095, 2
dpp8 1338/1338, 2                      sdwa 881/881, 2

Neither dump contains a single fadd, fmul, fdiv, fptosi, fptrunc or fpext; the lowering is the pure-uint helper at tools/pixel_aot.py:1088. With integer operands nothing can reach a binary32 denormal, so the second pass repeats the same words under -Od — it does not exercise -denorm ftz, and it is not evidence about ftz either way.

Observed: what the new static permutation control pins

Two one-line mutants of the cvt_norm DPP handler, at tools/pixel_aot.py:7177 (emit_quad_swizzle_u32(lines, i, s0_val, perm)), each traced in the run log by findstr /n of the edited line plus git status --porcelain ( M tools/pixel_aot.py), and restored with git checkout -- (SHA-256 back to fb813fae… afterwards). Python only: no rebuild, same binary and same tree otherwise.

  • perm → [0, 1, 2, 3] (the swizzle is dropped whatever the instruction says): AssertionError: ('dpp16', 'quad_perm:[1,0,3,2]', 'quad_perm:[2,3,0,1]'), 0% tests passed, 2 tests failed out of 2, 1.12 s and 1.08 s. The control discriminates.
  • perm → perm[1:] + perm[:1] (permutation-dependent, wrong by construction: [1,0,3,2] becomes [0,3,2,1], a different lane pattern): CONTROLS_PASS, and both entries pass (100% tests passed out of 2, 11.65 s and 7.31 s), twenty mutations still rejected.

The rotation is plainly visible in the emitted HLSL — it is the control that does not see it. Counts with the same translate_f16: dpp16 goes from QuadReadAcrossX 3, Y 3, Diagonal 2 to 0/0/0 plus 32 QuadReadLaneAt; dpp8 goes from 32 QuadReadLaneAt to 8 QuadReadAcrossY.

So the added check pins that the emitted HLSL depends on quad_perm/dpp8, not that the permutation applied is the one encoded in the instruction. The two neighbouring blocks (cvt_int16_dpp16 at tests/pixel_aot_check.py:10535, fmac_ldexp_dpp16 at :10526) do assert that the three names appear (the fmac_ldexp_dpp16 block also checks that its _1/_2 lines carry no QuadRead), but neither pins a per-permutation count. :18581 does exactly that for another handler ([1,0,3,2] → one QuadReadAcrossX, through the v_cndmask_b32_dpp path), and tests/startup_gfx2hlsl_dpp_quad_swap_check.py pins a permutation→intrinsic table (tools/startup/gfx2hlsl.py:1016) and mutates X→Y, Y→Diagonal to prove it. Both assert more than the control added here.

The doc sentence this PR adds at docs/experiments.md:17544 — "(permutation decoding is verified statically in check_f16_cvt_norm_controls)" — is in the paragraph that concedes device readbacks cannot distinguish lane routing, so the static control is presented as the substitute for what the draw cannot see. Measured, it is a sensitivity check. Two options:

  • narrow the word to "permutation sensitivity", or
  • pin the mapping. On the existing dpp16 fixture, asserting the exact counts (3/3/2) already kills the rotation — but not a swap of X and Y: both permutations occur three times, so the counts survive it (measured: identical 3/3/2, and check_f16_cvt_norm_controls() still passes). What pins the mapping is one instruction per permutation: a single-instruction program gives 1/0/0 for [1,0,3,2], [2,3,0,1] and [3,2,1,0], and the general path (quad_perm:[0,2,1,3] → QuadReadLaneAt ×4). The dpp16 fixture cannot carry a 1/0/0 assertion: it uses three permutations in the same program, so all three names are emitted.

Limits

  • One machine, one adapter, one driver run, no debug layer.
  • The WARP entry is Microsoft's software rasterizer; it says nothing about the AMD adapter.
  • Both mutants are mine; rotate is wrong by construction, not a defect found in the PR. It shows what the control cannot see, not that the lowering is wrong.
  • check_f16_cvt_norm_controls() runs before the draws, so under the ignore mutant no draw happened at all — that failure is the control, not the pixels.
  • The twenty mutation draws are compiled optimized (tests/pixel_aot_check.py:11870 calls compile_shader with no unoptimized), and the -Od CSO only runs the single pass case, so no mutant is exercised under -Od.
  • "No permutation can change a word" holds for these fixtures, where every DPP operand is a per-lane uniform literal, not in general. The draw is blind to lane routing by construction of the fixture, not by a measurement about the hardware.
  • Folded-vs-retained is read off dxc -dumpbin; what the AMD JIT then does with uniform literals is not observable with the tools here.
  • :18581 pins [1,0,3,2] → QuadReadAcrossX once, through the v_cndmask_b32_dpp path (tools/pixel_aot.py:7334); nothing pins the mapping at the cvt_norm call sites, which is the gap the rotation above walks through.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7200844836 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7200844836). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T18:46:56Z. --- **Independent AMD RDNA 4 result on `3100f363`: the optimized and `-Od` compile passes, and what the new permutation control pins** _Not a code change; measurements only._ ### Environment - Windows 11 `10.0.26200.9974` x64, MSVC `19.44.35230` (`VCToolsVersion` `14.44.35207`), Windows SDK `10.0.26100.0` (the DXC used is the one from `Windows Kits\10\bin\10.0.26100.0\x64`), DXC `1.9.2602.17` - `AMD Radeon RX 9070 XT` (`1002:7550`), driver `32.0.32029.2010`, from the drawing invocation: `adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550`, `driver=32.0.32029.2010`, `backend=hardware`, `debug_layer=unavailable` (the D3D12 debug layer is not installed here; nothing below is API validation) - worktree at `3100f363808bb67d154e8f9c850147bbf8b50ff5`, `git status --porcelain --untracked-files=no` empty, preset `dev`; `certutil` SHA-256 of the checked-out files: `tools/pixel_aot.py` `fb813fae1b1a8b63f5df1e295b63d883835fed9ee8586ba56c9044f1bfa2436c`, `tests/pixel_aot_check.py` `84ebd57157689617bec74adc3f49c7aab6120040e2e205db5592d9afcae8bfe5` ### Commands ``` git worktree add --detach <dir> refs/panam/2857 cmake --preset dev "-DINTAKE_PYTHON=<venv>/Scripts/python.exe" cmake --build --preset dev --target offscreen_check set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT" ctest --preset dev --no-tests=error -R "^pixel_aot_f16_cvt_norm_" -V # disassembly of the CSOs the fixture itself wrote, same flags by construction dxc -dumpbin <prog>_opt.cso > <prog>_opt.asm dxc -dumpbin <prog>_od.cso > <prog>_od.asm ``` Instruction counts below are `re.findall(r"\bmul\b", dump)` over those dumps, so `fmul`/`smul` are not counted (checked: the `mul i32` line count equals the `\bmul\b` count). Fifteen dumps kept, one per program per variant (optimized, `-Od -denorm preserve`, `-Od -denorm ftz`). ### Observed: both entries on this head ``` 1/2 Test #1971: pixel_aot_f16_cvt_norm_hardware ... Passed 12.09 sec 2/2 Test #2221: pixel_aot_f16_cvt_norm_warp ....... Passed 7.24 sec 100% tests passed out of 2 ``` Twenty mutation draws per entry, `statuses ['mismatch']` for all twenty, on both backends. ### Observed: the `-Od` pass is now a different measurement | program | optimized `-denorm preserve` | `-Od -denorm ftz` | |---|---|---| | `plain_e32` | `mul` 0, `lshr` 0, `shl` 0 | `mul` 8, `lshr` 24, `shl` 24 | | `plain_e64` | `mul` 0, `lshr` 0, `shl` 0 | `mul` 3, `lshr` 14, `shl` 14 | | `sdwa` | `mul` 0, `lshr` 0, `shl` 0 | `mul` 6, `lshr` 17, `shl` 19 | | `dpp16` | `mul` 8, `lshr` 16, `shl` 20 | `mul` 8, `lshr` 24, `shl` 24 | | `dpp8` | `mul` 8, `lshr` 24, `shl` 20 | `mul` 8, `lshr` 32, `shl` 24 | The decisive part is not the count but the operands, in `plain_e32`: ``` optimized call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 0, i32 -2147467264) call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 1, i32 49152) call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 2, i32 -2145435633) call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 3, i32 262146) -Od call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 0, i32 %667) ; … i8 3, i32 %673 %61 = mul i32 %52, 32767 %64 = lshr i32 %61, %63 ``` `plain_e32` holds four `v_cvt_norm_i16` and four `v_cvt_norm_u16` operations, and the `-Od` dump has four `mul i32 …, 32767` and four `mul i32 …, 65535` — one multiply per conversion. So the three programs whose optimized dump holds no arithmetic (`plain_e32` quoted above; `plain_e64` and `sdwa` by their zero `mul`/`lshr`/`shl`) now carry the integer conversion in the DXIL, and the five pass draws still return `F16_CVT_NORM_EXPECTED`. The DXIL side of that review point is answered; which unit evaluates the arithmetic is not (see Limits). `-Od` is what changed the body, not the denorm flag: `-Od -denorm preserve` and `-Od -denorm ftz` give the same instruction counts for all five programs, and the two dumps differ by exactly two lines — the `; shader hash` comment and `attributes #0 = { "fp32-denorm-mode"="preserve" }` vs `"ftz"`: ``` plain_e32 1079/1079 lines, 2 changed plain_e64 690/690, 2 dpp16 1095/1095, 2 dpp8 1338/1338, 2 sdwa 881/881, 2 ``` Neither dump contains a single `fadd`, `fmul`, `fdiv`, `fptosi`, `fptrunc` or `fpext`; the lowering is the pure-`uint` helper at `tools/pixel_aot.py:1088`. With integer operands nothing can reach a binary32 denormal, so the second pass repeats the same words under `-Od` — it does not exercise `-denorm ftz`, and it is not evidence about ftz either way. ### Observed: what the new static permutation control pins Two one-line mutants of the cvt_norm DPP handler, at `tools/pixel_aot.py:7177` (`emit_quad_swizzle_u32(lines, i, s0_val, perm)`), each traced in the run log by `findstr /n` of the edited line plus `git status --porcelain` (` M tools/pixel_aot.py`), and restored with `git checkout --` (SHA-256 back to `fb813fae…` afterwards). Python only: no rebuild, same binary and same tree otherwise. - `perm` → `[0, 1, 2, 3]` (the swizzle is dropped whatever the instruction says): `AssertionError: ('dpp16', 'quad_perm:[1,0,3,2]', 'quad_perm:[2,3,0,1]')`, `0% tests passed, 2 tests failed out of 2`, 1.12 s and 1.08 s. The control discriminates. - `perm` → `perm[1:] + perm[:1]` (permutation-dependent, wrong by construction: `[1,0,3,2]` becomes `[0,3,2,1]`, a different lane pattern): `CONTROLS_PASS`, and **both entries pass** (`100% tests passed out of 2`, 11.65 s and 7.31 s), twenty mutations still rejected. The rotation is plainly visible in the emitted HLSL — it is the control that does not see it. Counts with the same `translate_f16`: `dpp16` goes from `QuadReadAcrossX` 3, `Y` 3, `Diagonal` 2 to 0/0/0 plus 32 `QuadReadLaneAt`; `dpp8` goes from 32 `QuadReadLaneAt` to 8 `QuadReadAcrossY`. So the added check pins that the emitted HLSL *depends* on `quad_perm`/`dpp8`, not that the permutation applied is the one encoded in the instruction. The two neighbouring blocks (`cvt_int16_dpp16` at `tests/pixel_aot_check.py:10535`, `fmac_ldexp_dpp16` at `:10526`) do assert that the three names appear (the `fmac_ldexp_dpp16` block also checks that its `_1`/`_2` lines carry no `QuadRead`), but neither pins a per-permutation count. `:18581` does exactly that for another handler (`[1,0,3,2]` → one `QuadReadAcrossX`, through the `v_cndmask_b32_dpp` path), and `tests/startup_gfx2hlsl_dpp_quad_swap_check.py` pins a permutation→intrinsic table (`tools/startup/gfx2hlsl.py:1016`) and mutates `X`→`Y`, `Y`→`Diagonal` to prove it. Both assert more than the control added here. The doc sentence this PR adds at `docs/experiments.md:17544` — "(permutation decoding is verified statically in `check_f16_cvt_norm_controls`)" — is in the paragraph that concedes device readbacks cannot distinguish lane routing, so the static control is presented as the substitute for what the draw cannot see. Measured, it is a sensitivity check. Two options: - narrow the word to "permutation sensitivity", or - pin the mapping. On the existing `dpp16` fixture, asserting the exact counts (3/3/2) already kills the rotation — but not a swap of `X` and `Y`: both permutations occur three times, so the counts survive it (measured: identical 3/3/2, and `check_f16_cvt_norm_controls()` still passes). What pins the mapping is one instruction per permutation: a single-instruction program gives 1/0/0 for `[1,0,3,2]`, `[2,3,0,1]` and `[3,2,1,0]`, and the general path (`quad_perm:[0,2,1,3]` → `QuadReadLaneAt` ×4). The `dpp16` fixture cannot carry a 1/0/0 assertion: it uses three permutations in the same program, so all three names are emitted. ### Limits - One machine, one adapter, one driver run, no debug layer. - The WARP entry is Microsoft's software rasterizer; it says nothing about the AMD adapter. - Both mutants are mine; `rotate` is wrong by construction, not a defect found in the PR. It shows what the control cannot see, not that the lowering is wrong. - `check_f16_cvt_norm_controls()` runs before the draws, so under the `ignore` mutant no draw happened at all — that failure is the control, not the pixels. - The twenty mutation draws are compiled optimized (`tests/pixel_aot_check.py:11870` calls `compile_shader` with no `unoptimized`), and the `-Od` CSO only runs the single pass case, so no mutant is exercised under `-Od`. - "No permutation can change a word" holds for these fixtures, where every DPP operand is a per-lane uniform literal, not in general. The draw is blind to lane routing by construction of the fixture, not by a measurement about the hardware. - Folded-vs-retained is read off `dxc -dumpbin`; what the AMD JIT then does with uniform literals is not observable with the tools here. - `:18581` pins `[1,0,3,2]` → `QuadReadAcrossX` once, through the `v_cndmask_b32_dpp` path (`tools/pixel_aot.py:7334`); nothing pins the mapping at the `cvt_norm` call sites, which is the gap the rotation above walks through. _AI-assisted._
KomaGuy commented 2026-11-26 19:57:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-26T19:57:44Z.


Thanks @thepatrickworld for verifying the -Od DXIL disassembly on 3100f363 and for the mutant analysis!

Followed up with option 2 in 1c5f2ea6:

  1. Exact DPP16/DPP8 permutation→intrinsic pinning (tests/pixel_aot_check.py): Replaced the sensitivity-only check in check_f16_cvt_norm_controls with single-instruction-per-permutation checks for both v_cvt_norm_i16_f16_dpp and v_cvt_norm_u16_f16_dpp:
    • quad_perm:[0,1,2,3] → (0, 0, 0, 0) (identity)
    • quad_perm:[1,0,3,2] → (1, 0, 0, 0) (QuadReadAcrossX)
    • quad_perm:[2,3,0,1] → (0, 1, 0, 0) (QuadReadAcrossY)
    • quad_perm:[3,2,1,0] → (0, 0, 1, 0) (QuadReadAcrossDiagonal)
    • quad_perm:[2,2,2,2] → (0, 0, 0, 1) (QuadReadLaneAt(..., 2))
    • quad_perm:[0,2,1,3] and dpp8:[1,2,3,0,5,6,7,4] → (0, 0, 0, 4) plus regex-pinning the exact (l0, l1, l2, l3) lane selection order in the bitmask expression.
    • Tested locally against all 4 in-memory emit_quad_swizzle_u32 mutants (ignore, rotate perm[1:]+perm[:1], X<->Y swap, and general-lane swap): all 4 fail check_f16_cvt_norm_controls().
  2. docs/experiments.md: Updated the wording to note that -denorm ftz emits the same pure-uint instructions as -denorm preserve (no binary32 float ops in cvt_norm_{i16,u16}_f16), recorded the 3100f363 RX 9070 XT / -Od DXIL disassembly result, and noted that mutation draws compile optimized rather than -Od.

Re-verified locally on Linux: tests/pixel_aot_check.py, form_coverage_check (check_shader_records, check_f16_cvt_norm_forms), tests/docs_links_check.py, tests/bidi_controls_check.py, tests/rdna2_tools_check.py, and git diff --check origin/main all pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7202148134 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7202148134). Originally posted by [KomaGuy](https://github.com/KomaGuy) on 2026-11-26T19:57:44Z. --- Thanks @thepatrickworld for verifying the `-Od` DXIL disassembly on `3100f363` and for the mutant analysis! Followed up with option 2 in `1c5f2ea6`: 1. **Exact DPP16/DPP8 permutation→intrinsic pinning (`tests/pixel_aot_check.py`):** Replaced the sensitivity-only check in `check_f16_cvt_norm_controls` with single-instruction-per-permutation checks for both `v_cvt_norm_i16_f16_dpp` and `v_cvt_norm_u16_f16_dpp`: - `quad_perm:[0,1,2,3]` → `(0, 0, 0, 0)` (identity) - `quad_perm:[1,0,3,2]` → `(1, 0, 0, 0)` (`QuadReadAcrossX`) - `quad_perm:[2,3,0,1]` → `(0, 1, 0, 0)` (`QuadReadAcrossY`) - `quad_perm:[3,2,1,0]` → `(0, 0, 1, 0)` (`QuadReadAcrossDiagonal`) - `quad_perm:[2,2,2,2]` → `(0, 0, 0, 1)` (`QuadReadLaneAt(..., 2)`) - `quad_perm:[0,2,1,3]` and `dpp8:[1,2,3,0,5,6,7,4]` → `(0, 0, 0, 4)` plus regex-pinning the exact `(l0, l1, l2, l3)` lane selection order in the bitmask expression. - Tested locally against all 4 in-memory `emit_quad_swizzle_u32` mutants (`ignore`, `rotate` `perm[1:]+perm[:1]`, `X<->Y` swap, and general-lane swap): all 4 fail `check_f16_cvt_norm_controls()`. 2. **`docs/experiments.md`:** Updated the wording to note that `-denorm ftz` emits the same pure-`uint` instructions as `-denorm preserve` (no binary32 float ops in `cvt_norm_{i16,u16}_f16`), recorded the `3100f363` RX 9070 XT / `-Od` DXIL disassembly result, and noted that mutation draws compile optimized rather than `-Od`. Re-verified locally on Linux: `tests/pixel_aot_check.py`, `form_coverage_check` (`check_shader_records`, `check_f16_cvt_norm_forms`), `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/rdna2_tools_check.py`, and `git diff --check origin/main` all pass.
thepatrickworld commented 2026-11-26 20:36:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T20:36:05Z.


Independent replay of the emit_quad_swizzle_u32 mutants on 1c5f2ea6

Not a code change; measurements only.

Environment

  • Linux, Python 3.11.16: python3 -B tests/pixel_aot_check.py with no argument, which runs check_controls() only (~13 s here); no device.
  • Device: Windows 10.0.26200.9974, DXC 1.9.2602.17, backend=hardware debug_layer=unavailable, adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550, driver=32.0.32029.2010, entry draw-core-vector.

Commands

python3 -B tests/pixel_aot_check.py                 # check_controls only
python3 -B tests/pixel_aot_check.py draw-core-vector "<dxc.exe>" "<offscreen_check.exe>" hardware
# every mutant: one edit, rerun, then git checkout -- tools/pixel_aot.py

tools/pixel_aot.py is the same blob at both heads (cc12860c…, file sha256 4595dc7c… on an LF checkout; the CRLF Windows copy hashes to fb813fae…), so the two columns differ only by the fixture.

Mutants, one at a time, check_controls re-run each time

                                            3100f363  1c5f2ea6  first failure at 1c5f2ea6
perm -> perm[1:]+perm[:1]   (your rotation)   rc=0      rc=1     check_f16_cvt_norm_controls:11812
perm -> [p3,p1,p2,p0]       (your lane swap)  rc=0      rc=1     check_f16_cvt_norm_controls:11812
QuadReadAcrossX -> QuadReadAcrossY            rc=1      rc=1     _check_controls_inline:18598
identity branch -> always return bits         rc=1      rc=1     _check_controls_inline:18598
WaveGetLaneIndex() & 3u -> (+1) & 3u          rc=1      rc=1     _check_controls_inline:19828
even = (q & 1u) - 1u  ->  (q & 1u)            rc=0      rc=0     -
top  = (q >> 1u) - 1u ->  (q >> 1u)           rc=0      rc=0     -

How that reads against your 4/4

Rotation and lane swap are the two that go green-to-red on the runner, both at the lane-order regex. The Y-swap and identity mutants are red in both columns, at the pre-existing dpp_ternary count assert — so on the runner they do not witness the new block. Invoked directly, all four fail check_f16_cvt_norm_controls at 1c5f2ea6 (Y-swap and identity at the counts assert :11803, rotation and lane swap at the regex :11812): your 4/4 holds for the sub-check itself, and the runner only reports the older assert because _check_controls_inline raises first and cancels the sub-check futures that were still pending. Also: the lane order is pinned for [2,2,2,2], [0,2,1,3] and dpp8:[1,2,3,0] (the regex); the four other permutations are pinned by intrinsic counts only.

The two mask derivations

even and top (tools/pixel_aot.py:2699-2700) are pinned by no static control: the new block matches the names dpp\d+_even/_top and never the definitions, so either edit leaves check_controls green. Both are caught by a draw — on this adapter draw-core-vector goes EXIT=1 in check_dpp_int32_draw (case=0..2 status=mismatch, channel 0 expected_bits=42900000, actual_bits=424c0000 for even and 42580000 for top), clean run on the same entry EXIT=0 — but that is an int32 DPP fixture, not the f16 entries, whose draws cannot see lane routing under #839. pixel_aot_core_vector_* is not in ctest --preset pr, so this PR's own CI never runs it; it runs on main CI as _warp and on a GPU machine as _hardware. No action requested: if you do want the masks pinned, the same block can assert the two definition strings, one line each.

Limits

  • The static column is the Linux check_controls run only. The three mutant device runs (rotation, even, top) stop at the first failing batch, so the draw groups after check_dpp_int32_draw were not exercised there.
  • One adapter, one driver, debug_layer=unavailable.
  • Every mutant lives in emit_quad_swizzle_u32; nothing here speaks about ops that do not go through it.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7202875340 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7202875340). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T20:36:05Z. --- **Independent replay of the `emit_quad_swizzle_u32` mutants on `1c5f2ea6`** Not a code change; measurements only. ### Environment - Linux, Python 3.11.16: `python3 -B tests/pixel_aot_check.py` with no argument, which runs `check_controls()` only (~13 s here); no device. - Device: Windows `10.0.26200.9974`, DXC `1.9.2602.17`, `backend=hardware debug_layer=unavailable`, `adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550`, `driver=32.0.32029.2010`, entry `draw-core-vector`. ### Commands ``` python3 -B tests/pixel_aot_check.py # check_controls only python3 -B tests/pixel_aot_check.py draw-core-vector "<dxc.exe>" "<offscreen_check.exe>" hardware # every mutant: one edit, rerun, then git checkout -- tools/pixel_aot.py ``` `tools/pixel_aot.py` is the same blob at both heads (`cc12860c…`, file sha256 `4595dc7c…` on an LF checkout; the CRLF Windows copy hashes to `fb813fae…`), so the two columns differ only by the fixture. ### Mutants, one at a time, `check_controls` re-run each time ``` 3100f363 1c5f2ea6 first failure at 1c5f2ea6 perm -> perm[1:]+perm[:1] (your rotation) rc=0 rc=1 check_f16_cvt_norm_controls:11812 perm -> [p3,p1,p2,p0] (your lane swap) rc=0 rc=1 check_f16_cvt_norm_controls:11812 QuadReadAcrossX -> QuadReadAcrossY rc=1 rc=1 _check_controls_inline:18598 identity branch -> always return bits rc=1 rc=1 _check_controls_inline:18598 WaveGetLaneIndex() & 3u -> (+1) & 3u rc=1 rc=1 _check_controls_inline:19828 even = (q & 1u) - 1u -> (q & 1u) rc=0 rc=0 - top = (q >> 1u) - 1u -> (q >> 1u) rc=0 rc=0 - ``` ### How that reads against your 4/4 Rotation and lane swap are the two that go green-to-red on the runner, both at the lane-order regex. The Y-swap and identity mutants are red in both columns, at the pre-existing `dpp_ternary` count assert — so on the runner they do not witness the new block. Invoked directly, all four fail `check_f16_cvt_norm_controls` at `1c5f2ea6` (Y-swap and identity at the counts assert `:11803`, rotation and lane swap at the regex `:11812`): your 4/4 holds for the sub-check itself, and the runner only reports the older assert because `_check_controls_inline` raises first and cancels the sub-check futures that were still pending. Also: the lane order is pinned for `[2,2,2,2]`, `[0,2,1,3]` and `dpp8:[1,2,3,0]` (the regex); the four other permutations are pinned by intrinsic counts only. ### The two mask derivations `even` and `top` (`tools/pixel_aot.py:2699-2700`) are pinned by no static control: the new block matches the names `dpp\d+_even`/`_top` and never the definitions, so either edit leaves `check_controls` green. Both are caught by a draw — on this adapter `draw-core-vector` goes `EXIT=1` in `check_dpp_int32_draw` (`case=0..2 status=mismatch`, channel 0 `expected_bits=42900000`, `actual_bits=424c0000` for `even` and `42580000` for `top`), clean run on the same entry `EXIT=0` — but that is an int32 DPP fixture, not the f16 entries, whose draws cannot see lane routing under #839. `pixel_aot_core_vector_*` is not in `ctest --preset pr`, so this PR's own CI never runs it; it runs on main CI as `_warp` and on a GPU machine as `_hardware`. No action requested: if you do want the masks pinned, the same block can assert the two definition strings, one line each. ### Limits - The static column is the Linux `check_controls` run only. The three mutant device runs (rotation, `even`, `top`) stop at the first failing batch, so the draw groups after `check_dpp_int32_draw` were not exercised there. - One adapter, one driver, `debug_layer=unavailable`. - Every mutant lives in `emit_quad_swizzle_u32`; nothing here speaks about ops that do not go through it. _AI-assisted._
tedin7 commented 2026-11-27 18:15:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T18:15:23Z.

Review: COMMENTED


Review of 30d435a643 (the change from 1c5f2ea6, updated with main; the PR's own diff is unchanged). Comment only.

The cvt_norm_i16_f16 / cvt_norm_u16_f16 helpers compute round-to-nearest-even of clamp(x) * 32767 / * 65535 in exact integer arithmetic (largest product 2047 * 65535 fits in 32 bits), and the Python reference uses the same exact method instead of binary32, which avoids the double rounding near 0.5. The new pixel_aot_f16_cvt_norm_<adapter> draws compare with that reference, and the DPP16/DPP8 permutation pinning added after the earlier independent replay is in tests/pixel_aot_check.py.

Non-blocking note: for a NaN input the helpers return 32767 (signed, with the sign of the NaN) or 0xffff (unsigned, positive NaN), because mag >= 0x3c00 also catches the exponent-31 encodings. If the hardware returns 0 for NaN, a follow-up could special-case exponent 31 with a nonzero mantissa. The reference raises on non-finite inputs, so the fixture does not cover it either way.

Windows results are in the comment below.

Commands: git diff origin/main...pull/2857/head (read), plus the Windows commands listed in the comment.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6091987178 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#pullrequestreview-6091987178). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T18:15:23Z. **Review:** COMMENTED --- Review of 30d435a643991bf447cd276e6134e080820cc800 (the change from 1c5f2ea6, updated with main; the PR's own diff is unchanged). Comment only. The `cvt_norm_i16_f16` / `cvt_norm_u16_f16` helpers compute round-to-nearest-even of `clamp(x) * 32767` / `* 65535` in exact integer arithmetic (largest product 2047 * 65535 fits in 32 bits), and the Python reference uses the same exact method instead of binary32, which avoids the double rounding near 0.5. The new `pixel_aot_f16_cvt_norm_<adapter>` draws compare with that reference, and the DPP16/DPP8 permutation pinning added after the earlier independent replay is in `tests/pixel_aot_check.py`. Non-blocking note: for a NaN input the helpers return 32767 (signed, with the sign of the NaN) or 0xffff (unsigned, positive NaN), because `mag >= 0x3c00` also catches the exponent-31 encodings. If the hardware returns 0 for NaN, a follow-up could special-case exponent 31 with a nonzero mantissa. The reference raises on non-finite inputs, so the fixture does not cover it either way. Windows results are in the comment below. Commands: `git diff origin/main...pull/2857/head` (read), plus the Windows commands listed in the comment. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 18:15:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T18:15:24Z.


Windows Server 2025 verification of 30d435a643991bf447cd276e6134e080820cc800 (D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target offscreen_check; ctest --preset dev -R '^pixel_aot_': 204/204 passed, including pixel_aot_f16_cvt_norm_warp and pixel_aot_f16_cvt_norm_hardware
  • release: cmake --build --preset release --target offscreen_check; ctest --preset release -R '^pixel_aot_': 204/204 passed
  • Windows Python checks selected for tools/pixel_aot.py (including tests/form_coverage_check.py): all ok

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7225297046 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7225297046). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T18:15:24Z. --- Windows Server 2025 verification of `30d435a643991bf447cd276e6134e080820cc800` (D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target offscreen_check`; `ctest --preset dev -R '^pixel_aot_'`: 204/204 passed, including `pixel_aot_f16_cvt_norm_warp` and `pixel_aot_f16_cvt_norm_hardware` - release: `cmake --build --preset release --target offscreen_check`; `ctest --preset release -R '^pixel_aot_'`: 204/204 passed - Windows Python checks selected for `tools/pixel_aot.py` (including `tests/form_coverage_check.py`): all ok AI-assisted; commands listed were executed locally.
thepatrickworld commented 2026-11-27 18:23:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-27T18:23:25Z.


Thanks for the Windows Server run. One caveat about what 204/204 passed covers — measured here rather than
quoted, because this repo's CTest counts a skipped entry in that total.

Same entry, same tree (6ee878d8), only XBOX2WINDOWS_ADAPTER set to a name that matches no adapter:

1/1 Test #256: startup_view_census_hardware .....***Skipped   0.21 sec

The following tests passed:
	startup_view_census_hardware

100% tests passed out of 1

The following tests did not run:
	256 - startup_view_census_hardware (Skipped)

With the filter removed, same entry: Passed 1.09 sec, and the binary prints adapter=AMD Radeon RX 9070 XT.

That is the same code path a host with only WARP hits: the renderer's hardware backend returns 77 when no
non-software adapter is available (tests/pixel_aot_check.py:3628, and the entry carries
SKIP_RETURN_CODE 77, CMakeLists.txt:10803). So on Windows Server 2025 pixel_aot_f16_cvt_norm_hardware
cannot have drawn anything; what separates the two in a log is the ***Skipped marker, the "did not run"
section, or the fixture's own adapter= line — not the 204/204.

That left the hardware half unmeasured, so I ran it: worktree at 30d435a6, dev preset,
-DINTAKE_PYTHON borrowed from another checkout.

1/2 Test #2009: pixel_aot_f16_cvt_norm_hardware ...   Passed   10.67 sec
2/2 Test #2259: pixel_aot_f16_cvt_norm_warp .......   Passed    7.48 sec

Environment, from a direct invocation of the same binary with the same hardware backend:

backend=hardware debug_layer=unavailable
adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010

Limits: one adapter (RDNA 4) and one driver, no debug layer, and windows.yml runs -E '_hardware$', so
this entry runs nowhere in CI — this is a one-off run, and the WARP half stays yours.

AI-assisted; runs executed on the machine above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7225437676 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7225437676). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-27T18:23:25Z. --- Thanks for the Windows Server run. One caveat about what `204/204 passed` covers — measured here rather than quoted, because this repo's CTest counts a skipped entry in that total. Same entry, same tree (`6ee878d8`), only `XBOX2WINDOWS_ADAPTER` set to a name that matches no adapter: ``` 1/1 Test #256: startup_view_census_hardware .....***Skipped 0.21 sec The following tests passed: startup_view_census_hardware 100% tests passed out of 1 The following tests did not run: 256 - startup_view_census_hardware (Skipped) ``` With the filter removed, same entry: `Passed 1.09 sec`, and the binary prints `adapter=AMD Radeon RX 9070 XT`. That is the same code path a host with only WARP hits: the renderer's `hardware` backend returns 77 when no non-software adapter is available (`tests/pixel_aot_check.py:3628`, and the entry carries `SKIP_RETURN_CODE 77`, `CMakeLists.txt:10803`). So on Windows Server 2025 `pixel_aot_f16_cvt_norm_hardware` cannot have drawn anything; what separates the two in a log is the `***Skipped` marker, the "did not run" section, or the fixture's own `adapter=` line — not the `204/204`. That left the hardware half unmeasured, so I ran it: worktree at `30d435a6`, dev preset, `-DINTAKE_PYTHON` borrowed from another checkout. ``` 1/2 Test #2009: pixel_aot_f16_cvt_norm_hardware ... Passed 10.67 sec 2/2 Test #2259: pixel_aot_f16_cvt_norm_warp ....... Passed 7.48 sec ``` Environment, from a direct invocation of the same binary with the same `hardware` backend: ``` backend=hardware debug_layer=unavailable adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 ``` Limits: one adapter (RDNA 4) and one driver, no debug layer, and `windows.yml` runs `-E '_hardware$'`, so this entry runs nowhere in CI — this is a one-off run, and the WARP half stays yours. _AI-assisted; runs executed on the machine above._
pigalot commented 2026-11-27 19:50:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T19:50:22Z.

Review: APPROVED


Independently reviewed 841e70c9 integrated over main 0f3e8248 (tree 263f8473, clean merge).

What I traced. For a normal binary16, mant * 2^(exp-25) is the value. So shift = 25 - exp (24 for subnormals) gives x * 32767 / x * 65535 exactly as prod >> shift plus the remainder. The products stay under 2^27. mag >= 0x3c00 is the |x| ≥ 1 clamp, and the signed path negates after rounding, so -1 maps to -32767.

The HLSL helpers and f16_cvt_norm_result are the same arithmetic. On the DPP path, abs applies before neg. Every path calls the reference on the proven operand, so a non-finite operand is refused at translation time. The NaN behaviour in tedin7's note therefore can't reach a lowered shader.

What I ran. I built offscreen_check in dev and release, then ran:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(pixel_aot_f16_cvt_norm_(warp|hardware)|pixel_aot_f16_exact_extra_(warp|hardware)|pixel_aot_sdwa_cvt_(warp|hardware)|form_coverage)$'

  • 7/7 passed in Debug and Release /O2, with no skips.
  • The _hardware entries drew on an RTX 5090. None reported ***Skipped, which matters given thepatrickworld's point that a skip counts toward the passed total.
  • python -B tests/pixel_aot_check.py (controls only) exits 0 in 8 s.

Mutants (in the HLSL helpers in tools/pixel_aot.py):

  • Truncation (if (false) q += 1u; in cvt_norm_i16_f16): fails pixel_aot_f16_cvt_norm_warp and _hardware at expected_bits=80004000 actual_bits=80003fff, the x = 0.5 input.
  • Round-half-up instead of round-to-even (rem >= mid, both helpers): passes, and no input can tell the two apart.
    • A tie needs v2(mant * 32767) = shift - 1, so v2(mant) = shift - 1 >= 10.
    • The only finite input with that property is ±0.5 (mant = 1024, shift = 11).
    • There q is odd (16383 / 32767), so both rules round up.
    • The tie-to-even branch has no observable effect. That is not a fixture gap.

I restored the file after each mutant and confirmed with git diff --quiet. git diff --check is clean.

Not checked. I have no RDNA2 hardware. The fixture compares the lowering against the PR's own reference, round_rne(clamp(x) * 32767 | 65535) as the body states. Whether gfx1013 rounds exactly that way is not measured here.

Verdict: approve on 841e70c9.

Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP 10.0.26100.9818; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; debug layer on.
CI: Build and test on Windows passes on 841e70c9. There are no review threads.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6092788442 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#pullrequestreview-6092788442). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T19:50:22Z. **Review:** APPROVED --- Independently reviewed `841e70c9` integrated over `main` `0f3e8248` (tree `263f8473`, clean merge). **What I traced.** For a normal binary16, `mant * 2^(exp-25)` is the value. So `shift = 25 - exp` (24 for subnormals) gives `x * 32767` / `x * 65535` exactly as `prod >> shift` plus the remainder. The products stay under 2^27. `mag >= 0x3c00` is the |x| ≥ 1 clamp, and the signed path negates after rounding, so -1 maps to -32767. The HLSL helpers and `f16_cvt_norm_result` are the same arithmetic. On the DPP path, `abs` applies before `neg`. Every path calls the reference on the proven operand, so a non-finite operand is refused at translation time. The NaN behaviour in tedin7's note therefore can't reach a lowered shader. **What I ran.** I built `offscreen_check` in `dev` and `release`, then ran: `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(pixel_aot_f16_cvt_norm_(warp|hardware)|pixel_aot_f16_exact_extra_(warp|hardware)|pixel_aot_sdwa_cvt_(warp|hardware)|form_coverage)$'` - 7/7 passed in Debug and Release `/O2`, with no skips. - The `_hardware` entries drew on an RTX 5090. None reported `***Skipped`, which matters given thepatrickworld's point that a skip counts toward the `passed` total. - `python -B tests/pixel_aot_check.py` (controls only) exits 0 in 8 s. **Mutants** (in the HLSL helpers in `tools/pixel_aot.py`): - **Truncation** (`if (false) q += 1u;` in `cvt_norm_i16_f16`): fails `pixel_aot_f16_cvt_norm_warp` and `_hardware` at `expected_bits=80004000 actual_bits=80003fff`, the x = 0.5 input. - **Round-half-up instead of round-to-even** (`rem >= mid`, both helpers): passes, and no input can tell the two apart. - A tie needs `v2(mant * 32767) = shift - 1`, so `v2(mant) = shift - 1 >= 10`. - The only finite input with that property is ±0.5 (`mant = 1024`, `shift = 11`). - There `q` is odd (16383 / 32767), so both rules round up. - The tie-to-even branch has no observable effect. That is not a fixture gap. I restored the file after each mutant and confirmed with `git diff --quiet`. `git diff --check` is clean. **Not checked.** I have no RDNA2 hardware. The fixture compares the lowering against the PR's own reference, `round_rne(clamp(x) * 32767 | 65535)` as the body states. Whether gfx1013 rounds exactly that way is not measured here. **Verdict:** approve on `841e70c9`. Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP 10.0.26100.9818; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; debug layer on. CI: `Build and test on Windows` passes on `841e70c9`. There are no review threads. This reply was AI-assisted.
tedin7 commented 2026-11-27 19:50:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T19:50:39Z.


Windows Server 2025 re-verification of 841e70c9b10ad4ca54181d11078014e6989ac1eb (the same change, updated with main again; D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target offscreen_check; ctest --preset dev -R '^pixel_aot_': 204/204 passed, including pixel_aot_f16_cvt_norm_warp and _hardware
  • release: cmake --build --preset release --target offscreen_check; ctest --preset release -R '^pixel_aot_': 204/204 passed
  • Windows Python checks selected for tools/pixel_aot.py: all ok

The NaN note in my review stays a possible follow-up, not a blocker.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7226924635 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2857#issuecomment-7226924635). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T19:50:39Z. --- Windows Server 2025 re-verification of `841e70c9b10ad4ca54181d11078014e6989ac1eb` (the same change, updated with main again; D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target offscreen_check`; `ctest --preset dev -R '^pixel_aot_'`: 204/204 passed, including `pixel_aot_f16_cvt_norm_warp` and `_hardware` - release: `cmake --build --preset release --target offscreen_check`; `ctest --preset release -R '^pixel_aot_'`: 204/204 passed - Windows Python checks selected for `tools/pixel_aot.py`: all ok The NaN note in my review stays a possible follow-up, not a blocker. AI-assisted; commands listed were executed locally.
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!2849
No description provided.