Shaders: mesh lane permutations within runs of 8 and 16 lanes #2255

Closed
github-bot wants to merge 1 commit from gh-pr/2255/head into gh-pr/2255/base
Owner

@⁠Mericas77 on GitHub · 2026-11-25 09:00 UTC · original
feat/mesh-lane-runs → main · +344 −16 · 2 files · 1 commits · closed without merging

Mesh programs using DPP8, DPP16 row patterns or ds_swizzle_b32 bit-mask swizzles beyond quads currently stop with a cross-lane operation in a mesh shader (seen in #293, #769, #778).

Change

  • lane_block gives the aligned run a permutation reads within: quad (4), DPP8 and row_half_mirror (8), row shifts / row_ror / row_mirror / row_share / row_xmask (16), bit-mask swizzles by the bits they touch.
  • Mesh programs with such permutations number their threads by host lane (waveReadLaneFirst of the flat id rounded down to WaveGetLaneCount, plus the lane index), the same bijection thread_id uses for compute's console lanes. A run of console lanes is then a run of host lanes, and each lane reads its source with waveReadLaneAt inside its run.
  • Runs of up to 16 lanes are accepted (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 on 940d32f. The same 3 known NVIDIA failures on both (two stride_tests, gathers_at_a_level); +2 are the new tests.

AI-assisted.

**@⁠Mericas77** on GitHub · 2026-11-25 09:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2255) `feat/mesh-lane-runs` → `main` · +344 −16 · 2 files · 1 commits · closed without merging Mesh programs using DPP8, DPP16 row patterns or `ds_swizzle_b32` bit-mask swizzles beyond quads currently stop with `a cross-lane operation in a mesh shader` (seen in #293, #769, #778). ## Change - `lane_block` gives the aligned run a permutation reads within: quad (4), DPP8 and `row_half_mirror` (8), row shifts / `row_ror` / `row_mirror` / `row_share` / `row_xmask` (16), bit-mask swizzles by the bits they touch. - Mesh programs with such permutations number their threads by host lane (`waveReadLaneFirst` of the flat id rounded down to `WaveGetLaneCount`, plus the lane index), the same bijection `thread_id` uses for compute's console lanes. A run of console lanes is then a run of host lanes, and each lane reads its source with `waveReadLaneAt` inside its run. - Runs of up to 16 lanes are accepted (`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 on 940d32f. The same 3 known NVIDIA failures on both (two stride_tests, gathers_at_a_level); +2 are the new tests. AI-assisted.
DPP8, DPP16 row patterns and ds_swizzle_b32 bit-mask swizzles that stay
within aligned runs of up to 16 lanes no longer stop mesh programs with
"a cross-lane operation in a mesh shader". Mesh threads that use them
are numbered by their host lane (as compute's console lanes are), so a
run of console lanes is a run of host lanes on any host wave of 16 lanes
or more, and each lane reads its source through waveReadLaneAt.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:59:59 +00:00
github-bot closed this pull request 2026-11-26 04:59:59 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 09:17 UTC · original

Tested this head (72b8fa5) together with #2245 (2e26c46), from 940d32f. 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 --lib run: 246 passed, 3 ignored, 3 failed. I reran those three failures (two heap-buffer stride cases and the gather-at-level case) on 940d32f; all three also failed there. AI-assisted, synthetic fixtures only.

**@⁠Dathinel** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2255#issuecomment-7158142401) Tested this head (72b8fa5) together with #2245 (2e26c46), from 940d32f. 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 --lib` run: 246 passed, 3 ignored, 3 failed. I reran those three failures (two heap-buffer stride cases and the gather-at-level case) on 940d32f; all three also failed there. AI-assisted, synthetic fixtures only.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 10:33 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 72b8fa5b onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 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).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 10:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2255#issuecomment-7159852199) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 72b8fa5b onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:32 UTC · original

Automated triage for the maintainers.

Needs work. The change lets mesh programs use DPP8/DPP16 row patterns and bit-mask ds_swizzle_b32 within runs of up to 16 lanes (lane_block, Lower::mesh_block, Lower::mesh_read) by renumbering mesh threads by host lane in Lower::mesh_thread. The DPP control ranges in lane_block match the RDNA 2 encodings, the hardware test checks the lanes read, CI check passes 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 as main and no program changing its failure reason, so none of the mesh programs that stop at a cross-lane operation in a mesh shader today 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

**@⁠Marvisak** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2255#issuecomment-7163921987) <!-- victory-triage v1 head=72b8fa5b7596272a46b75ea2b8c96defe4544bae verdict=needs-work at=2026-11-25T13:46:00Z --> Automated triage for the maintainers. **Needs work.** The change lets mesh programs use DPP8/DPP16 row patterns and bit-mask `ds_swizzle_b32` within runs of up to 16 lanes (`lane_block`, `Lower::mesh_block`, `Lower::mesh_read`) by renumbering mesh threads by host lane in `Lower::mesh_thread`. The DPP control ranges in `lane_block` match the RDNA 2 encodings, the hardware test checks the lanes read, CI `check` passes 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 as `main` and **no program changing its failure reason**, so none of the mesh programs that stop at `a cross-lane operation in a mesh shader` today 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](https://claude.ai/code)_
Author
Owner

@⁠Mericas77 on GitHub · 2026-11-25 15:44 UTC · original

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.

**@⁠Mericas77** on GitHub · 2026-11-25 15:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2255#issuecomment-7167285372) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2255
No description provided.