Shaders: cover s_bfe_u32/s_bfe_i32 SCC, literal src1, dirty bits, and width>=32 in valu_tests #2060

Manually merged
github merged 1 commit from gh-pr/2060/head into gh-pr/2060/base 2026-11-26 04:53:27 +00:00
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:17 UTC · original
fuzeofficlal:test/shader-sbfe-valu-803 → main · +126 −12 · 1 files · 1 commits · merged 2026-11-25 21:54 UTC

Addresses #803.

Summary

Audited Lower::bfe and Lower::sop against RDNA2 S_BFE_U32 (0x27) / S_BFE_I32 (0x28) semantics and expanded valu_tests::bfe_signed_and_unsigned_match_rdna2 to cover the remaining gaps beyond 328eec1:

  • s_bfe_u32 & v_bfe_u32 width wrapping: adds s_bfe_u32 GPU/WARP cases in valu_tests and verifies 5-bit width = 32 -> 0 masking for v_bfe_u32 alongside v_bfe_i32.
  • SCC condition-code output (D != 0): verifies SCC for both s_bfe_i32 (not previously checked via sop2_probe) and s_bfe_u32 through s_cselect_b32.
  • 32-bit literal src1 (0xFF): exercises literal offset | (width << 16) operands for both 0x27 and 0x28 (value and SCC).
  • Ignored bits & width = 64 boundary: verifies hardware masking of unused src1[15:5] and src1[31:23] bits (0xFF80_FFE0) and width = 64 (where width >= 32 while width & 31 == 0).

Testing

  • cargo test -p victory-shader --locked bfe_signed_and_unsigned_match_rdna2 across hardware D3D12 adapters (RTX 5090, RDNA2), WARP, and dxil.dll validation.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings and cargo xtask policy.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2060) `fuzeofficlal:test/shader-sbfe-valu-803` → `main` · +126 −12 · 1 files · 1 commits · merged 2026-11-25 21:54 UTC Addresses #803. ### Summary Audited `Lower::bfe` and `Lower::sop` against RDNA2 `S_BFE_U32` (`0x27`) / `S_BFE_I32` (`0x28`) semantics and expanded `valu_tests::bfe_signed_and_unsigned_match_rdna2` to cover the remaining gaps beyond `328eec1`: - **`s_bfe_u32` & `v_bfe_u32` width wrapping**: adds `s_bfe_u32` GPU/WARP cases in `valu_tests` and verifies 5-bit `width = 32 -> 0` masking for `v_bfe_u32` alongside `v_bfe_i32`. - **`SCC` condition-code output (`D != 0`)**: verifies `SCC` for both `s_bfe_i32` (not previously checked via `sop2_probe`) and `s_bfe_u32` through `s_cselect_b32`. - **32-bit literal `src1` (`0xFF`)**: exercises literal `offset | (width << 16)` operands for both `0x27` and `0x28` (value and `SCC`). - **Ignored bits & `width = 64` boundary**: verifies hardware masking of unused `src1[15:5]` and `src1[31:23]` bits (`0xFF80_FFE0`) and `width = 64` (where `width >= 32` while `width & 31 == 0`). ### Testing - `cargo test -p victory-shader --locked bfe_signed_and_unsigned_match_rdna2` across hardware D3D12 adapters (RTX 5090, RDNA2), WARP, and `dxil.dll` validation. - `cargo clippy --workspace --all-targets --all-features -- -D warnings` and `cargo xtask policy`.
