gpu: check signed-zero float min and max through title addresses #1031

Merged
zohaiblazuli merged 1 commit from upstream-pr/1038 into main 2026-11-23 22:43:43 +00:00
zohaiblazuli commented 2026-11-23 22:26:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by zohaiblazuli on 2026-11-23T22:26:57Z.


Change

Refs #874, Refs #369. This is the signed-zero readback check the maintainer described in #874 (claimed there and confirmed with guidance, which this follows). It extends the existing gpu_alias_lookup_writes fixture. The shader is unchanged.

Replaces in tests/gpu_alias_writes.hlsl uses a strict < or >, and -0.0 < +0.0 is false. So a float min or max between the two zeros keeps the stored word. The fixture now documents this as its expectation, not IEEE minNum/maxNum, and compares raw bits (0x00000000, 0x80000000).

tests/gpu_alias_lookup.cpp adds nine words to the second allocation:

  • Four single-record ties: min and max, each from +0 with a -0 candidate and from -0 with a +0 candidate. All four must keep their starting bits.
  • Four contended words, each starting at a signed zero with 256 contenders:
    • Every third contender alternates -0 and +0. The rest are strictly negative or strictly positive inputs from the existing generator.
    • Must win: from +0, min must land the lowest negative; from -0, max must land the highest positive.
    • Must survive: from +0, min with only ties and larger inputs must keep +0; from -0, max with only ties and smaller inputs must keep -0.
    • A zero that could win is never contended by the opposite zero, so every expected word is deterministic.
  • Negative-only max: one more word with 256 strictly negative contenders, seeded at negative infinity, because under a strict > no negative input can replace a zero. The highest negative (-0.125, 0xbe000000) must win.

The record count goes from 1,047 to 2,331. The output gains one signed_zero line with the actual and expected bits of each word. The existing groups, the array-atomics probe and its failure message are unchanged. docs/experiments.md has the new count and a measurement entry.

Verification

Commit 9a1c1e9 on main at 64ecc87. Windows 11 build 26300, MSVC x64, Windows SDK DXC, debug layer enabled.

cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^(docs_links|gpu_alias)'

9/9 passed with dev, and the 8 gpu_alias* tests passed again with release (/O2). Direct runs of offscreen_check.exe <backend> --gpu-alias-lookup-writes:

Adapter Driver Result
WARP 10.0.26100.10068 2,331 records, mismatches 0, all 9 signed-zero words exact, debug errors/warnings 0 (dev and release)
NVIDIA GeForce RTX 3060 (10de:2504) 32.0.16.1742 same (dev and release)
Intel UHD Graphics 770 (8086:a780), XBOX2WINDOWS_ADAPTER=Intel 32.0.101.7092 All 2,331 records and all 9 signed-zero words match (dev and release). Exits 1 on the existing array-atomics probe (256,192,128,64), the signature already recorded in #369 for this driver.
gpu_alias_lookup_writes signed_zero words=9 00000000/00000000 80000000/80000000 00000000/00000000 80000000/80000000 c49bc000/c49bc000 449b3c00/449b3c00 00000000/00000000 80000000/80000000 be000000/be000000

Mutation checks (local, not committed):

  • Replace on equality (<=/>= in Replaces): 5 mismatches on both WARP and the RTX 3060, all on signed-zero words. These are the four ties plus one contended tie word; which tie word flips depends on arrival order.
  • Compare-exchange loop without retry: still passes on WARP, as the experiment note already records. On the RTX 3060 it failed 3 of 3 runs with 5 mismatches: the original min and max words and the three contended words a strict input must win, including the negative-only max.

Evidence and follow-up

All inputs are synthetic and generated in the test. No title data is involved.

