shader: lower private LDS qword min, max and xor updates #1002

Manually merged
github merged 2 commits from gh-pr/1002/head into gh-pr/1002/base 2026-11-26 22:34:17 +00:00
Owner

@⁠lambirou on GitHub · 2026-11-23 20:38 UTC · original
lambirou:shader/lds-qword-minmax-xor → main · +103 −17 · 4 files · 2 commits · merged 2026-11-23 21:25 UTC

Change

Adds five non-return private gfx1030 LDS qword updates to the compute-store profile: ds_xor_b64, ds_min_i64, ds_max_i64, ds_min_u64 and ds_max_u64. This completes the integer/bitwise qword family started in #941.

ds_xor_b64 updates both words independently. The min/max forms compare the high words first, signed through asint for the i64 forms and unsigned for the u64 forms, then compare the low words when the highs are equal.

Files:

  • tools/compute_store_aot.py
  • tests/compute_store_check.py
  • docs/experiments.md
  • README.md

Refs #941.

Verification

Commit d293808 on shader/lds-qword-minmax-xor, rebased on upstream main at 986e7f6.

  • ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V: 2/2 passed. Both backends compared all 320 UAV words for groups 1 and 3 with 0 mismatches, and all 14 mutants were detected.
  • ctest --preset release --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V: 2/2 passed with the same results.
  • WARP is Microsoft Basic Render Driver, driver 10.0.26100.10068. Hardware is AMD Radeon RX 9060 XT, driver 32.0.32029.2010. The D3D12 debug layer was unavailable.
  • controls() passes; python -B -m py_compile tools/compute_store_aot.py tests/compute_store_check.py passes; tests/docs_links_check.py passes (13 Markdown files, 211 links).
  • Not run locally: tests/compute_store_check.py binary, because the local llvm-mc.exe returns "Permission denied". The gfx1013 CI job ran it with LLVM 15 and passed.

Evidence and follow-up

The qword cases are source-built synthetic fixtures. Each new form has one readback case and at least one mutation. The min/max fixtures now use high 0x7fffffff + (thread_id & 1) for the prior value and 0x80000000 for the source, keeping the existing low words. Even lanes cross the signed high-word boundary; odd lanes repeat the high word, so every odd lane exercises the unsigned low-word tie-break. Swapping signedness first mismatches word 0; dropping the low-word comparison first mismatches word 34 for min and word 2 for max.

The README compute row and the docs/experiments.md#private-gfx1030-lds-word-access section are updated.

Relationship to #943

The five storage forms overlap with draft #943. I compared both control sets. The carry, borrow and bitwise controls were already here; #943's distinct controls are the signed/unsigned swap and a low-word tie-break mutation. Both are now carried over, using the alternating high-word setup above. The comparison controls originated in #943 by stan495, and the commit records that credit. The five returning forms remain in #943; once this lands, #943 can drop the duplicated non-return forms and keep the returning forms.

AI-assisted (Codex).

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.
**@⁠lambirou** on GitHub · 2026-11-23 20:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1002) `lambirou:shader/lds-qword-minmax-xor` → `main` · +103 −17 · 4 files · 2 commits · merged 2026-11-23 21:25 UTC ## Change Adds five non-return private gfx1030 LDS qword updates to the compute-store profile: `ds_xor_b64`, `ds_min_i64`, `ds_max_i64`, `ds_min_u64` and `ds_max_u64`. This completes the integer/bitwise qword family started in #941. `ds_xor_b64` updates both words independently. The min/max forms compare the high words first, signed through `asint` for the i64 forms and unsigned for the u64 forms, then compare the low words when the highs are equal. Files: - `tools/compute_store_aot.py` - `tests/compute_store_check.py` - `docs/experiments.md` - `README.md` Refs #941. ## Verification Commit `d293808` on `shader/lds-qword-minmax-xor`, rebased on upstream `main` at `986e7f6`. - `ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V`: 2/2 passed. Both backends compared all 320 UAV words for groups 1 and 3 with 0 mismatches, and all 14 mutants were detected. - `ctest --preset release --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V`: 2/2 passed with the same results. - WARP is Microsoft Basic Render Driver, driver `10.0.26100.10068`. Hardware is AMD Radeon RX 9060 XT, driver `32.0.32029.2010`. The D3D12 debug layer was unavailable. - `controls()` passes; `python -B -m py_compile tools/compute_store_aot.py tests/compute_store_check.py` passes; `tests/docs_links_check.py` passes (13 Markdown files, 211 links). - Not run locally: `tests/compute_store_check.py binary`, because the local `llvm-mc.exe` returns "Permission denied". The gfx1013 CI job ran it with LLVM 15 and passed. ## Evidence and follow-up The qword cases are source-built synthetic fixtures. Each new form has one readback case and at least one mutation. The min/max fixtures now use high `0x7fffffff + (thread_id & 1)` for the prior value and `0x80000000` for the source, keeping the existing low words. Even lanes cross the signed high-word boundary; odd lanes repeat the high word, so every odd lane exercises the unsigned low-word tie-break. Swapping signedness first mismatches word 0; dropping the low-word comparison first mismatches word 34 for min and word 2 for max. The README compute row and the `docs/experiments.md#private-gfx1030-lds-word-access` section are updated. ## Relationship to #943 The five storage forms overlap with draft #943. I compared both control sets. The carry, borrow and bitwise controls were already here; #943's distinct controls are the signed/unsigned swap and a low-word tie-break mutation. Both are now carried over, using the alternating high-word setup above. The comparison controls originated in #943 by stan495, and the commit records that credit. The five returning forms remain in #943; once this lands, #943 can drop the duplicated non-return forms and keep the returning forms. AI-assisted (Codex). ## 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.
Add ds_xor_b64, ds_min_i64, ds_max_i64, ds_min_u64 and ds_max_u64 to the private gfx1030 LDS qword profile. The comparison forms compare high words first, signed for i64 and unsigned for u64, then compare low words when the highs are equal.

