Repository navigation
Shaders: lower mul_hi without INT64 - #741
scoresby13 wants to merge 1 commit into
Conversation
|
Independent check of All four base shaders set the SFI0 The arithmetic check ran on the CPU. Windows execution, WARP/GPU readback, and Microsoft DXIL validation remain unverified by this check. No game files were used. |
|
An AMD run of this PR's new tests. The setup, and the same run for eight related shader PRs, are in one table on #637: #637 (comment) |
|
Sharing an upstream benchmark update for context: upstream Leaving this PR open (alongside #726) in case you'd prefer to merge the verified 16x16 lowering as-is or adapt AI-assisted. |
Summary
Lowers
Lower::mul_hi(s_mul_hi_u32,s_mul_hi_i32,v_mul_hi_u32,v_mul_hi_i32) invictory-shaderusing pure 32-bit DXIL operations instead of 64-bit integer multiplication, removingflags::INT64(SFI0bit0x8000/Int64ShaderOps) from shaders that use 32-bit high-multiply instructions.Details
16x16partial products without intermediate unsigned overflow (Hacker's Delight 8-2).signedis true, applies sign-bit masks(a >>s 31) & band(b >>s 31) & asubtracted from the unsigned high word to produce the exact signed high dword.SFI0validation (emit::lower::tests::mul_hi_needs_no_int64) and GPU/WARP tests (emit::valu_tests::mul_hi_matches_rdna2_without_int64) covering all 144 ordered pairs of 12 edge-case 32-bit values across all 4 instructions.Testing
cargo clippy -p victory-shader --all-targets --locked -- -D warnings(passed)cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings(passed)cargo xtask policy(asset policy: 171 files ok)cargo test -p victory-shader --locked mul_hi -- --nocapture(2 passed, 0 failed)No game data was used. AI-assisted.