shader: lower remaining gfx1030 finite-normal buffer float atomics #2748

Merged
stan495 merged 1 commit from upstream-pr/2756 into main 2026-11-26 06:13:05 +00:00
stan495 commented 2026-11-26 06:02:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T06:02:43Z.


Summary

Refs #1545. Replay only the four gfx1030 MUBUF float atomic forms not already lowered by #2511: buffer_atomic_fcmpswap, buffer_atomic_fcmpswap_x2, buffer_atomic_fmin_x2, and buffer_atomic_fmax_x2. The existing FP32 fmin and fmax lowering and test cases remain in place.

Keep the fixed-address, non-returning raw u0 profile and reuse --buffer-float-domain finite-normal. The caller guarantees finite-normal memory; the four new forms additionally require finite-normal constant operands. Compare-swap reverses the native replacement/compare tuple for HLSL's compare-first CAS. The x2 reductions extend the image/buffer integer ordering helper to a single 64-bit CAS retry loop. glc, dynamic addressing, non-normal values and mixed UAV operations remain unsupported. The FP32 compare-swap uses cs_6_0; the x2 cases use cs_6_6 and the existing raw atomic64 capability gate, so each width is reported separately.

Verification

Tested commit: 79abaa5d5588f59fd3a8120be71a5b3823ac621f, on upstream 594bb3ce639be18bd8b28cf950f362506d275b66. git merge-tree --write-tree origin/main HEAD completed without conflicts against that base and the later upstream 5f27d8cf658cf11ea720fca8149e4f6cce6b7517.

  • LLVM 15: the full binary regression passed (375 successful container CLI translations, including MIMG float atomics). In the focused check, all four forms assembled, disassembled and translated through the compute-container CLI, matching text lowering. Four separately assembled negatives also disassembled, then failed in the CLI with exit 1 and no HLSL output: missing domain, glc, a binary64 infinity in the compare operand, and an x2 address of byte offset 4. The first rejection was Float buffer compare-swap and _x2 require a finite-normal domain and no glc.
  • The readback fixture checks 320 DWORDs for one and two 32-lane workgroups. It checks both compare match and a miss that differs only in the low bit. All four mutations produced the predicted first readback difference on both adapters (see below). All lanes use identical literals; this does not validate arbitrary per-lane reductions or native AMD execution.
  • Windows Debug offscreen_check rebuilt successfully with MSVC 19.44 and DXC 1.9.2602.17. All three compile modes passed, including all five existing MIMG float cases (four min/max cases with and without distinct contenders, plus compare-swap). ctest -N selected eight WARP/hardware entries; no GPU work ran during preparation.
  • Windows 11 26H2 build 26300.9974, Debug preset, D3D12 debug layer unavailable. Serial CTest: 8 passed, 0 failed, 0 skipped in 60.68 s. The new FP32 compare-swap, new FP64 x2, existing FP32 buffer min/max, and existing image float atomics each passed on both WARP (Microsoft Basic Render Driver 10.0.26100.9818) and hardware (Intel Arc B390 32.0.101.8509). All unmutated readbacks had zero mismatches. The same-run CTest JUnit and form_coverage.py confirmed all four new gfx1030 MUBUF forms in passing records on both adapters. The eight-test subset covers nine distinct gfx1030 forms (six MUBUF and three MIMG), not a project-wide coverage estimate.

First difference for each new mutation on both adapters (all at zero-based DWORD index 2):

Form Mutant Expected Actual
buffer_atomic_fcmpswap swap compare and replacement 3f865432 bf812345
buffer_atomic_fcmpswap_x2 swap compare and replacement 12345678 76543210
buffer_atomic_fmin_x2 use max 87654321 12345678
buffer_atomic_fmax_x2 use min 87654321 76543210

The shared MIMG helper regression also reproduced the missing-retry negative for its contended min/max fixtures (first difference at mip 0 DWORD 32). For min, both adapters reported bf800012 expected and 7f7fffff actual.

