Shaders: translate the 32-bit and 64-bit scalar zero-bit counts #171

Open
GeaorgeAyvazov wants to merge 1 commit from upstream-pr/171 into main
GeaorgeAyvazov commented 2026-11-24 22:06:52 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by GeaorgeAyvazov on 2026-11-24T22:06:52Z.


The decoder and IR already represent S_BCNT0_I32_B32 and S_BCNT0_I32_B64, but scalar lowering falls through to the unsupported-instruction path. This translates both to the operand width minus its population count, using the existing dword pair representation for the wide form. SCC reflects whether the resulting count is nonzero.

The regression builds two synthetic GFX10 compute shaders, consumes the count and SCC together, and checks the UAV output for all zeros, all ones, asymmetric halves, and mixed bits. It uses the normal shader translator and D3D12 test harness. No game assets.

Tested on Windows with Rust 1.98.1. The focused test passed on RTX 3070 Ti Laptop and Iris Xe with temporary explicit DXGI selection, and through the ordinary hardware/WARP harness. Running the full victory-shader library suite with the new test on the original emitter gave 203 passed, 8 failed, 2 ignored. With this patch: 204 passed, 7 failed, 2 ignored. The same seven existing intersection, LDS and wave64 tests failed both times. No title-level performance or visual claims.

Implemented and tested with OpenAI Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592359612 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/171). Originally posted by [GeaorgeAyvazov](https://github.com/GeaorgeAyvazov) on 2026-11-24T22:06:52Z. --- The decoder and IR already represent S_BCNT0_I32_B32 and S_BCNT0_I32_B64, but scalar lowering falls through to the unsupported-instruction path. This translates both to the operand width minus its population count, using the existing dword pair representation for the wide form. SCC reflects whether the resulting count is nonzero. The regression builds two synthetic GFX10 compute shaders, consumes the count and SCC together, and checks the UAV output for all zeros, all ones, asymmetric halves, and mixed bits. It uses the normal shader translator and D3D12 test harness. No game assets. Tested on Windows with Rust 1.98.1. The focused test passed on RTX 3070 Ti Laptop and Iris Xe with temporary explicit DXGI selection, and through the ordinary hardware/WARP harness. Running the full victory-shader library suite with the new test on the original emitter gave 203 passed, 8 failed, 2 ignored. With this patch: 204 passed, 7 failed, 2 ignored. The same seven existing intersection, LDS and wave64 tests failed both times. No title-level performance or visual claims. Implemented and tested with 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/171:upstream-pr/171'
git switch 'upstream-pr/171'

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/171'
git switch 'upstream-pr/171'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/171'
git switch 'upstream-pr/171'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/171'
git switch 'main'
git merge --squash 'upstream-pr/171'
git switch 'main'
git merge --ff-only 'upstream-pr/171'
git switch 'main'
git merge 'upstream-pr/171'
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
fxceless/victory-fork!171
No description provided.