Repository navigation
Shaders: lower s_bcnt0_i32_b32/b64 and s_ff0_i32_b32/b64 - #165
n-romanovich wants to merge 3 commits into
Conversation
|
Tested
No game data used. |
|
This duplicates #148 (opened earlier, which also adds Static review, not built or run. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RDNA2 hardware check of the four instructions: all match. Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. Hand-written instructions in a HIP kernel (assembled by the AMD driver's amd_comgr). RDNA2 desktop silicon, not the console's. No game data. 130 cases: low dwords from edge values (including
(#148 covers the same four plus AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run. |
|
Tested head Merged onto current There's no text conflict, so GitHub still shows the PR as mergeable, but merging it as it is would break With
AI-assisted (Claude Code). |
|
Merged onto Checked with CI's steps (both clippy runs with |
|
Thanks for testing and pointing this out, @alexdeliu! Merged latest main and updated resource::track in the test to pass Some(&st) per 6638098. Verified with cargo clippy --all-targets --locked -- -D warnings and re-ran the GPU test — both compile cleanly and pass with 0 warnings. |
|
@n-romanovich rechecked |
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #148. s_bcnt0/s_ff0 (b32 and b64) lowering equal in effect to #148's, which also covers s_flbit_i32_b64/_i64. Its GPU test builds HostShader with the old field set and does not compile on main. 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. |
Implements DXIL lowering for the zero-bit counting and find-first-zero scalar ALU instructions in
victory-shader:s_bcnt0_i32_b32: bitwise invertssrc0and counts set bits via DXILunaryBits.i32(31), updatingSCC(result != 0).s_ff0_i32_b32: bitwise invertssrc0and finds the lowest set bit via DXILunaryBits.i32(32, returning-1when all bits are1).s_bcnt0_i32_b64,s_ff0_i32_b64: shares the 64-bit split-dword lowering paths withs_bcnt1_i32_b64ands_ff1_i32_b64over inverted dwords, without requiring DXILINT64.Testing
emit::tests::scalar_bitcount_and_first_zero_execute_on_gpuincrates/victory-shader/src/emit/mod.rscovering 32-bit and 64-bit inputs, inline-1, high-dword hits, andSCCupdates.dxil.dlland executed on D3D12 (NVIDIA GeForce RTX 5060 Ti).cargo fmt -p victory-shader -- --check: passed.cargo clippy -p victory-shader --all-targets -- -D warnings: passed (0 warnings).cargo xtask policy: passed (asset policy: 151 files ok).cargo test -p victory-shader: 70 passed, 0 failed.