Shaders: lower 64-bit shifts without INT64 #2131
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2133"
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?
Imported from Marvisak/VIctory. Originally posted by scoresby13 on 2026-11-25T05:46:56Z.
Summary
Lowers all six 64-bit scalar and vector shift instructions (
s_lshl_b64,s_lshr_b64,s_ashr_i64,v_lshlrev_b64,v_lshrrev_b64,v_ashrrev_i64) invictory-shaderusing pure 32-bit DXIL operations on(lo, hi)dwords (shift64+src64_dwords), removingflags::INT64(SFI0bit0x8000/Int64ShaderOps) from shaders that use 64-bit shifts.Claimed on #1633.
Details
sh = shift & 31,wide = (shift & 32) != 0, andinv = 31 - sh, computing cross-dword carries via(lo >> 1) >> inv(Shl) and(hi << 1) << inv(LShr/AShr) so every 32-bit DXIL shift stays in0..=31._i64literal sign-extension, and scalarSCCupdates.SFI0validation (shifts_64_bit_need_no_int64) and GPU/WARP tests (v_shift_64_matches_rdna2_without_int64,s_shift_64_matches_rdna2_without_int64) covering 126(value, shift)pairs per instruction plus inline-1and literal-100cases.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: 182 files ok)cargo test -p victory-shader --locked shift -- --nocapture(4 passed, 0 failed)cargo test -p victory-shader --locked signed_64_bit_operands_sign_extend_their_literal -- --nocapture(1 passed, 0 failed)No game data was used. AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:40:59Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.145 passed / 0 failed / 2 ignored. 64-bit shifts lowered without INT64 (+1 test) — shift lowering for 64-bit values in 32-bit DXIL; relates to #2104's wqm and the no-INT64 cluster.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:46:03Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, withdxil.dllvalidator):cargo test -p victory-shader --lib shift— 4 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(verifying 64-bit shifts withoutINT64)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean pure-32-bit DXIL lowering of 64-bit shifts without
INT64, verified end-to-end on hardware and WARP. Looks great.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T08:24:53Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
670c441fontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 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).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:49:11Z.
Automated triage for the maintainers.
Merge candidate. This lowers
s_lshl/lshr/ashr_b64andv_lshlrev/lshrrev/ashrrev_b64on 32-bit dword pairs (Lower::shift64,src64_dwords), so these shaders no longer needInt64ShaderOps. That follows the earlier v_perm_b32 and v_sad changes in main. I checked the arithmetic:(lo >> 1) >> (31 - sh)/(hi << 1) << (31 - sh)is 0 atsh == 0.ashr.src64.CI passes, and the offline count on the retail shaders is unchanged. One optional cleanup:
src64could build onsrc64_dwordsso the operand rules live in one place.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:05:53Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because it adds no capability the project needs. The arithmetic is right and the tests pass on hardware and WARP. But the title needs Int64 on the host anyway (64-bit compares, 64-bit image atomics, and
flags::INT64is set in four other places), and every SM 6.6 host has it. Merging would retranslate about 9,800 title sites, turning each native 64-bit shift into about ten 32-bit operations, and add a near-copy ofsrc64. If the project ever decides that emitted DXIL must avoid Int64, this is a correct starting point.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed