shader: lower gfx1030 finite-normal image atomics #1580

Merged
stan495 merged 2 commits from upstream-pr/1587 into main 2026-11-24 17:50:14 +00:00
stan495 commented 2026-11-24 14:37:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T14:37:05Z.


Summary

Refs #1565

Lower image_atomic_fcmpswap, image_atomic_fmin and image_atomic_fmax for a scalar gfx1030 2D R32_FLOAT image at mip 0 with glc clear. The caller opts into the finite-normal binary32 domain and binds a desktop R32_UINT UAV carrying the original bits. Compare-swap uses bit equality. Min and max use ordered integer keys and a typed compare-exchange loop. The profile excludes zero, subnormals, infinities and NaNs.

Verification

Tested clean head a5633ab6117a97392ba1ea52bd8bfc2cbae2a6b2 on parent be484d0f12aa6e7d6e755cbded6068dd7172a1f4.

. .\tools\dev.ps1
$root = (Get-Location).Path
cmake --preset dev -DINTAKE_PYTHON=<python.exe>
cmake --build --preset dev --target offscreen_check
$env:TEMP = "$root/out"
$env:TMP = $env:TEMP
ctest --preset dev --no-tests=error -j 1 -R '^compute_store_aot_mimg_atomic_(float|counter|integer|minmax|exchange)_(warp|hardware)$' -V --output-junit "$root/out/float-a5633ab6.xml"
python -B tools/form_coverage.py out/float-a5633ab6.xml --records out/build/dev/form_coverage --json out/float-a5633ab6.coverage.json
python -B tests/compute_store_check.py compile-mimg-atomic-float dxc

CTest reported 10 passes, 0 failures and 0 skips. Both float records contain all three forms. The translated shaders matched the CPU reference over all 336 words per case in one- and two-group dispatches. Swapping compare-swap operands changed mip 0, word 32 from ff7fffff to 00800000 on both adapters. The ordering and CAS retry mutations also differed first at that word.

Windows 11 build 26300.9974, Intel Arc B390 driver 32.0.101.8509, Microsoft WARP 10.0.26100.9818. The debug layer was unavailable.

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1

The LLVM 15 container check passed assembly, disassembly and synthetic-container CLI regressions. git diff --check origin/main...HEAD and git merge-tree --write-tree origin/main HEAD passed against 6aa50eca1d074ededaafc00325c293eda7890f25. A separate simulation applied #1568 and #1576 first and also merged cleanly.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584243279 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1587). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T14:37:05Z. --- ## Summary Refs #1565 Lower `image_atomic_fcmpswap`, `image_atomic_fmin` and `image_atomic_fmax` for a scalar gfx1030 2D `R32_FLOAT` image at mip 0 with `glc` clear. The caller opts into the finite-normal binary32 domain and binds a desktop `R32_UINT` UAV carrying the original bits. Compare-swap uses bit equality. Min and max use ordered integer keys and a typed compare-exchange loop. The profile excludes zero, subnormals, infinities and NaNs. ## Verification Tested clean head `a5633ab6117a97392ba1ea52bd8bfc2cbae2a6b2` on parent `be484d0f12aa6e7d6e755cbded6068dd7172a1f4`. ```powershell . .\tools\dev.ps1 $root = (Get-Location).Path cmake --preset dev -DINTAKE_PYTHON=<python.exe> cmake --build --preset dev --target offscreen_check $env:TEMP = "$root/out" $env:TMP = $env:TEMP ctest --preset dev --no-tests=error -j 1 -R '^compute_store_aot_mimg_atomic_(float|counter|integer|minmax|exchange)_(warp|hardware)$' -V --output-junit "$root/out/float-a5633ab6.xml" python -B tools/form_coverage.py out/float-a5633ab6.xml --records out/build/dev/form_coverage --json out/float-a5633ab6.coverage.json python -B tests/compute_store_check.py compile-mimg-atomic-float dxc ``` CTest reported 10 passes, 0 failures and 0 skips. Both float records contain all three forms. The translated shaders matched the CPU reference over all 336 words per case in one- and two-group dispatches. Swapping compare-swap operands changed mip 0, word 32 from `ff7fffff` to `00800000` on both adapters. The ordering and CAS retry mutations also differed first at that word. Windows 11 build `26300.9974`, Intel Arc B390 driver `32.0.101.8509`, Microsoft WARP `10.0.26100.9818`. The debug layer was unavailable. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` The LLVM 15 container check passed assembly, disassembly and synthetic-container CLI regressions. `git diff --check origin/main...HEAD` and `git merge-tree --write-tree origin/main HEAD` passed against `6aa50eca1d074ededaafc00325c293eda7890f25`. A separate simulation applied #1568 and #1576 first and also merged cleanly.
tedin7 commented 2026-11-24 15:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:50:40Z.

