fix: mask inactive source lanes in wave64 ds_bpermute_b32 #281

Open
Tiimonprog wants to merge 2 commits from upstream-pr/281 into main
Tiimonprog commented 2026-11-26 00:28:48 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by Tiimonprog on 2026-11-26T00:28:48Z.


Change

The wave64 HLSL translator for ds_bpermute_b32 publishes the source VGPR even when that lane is inactive in EXEC. An active destination can then read a stale value. In the synthetic regression case, lane 1 reads 3 on the GPU while the interpreter returns 0.

Publish zero for inactive source lanes. All 64 threads still call ReadLane64 and execute the group barriers. The regression test uses different EXEC masks in the two halves and checks active reads, inactive sources, untouched inactive destinations, and wraparound at lane 63. The HLSL and interpreter outputs are compared byte for byte.

Validation

Based on c4c93bd. The regression fails before the fix and passes afterwards on RTX 4060 Laptop, Intel UHD, and WARP.

  • python -m pytest -q -p no:cacheprovider tests/test_rdna2_exec_wave64.py tests/test_rdna2_hlsl_wave64.py tests/test_rdna2_alu_parity.py — 31 passed on each adapter.
  • python -m pytest -q -p no:cacheprovider on WARP with Python's Windows default encoding — 1649 passed, 17 skipped.
  • python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools — passed.

The test uses synthetic shader code. Tested on the PC through the D3D12 runner.

Implemented and verified with assistance from OpenAI Codex.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:6616677980 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/281). Originally posted by [Tiimonprog](https://github.com/Tiimonprog) on 2026-11-26T00:28:48Z. --- ## Change The wave64 HLSL translator for `ds_bpermute_b32` publishes the source VGPR even when that lane is inactive in EXEC. An active destination can then read a stale value. In the synthetic regression case, lane 1 reads `3` on the GPU while the interpreter returns `0`. Publish zero for inactive source lanes. All 64 threads still call `ReadLane64` and execute the group barriers. The regression test uses different EXEC masks in the two halves and checks active reads, inactive sources, untouched inactive destinations, and wraparound at lane 63. The HLSL and interpreter outputs are compared byte for byte. ## Validation Based on `c4c93bd`. The regression fails before the fix and passes afterwards on RTX 4060 Laptop, Intel UHD, and WARP. - `python -m pytest -q -p no:cacheprovider tests/test_rdna2_exec_wave64.py tests/test_rdna2_hlsl_wave64.py tests/test_rdna2_alu_parity.py` — 31 passed on each adapter. - `python -m pytest -q -p no:cacheprovider` on WARP with Python's Windows default encoding — 1649 passed, 17 skipped. - `python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools` — passed. The test uses synthetic shader code. Tested on the PC through the D3D12 runner. Implemented and verified with assistance from OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/281:upstream-pr/281'
git switch 'upstream-pr/281'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/281'
git switch 'upstream-pr/281'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/281'
git switch 'upstream-pr/281'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/281'
git switch 'main'
git merge --squash 'upstream-pr/281'
git switch 'main'
git merge --ff-only 'upstream-pr/281'
git switch 'main'
git merge 'upstream-pr/281'
git push origin 'main'
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
LooperSalty/AnyXboxX!281
No description provided.