Shaders: mesh lane permutations within runs of 8 and 16 lanes #2253
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2255"
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 Mericas77 on 2026-11-25T09:00:29Z.
Mesh programs using DPP8, DPP16 row patterns or
ds_swizzle_b32bit-mask swizzles beyond quads currently stop witha cross-lane operation in a mesh shader(seen in #293, #769, #778).Change
lane_blockgives the aligned run a permutation reads within: quad (4), DPP8 androw_half_mirror(8), row shifts /row_ror/row_mirror/row_share/row_xmask(16), bit-mask swizzles by the bits they touch.waveReadLaneFirstof the flat id rounded down toWaveGetLaneCount, plus the lane index), the same bijectionthread_iduses for compute's console lanes. A run of console lanes is then a run of host lanes, and each lane reads its source withwaveReadLaneAtinside its run.MESH_BLOCK); wider ones are still refused, since the translation does not know the host's wave size and the shader cache does not key on it. Mesh programs without such permutations are unchanged.Tests
mesh_permutes_in_runs_of_16_lanes_translate: six permutations (DPP8 reversed, row_mirror, row_half_mirror, row_xmask:9, row_ror:3, swizzle SWAP 8) translate and pass dxil.dll; SWAP 16 is still refused.mesh_permutes_read_the_console_lanes: a 64-thread mesh draw where each lane culls its triangle when it read the expected lane; nothing must be lit, and a control comparing with the lane's own index must light all 256 texels. Skipped on devices with waves under 16 lanes.RTX 4070 (driver 621.01, Windows 11), on
940d32f:hardware: mesh permutes read the console lanes (waves of 32-32 lanes); WARP skipped (waves of 4 lanes).cargo test -p victory-shader --locked: 246 passed, 3 failed, vs 244 passed, 3 failed on940d32f. The same 3 known NVIDIA failures on both (two stride_tests, gathers_at_a_level); +2 are the new tests.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:23:36Z.
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 mesh— 7 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean lowering of mesh lane permutations within 8- and 16-lane runs, verified end-to-end on hardware and WARP. Looks great.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:43:10Z.
Review: APPROVED
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 145 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — mesh lane permutations within runs of 8/16, +1 test.Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T09:17:57Z.
Tested this head (
72b8fa5) together with #2245 (2e26c46), from940d32f. They conflict in the mesh emitter and test builders. Keeping both emitter fields and initializers, plus the two builders as separate helpers, let both sets of tests run.For the interaction test I extended
permute_mesh: first export an always-culled triangle, then export the lane-selected triangle with all three edge flags set. On wave32 hardware the expected permutation lit 0/256 pixels and the own-lane control lit 256/256. WARP drew the standalone edge-flag test but skipped the permutation test (4-lane waves; 16 required).Full combined
victory-shader --librun: 246 passed, 3 ignored, 3 failed. I reran those three failures (two heap-buffer stride cases and the gather-at-level case) on940d32f; all three also failed there. AI-assisted, synthetic fixtures only.Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T10:33:09Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
72b8fa5bontomain940d32f(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-25T13:32:20Z.
Automated triage for the maintainers.
Needs work. The change lets mesh programs use DPP8/DPP16 row patterns and bit-mask
ds_swizzle_b32within runs of up to 16 lanes (lane_block,Lower::mesh_block,Lower::mesh_read) by renumbering mesh threads by host lane inLower::mesh_thread. The DPP control ranges inlane_blockmatch the RDNA 2 encodings, the hardware test checks the lanes read, CIcheckpasses and it merges cleanly. The problem is value: a tester's offline run over the title's shader corpus found the same 23,918 validated programs asmainand no program changing its failure reason, so none of the mesh programs that stop ata cross-lane operation in a mesh shadertoday is unlocked; the patterns they use are evidently outside these runs. What would change the verdict: show which refused mesh programs this translates (count of that failure reason before/after), or extend it to the patterns they actually use. The relabelling also assumes each host wave holds an aligned run of flat thread ids, which is worth a sentence of evidence.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Mericas77 on 2026-11-25T15:44:26Z.
Thanks for the triage, that's a fair call. I don't have a shader corpus to produce the before/after refusal counts, and from what I could see the game's mesh programs are wave64 and use cross-lane patterns outside these ≤16-lane runs, so this change wouldn't unlock any of them as-is. Extending it to the patterns actually used isn't something I can validate without the corpus, so I'm closing this rather than leaving it open. Happy to pick it back up if someone with the corpus finds a case it helps.
Pull request closed