Review: COMMENTED


Reviewed commit a5633ab6117a97392ba1ea52bd8bfc2cbae2a6b2 (shader: lower gfx1030 finite-normal image atomics). No defects found.

Technical review

  • Domain & binding gating (tools/compute_store_aot.py): R32_FLOAT is gated to image_uav_mip is not None and image_float_domain == "finite-normal", and IMAGE_FLOAT_ATOMIC_OPS (fcmpswap, fmin, fmax) are isolated from integer image_atomic_* ops via image_float != (op in IMAGE_FLOAT_ATOMIC_OPS).
  • Lowering semantics:
    • image_atomic_fcmpswap: maps VDATA (replacement) and VDATA+1 (compare) with dmask:0x3 to InterlockedCompareStore(dest, compare, value), which matches RDNA2 operand order and is exact on finite-normal binary32 where numeric and bit equality agree.
    • image_atomic_fmin / image_atomic_fmax: maps the sign-dependent key value ^ ((value & 0x80000000u) ? 0xffffffffu : 0x80000000u) so finite-normal binary32 values order as uint, and uses observed = 0u (outside the finite-normal domain) to seed the InterlockedCompareExchange retry loop without a typed UAV load.
  • Controls & mutations (tests/compute_store_check.py): Covers fcmpswap, fmin, fmax, and contended fmin/fmax, negative controls (missing domain, R32_UINT mismatch, mip != 0, forbidden flags, wrong dmask/register range, missing descriptor), and HLSL mutation checks.

Verification

  • Linux:
    • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so — passed.
    • python3 tests/docs_links_check.py — passed (16 Markdown files, 347 links).
    • python3 tests/bidi_controls_check.py — passed (1255 files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP):
    • Debug (--preset dev, offscreen_check): 49/49 passed (69.60s), including compute_store_aot_mimg_atomic_float_warp (4.53s).
    • Release /O2 (--preset release, offscreen_check): 49/49 passed (70.44s), including compute_store_aot_mimg_atomic_float_warp (4.83s).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041498110 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1587#pullrequestreview-6041498110). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:50:40Z. **Review:** COMMENTED --- Reviewed commit `a5633ab6117a97392ba1ea52bd8bfc2cbae2a6b2` (`shader: lower gfx1030 finite-normal image atomics`). No defects found. ### Technical review - **Domain & binding gating (`tools/compute_store_aot.py`)**: `R32_FLOAT` is gated to `image_uav_mip is not None` and `image_float_domain == "finite-normal"`, and `IMAGE_FLOAT_ATOMIC_OPS` (`fcmpswap`, `fmin`, `fmax`) are isolated from integer `image_atomic_*` ops via `image_float != (op in IMAGE_FLOAT_ATOMIC_OPS)`. - **Lowering semantics**: - `image_atomic_fcmpswap`: maps `VDATA` (replacement) and `VDATA+1` (compare) with `dmask:0x3` to `InterlockedCompareStore(dest, compare, value)`, which matches RDNA2 operand order and is exact on finite-normal binary32 where numeric and bit equality agree. - `image_atomic_fmin` / `image_atomic_fmax`: maps the sign-dependent key `value ^ ((value & 0x80000000u) ? 0xffffffffu : 0x80000000u)` so finite-normal binary32 values order as `uint`, and uses `observed = 0u` (outside the finite-normal domain) to seed the `InterlockedCompareExchange` retry loop without a typed UAV load. - **Controls & mutations (`tests/compute_store_check.py`)**: Covers `fcmpswap`, `fmin`, `fmax`, and contended `fmin`/`fmax`, negative controls (missing domain, `R32_UINT` mismatch, mip != 0, forbidden flags, wrong `dmask`/register range, missing descriptor), and HLSL mutation checks. ### Verification - **Linux**: - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so` — passed. - `python3 tests/docs_links_check.py` — passed (16 Markdown files, 347 links). - `python3 tests/bidi_controls_check.py` — passed (1255 files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP)**: - Debug (`--preset dev`, `offscreen_check`): **49/49 passed** (`69.60s`), including `compute_store_aot_mimg_atomic_float_warp` (`4.53s`). - Release `/O2` (`--preset release`, `offscreen_check`): **49/49 passed** (`70.44s`), including `compute_store_aot_mimg_atomic_float_warp` (`4.83s`). AI-assisted; commands listed were executed locally.