Assumptions:

  • The tie-keeps-stored policy follows from the fixture's current strict-compare loop. It is a statement about this lowering, not about the console's global_atomic_fmin/fmax signed-zero behavior, which needs its own evidence.
  • The separate strict dynamic-UAV probe and the #369 failure counts stay as they are.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6570108129 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1038). Originally posted by [zohaiblazuli](https://github.com/zohaiblazuli) on 2026-11-23T22:26:57Z. --- ## Change Refs #874, Refs #369. This is the signed-zero readback check the maintainer described in #874 (claimed [there](https://github.com/R0Y00/Xbox2Windows/issues/874#issuecomment-7115635435) and confirmed with guidance, which this follows). It extends the existing `gpu_alias_lookup_writes` fixture. The shader is unchanged. `Replaces` in `tests/gpu_alias_writes.hlsl` uses a strict `<` or `>`, and `-0.0 < +0.0` is false. So a float min or max between the two zeros keeps the stored word. The fixture now documents this as its expectation, not IEEE `minNum`/`maxNum`, and compares raw bits (`0x00000000`, `0x80000000`). `tests/gpu_alias_lookup.cpp` adds nine words to the second allocation: - **Four single-record ties:** min and max, each from `+0` with a `-0` candidate and from `-0` with a `+0` candidate. All four must keep their starting bits. - **Four contended words**, each starting at a signed zero with 256 contenders: - Every third contender alternates `-0` and `+0`. The rest are strictly negative or strictly positive inputs from the existing generator. - **Must win:** from `+0`, min must land the lowest negative; from `-0`, max must land the highest positive. - **Must survive:** from `+0`, min with only ties and larger inputs must keep `+0`; from `-0`, max with only ties and smaller inputs must keep `-0`. - A zero that could win is never contended by the opposite zero, so every expected word is deterministic. - **Negative-only max:** one more word with 256 strictly negative contenders, seeded at negative infinity, because under a strict `>` no negative input can replace a zero. The highest negative (`-0.125`, `0xbe000000`) must win. The record count goes from 1,047 to 2,331. The output gains one `signed_zero` line with the actual and expected bits of each word. The existing groups, the array-atomics probe and its failure message are unchanged. `docs/experiments.md` has the new count and a measurement entry. ## Verification Commit `9a1c1e9` on `main` at `64ecc87`. Windows 11 build 26300, MSVC x64, Windows SDK DXC, debug layer enabled. ```powershell cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^(docs_links|gpu_alias)' ``` 9/9 passed with `dev`, and the 8 `gpu_alias*` tests passed again with `release` (/O2). Direct runs of `offscreen_check.exe <backend> --gpu-alias-lookup-writes`: | Adapter | Driver | Result | |---|---|---| | WARP | 10.0.26100.10068 | 2,331 records, mismatches 0, all 9 signed-zero words exact, debug errors/warnings 0 (`dev` and `release`) | | NVIDIA GeForce RTX 3060 (`10de:2504`) | 32.0.16.1742 | same (`dev` and `release`) | | Intel UHD Graphics 770 (`8086:a780`), `XBOX2WINDOWS_ADAPTER=Intel` | 32.0.101.7092 | All 2,331 records and all 9 signed-zero words match (`dev` and `release`). Exits 1 on the existing array-atomics probe (`256,192,128,64`), the signature already recorded in #369 for this driver. | ```text gpu_alias_lookup_writes signed_zero words=9 00000000/00000000 80000000/80000000 00000000/00000000 80000000/80000000 c49bc000/c49bc000 449b3c00/449b3c00 00000000/00000000 80000000/80000000 be000000/be000000 ``` **Mutation checks** (local, not committed): - **Replace on equality** (`<=`/`>=` in `Replaces`): 5 mismatches on both WARP and the RTX 3060, all on signed-zero words. These are the four ties plus one contended tie word; which tie word flips depends on arrival order. - **Compare-exchange loop without retry:** still passes on WARP, as the experiment note already records. On the RTX 3060 it failed 3 of 3 runs with 5 mismatches: the original min and max words and the three contended words a strict input must win, including the negative-only max. ## Evidence and follow-up All inputs are synthetic and generated in the test. No title data is involved. **Assumptions:** - The tie-keeps-stored policy follows from the fixture's current strict-compare loop. It is a statement about this lowering, not about the console's `global_atomic_fmin`/`fmax` signed-zero behavior, which needs its own evidence. - The separate strict dynamic-UAV probe and the #369 failure counts stay as they are. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:45:58 +00:00
R0Y00 commented 2026-11-24 06:49:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:37:28Z.


Independent Windows Release readback at 9a1c1e9: the RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818) each matched all 2,331 records and all nine raw-bit results, with zero debug errors or warnings. The existing dynamic array probe also passed on both. The Intel array-probe failure stays separately attributed to #369. This verifies the strict comparison policy of the current fixture.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115983813 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1038#issuecomment-7115983813). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:37:28Z. --- Independent Windows Release readback at 9a1c1e9: the RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818) each matched all 2,331 records and all nine raw-bit results, with zero debug errors or warnings. The existing dynamic array probe also passed on both. The Intel array-probe failure stays separately attributed to #369. This verifies the strict comparison policy of the current fixture.
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!1031
No description provided.