Shaders: s_bfe_u32 (SOP2 0x27) has no scalar hardware test #803
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#803
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kss306 on GitHub · 2026-11-24 11:11 UTC · original
bfe_signed_and_unsigned_match_rdna2invalu_tests.rsbuilds shaders forv_bfe_i32(VOP3 0x149),v_bfe_u32(VOP3 0x148) ands_bfe_i32(SOP2 0x28). The scalar unsigned variants_bfe_u32(SOP2 0x27) is never tested, even though it is handled in the samematcharm.Implementation evidence
lower.rs,sop()at line 2638:s_bfe_u32passessigned=falsetobfe(). The 7-bit width field (src1[22:16]) is unique to SOP2: a width of 32..127 means "return all bits from the shifted source", exercising thefull = width >= 32branch ofbfe().Missing test
valu_tests.rs,bfe_signed_and_unsigned_match_rdna2(line 794), builds:v_signedv_bfe_i32v_unsignedv_bfe_u32s_signeds_bfe_i32s_bfe_u32The signed scalar path exercises
bfe(…, true)with the 7-bit width and thewidth >= 32branch ([0x8000_0000, 4, 32, 0] → 0xf800_0000). The unsigned scalar equivalent (bfe(…, false)with the same 7-bit encoding, no sign extension) is not tested. The expected result for width=32 differs:0x0800_0000unsigned vs0xf800_0000signed.Suggested test addition
Add a fourth shader
s_unsignedtobfe_signed_and_unsigned_match_rdna2:Then run the same
s_incases against it, plus the width=32 edge case:The key case that differs from the signed test:
([0x8000_0000, 4, 32, 0], 0x0800_0000)— width=32 on a 7-bit field extracts all bits from offset 4 without sign-extending bit 31.No game data needed; the test skips when no SM 6.6 device is available and runs on WARP.
AI-assisted: found with Kiro (Claude) and independently confirmed by five separate analysis passes without cross-contamination; no hardware run, no game data.
@Jxyden34 on GitHub · 2026-11-24 11:25 UTC · original
Tested fix for the missing scalar unsigned case:
github.com/Jxyden34/VIctory@0c39a5f7b5. The targeted test passed on native Windows on hardware and WARP. It covers seven inputs, including width 32 with bit 31 set, where the unsigned result is 0x08000000. The commit can be cherry-picked.@towiice on GitHub · 2026-11-24 12:17 UTC · original
Adding an NVIDIA Turing hardware verification data point (
GTX 1650 SUPER, 4 GB VRAM, wave32, driver610.88, Windows 11 26300,stable-x86_64-pc-windows-gnullvm):bfe_signed_and_unsigned_match_rdna2withs_bfe_u32(SOP20x27), including the 7-bit width=32 unsigned case (0x8000_0000, offset 4, width 32 ->0x0800_0000), on https://github.com/towiice/VIctory/tree/test/valu-f32-class-and-s-bfe-u32 (commitfb441bf).cargo +stable-x86_64-pc-windows-gnullvm test -p victory-shader --lib bfe_signed_and_unsigned_match_rdna2: 1 passed, 0 failed (3.74 s, both hardware GPU and WARP).@Altorru on GitHub · 2026-11-24 12:17 UTC · original
s_bfe_u32 (SOP2 0x27) is added to bfe_signed_and_unsigned_match_rdna2 with the shared 7-bit width field, the unsigned 0x0800_0000 width=32 case, and the same unsigned cases as the vector form. Implemented in fork PR Altorru/VIctory#1 (upstream PR creation is collaborator-only), commit
bb3a37b. Windows CI passed: cargo test --workspace on https://github.com/Altorru/VIctory/actions/runs/45391712656, where the new test ran on WARP. No game data.@Beeak on GitHub · 2026-11-24 13:14 UTC · original
Added a standalone synthetic scalar integration test for
s_bfe_u32(SOP20x027) incrates/victory-shader/tests/s_bfe_u32_test.rs(zero existing files modified), implemented in fork PR https://github.com/Beeak/VIctory/pull/1 (commita1703c7, since upstream PR creation is collaborator-only).Covers:
src1[22:16]):width = 0,31,32,64,127, and ignored upper bits (bits 31:23)src1[4:0]): offsets >= 32 and ignored bits (15:5)Verified locally on Windows (
rustc 1.98.1):cargo test -p victory-shader --features host --test s_bfe_u32_test: 2 passed, 0 failed (hardware GPU and WARP)cargo test -p victory-shader -- --test-threads=1: 120 passed, 0 failed, 1 ignored (unit tests); 1 passed, 0 failed (s_bfe_u32_test)cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: cleancargo xtask policy: 155 files okAll input data is synthetic; no game data was used.
@jules47800 on GitHub · 2026-11-25 01:25 UTC · original
Covered on main since
328eec1(2026-11-24).scalar_probes()incrates/victory-shader/src/emit/semantics_tests.rsrunss_bfe_u32(SOP2 0x27) assop2_probe(0x27, fields, bfe_u). Its inputs cover offsets 0, 4, 16, 28, 31, 32 and widths 0, 1, 4, 16, 31, 32, 33, 0x7F over five sources, so the width ≥ 32 branch is included, and it checks SCC too. That'sscalar_alu_matches_the_hardware, which passes on an RX 6600 XT and on WARP at42363ab. This issue can be closed.@Marvisak on GitHub · 2026-11-25 03:53 UTC · original
Automated triage for the maintainers.
Fixed in
main. Commit328eec1(2026-11-24) addedscalar_probes()incrates/victory-shader/src/emit/semantics_tests.rs, which runss_bfe_u32(SOP2 0x27) assop2_probe(0x27, ...). Its widths include 32, 33 and 0x7F, so thewidth >= 32branch is covered. It runs on the hardware and WARP throughscalar_alu_matches_the_hardware. That is the test this issue asks for.This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the
triage: proposed closelabel.Generated by Claude Code