thepatrickworld commented 2026-11-24 17:02:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T16:56:49Z.


Independent GPU validation

Measured 7ff2fbc1 — the review's a5633ab6 plus a merge of upstream main — merged onto main (my merge 1e0d9074, tree 283d5798, working tree clean). Nothing below is a code change.

Environment

  • Windows 11 25H2, build 26200.9974
  • DXC 1.9.2602.17 (10.0.26100.0 user-mode)
  • hardware: AMD Radeon RX 9070 XT vendor=1002 device=7550, driver 32.0.32029.2010 (RDNA 4, gfx1201)
  • warp: Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818
  • preset dev (Debug), debug_layer=unavailable

Commands

ctest --preset dev --no-tests=error -R "^compute_store_aot_mimg_atomic_float_(hardware|warp)$" -V
ctest --preset dev --no-tests=error -j 1 -R "^compute_store_aot_mimg_atomic_(float|counter|integer|minmax|exchange)_(warp|hardware)$" -V

Observed

The float entries, three runs each: 6 passed, 0 failed, 0 skipped.

compute_store_aot_mimg_atomic_float_hardware   Passed  4.83 / 4.47 / 4.52 s
compute_store_aot_mimg_atomic_float_warp       Passed  3.29 / 3.28 / 3.27 s

Each backend runs the five cases — fcmpswap, fmin, fmax and the two contended forms — at one and two groups, ten dispatches. The groups=1 dispatches report:

adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
groups=1 view_mip=0 compared_words=336 mismatches=0

and the groups=2 dispatches are identical apart from that field. No dispatch reports a mismatch.

The first-difference lines your Intel run reports reproduce here, word for word and at the same word:

fcmpswap float image atomic mutation: mip=0 word=32 expected=ff7fffff actual=00800000
fmin float image atomic mutation: mip=0 word=32 expected=bf800011 actual=7f7fffff
fmax float image atomic mutation: mip=0 word=32 expected=3f800011 actual=ff7fffff

So the three mutations are still caught on this adapter, not only on the one you used.

Regression

The five-group selection you ran: 10 passed, 0 failed, 0 skipped.

