shader: test qword decrement borrow below limit #1113

Merged
lambirou merged 3 commits from upstream-pr/1120 into main 2026-11-24 03:35:38 +00:00
lambirou commented 2026-11-24 01:20:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T01:20:50Z.


Change

This is now a test-only contribution after #948 merged the qword counter implementation.
It adds one focused case to the existing private LDS qword fixture:

  • lds_dec_borrow writes 0x40000001_00000000 at byte offset 8 of the 16-byte record and
    uses 0x80000000_00000000 as the limit.
  • The old pair is strictly below the limit, nonzero and has a zero low word, so ds_dec_u64
    must borrow into the low dword and produce 0x40000000_ffffffff.
  • A mutant removes the high-word borrow term and must differ at word 1.
  • docs/experiments.md records the case and the expected pair.

No tools/ or implementation file is changed.

Verification

  • ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_warp$' -V
    • 1/1 passed; Microsoft Basic Render Driver, driver 10.0.26100.10068, 320 words per case,
      0 mismatches. The borrow mutant is detected at word 1.
  • python -B tests/compute_store_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM-23>
    • Completed without a traceback or unsupported-instruction diagnostic; LLVM 23.1.5 is the
      local toolchain because LLVM 15 is not installed here.
  • docs_links_check.py: Self-test passed., Checked 15 Markdown files and 256 links..
  • git diff --check origin/main...HEAD: clean.
  • Not run: full CTest, release preset, hardware after the #948 rebase (the case is test-only;
    the earlier hardware run on RX 9060 XT passed the same borrow fixture at 3050425).

