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

Manually merged
github merged 1 commit from gh-pr/1038/head into gh-pr/1038/base 2026-11-26 22:36:53 +00:00
Owner

@⁠zohaiblazuli on GitHub · 2026-11-23 22:26 UTC · original
zohaiblazuli:gpu/alias-signed-zero → main · +68 −1 · 2 files · 1 commits · merged 2026-11-23 22:43 UTC

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.
**@⁠zohaiblazuli** on GitHub · 2026-11-23 22:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1038) `zohaiblazuli:gpu/alias-signed-zero` → `main` · +68 −1 · 2 files · 1 commits · merged 2026-11-23 22:43 UTC ## Change Refs #874, Refs #369. This is the signed-zero readback check the maintainer described in #874 (claimed [there](https://git.gtahub.st/github/R0Y00--Xbox2Windows/issues/874) 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.
Extend gpu_alias_lookup_writes with nine words. Four single records tie
+0 and -0 through min and max and must keep the stored bits, since the
shader replaces only on a strict compare. Four contended words start at a
signed zero: on two a strictly smaller or larger input must win, and on
two every contender ties or loses. A negative-only max word is seeded at
negative infinity so the highest negative must win. Expected words are
compared as raw bits.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:36:51 +00:00
github manually merged commit 9a1c1e9acc into gh-pr/1038/base 2026-11-26 22:36:53 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 22:37 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-23 22:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1038#issuecomment-7115983813) 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.