Shaders: lower 64-bit shifts without INT64 #2133
No reviewers
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!2133
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2133/head"
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?
@scoresby13 on GitHub · 2026-11-25 05:46 UTC · original
scoresby13:shader/shift64-no-int64→main· +325 −21 · 2 files · 1 commits · closed without mergingSummary
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.
@sinan-cmyk on GitHub · 2026-11-25 08:24 UTC · original
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).
@Marvisak on GitHub · 2026-11-25 10:49 UTC · original
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
@Marvisak on GitHub · 2026-11-25 22:05 UTC · original
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