Shaders: lower the console's scalar bit searches (s_flbit_i32_b64, s_ff0_i32_b32/b64) #233

Open
github-bot wants to merge 2 commits from github-bot/gh-233 into main AGit
Owner

@⁠pablogonz12 on GitHub · 2026-11-24 22:52 UTC · original
pablogonz12:scalar-bit-ops → main · +178 −0 · 3 files · 2 commits · open

Setup: RX 9070 XT (RDNA4), RADV Mesa 26.3.1, Linux, GE-Proton11-14, Series X files.

The decoder names s_flbit_i32_b64, s_ff0_i32_b32, s_ff0_i32_b64 (and the dword
widths in gfx10/fields.rs know their 64-bit sources), but the scalar lowering has no
arms for them: they fall through to the catch-all and a shader containing one is refused
whole. This adds them in DXIL unaryBits, as TuxBox does: the 64-bit searches test the
high word first and continue 32 past the low word's own result, −1 for a zero pair
(s_flbit) or an all-ones pair (s_ff0); none writes SCC.

Complements #171 (GeaorgeAyvazov), which lowers s_bcnt0_i32_b32/b64; that family is
left out here so the two changes do not both touch it.

Adapted from TuxBox (brcly/TuxBox, Apache-2.0, commit 1a50eb9 "shader: restore
s_flbit_i32_b64 and s_ff0_i32 lowering dropped by a merge", Copyright (c) 2026 the TuxBox
authors); NOTICE added. Not ported: s_flbit_i32_i64, which TuxBox guards but does not
lower either.

On an RX 9070 XT this changes 0 of our 751 world programs and 0 of the 25,586 archive
programs
(all 767 emitted DXIL containers byte-identical); it is for the console
programs that carry these instructions, which our captures do not contain. Tests: a
Windows/WARP + hardware oracle for the three against the console's answers, and a
platform-neutral test whose hand-assembled encodings decode to the three names (refused
before). cargo clippy --workspace --all-targets [--all-features] -- -D warnings clean.

AI-assisted: written and tested with an AI coding agent; the port was compared
against TuxBox's source by hand.

**@⁠pablogonz12** on GitHub · 2026-11-24 22:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/233) `pablogonz12:scalar-bit-ops` → `main` · +178 −0 · 3 files · 2 commits · open Setup: RX 9070 XT (RDNA4), RADV Mesa 26.3.1, Linux, GE-Proton11-14, Series X files. The decoder names `s_flbit_i32_b64`, `s_ff0_i32_b32`, `s_ff0_i32_b64` (and the dword widths in `gfx10/fields.rs` know their 64-bit sources), but the scalar lowering has no arms for them: they fall through to the catch-all and a shader containing one is refused whole. This adds them in DXIL `unaryBits`, as TuxBox does: the 64-bit searches test the high word first and continue 32 past the low word's own result, −1 for a zero pair (`s_flbit`) or an all-ones pair (`s_ff0`); none writes SCC. Complements #171 (GeaorgeAyvazov), which lowers `s_bcnt0_i32_b32/b64`; that family is left out here so the two changes do not both touch it. Adapted from TuxBox (brcly/TuxBox, Apache-2.0, commit 1a50eb9 "shader: restore s_flbit_i32_b64 and s_ff0_i32 lowering dropped by a merge", Copyright (c) 2026 the TuxBox authors); `NOTICE` added. Not ported: `s_flbit_i32_i64`, which TuxBox guards but does not lower either. On an RX 9070 XT this changes **0 of our 751 world programs and 0 of the 25,586 archive programs** (all 767 emitted DXIL containers byte-identical); it is for the console programs that carry these instructions, which our captures do not contain. Tests: a Windows/WARP + hardware oracle for the three against the console's answers, and a platform-neutral test whose hand-assembled encodings decode to the three names (refused before). `cargo clippy --workspace --all-targets [--all-features] -- -D warnings` clean. AI-assisted: written and tested with an AI coding agent; the port was compared against TuxBox's source by hand.
The decoder names s_flbit_i32_b64, s_ff0_i32_b32 and s_ff0_i32_b64 (and the
dword widths in gfx10/fields.rs know their 64-bit sources), but the scalar
lowering has no arms for them: they fall through to the catch-all, so a
shader containing one is refused whole.

Lower them as TuxBox does, in DXIL unaryBits: the 64-bit searches test the
high word first and continue 32 past the low word's own result, -1 for a zero
pair (s_flbit) or an all-ones pair (s_ff0). Neither writes SCC, so only the
destination is set, as the existing s_ff1_i32_b64 arm does.

Complements #171, which lowers s_bcnt0_i32_b32/b64; that family is left out of
this change so the two do not both touch it.

Adapted from TuxBox (https://github.com/brcly/TuxBox, Apache-2.0), commit
1a50eb9 "shader: restore s_flbit_i32_b64 and s_ff0_i32 lowering dropped by a
merge" (Copyright (c) 2026 the TuxBox authors); see NOTICE. Not ported:
s_flbit_i32_i64, which TuxBox guards but does not lower either.

Tests: a Windows/WARP + hardware oracle for the three against the console's
answers (valu_tests), and a platform-neutral lowering test whose hand-assembled
encodings decode to the three names (they were refused before). Offline, the
world dump is unchanged (750 of 751 emitted) and so is the full archive
(25,586 of 26,084): these instructions are not in our captures.

Co-Authored-By: Claude Sonnet 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:38:59 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 22:53 UTC · original

Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T22:52:59.051238Z
We couldn’t complete this review. Comment @codex review to try again.
4db8615 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 22:53 UTC · [original](https://github.com/fxceless/victory-fork/pull/233#issuecomment-7146755321) <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"4db86158d26e73381dc0024921f08d2c61f8b5af","has_any_findings":true,"has_unresolved_findings":true,"status":"failed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ❌ Failed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ❌ **Failed** <relative-time datetime="2026-11-24T22:52:59.051238Z">2026-11-24T22:52:59.051238Z</relative-time><br/>We couldn’t complete this review. Comment `@codex review` to try again. | `4db8615` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 22:53 UTC · original

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 22:53 UTC · [original](https://github.com/fxceless/victory-fork/pull/233#issuecomment-7146755981) You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage).
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 19:29 UTC · original

RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main d510ee4: both new tests pass on the card with this PR. With the tests alone on the base, scalar_bit_searches_match_the_console fails (the other test is inline). No other test changed. Run table: #129 (#129).

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 19:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/233#issuecomment-7172378940) RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main `d510ee4`: both new tests pass on the card with this PR. With the tests alone on the base, `scalar_bit_searches_match_the_console` fails (the other test is inline). No other test changed. Run table: #129 (https://git.gtahub.st/github/fxceless--victory-fork/pulls/129).
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/233/head:github-bot/gh-233'
git switch 'github-bot/gh-233'

Merge

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