Repository navigation
shader: lower 10 scalar bitops (bcnt0/ff0/flbit64/brev64/bitset64/bitreplicate) without INT64 - #1684
geiyiliyabumo wants to merge 1 commit into
Conversation
…rev/bitset/bitreplicate) without INT64
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.
Ten scalar bitops (bcnt0/ff0/flbit 32+64/brev64/bitset64/bitreplicate) lowered without INT64; the test asserts the INT64 feature flag stays clear and values match RDNA2 per backend.
|
Reviewed head c0b3633 locally (isolated worktree, fresh CARGO_TARGET_DIR, real GPU dispatch). What it does: lowers the ten RDNA2 scalar bitops without INT64 — 32-bit Verified locally:
Findings, ranked:
LGTM. |
|
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, at the PR head |
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #148. Ten scalar bit operations (bcnt0, ff0, flbit 64-bit, brev64, bitset64, bitreplicate), which the title does not use. All ten are covered by PRs that merge clean: #148 (bcnt0, ff0, flbit) and #166 (bitset_b64, brev_b64, bitreplicate). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
Summary
crates/victory-shader/src/emit/lower.rsusing pure 32-bit DXIL arithmetic (noINT64capability flag set inSFI0):s_bcnt0_i32_b32(0x00d) &s_bcnt0_i32_b64(0x00e): count clear bits viacountbits(~x)and setSCC = (result != 0).s_ff0_i32_b32(0x011) &s_ff0_i32_b64(0x012): lowest clear bit viafirstbitlow(~x)(-1when all ones).s_flbit_i32_b64(0x016) &s_flbit_i32_i64(0x018): leading zeros / leading bits matching sign bit 63 (-1when all bits are equal).s_brev_b64(0x00c): 64-bit bit-reversal across the swapped dword pair.s_bitset0_b64(0x01c) &s_bitset1_b64(0x01e): clear/set bitsrc0[5:0]of the 64-bit destination pair (also handlesnulldestination cleanly).s_bitreplicate_b64_b32(0x03b): duplicates each bit ofsrc0into two adjacent bits ofsdst[0:1]via SWAR bit-spreading (addss_bitreplicate_b64_b32to thewidescalar dispatch since its destination is 64-bit despite ending in_b32).Verification
cargo test -p victory-shader --lib: 121 passed, 0 failed, 1 ignored on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP), includingscalar_bitops_zero_rev_and_64bit_match_rdna2_without_int64exercising all 10 instructions (includingSCCchecks, boundary bit indices0/31/32/63/69, sign-bit edge cases fors_flbit_i32_i64, andSFI0 & 0x8000 == 0on all 64-bit variants).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: pass (154 files).AI-assisted; synthetic tests only, no game files.