Limits

  • One physical adapter, one driver. The debug layer is not installed here (0x887a002d, SDK component missing), so the run says nothing about D3D12 API validation — only that the readbacks match.
  • The adapter is gfx1201 (RDNA 4). This covers the translated HLSL executing here, not gfx1030 hardware.
  • The profile excludes zero, subnormals, infinities and NaN by construction, so this run says nothing about them; the finite-normal domain is the only one exercised.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138451518 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1587#issuecomment-7138451518). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T16:56:49Z. --- ### Independent GPU validation Measured `7ff2fbc1` — the review's `a5633ab6` plus a merge of upstream main — merged onto main (my merge `1e0d9074`, tree `283d5798`, working tree clean). Nothing below is a code change. **Environment** - Windows 11 25H2, build 26200.9974 - DXC 1.9.2602.17 (`10.0.26100.0` user-mode) - hardware: `AMD Radeon RX 9070 XT vendor=1002 device=7550`, driver `32.0.32029.2010` (RDNA 4, `gfx1201`) - warp: `Microsoft Basic Render Driver vendor=1414 device=008c`, driver `10.0.26100.9818` - preset `dev` (Debug), `debug_layer=unavailable` **Commands** ```powershell ctest --preset dev --no-tests=error -R "^compute_store_aot_mimg_atomic_float_(hardware|warp)$" -V ctest --preset dev --no-tests=error -j 1 -R "^compute_store_aot_mimg_atomic_(float|counter|integer|minmax|exchange)_(warp|hardware)$" -V ``` **Observed** The float entries, three runs each: 6 passed, 0 failed, 0 skipped. ``` compute_store_aot_mimg_atomic_float_hardware Passed 4.83 / 4.47 / 4.52 s compute_store_aot_mimg_atomic_float_warp Passed 3.29 / 3.28 / 3.27 s ``` Each backend runs the five cases — `fcmpswap`, `fmin`, `fmax` and the two contended forms — at one and two groups, ten dispatches. The `groups=1` dispatches report: ``` adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 groups=1 view_mip=0 compared_words=336 mismatches=0 ``` and the `groups=2` dispatches are identical apart from that field. No dispatch reports a mismatch. The first-difference lines your Intel run reports reproduce here, word for word and at the same word: ``` fcmpswap float image atomic mutation: mip=0 word=32 expected=ff7fffff actual=00800000 fmin float image atomic mutation: mip=0 word=32 expected=bf800011 actual=7f7fffff fmax float image atomic mutation: mip=0 word=32 expected=3f800011 actual=ff7fffff ``` So the three mutations are still caught on this adapter, not only on the one you used. **Regression** The five-group selection you ran: **10 passed, 0 failed, 0 skipped**. **Limits** - One physical adapter, one driver. The debug layer is not installed here (`0x887a002d`, SDK component missing), so the run says nothing about D3D12 API validation — only that the readbacks match. - The adapter is `gfx1201` (RDNA 4). This covers the translated HLSL executing here, not `gfx1030` hardware. - The profile excludes zero, subnormals, infinities and NaN by construction, so this run says nothing about them; the finite-normal domain is the only one exercised. _AI-assisted; runs executed locally on the adapter above._
upstream-sync closed this pull request 2026-11-24 18:02:15 +00:00
tedin7 commented 2026-11-24 18:02:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:35:03Z.

Review: COMMENTED


Audit at head_sha: 7ff2fbc178b15030f1af6607b644d83315a6021d (previously reviewed at a5633ab6).

Verdict: 0 P1, 0 P2.

Scope

  • Files: CMakeLists.txt (one new add_test, test only), README.md (one table row), docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py. No src/, no gfx2hlsl, no .github/.
  • The new head merges current main into the branch. Against the previous head the only change in the PR's own patch is the rsrc2=None parameter in the lower() signature, which main added in the meantime; the new parameter image_float_domain sits next to it. git merge-tree against main (68969ed8): no conflicts.