Extend the qword fixture references and negative controls so xor is checked against and, min against max, and the unsigned cases exercise the low-word tie-break. Document the new forms in the compute-shader section.
Use 0x7fffffff + (thread_id & 1) for the prior high word and 0x80000000 for the source, keeping the existing low words. Even lanes cross the signed boundary and odd lanes exercise the unsigned low-word tie-break.

Add a signedness swap control and a low-word tie-break control. The latter first mismatches word 34 for min and word 2 for max. These carry forward the distinct controls from #943 by stan495; the returning forms remain in #943.

Verified with ctest --preset dev and release, compute_store_aot_lds_qword_warp and _hardware, 0 mismatches and all mutants detected.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:34:15 +00:00
github manually merged commit d29380825f into gh-pr/1002/base 2026-11-26 22:34:17 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 20:43 UTC · original

These five non-return forms overlap with the draft #943, which is stacked behind #942. Please compare the two independent control sets here before either is merged. This PR can be reviewed without waiting for the returning forms. Keep one implementation, carry forward distinct tests and author credit, and have #943 reconcile its scope once the non-return candidate lands.

**@⁠R0Y00** on GitHub · 2026-11-23 20:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7113473770) These five non-return forms overlap with the draft #943, which is stacked behind #942. Please compare the two independent control sets here before either is merged. This PR can be reviewed without waiting for the returning forms. Keep one implementation, carry forward distinct tests and author credit, and have #943 reconcile its scope once the non-return candidate lands.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 20:56 UTC · original

The current fixture tests unequal high words only for signed comparisons and equal high words only for unsigned comparisons. I verified a single deterministic setup for all four: use high 0x7fffffff + (thread_id & 1) for the prior value and 0x80000000 for the source. Keep the existing low words. This makes even threads distinguish signedness and odd threads exercise unsigned low-word tie-breaking. Flipping signedness first mismatches word 0. Disabling the tie-break first mismatches word 34 for min and word 2 for max. The augmented LLVM 15 round-trip and both Release draws passed locally. Maintainer edits are disabled on the branch. Please carry over these two controls, or enable edits so I can push the tested patch.

**@⁠R0Y00** on GitHub · 2026-11-23 20:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7113785225) The current fixture tests unequal high words only for signed comparisons and equal high words only for unsigned comparisons. I verified a single deterministic setup for all four: use high `0x7fffffff + (thread_id & 1)` for the prior value and `0x80000000` for the source. Keep the existing low words. This makes even threads distinguish signedness and odd threads exercise unsigned low-word tie-breaking. Flipping signedness first mismatches word 0. Disabling the tie-break first mismatches word 34 for min and word 2 for max. The augmented LLVM 15 round-trip and both Release draws passed locally. Maintainer edits are disabled on the branch. Please carry over these two controls, or enable edits so I can push the tested patch.
Author
Owner

@⁠lambirou on GitHub · 2026-11-23 21:09 UTC · original

Addressed both points in d293808.

I compared the #943 control set with this branch. The carry, borrow and bitwise controls were already present here; #943's distinct controls are the signed/unsigned swap and the low-word tie-break mutation. Both are now carried over, with credit to stan495 in the commit message. The returning forms stay in #943.

The min/max fixture now uses high 0x7fffffff + (thread_id & 1) for the prior value and 0x80000000 for the source, keeping the existing low words. This reproduces the proposed controls exactly: swapping signedness first mismatches word 0; dropping the low-word comparison first mismatches word 34 for min and word 2 for max.

Verification:

  • ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V: 2/2 passed, 0 mismatches, all 14 mutants detected.
  • ctest --preset release --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V: 2/2 passed with the same results.
  • WARP: Microsoft Basic Render Driver, 10.0.26100.10068. Hardware: AMD Radeon RX 9060 XT, 32.0.32029.2010. Debug layer unavailable.
  • binary remains for CI because the local llvm-mc.exe returns "Permission denied".

The PR body now records the #943 comparison and the updated evidence.

**@⁠lambirou** on GitHub · 2026-11-23 21:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7114091521) Addressed both points in `d293808`. I compared the #943 control set with this branch. The carry, borrow and bitwise controls were already present here; #943's distinct controls are the signed/unsigned swap and the low-word tie-break mutation. Both are now carried over, with credit to stan495 in the commit message. The returning forms stay in #943. The min/max fixture now uses high `0x7fffffff + (thread_id & 1)` for the prior value and `0x80000000` for the source, keeping the existing low words. This reproduces the proposed controls exactly: swapping signedness first mismatches word 0; dropping the low-word comparison first mismatches word 34 for min and word 2 for max. Verification: - `ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V`: 2/2 passed, 0 mismatches, all 14 mutants detected. - `ctest --preset release --no-tests=error -R '^compute_store_aot_lds_qword_(warp|hardware)$' -V`: 2/2 passed with the same results. - WARP: Microsoft Basic Render Driver, `10.0.26100.10068`. Hardware: AMD Radeon RX 9060 XT, `32.0.32029.2010`. Debug layer unavailable. - `binary` remains for CI because the local `llvm-mc.exe` returns "Permission denied". The PR body now records the #943 comparison and the updated evidence.
This discussion has been locked. Commenting is limited to contributors.
No description provided.