Shaders: lower s_bitreplicate_b64_b32 in pure 32-bit DXIL #2083

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

@⁠geiyiliyabumo on GitHub · 2026-11-25 04:30 UTC · original
geiyiliyabumo:feat/shader-s-bitreplicate → main · +130 −3 · 2 files · 1 commits · open

Summary

  • Lowers GFX10 SOP1 instruction s_bitreplicate_b64_b32 (opcode 0x3b) in crates/victory-shader/src/emit/lower.rs using pure 32-bit DXIL (4-step 16-to-32 bit interleave + even | (even << 1) for low and high halves), writing the 2-dword scalar destination without enabling Int64 / WIDE_OPS and while preserving SCC.
  • Adds synthetic IR, DXIL-validation, and GPU execution tests in crates/victory-shader/src/emit/valu_tests.rs covering 8 bit patterns across both halves with both SCC = 0 and SCC = 1, verifying destination width and that Int64 is not set.

Verification

  • cargo xtask policy: passed
  • cargo clippy -p victory-shader --tests -- -D warnings: passed
  • cargo test -p victory-shader --lib s_bitreplicate with Microsoft dxil.dll: 2/2 passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP)
  • Zero game files or game-derived data used (synthetic tests only).
**@⁠geiyiliyabumo** on GitHub · 2026-11-25 04:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2083) `geiyiliyabumo:feat/shader-s-bitreplicate` → `main` · +130 −3 · 2 files · 1 commits · open ## Summary - Lowers GFX10 SOP1 instruction `s_bitreplicate_b64_b32` (opcode `0x3b`) in `crates/victory-shader/src/emit/lower.rs` using pure 32-bit DXIL (4-step 16-to-32 bit interleave + `even | (even << 1)` for low and high halves), writing the 2-dword scalar destination without enabling `Int64` / `WIDE_OPS` and while preserving `SCC`. - Adds synthetic IR, DXIL-validation, and GPU execution tests in `crates/victory-shader/src/emit/valu_tests.rs` covering 8 bit patterns across both halves with both `SCC = 0` and `SCC = 1`, verifying destination width and that `Int64` is not set. ## Verification - `cargo xtask policy`: passed - `cargo clippy -p victory-shader --tests -- -D warnings`: passed - `cargo test -p victory-shader --lib s_bitreplicate` with Microsoft `dxil.dll`: 2/2 passed on **AMD Radeon RX 9060 XT (RDNA4)** and **Microsoft Basic Render Driver (WARP)** - Zero game files or game-derived data used (synthetic tests only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:21 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-25 04:39 UTC · original

Triage verdict — Confirmed duplicate of the bit-replicate change in #166 (fd1f5fa)

Evidence

  • @⁠geiyiliyabumo and @⁠n-romanovich split the same input into two halfwords and use the same four spreading masks and final OR to duplicate each input bit. Both write two SGPRs without changing SCC or requiring Int64. #166 is clean against current main and also adds three independent bit-set and reversal instructions. This lowering · #166 lowering

Checks and limits

  • Compared both exact-head implementations and fixtures. The existing #2083 review reports both focused tests passing with hardware, WARP, and DXIL validation. #166 has separate contributor readback evidence, including a native RDNA2 check of all four instruction rules. #2083 verification · #166 RDNA2 evidence

Next step

  • Maintainers could retain #166 and close this focused duplicate after carrying over the expanded input patterns, explicit SCC controls, and no-Int64 assertion. Preserve credit for both implementations and the earlier test work.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-25 04:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2083#issuecomment-7153051393) **Triage verdict — Confirmed duplicate of the bit-replicate change in #166** (`fd1f5fa`) **Evidence** - @⁠geiyiliyabumo and @⁠n-romanovich split the same input into two halfwords and use the same four spreading masks and final OR to duplicate each input bit. Both write two SGPRs without changing SCC or requiring Int64. #166 is clean against current `main` and also adds three independent bit-set and reversal instructions. [This lowering](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2083/files) · [#166 lowering](https://git.gtahub.st/github/Marvisak--VIctory/pulls/166/files) **Checks and limits** - Compared both exact-head implementations and fixtures. The existing #2083 review reports both focused tests passing with hardware, WARP, and DXIL validation. #166 has separate contributor readback evidence, including a native RDNA2 check of all four instruction rules. [#2083 verification](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2083) · [#166 RDNA2 evidence](https://git.gtahub.st/github/Marvisak--VIctory/pulls/166) **Next step** - Maintainers could retain #166 and close this focused duplicate after carrying over the expanded input patterns, explicit SCC controls, and no-Int64 assertion. Preserve credit for both implementations and the earlier test work. This verification was AI-assisted.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 04:41 UTC · original

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at fd1f5fa. victory-shader: 246 passed, 3 failed, 3 ignored; the new s_bitreplicate_b64_b32_ir_and_dxil and s_bitreplicate_b64_b32_replicates_both_halves_and_preserves_scc pass. The 3 failures are #1744's NVIDIA failures on main. Same as main on this hardware. Not run: a title.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 04:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2083#issuecomment-7153077639) Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `fd1f5fa`. `victory-shader`: 246 passed, 3 failed, 3 ignored; the new `s_bitreplicate_b64_b32_ir_and_dxil` and `s_bitreplicate_b64_b32_replicates_both_halves_and_preserves_scc` pass. The 3 failures are #1744's NVIDIA failures on `main`. Same as `main` on this hardware. Not run: a title. AI-assisted (Claude Code).
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 09:04 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head fd1f5fa2 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 09:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2083#issuecomment-7157840295) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head fd1f5fa2 onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:31 UTC · original

Automated triage for the maintainers.

This lowering of s_bitreplicate_b64_b32 in Lower (emit/lower.rs, the wide SOP1 arm) duplicates #166, which is still open. #166 makes the same change to the wide test, uses the same four-mask 16-bit spread with the final x | x << 1 for each half, and writes both SGPRs without touching SCC or needing Int64. It also lowers s_bitset0/1_b64 and s_brev_b64. I compared the two lowering hunks, and they match. The extra input patterns and the explicit SCC/no-Int64 assertions here would be welcome as test additions on #166. Reason for closing: duplicate of the broader open PR #166. the PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2083#issuecomment-7159823313) <!-- victory-triage v1 head=fd1f5fa295c2a598e79574ed228f0c08770e2985 verdict=proposed-close at=2026-11-25T10:31:41Z --> Automated triage for the maintainers. This lowering of `s_bitreplicate_b64_b32` in `Lower` (`emit/lower.rs`, the wide SOP1 arm) duplicates #166, which is still open. #166 makes the same change to the `wide` test, uses the same four-mask 16-bit spread with the final `x | x << 1` for each half, and writes both SGPRs without touching SCC or needing Int64. It also lowers `s_bitset0/1_b64` and `s_brev_b64`. I compared the two lowering hunks, and they match. The extra input patterns and the explicit SCC/no-Int64 assertions here would be welcome as test additions on #166. Reason for closing: duplicate of the broader open PR #166. the PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2083/head:github-bot/gh-2083'
git switch 'github-bot/gh-2083'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2083'
git switch 'github-bot/gh-2083'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2083'
git switch 'github-bot/gh-2083'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2083'
git switch 'main'
git merge --squash 'github-bot/gh-2083'
git switch 'main'
git merge --ff-only 'github-bot/gh-2083'
git switch 'main'
git merge 'github-bot/gh-2083'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2083
No description provided.