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

Merged
lambirou merged 2 commits from upstream-pr/1002 into main 2026-11-23 21:25:54 +00:00
lambirou commented 2026-11-23 20:38:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T20:38:41Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6568363585 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1002). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T20:38:41Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:45:47 +00:00
R0Y00 commented 2026-11-24 06:49:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:43:43Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7113473770 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7113473770). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T20:43:43Z. --- 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 commented 2026-11-24 06:49:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:56:54Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7113785225 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7113785225). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T20:56:54Z. --- 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.
lambirou commented 2026-11-24 06:49:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T21:09:52Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114091521 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1002#issuecomment-7114091521). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T21:09:52Z. --- 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.
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!995
No description provided.