RDNA 2 semantics

  • image_atomic_fcmpswap: data VGPR holds the new value, the next one the compare value, dmask:0x3. The lowering is InterlockedCompareStore(dest, compare, value), which stores value when memory equals compare. For finite normal binary32, numeric equality and bit equality are the same, so the integer compare is exact. Zero and NaN are outside the declared domain, and the domain is a required, explicit argument (image_float_domain="finite-normal").
  • image_atomic_fmin / fmax: key w ^ (sign ? 0xffffffff : 0x80000000) orders finite normal binary32 as unsigned integers, fmin keeps the value when valueKey < oldKey, fmax when >, through an InterlockedCompareExchange retry loop. The seed observed = 0 is not a finite normal, so the first exchange cannot change a texel in the declared domain and only fetches the old word.
  • Gates: R32_FLOAT requires a UAV with image_float_domain and nothing else may pass it; the float opcodes require an R32_FLOAT image, and the integer opcodes (add, swap, cmpswap, ...) are refused on one (image_float != (op in IMAGE_FLOAT_ATOMIC_OPS)), so an integer add cannot silently be applied to float words.
  • I generated the HLSL for the fixture cases and asserted the exact key and compare text, then emulated the retry loop on a single word for 120,016 pairs (edge values 0x00800000, 0x7f7fffff, 0xff7fffff, +/-1.0 and neighbours, plus 120,000 random finite normals): the result equals binary32 min/max in every case.
  • llvm-mc-19 -mcpu=gfx1030 assembles image_atomic_fcmpswap v[14:15], v[8:9], s[24:31] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm, image_atomic_fmin and image_atomic_fmax (f0 74 ..., f0 78 ..., f0 7c ...). On gfx1013 the same lines are refused by the assembler, matching the PR's gfx1030-only scope.

Verified