Extend bfe_signed_and_unsigned_match_rdna2 in valu_tests with scalar unsigned s_bfe_u32 (SOP2 0x27), literal src1 operands, ignored src1[15:5]/[31:23] bits, 7-bit widths >= 32 (32, 64, 127), v_bfe_u32 5-bit width wrap, and SCC conditional selection for both s_bfe_u32 and s_bfe_i32 (#803).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:26 +00:00
github manually merged commit a3479b252b into gh-pr/2060/base 2026-11-26 04:53:27 +00:00
Author
Owner

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

Triage verdict — Keep the expanded coverage as a standalone test change (a3479b2)

Evidence

  • main already covers the unsigned scalar value and SCC cases described in #803. @⁠fuzeofficlal’s additional cases cover signed SCC, literal operands, ignored packed bits, and the width-64 wrapping boundary. Those assertions add coverage beyond the original issue. Existing scalar coverage · Expanded fixture

Checks and limits

  • The exact-head focused test passed independently. Hardware D3D12 and WARP both ran the synthetic shader cases. I did not separately require the optional DXIL validator in this run.

Next step

  • Keep the incremental cases together as a test-only change. The maintainer can resolve #803 based on the existing scalar coverage and review these additional assertions on their own merits.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-25 04:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2060#issuecomment-7152752706) **Triage verdict — Keep the expanded coverage as a standalone test change** (`a3479b2`) **Evidence** - `main` already covers the unsigned scalar value and SCC cases described in #803. @⁠fuzeofficlal’s additional cases cover signed SCC, literal operands, ignored packed bits, and the width-64 wrapping boundary. Those assertions add coverage beyond the original issue. [Existing scalar coverage](https://github.com/Marvisak/VIctory/commit/328eec1ce3af6de07dedc381a075e6a567a0afc1) · [Expanded fixture](https://github.com/Marvisak/VIctory/blob/a3479b252b005ddeae50b1fcba727506282036da/crates/victory-shader/src/emit/valu_tests.rs#L1099-L1280) **Checks and limits** - The exact-head focused test passed independently. Hardware D3D12 and WARP both ran the synthetic shader cases. I did not separately require the optional DXIL validator in this run. **Next step** - Keep the incremental cases together as a test-only change. The maintainer can resolve #803 based on the existing scalar coverage and review these additional assertions on their own merits. This verification was AI-assisted.
Author
Owner

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

Automated triage for the maintainers.
Merge candidate.

This only adds tests. It extends bfe_signed_and_unsigned_match_rdna2 in crates/victory-shader/src/emit/valu_tests.rs (#803) with:

  • s_bfe_u32 values
  • SCC for both scalar BFEs, read through s_cselect_b32
  • literal src1, with the unused bits [15:5] and [31:23] set
  • widths 32/64/127 for the scalar ops (7-bit width field)
  • the 5-bit width wrap of v_bfe_u32

I checked the expected values by hand against the documented RDNA2 BFE formula, (S0 >> S1[4:0]) & ((1 << S1[22:16]) - 1) with SCC = result != 0. The values follow that formula rather than just matching Lower::bfe in lower.rs. The width ≥ 32 → full-mask reading matches the width-32 case main already asserts. No other open PR adds these cases.

CI: passing (check).

Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2060#issuecomment-7158303207) <!-- victory-triage v1 head=a3479b252b005ddeae50b1fcba727506282036da verdict=merge-candidate at=2026-11-25T09:25:02Z --> Automated triage for the maintainers. **Merge candidate.** This only adds tests. It extends `bfe_signed_and_unsigned_match_rdna2` in `crates/victory-shader/src/emit/valu_tests.rs` (#803) with: - `s_bfe_u32` values - SCC for both scalar BFEs, read through `s_cselect_b32` - literal `src1`, with the unused bits `[15:5]` and `[31:23]` set - widths 32/64/127 for the scalar ops (7-bit width field) - the 5-bit width wrap of `v_bfe_u32` I checked the expected values by hand against the documented RDNA2 BFE formula, `(S0 >> S1[4:0]) & ((1 << S1[22:16]) - 1)` with SCC = result != 0. The values follow that formula rather than just matching `Lower::bfe` in `lower.rs`. The width ≥ 32 → full-mask reading matches the width-32 case `main` already asserts. No other open PR adds these cases. CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

Offline measurement on a retail dump

Result: no count change against main.

I merged head a3479b25 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:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2060#issuecomment-7158341381) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head a3479b25 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).
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!2060
No description provided.