python3 -B tests/compute_store_check.py binary-mubuf-float-extra llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
. .\tools\dev.ps1
$python = (Resolve-Path ..\..\out\pe-env\Scripts\python.exe).Path # isolated worktree under the main checkout's out/
$dxc = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/dxc.exe'
cmake --preset dev "-DINTAKE_PYTHON=$python" "-DDXC_EXECUTABLE=$dxc"
cmake --build --preset dev --target offscreen_check --parallel 2
& $python -B tests/compute_store_check.py compile-mubuf-float-cmpswap $dxc
& $python -B tests/compute_store_check.py compile-mubuf-float-x2 $dxc
& $python -B tests/compute_store_check.py compile-mimg-atomic-float $dxc
$filter = '^compute_store_aot_(mubuf_float(-(cmpswap|x2))?|mimg_atomic_float)_(warp|hardware)$'
ctest --preset dev --no-tests=error -N -R $filter
ctest --preset dev --no-tests=error -j 1 -R $filter -V --output-junit "$PWD/out/mubuf-float-extra.xml"
& $python -B tools/form_coverage.py out/mubuf-float-extra.xml --records out/build/dev/form_coverage --json out/mubuf-float-extra-coverage.json

Before opening this PR, git merge-tree --write-tree completed cleanly against upstream 6f696d48a020fa47440c50ce68914509a0bc2f19 and with the planned comparison-gradient and gather batches in order. This is separate from the execution results.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6620597191 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2756). Originally posted by [stan495](https://github.com/stan495) on 2026-11-26T06:02:43Z. --- ## Summary Refs #1545. Replay only the four gfx1030 MUBUF float atomic forms not already lowered by #2511: `buffer_atomic_fcmpswap`, `buffer_atomic_fcmpswap_x2`, `buffer_atomic_fmin_x2`, and `buffer_atomic_fmax_x2`. The existing FP32 `fmin` and `fmax` lowering and test cases remain in place. Keep the fixed-address, non-returning raw `u0` profile and reuse `--buffer-float-domain finite-normal`. The caller guarantees finite-normal memory; the four new forms additionally require finite-normal constant operands. Compare-swap reverses the native replacement/compare tuple for HLSL's compare-first CAS. The x2 reductions extend the image/buffer integer ordering helper to a single 64-bit CAS retry loop. `glc`, dynamic addressing, non-normal values and mixed UAV operations remain unsupported. The FP32 compare-swap uses `cs_6_0`; the x2 cases use `cs_6_6` and the existing raw atomic64 capability gate, so each width is reported separately. ## Verification Tested commit: `79abaa5d5588f59fd3a8120be71a5b3823ac621f`, on upstream `594bb3ce639be18bd8b28cf950f362506d275b66`. `git merge-tree --write-tree origin/main HEAD` completed without conflicts against that base and the later upstream `5f27d8cf658cf11ea720fca8149e4f6cce6b7517`. - LLVM 15: the full binary regression passed (375 successful container CLI translations, including MIMG float atomics). In the focused check, all four forms assembled, disassembled and translated through the compute-container CLI, matching text lowering. Four separately assembled negatives also disassembled, then failed in the CLI with exit 1 and no HLSL output: missing domain, `glc`, a binary64 infinity in the compare operand, and an x2 address of byte offset 4. The first rejection was `Float buffer compare-swap and _x2 require a finite-normal domain and no glc`. - The readback fixture checks 320 DWORDs for one and two 32-lane workgroups. It checks both compare match and a miss that differs only in the low bit. All four mutations produced the predicted first readback difference on both adapters (see below). All lanes use identical literals; this does not validate arbitrary per-lane reductions or native AMD execution. - Windows Debug `offscreen_check` rebuilt successfully with MSVC 19.44 and DXC 1.9.2602.17. All three compile modes passed, including all five existing MIMG float cases (four min/max cases with and without distinct contenders, plus compare-swap). `ctest -N` selected eight WARP/hardware entries; no GPU work ran during preparation. - Windows 11 26H2 build `26300.9974`, Debug preset, D3D12 debug layer unavailable. Serial CTest: **8 passed, 0 failed, 0 skipped** in 60.68 s. The new FP32 compare-swap, new FP64 x2, existing FP32 buffer min/max, and existing image float atomics each passed on both WARP (Microsoft Basic Render Driver `10.0.26100.9818`) and hardware (Intel Arc B390 `32.0.101.8509`). All unmutated readbacks had zero mismatches. The same-run CTest JUnit and `form_coverage.py` confirmed all four new gfx1030 MUBUF forms in passing records on both adapters. The eight-test subset covers nine distinct gfx1030 forms (six MUBUF and three MIMG), not a project-wide coverage estimate. First difference for each new mutation on both adapters (all at zero-based DWORD index 2): | Form | Mutant | Expected | Actual | |---|---|---|---| | `buffer_atomic_fcmpswap` | swap compare and replacement | `3f865432` | `bf812345` | | `buffer_atomic_fcmpswap_x2` | swap compare and replacement | `12345678` | `76543210` | | `buffer_atomic_fmin_x2` | use max | `87654321` | `12345678` | | `buffer_atomic_fmax_x2` | use min | `87654321` | `76543210` | The shared MIMG helper regression also reproduced the missing-retry negative for its contended min/max fixtures (first difference at mip 0 DWORD 32). For min, both adapters reported `bf800012` expected and `7f7fffff` actual. ```sh python3 -B tests/compute_store_check.py binary-mubuf-float-extra llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` ```powershell . .\tools\dev.ps1 $python = (Resolve-Path ..\..\out\pe-env\Scripts\python.exe).Path # isolated worktree under the main checkout's out/ $dxc = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/dxc.exe' cmake --preset dev "-DINTAKE_PYTHON=$python" "-DDXC_EXECUTABLE=$dxc" cmake --build --preset dev --target offscreen_check --parallel 2 & $python -B tests/compute_store_check.py compile-mubuf-float-cmpswap $dxc & $python -B tests/compute_store_check.py compile-mubuf-float-x2 $dxc & $python -B tests/compute_store_check.py compile-mimg-atomic-float $dxc $filter = '^compute_store_aot_(mubuf_float(-(cmpswap|x2))?|mimg_atomic_float)_(warp|hardware)$' ctest --preset dev --no-tests=error -N -R $filter ctest --preset dev --no-tests=error -j 1 -R $filter -V --output-junit "$PWD/out/mubuf-float-extra.xml" & $python -B tools/form_coverage.py out/mubuf-float-extra.xml --records out/build/dev/form_coverage --json out/mubuf-float-extra-coverage.json ``` Before opening this PR, `git merge-tree --write-tree` completed cleanly against upstream `6f696d48a020fa47440c50ce68914509a0bc2f19` and with the planned comparison-gradient and gather batches in order. This is separate from the execution results.
upstream-sync closed this pull request 2026-11-26 07:00:22 +00:00
R0Y00 commented 2026-11-26 07:00:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T06:12:58Z.

Review: APPROVED


Reviewed finite-normal operand/domain checks, compare/replacement order and ordered-key 64-bit CAS. Re-ran the two new draw suites serially on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, Windows 11 build 26200. All four cases had exact results and the predicted per-form mutation mismatch at word 2 on both adapters, with zero debug warnings/errors and no skips.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069343823 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2756#pullrequestreview-6069343823). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T06:12:58Z. **Review:** APPROVED --- Reviewed finite-normal operand/domain checks, compare/replacement order and ordered-key 64-bit CAS. Re-ran the two new draw suites serially on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, Windows 11 build 26200. All four cases had exact results and the predicted per-form mutation mismatch at word 2 on both adapters, with zero debug warnings/errors and no skips.
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!2748
No description provided.