Limits: Linux x86-64 only. No Windows/D3D12/DXC: compute_store_aot_mimg_atomic_float_* (draw, wrong-reference and mutated-HLSL checks) were not run for this head.

  • PYTHONPATH=tests:tools python3 -B -c "import compute_store_check as c; c.controls(); c.mimg_atomic_float_controls()" -> OK. python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so -> exit 0 (194 s). python3 -B tests/docs_links_check.py -> 16 files, 350 links OK. git diff --check HEAD^ HEAD clean.
  • Mutation 1: fcmpswap no longer treated as a compare-swap: Linux controls fail (Unverified image atomic data range or mask).
  • Mutation 2: float/integer opcode gate removed: Linux controls fail (Expected rejection: Unsupported image atomic target or binding).
  • Mutation 3: fmin comparison direction flipped.
  • Mutation 4: negative-value key constant 0xffffffff -> 0x7fffffff.
  • Mutation 5: oldKey computed with ^ 0x80000000u only.
  • Coverage note: mutations 3 to 5 are not detected by the Linux-run controls (they exit 0). The comparison direction and key constants are guarded by the Windows draw (mimg_float_mutation and the reference words), which I could not run; I detected mutations 3 and 4 with my own text-and-emulation harness above. This is how the neighbouring integer min/max forms are guarded as well.
  • All mutations reverted with git checkout -- .; git status --short clean.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044282293 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1587#pullrequestreview-6044282293). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:35:03Z. **Review:** COMMENTED --- Audit at `head_sha`: `7ff2fbc178b15030f1af6607b644d83315a6021d` (previously reviewed at `a5633ab6`). **Verdict: 0 P1, 0 P2.** ### Scope - Files: `CMakeLists.txt` (one new `add_test`, test only), `README.md` (one table row), `docs/experiments.md`, `tests/compute_store_check.py`, `tools/compute_store_aot.py`. No `src/`, no `gfx2hlsl`, no `.github/`. - The new head merges current `main` into the branch. Against the previous head the only change in the PR's own patch is the `rsrc2=None` parameter in the `lower()` signature, which `main` added in the meantime; the new parameter `image_float_domain` sits next to it. `git merge-tree` against `main` (`68969ed8`): no conflicts. ### RDNA 2 semantics - `image_atomic_fcmpswap`: data VGPR holds the new value, the next one the compare value, `dmask:0x3`. The lowering is `InterlockedCompareStore(dest, compare, value)`, which stores `value` when memory equals `compare`. For finite normal binary32, numeric equality and bit equality are the same, so the integer compare is exact. Zero and NaN are outside the declared domain, and the domain is a required, explicit argument (`image_float_domain="finite-normal"`). - `image_atomic_fmin` / `fmax`: key `w ^ (sign ? 0xffffffff : 0x80000000)` orders finite normal binary32 as unsigned integers, `fmin` keeps the value when `valueKey < oldKey`, `fmax` when `>`, through an `InterlockedCompareExchange` retry loop. The seed `observed = 0` is not a finite normal, so the first exchange cannot change a texel in the declared domain and only fetches the old word. - Gates: `R32_FLOAT` requires a UAV with `image_float_domain` and nothing else may pass it; the float opcodes require an `R32_FLOAT` image, and the integer opcodes (`add`, `swap`, `cmpswap`, ...) are refused on one (`image_float != (op in IMAGE_FLOAT_ATOMIC_OPS)`), so an integer add cannot silently be applied to float words. - I generated the HLSL for the fixture cases and asserted the exact key and compare text, then emulated the retry loop on a single word for 120,016 pairs (edge values `0x00800000`, `0x7f7fffff`, `0xff7fffff`, `+/-1.0` and neighbours, plus 120,000 random finite normals): the result equals binary32 min/max in every case. - `llvm-mc-19 -mcpu=gfx1030` assembles `image_atomic_fcmpswap v[14:15], v[8:9], s[24:31] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm`, `image_atomic_fmin` and `image_atomic_fmax` (`f0 74 ...`, `f0 78 ...`, `f0 7c ...`). On `gfx1013` the same lines are refused by the assembler, matching the PR's gfx1030-only scope. ### Verified Limits: Linux x86-64 only. No Windows/D3D12/DXC: `compute_store_aot_mimg_atomic_float_*` (draw, wrong-reference and mutated-HLSL checks) were not run for this head. - `PYTHONPATH=tests:tools python3 -B -c "import compute_store_check as c; c.controls(); c.mimg_atomic_float_controls()"` -> OK. `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so` -> exit 0 (194 s). `python3 -B tests/docs_links_check.py` -> 16 files, 350 links OK. `git diff --check HEAD^ HEAD` clean. - **Mutation 1:** `fcmpswap` no longer treated as a compare-swap: Linux controls fail (`Unverified image atomic data range or mask`). - **Mutation 2:** float/integer opcode gate removed: Linux controls fail (`Expected rejection: Unsupported image atomic target or binding`). - **Mutation 3:** `fmin` comparison direction flipped. - **Mutation 4:** negative-value key constant `0xffffffff` -> `0x7fffffff`. - **Mutation 5:** `oldKey` computed with `^ 0x80000000u` only. - Coverage note: mutations 3 to 5 are **not** detected by the Linux-run controls (they exit 0). The comparison direction and key constants are guarded by the Windows draw (`mimg_float_mutation` and the reference words), which I could not run; I detected mutations 3 and 4 with my own text-and-emulation harness above. This is how the neighbouring integer min/max forms are guarded as well. - All mutations reverted with `git checkout -- .`; `git status --short` clean. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 18:02:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:49:11Z.

Review: COMMENTED


Independent verification at head_sha: 7ff2fbc178b15030f1af6607b644d83315a6021d.

Verdict: 0 P1, 0 P2.

Scope & Semantics

  • Scope: CMakeLists.txt (test-only add_test), README.md, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py. Clean-room verified; no src/, gfx2hlsl, or .github/ changes.
  • RDNA2 semantics (image_atomic_fcmpswap, image_atomic_fmin, image_atomic_fmax on gfx1030 2D R32_FLOAT at mip 0 with image_float_domain="finite-normal"):
    • fcmpswap maps RDNA VDATA (replacement) / VDATA+1 (compare) to HLSL InterlockedCompareStore(dest, compare, replacement), valid because numeric equality equals bit equality on finite-normal binary32.
    • fmin / fmax use the order-preserving unsigned key transform x ^ ((x & 0x80000000u) ? 0xffffffffu : 0x80000000u) inside an InterlockedCompareExchange retry loop seeded with 0u (outside finite-normal domain, fetching the old word without a typed UAV load).
    • Domain/format/op gating rejects float ops on integer formats, integer ops on R32_FLOAT, missing --image-float-domain finite-normal, and non-zero mip.

