tests: keep integer copy and scratch readback references bit-exact #2450

Merged
RavenCurseBurg merged 1 commit from upstream-pr/2458 into main 2026-11-25 17:29:22 +00:00
RavenCurseBurg commented 2026-11-25 17:20:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T17:20:45Z.


Fixes #2456.

The copy and scratch cases now serialize four unsigned words directly into each expected texel. The integer-copy fixture keeps its existing subnormal corruption control and adds positive and negative signaling-NaN bit patterns, with a separate reference that differs only in the quiet bit. Both scratch programs now exercise those signals alongside two distinct quiet payloads.

Reproduction and verification

  • On Windows x64 CPython 3.11.9, the old scratch writer produced 7fc00001 ffc12345 for inputs 7f800001 ff812345. On Intel UHD 770, RTX 4060 and WARP, both original shaders failed the old reference and matched a direct integer reference. Both deliberately quieted shaders did the opposite. CPython 3.14.3 on the same PC preserved the words in the old writer. Python documents that the NaN type can change during packing. Python floating-point packing
  • I ran the changed copy and scratch draws with CPython 3.11.9 and 3.14.3 on all three adapters. The exact copies passed, all three corrupted references failed, and both scratch groups passed all six patterns. The five existing scratch mutation controls still detected a mismatch. All 54 corresponding case files were byte-identical across Python versions.
  • The full draw-e64 and draw-flat-scratch CLI entries passed on WARP with 3.11.9 and DXC 1.9.2609.5. Documentation links and bidi checks passed.

AI-assisted with Codex + GPT-6.2 Astra (xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609876591 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2458). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T17:20:45Z. --- Fixes #2456. The copy and scratch cases now serialize four unsigned words directly into each expected texel. The integer-copy fixture keeps its existing subnormal corruption control and adds positive and negative signaling-NaN bit patterns, with a separate reference that differs only in the quiet bit. Both scratch programs now exercise those signals alongside two distinct quiet payloads. **Reproduction and verification** - On Windows x64 CPython 3.11.9, the old scratch writer produced `7fc00001 ffc12345` for inputs `7f800001 ff812345`. On Intel UHD 770, RTX 4060 and WARP, both original shaders failed the old reference and matched a direct integer reference. Both deliberately quieted shaders did the opposite. CPython 3.14.3 on the same PC preserved the words in the old writer. Python documents that the NaN type can change during packing. [Python floating-point packing](https://docs.python.org/3.11/c-api/float.html#pack-and-unpack-functions) - I ran the changed copy and scratch draws with CPython 3.11.9 and 3.14.3 on all three adapters. The exact copies passed, all three corrupted references failed, and both scratch groups passed all six patterns. The five existing scratch mutation controls still detected a mismatch. All 54 corresponding case files were byte-identical across Python versions. - The full `draw-e64` and `draw-flat-scratch` CLI entries passed on WARP with 3.11.9 and DXC 1.9.2609.5. Documentation links and bidi checks passed. AI-assisted with Codex + GPT-6.2 Astra (xhigh).
upstream-sync closed this pull request 2026-11-25 18:01:11 +00:00
MasterDomino commented 2026-11-25 18:01:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-25T17:29:19Z.

Review: APPROVED


Approved at head 541e1ff5. The change is test-only: tests/pixel_aot_check.py and docs/experiments.md.

Environment

  • Windows 11 build 26300, --preset dev, offscreen_check built at 541e1ff5.
  • DXC from SDK 10.0.26100, CPython 3.13.1.

Python behaviour on this machine

The round trip struct.unpack('<f', …) then struct.pack('<f', …) quiets signalling NaNs on CPython 3.13.1:

  • 7f800001 becomes 7fc00001;
  • ff812345 becomes ffc12345.

So 3.13.1 behaves like the 3.11.9 the description reports, not like 3.14.3.

Normal run

ctest --preset dev --no-tests=error -V -R '^pixel_aot_(flat_scratch|e64)_(warp|hardware)$'
  • 4/4 pass on WARP 10.0.26100.9818 and the AMD Radeon RX 9070 XT (1002:7550, driver 32.0.32029.2010), every batch debug_errors=0 debug_warnings=0, with no skips.
  • What this shows about RDNA 4:
    • The positive-snan and negative-snan exact copies pass, while the references that differ only in the quiet bit report mismatch, so v_mov_b32 keeps the signalling bit through the integer target.
    • The scratch row 7f800001 ff812345 7fcabcde ffe76543 passes in both groups.

Negative control (the bug this fixes)

I restored main's tests/pixel_aot_check.py from the merge base, with its float-based writer, and added only this PR's new FLAT_SCRATCH_WORDS row:

  • pixel_aot_flat_scratch_hardware fails: Expected ['pass', …, 'pass'], got [… 'mismatch'].
  • The reported bits: channel=0 expected_bits=7fc00001 actual_bits=7f800001 and channel=1 expected_bits=ffc12345 actual_bits=ff812345. The GPU kept the exact sNaN and the old writer quieted the reference.
  • After restoring the PR's file, the test passes.

Merge checks: the branch merges cleanly with current main. Required CI passed at this head. The /O2 and coverage skips come from explicit workflow conditions. There are no review threads.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062080739 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2458#pullrequestreview-6062080739). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-25T17:29:19Z. **Review:** APPROVED --- Approved at head `541e1ff5`. The change is test-only: `tests/pixel_aot_check.py` and `docs/experiments.md`. ### Environment - Windows 11 build 26300, `--preset dev`, `offscreen_check` built at `541e1ff5`. - DXC from SDK 10.0.26100, **CPython 3.13.1**. ### Python behaviour on this machine The round trip `struct.unpack('<f', …)` then `struct.pack('<f', …)` quiets signalling NaNs on CPython 3.13.1: - `7f800001` becomes `7fc00001`; - `ff812345` becomes `ffc12345`. So 3.13.1 behaves like the 3.11.9 the description reports, not like 3.14.3. ### Normal run ```powershell ctest --preset dev --no-tests=error -V -R '^pixel_aot_(flat_scratch|e64)_(warp|hardware)$' ``` - **4/4 pass on WARP 10.0.26100.9818 and the AMD Radeon RX 9070 XT** (1002:7550, driver 32.0.32029.2010), every batch `debug_errors=0 debug_warnings=0`, with no skips. - **What this shows about RDNA 4:** - The `positive-snan` and `negative-snan` exact copies pass, while the references that differ only in the quiet bit report `mismatch`, so `v_mov_b32` keeps the signalling bit through the integer target. - The scratch row `7f800001 ff812345 7fcabcde ffe76543` passes in both groups. ### Negative control (the bug this fixes) I restored `main`'s `tests/pixel_aot_check.py` from the merge base, with its float-based writer, and added only this PR's new `FLAT_SCRATCH_WORDS` row: - **`pixel_aot_flat_scratch_hardware` fails:** `Expected ['pass', …, 'pass'], got [… 'mismatch']`. - **The reported bits:** `channel=0 expected_bits=7fc00001 actual_bits=7f800001` and `channel=1 expected_bits=ffc12345 actual_bits=ff812345`. The GPU kept the exact sNaN and the old writer quieted the reference. - **After restoring the PR's file,** the test passes. Merge checks: the branch merges cleanly with current `main`. Required CI passed at this head. The `/O2` and coverage skips come from explicit workflow conditions. There are no review threads. 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!2450
No description provided.