Shaders: bitwise wave prefixes as WaveMultiPrefixOp #1328
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!1328
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1328/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?
@paulomatias97-create on GitHub · 2026-11-24 17:28 UTC · original
paulomatias97-create:shader/bitwise-wave-prefix→main· +137 −1 · 2 files · 1 commits · closed without mergingA whole-wave section the simulation finds to be an OR, AND or XOR prefix failed the translation ("a wave prefix of an operation other than a sum"). DXIL has no plain bitwise prefix, but WaveMultiPrefixOp over one partition holding every active lane is one: exclusive, with the identity in the first lane, the lane's own value joined for an inclusive prefix. Inactive lanes already hold the identity. Minimum and maximum prefixes still fail, now under their own reason.
Claude-Session: https://claude.ai/code/session_01CL4QZxTrzfn3nkthzLyAtV
A whole-wave section the simulation finds to be an OR, AND or XOR prefix failed the translation ("a wave prefix of an operation other than a sum"). DXIL has no plain bitwise prefix, but WaveMultiPrefixOp over one partition holding every active lane is one: exclusive, with the identity in the first lane, the lane's own value joined for an inclusive prefix. Inactive lanes already hold the identity. Minimum and maximum prefixes still fail, now under their own reason. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CL4QZxTrzfn3nkthzLyAtV@sinan-cmyk on GitHub · 2026-11-25 02:09 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
9182328ontomainffe310e(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: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 02:35 UTC · original
Automated triage for the maintainers.
Recommended for a maintainer's look. In
Lower's wave-reduction lowering (emit/lower.rs), OR/AND/XOR prefixes now lower toWaveMultiPrefixOp(DXIL op 166) instead of failing. They use one partition mask taken fromWaveActiveBallot(true)(op 116), and the lane's own value is joined for an inclusive prefix. I checked the op numbers, argument order and op kinds (And=1, Or=2, Xor=3) against the public DXIL operation list. A single all-active-lanes partition gives an exclusive prefix with the identity in the first lane, inactive lanes already hold the identity through the existingselect, and mesh programs still refuse prefixes earlier in the function. The new test inemit/mod.rschecks that the simulation sees the OR prefix and that the output validates. A GPU readback test comparing against the expected prefix would make it stronger. No CI ran on this head; a contributor reportsvictory-shadertests passing on an RTX 4070 SUPER.Generated by Claude Code
@Marvisak on GitHub · 2026-11-25 22:00 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 the emitted code cannot be used on the hosts tested. A GPU readback of this PR's own test program (
or_prefix_cs) failed at pipeline creation both times on an RX 6700 XT with the device removed, and WARP refused it withE_INVALIDARG. A control with the threev_or_b32turned into adds, which takesmain'swavePrefixOppath, built every time and returned the right prefix sums. No title program is refused for this reason onmaineither.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