Commands Executed

  • Linux:
    • git diff --check origin/main...HEAD — PASS
    • python3 tests/docs_links_check.py — PASS (16 Markdown files, 350 links)
    • python3 tests/bidi_controls_check.py — PASS (1277 files)
    • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/x86_64-linux-gnu/libLLVM-19.so — PASS
  • Win2025 (OS build 26100, MSVC 14.44.35207, D3D12 WARP):
    • cmake --build --preset dev + ctest --preset dev (57/57 passed, including compute_store_aot_mimg_atomic_float_warp) — PASS
    • cmake --build --preset release (/O2) + ctest --preset release (57/57 passed, including compute_store_aot_mimg_atomic_float_warp) — PASS
  • Local mutation checks on tools/compute_store_aot.py (reverted via git checkout -- .):
    1. Dropped image_float != (op in IMAGE_FLOAT_ATOMIC_OPS) gating -> caught by mimg_atomic_float_controls() (AssertionError: Expected rejection: Unsupported image atomic target or binding).
    2. Flipped fmin/fmax comparison predicate (< <-> >) -> caught by mimg_float_mutation check (expected valueKey < oldKey in lowered HLSL).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044480288 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1587#pullrequestreview-6044480288). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:49:11Z. **Review:** COMMENTED --- Independent verification at `head_sha`: `7ff2fbc178b15030f1af6607b644d83315a6021d`. **Verdict: 0 P1, 0 P2.** ### Scope & Semantics - Scope: `CMakeLists.txt` (test-only `add_test`), `README.md`, `docs/experiments.md`, `tests/compute_store_check.py`, `tools/compute_store_aot.py`. Clean-room verified; no `src/`, `gfx2hlsl`, or `.github/` changes. - RDNA2 semantics (`image_atomic_fcmpswap`, `image_atomic_fmin`, `image_atomic_fmax` on `gfx1030` 2D `R32_FLOAT` at mip 0 with `image_float_domain="finite-normal"`): - `fcmpswap` maps RDNA `VDATA` (replacement) / `VDATA+1` (compare) to HLSL `InterlockedCompareStore(dest, compare, replacement)`, valid because numeric equality equals bit equality on finite-normal binary32. - `fmin` / `fmax` use the order-preserving unsigned key transform `x ^ ((x & 0x80000000u) ? 0xffffffffu : 0x80000000u)` inside an `InterlockedCompareExchange` retry loop seeded with `0u` (outside finite-normal domain, fetching the old word without a typed UAV load). - Domain/format/op gating rejects float ops on integer formats, integer ops on `R32_FLOAT`, missing `--image-float-domain finite-normal`, and non-zero mip. ### Commands Executed - Linux: - `git diff --check origin/main...HEAD` — PASS - `python3 tests/docs_links_check.py` — PASS (16 Markdown files, 350 links) - `python3 tests/bidi_controls_check.py` — PASS (1277 files) - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/x86_64-linux-gnu/libLLVM-19.so` — PASS - Win2025 (OS build 26100, MSVC 14.44.35207, D3D12 WARP): - `cmake --build --preset dev` + `ctest --preset dev` (57/57 passed, including `compute_store_aot_mimg_atomic_float_warp`) — PASS - `cmake --build --preset release` (`/O2`) + `ctest --preset release` (57/57 passed, including `compute_store_aot_mimg_atomic_float_warp`) — PASS - Local mutation checks on `tools/compute_store_aot.py` (reverted via `git checkout -- .`): 1. Dropped `image_float != (op in IMAGE_FLOAT_ATOMIC_OPS)` gating -> caught by `mimg_atomic_float_controls()` (`AssertionError: Expected rejection: Unsupported image atomic target or binding`). 2. Flipped `fmin`/`fmax` comparison predicate (`<` <-> `>`) -> caught by `mimg_float_mutation` check (`expected valueKey < oldKey in lowered HLSL`). 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!1580
No description provided.