Shaders: with pair meetings, a lane mask joined with a number is exchanged where the mask is written (on #3683) #3823
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3823"
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 redNSF on 2026-11-29T06:45:30Z.
Stacked on #3683 (pair meetings, itself on #439); the last commit is this change. It does not depend on #3759 (also on #3683); the two merge without conflicts.
Problem. A register that holds a lane mask on one way and a number on another is a number after the join, and the join takes the mask's number along its edge (
fill_phis, "a lane mask joined with data at a join every lane enters along one edge"). The joins are filled in when no block is being lowered any more. With pair meetings the two halves of a console wave meet only in the block being lowered, so the exchange of the mask's two words was made behind the last block lowered, the program's end, after the join that reads it.defs_dominate_usesthen refuses the program: "a value used before the meeting of the halves that makes it".Change. Such a mask is exchanged in the block that writes it, right after the instruction (at the top of the block for a mask that is itself a join). The exchanged words are then made on every way to the join and kept for the whole program, as when an instruction of that block reads the mask as a number. The lowering finds these masks where it did, when it fills the joins, and lowers the program once more with them (
Stop::Exchange, besideStop::Retry); a program without such a join is lowered exactly as before. Both halves run the block that writes the mask, so they meet in step.Effect. Grand Theft Auto VI,
translate --list --host-lanes 32-32: compute programs that translate go from 2,619 (#3683) to 2,621 of 2,682; none are lost. The two gained are the two refused for this reason:cascadeshadows_rendering:CS_ShadowRenderTiledCascadesAlphaCBPPPCandCS_ShadowRenderTiledMiscAlphaPPPC. With #3759 merged in as well: 2,626.Tests (RTX 3060, 32-lane waves only):
a_mask_joined_with_a_number_translates_with_pair_meetings: a group of four console waves in which s[12:13] holds a number in the odd console waves and a 64-bit lane mask in the even ones (a compare the odd waves branch around), joined and read as a number. It translates; without this change it is refused with the reason above. Runs anywhere.a_mask_joined_with_a_number_is_the_console_waves_mask: that program on a 32-lane hardware adapter (skipped elsewhere): every thread of an even console wave stores its wave's mask, both dwords (one mask has lanes of both halves), every thread of an odd one the number.cargo test -p victory-shader --libon WARP: the same 4synthetic_testsfail here as on #3683 alone. The pair meeting tests pass on the card.Not run in the title yet: this PR claims that the two programs translate and that the join behaves as the test checks on this card.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-29T17:17:11Z.
AMD run on a Radeon 780M (RDNA3, wave32 and wave64), #3823 + #3824 + #3830 merged together (they merge clean) onto main
63bcca4,cargo test --profile diag -p <crate> --locked --lib:No regressions on AMD, and the pair-meeting tests pass on a card that can also run the console's wave64 natively. #3822 takes the other approach to the same problem and also passes everything here (340 / 232); the two conflict, so this is just data for choosing.
AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.