shader: avoid negated TGSM atomic add in the HLSL LDS subtract lowering #3933

Open
github-bot wants to merge 1 commit from github-bot/gh-3931 into main AGit
Owner

@⁠timbot103 on GitHub · 2026-12-03 12:43 UTC · original
timbot103:shader/compute-ir-lds-subtract → main · +77 −11 · 7 files · 1 commits · open

Refs #1541, #2954 and #3921.

Change

Use one successful compare-exchange for each HLSL LDS subtract. The returning form writes the observed old word after the retry, including when the destination aliases the operand. The shader cache revision changes so existing native HLSL pragmas recompile with the new lowering.

expand_gfx1013_compute serves the register-based compute-request path and the shader compiler's #pragma x2w_lds path. The portable gfx1013_compute_ir_check covers both form expansions. The GPU fixture compares the aliasing return, the resulting private LDS word, and 32 contending non-returning subtracts on a shared word.

With the strengthened fixture and the old expansion, RTX 5080 PSO creation failed with 0x8007000e on a44d1967. WARP passed. The old hardware cache still produced the failure with the fixed expander under the old key. With the new key, the same hardware cache directory produced a second entry and the readback passed.

Verification

Windows 11 26200.9974, RTX 5080 driver 32.0.16.2140 (621.40), Microsoft Basic Render Driver with app-local WARP 1.0.22.0 and DXC 1.9.2602.17 (21d28f727). The LDS replay ran with its debug layer disabled.

cmake --build out/build/dev -- -j 6
$targets = 'compile_dxil', 'offscreen_check', 'native_lds_gpu', 'gfx1013_compute_ir_check',
    'gfx1013_compute_ir_gds_mask_mut', 'gfx1013_compute_ir_unsupported_opcode_mut',
    'gfx1013_compute_ir_register_tuple_mut', 'gfx1013_compute_ir_vop2_opcode_mut',
    'gfx1013_compute_ir_inline_negative_mut'
cmake --build out/build/release --target @targets -- -j 6
ctest --preset dev --no-tests=error -j 1 -R '^(gfx1013_compute_ir_|native_lds_)' -V
ctest --preset release --no-tests=error -j 1 -R '^(gfx1013_compute_ir_|native_lds_)' -V
ctest --preset pr --no-tests=error -j 1 -R '^native_lds_subword_(read|store)_controls$' -V
python -B tests/bidi_controls_check.py
python -B tests/docs_links_check.py
git diff --check origin/main...HEAD

Debug and Release each passed 100 tests with 0 failures and 0 skips. Both adapters passed readback. The two PR-preset controls, full Debug build, and repository checks passed.

🤖 Generated with Claude Code

**@⁠timbot103** on GitHub · 2026-12-03 12:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3931) `timbot103:shader/compute-ir-lds-subtract` → `main` · +77 −11 · 7 files · 1 commits · open Refs #1541, #2954 and #3921. ## Change Use one successful compare-exchange for each HLSL LDS subtract. The returning form writes the observed old word after the retry, including when the destination aliases the operand. The shader cache revision changes so existing native HLSL pragmas recompile with the new lowering. `expand_gfx1013_compute` serves the register-based compute-request path and the shader compiler's `#pragma x2w_lds` path. The portable `gfx1013_compute_ir_check` covers both form expansions. The GPU fixture compares the aliasing return, the resulting private LDS word, and 32 contending non-returning subtracts on a shared word. With the strengthened fixture and the old expansion, RTX 5080 PSO creation failed with `0x8007000e` on `a44d1967`. WARP passed. The old hardware cache still produced the failure with the fixed expander under the old key. With the new key, the same hardware cache directory produced a second entry and the readback passed. ## Verification Windows 11 26200.9974, RTX 5080 driver 32.0.16.2140 (621.40), Microsoft Basic Render Driver with app-local WARP 1.0.22.0 and DXC 1.9.2602.17 (21d28f727). The LDS replay ran with its debug layer disabled. ```powershell cmake --build out/build/dev -- -j 6 $targets = 'compile_dxil', 'offscreen_check', 'native_lds_gpu', 'gfx1013_compute_ir_check', 'gfx1013_compute_ir_gds_mask_mut', 'gfx1013_compute_ir_unsupported_opcode_mut', 'gfx1013_compute_ir_register_tuple_mut', 'gfx1013_compute_ir_vop2_opcode_mut', 'gfx1013_compute_ir_inline_negative_mut' cmake --build out/build/release --target @targets -- -j 6 ctest --preset dev --no-tests=error -j 1 -R '^(gfx1013_compute_ir_|native_lds_)' -V ctest --preset release --no-tests=error -j 1 -R '^(gfx1013_compute_ir_|native_lds_)' -V ctest --preset pr --no-tests=error -j 1 -R '^native_lds_subword_(read|store)_controls$' -V python -B tests/bidi_controls_check.py python -B tests/docs_links_check.py git diff --check origin/main...HEAD ``` Debug and Release each passed 100 tests with 0 failures and 0 skips. Both adapters passed readback. The two PR-preset controls, full Debug build, and repository checks passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #1541 and #3919. Preserve returning and non-returning atomic subtraction and invalidate cached native IR bytecode.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 12:49:28 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 12:58 UTC · original · requested changes

The Linux check on 95c9e063 reaches all 84 C++ cases successfully, including expand_atomic_subtract, then fails the Python meta-check because it still expects the literal 83/83 summary. Please update tests/gfx1013_compute_ir_meta_check.py to include the new case in CASES and update its count and summary expectations while retaining the mutation checks. The relevant job is https://github.com/R0Y00/Xbox2Windows/actions/runs/47108374219/job/144260156747.

**@⁠R0Y00** on GitHub · 2026-12-03 12:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3931#pullrequestreview-6170264604) · **requested changes** The Linux check on 95c9e063 reaches all 84 C++ cases successfully, including expand_atomic_subtract, then fails the Python meta-check because it still expects the literal 83/83 summary. Please update tests/gfx1013_compute_ir_meta_check.py to include the new case in CASES and update its count and summary expectations while retaining the mutation checks. The relevant job is https://github.com/R0Y00/Xbox2Windows/actions/runs/47108374219/job/144260156747.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3933/head:github-bot/gh-3931'
git switch 'github-bot/gh-3931'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3931'
git switch 'github-bot/gh-3931'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3931'
git switch 'github-bot/gh-3931'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3931'
git switch 'main'
git merge --squash 'github-bot/gh-3931'
git switch 'main'
git merge --ff-only 'github-bot/gh-3931'
git switch 'main'
git merge 'github-bot/gh-3931'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.