Shaders: mesh lane permutations within runs of 8 and 16 lanes #2255
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!2255
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2255/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?
@Mericas77 on GitHub · 2026-11-25 09:00 UTC · original
feat/mesh-lane-runs→main· +344 −16 · 2 files · 1 commits · closed without mergingMesh 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.
@Dathinel on GitHub · 2026-11-25 09:17 UTC · original
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.@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
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).
@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_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
@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.
Pull request closed