Evidence and follow-up

  • Branch shader/ds-inc-dec-u64, head c42b1ef (maintainer merge of main and focused test
    cleanup). The implementation commit from the earlier PR revision was dropped; the branch is
    test-only on top of the merged #944/#948 work.
  • Public AMD RDNA 2 ISA Reference Guide, document 70648, section 12.13, page PDF 206, table 95
    (opcodes 0x63/0x64): decrement is unsigned and clamps at zero or above the limit; a below-limit
    pair with a zero low word requires the borrow.
  • This complements #948's counter fixtures without duplicating the lowerer. If #948's emitted
    expression changes, the mutant replacement - uint( must be updated.
  • No game files, dumps, shader bytes, title paths or secrets are included.

Checklist

  • One focused test behavior: below-limit zero-low-word decrement borrow.
  • Positive GPU case and borrow mutant.
  • Documentation updated.
  • No game files, dumps, logs or secrets.
  • Provenance checked; no XCL code used.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572428476 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T01:20:50Z. --- ## Change This is now a **test-only** contribution after #948 merged the qword counter implementation. It adds one focused case to the existing private LDS qword fixture: - `lds_dec_borrow` writes `0x40000001_00000000` at byte offset 8 of the 16-byte record and uses `0x80000000_00000000` as the limit. - The old pair is strictly below the limit, nonzero and has a zero low word, so `ds_dec_u64` must borrow into the low dword and produce `0x40000000_ffffffff`. - A mutant removes the high-word borrow term and must differ at word 1. - `docs/experiments.md` records the case and the expected pair. No `tools/` or implementation file is changed. ## Verification - `ctest --preset dev --no-tests=error -R '^compute_store_aot_lds_qword_warp$' -V` - 1/1 passed; Microsoft Basic Render Driver, driver 10.0.26100.10068, 320 words per case, 0 mismatches. The borrow mutant is detected at word 1. - `python -B tests/compute_store_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM-23>` - Completed without a traceback or unsupported-instruction diagnostic; LLVM 23.1.5 is the local toolchain because LLVM 15 is not installed here. - `docs_links_check.py`: `Self-test passed.`, `Checked 15 Markdown files and 256 links.`. - `git diff --check origin/main...HEAD`: clean. - Not run: full CTest, release preset, hardware after the #948 rebase (the case is test-only; the earlier hardware run on RX 9060 XT passed the same borrow fixture at `3050425`). ## Evidence and follow-up - Branch `shader/ds-inc-dec-u64`, head `c42b1ef` (maintainer merge of main and focused test cleanup). The implementation commit from the earlier PR revision was dropped; the branch is test-only on top of the merged #944/#948 work. - Public AMD RDNA 2 ISA Reference Guide, document 70648, section 12.13, page PDF 206, table 95 (opcodes 0x63/0x64): decrement is unsigned and clamps at zero or above the limit; a below-limit pair with a zero low word requires the borrow. - This complements #948's counter fixtures without duplicating the lowerer. If #948's emitted expression changes, the mutant replacement ` - uint(` must be updated. - No game files, dumps, shader bytes, title paths or secrets are included. ## Checklist - [x] One focused test behavior: below-limit zero-low-word decrement borrow. - [x] Positive GPU case and borrow mutant. - [x] Documentation updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance checked; no XCL code used. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:46:25 +00:00
tedin7 commented 2026-11-24 06:46:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:58:54Z.

Review: COMMENTED


Reviewed commit 30504257d4d7586fdcbc9abcc0a879ed9187b6af on Linux x86_64 (Python 3.14.8, LLVM 19; Windows MSVC/WARP/LLVM-15 execution relies on CI).

Checks run:

  • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so -> exit 0
  • python3 -B tests/gpu_report_format_check.py -> 10/10 OK

Diff notes:

  • tools/compute_store_aot.py: unsigned_qword_compare and qword_is_zero match RDNA 2 ISA 70648 §12.13 for ds_inc_u64 / ds_dec_u64 and their _rtn forms, with carry/borrow handled on the high word.
  • tests/compute_store_check.py: the added lds_dec_borrow case (0x40000001_00000000 under 0x80000000_00000000), qword_counter_mutants, and updated lds_controls negative check are consistent and clean; docs/experiments.md is updated and title-neutral.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032495099 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#pullrequestreview-6032495099). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:58:54Z. **Review:** COMMENTED --- Reviewed commit `30504257d4d7586fdcbc9abcc0a879ed9187b6af` on Linux x86_64 (Python 3.14.8, LLVM 19; Windows MSVC/WARP/LLVM-15 execution relies on CI). Checks run: - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so` -> exit 0 - `python3 -B tests/gpu_report_format_check.py` -> 10/10 OK Diff notes: - `tools/compute_store_aot.py`: `unsigned_qword_compare` and `qword_is_zero` match RDNA 2 ISA 70648 §12.13 for `ds_inc_u64` / `ds_dec_u64` and their `_rtn` forms, with carry/borrow handled on the high word. - `tests/compute_store_check.py`: the added `lds_dec_borrow` case (`0x40000001_00000000` under `0x80000000_00000000`), `qword_counter_mutants`, and updated `lds_controls` negative check are consistent and clean; `docs/experiments.md` is updated and title-neutral.
R0Y00 commented 2026-11-24 06:50:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T01:35:15Z.


All four increment/decrement forms in this PR overlap the older #948, which also adds the conditional exchange. I’m keeping #948 at the front of the queue and preserving both authors’ evidence. The independent RX 9060 XT results and the strictly-below-limit, zero-low-word decrement case you identified are useful here. Please keep this PR open while #948’s refreshed CI runs. Its remaining delta can become a focused test contribution if it adds coverage.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119248580 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#issuecomment-7119248580). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T01:35:15Z. --- All four increment/decrement forms in this PR overlap the older #948, which also adds the conditional exchange. I’m keeping #948 at the front of the queue and preserving both authors’ evidence. The independent RX 9060 XT results and the strictly-below-limit, zero-low-word decrement case you identified are useful here. Please keep this PR open while #948’s refreshed CI runs. Its remaining delta can become a focused test contribution if it adds coverage.
lambirou commented 2026-11-24 06:50:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T01:45:28Z.


Added the focused test-only follow-up 3050425: a strictly-below-limit, zero-low-word decrement (0x40000001_00000000 against limit 0x80000000_00000000) must borrow to 0x40000000_ffffffff; the borrow mutant is detected at word 1. WARP and RX 9060 XT both pass the qword test, binary exit 0. Keeping #1120 open while #948 CI runs, per review; if #948 lands this remains the test delta.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119417119 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#issuecomment-7119417119). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T01:45:28Z. --- Added the focused test-only follow-up 3050425: a strictly-below-limit, zero-low-word decrement (0x40000001_00000000 against limit 0x80000000_00000000) must borrow to 0x40000000_ffffffff; the borrow mutant is detected at word 1. WARP and RX 9060 XT both pass the qword test, binary exit 0. Keeping #1120 open while #948 CI runs, per review; if #948 lands this remains the test delta.
R0Y00 commented 2026-11-24 06:50:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T02:06:35Z.


#948 has merged at 619ef878. Your below-limit decrement/borrow control is distinct and is worth keeping. Please bring #1120 onto that commit and keep the test-only delta and its AMD/WARP evidence. The existing implementation and conditional exchange can remain from #948. #954 also touches the shared test file, so I will verify the combined diff before merging.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119762789 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#issuecomment-7119762789). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T02:06:35Z. --- #948 has merged at 619ef878. Your below-limit decrement/borrow control is distinct and is worth keeping. Please bring #1120 onto that commit and keep the test-only delta and its AMD/WARP evidence. The existing implementation and conditional exchange can remain from #948. #954 also touches the shared test file, so I will verify the combined diff before merging.
lambirou commented 2026-11-24 06:50:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T02:33:37Z.


Rebased onto main f05369ec after #948 merged and dropped the implementation commit. #1120 is now test-only: the lds_dec_borrow case (strictly below limit, zero low word, result 0x40000000_ffffffff) plus its borrow mutant and docs. WARP qword passes with #948 at 320 words and the mutant at word 1; no tools/ change remains.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7120264336 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#issuecomment-7120264336). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T02:33:37Z. --- Rebased onto main f05369ec after #948 merged and dropped the implementation commit. #1120 is now test-only: the lds_dec_borrow case (strictly below limit, zero low word, result 0x40000000_ffffffff) plus its borrow mutant and docs. WARP qword passes with #948 at 320 words and the mutant at word 1; no tools/ change remains.
lambirou commented 2026-11-24 06:50:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T03:19:58Z.


Adopted c42b1ef. The branch is reset to the maintainer merge; the focused cleanup removed the stale expected-returns/base assertions and leaves only the lds_dec_borrow case and mutant on top of #948. No force push needed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7120989301 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1120#issuecomment-7120989301). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T03:19:58Z. --- Adopted c42b1ef. The branch is reset to the maintainer merge; the focused cleanup removed the stale expected-returns/base assertions and leaves only the lds_dec_borrow case and mutant on top of #948. No force push needed.
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!1113
No description provided.