xshader: hide the lane number of mesh programs that vote (workaround) #473
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/473"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T13:20:23Z.
Summary
On an RTX 5090 (driver 620.70.10) some 32-lane waves of a 128-lane mesh group can get wrong register values in programs that vote over the group (#458). Such a program now makes its lane number as
SV_GroupIndex ^ (SV_GroupID.x >> 16). A D3D12 dispatch dimension is at most 65,535, so the value does not change. Two instructions per program, no resource.This is a workaround. The cause is not known. It replaces #459, which is closed (below).
What was measured
Reduced shader, plain Vulkan (no D3D12, vkd3d-proton or Wine), 64 edits of it, 45 wrong on the 5090:
In the wrong edits looked at (up to eight modules),
index >> 5is the use that decides: hidden there alone the module is right, hidden in every other use it is wrong. In some modules hiding another single use also makes it right. The range does not matter (masked to 127 is as good) and the low bits do not. The reading that fits is that the compiler recognisesindex >> 5; that is an inference.Translated programs, every export against the compute form: three that are wrong as they are on the 5090 are right with the change, and all are right on AMD.
Random sample of the voting programs (fixed seed, 150, 30 from each of five size classes, none of them used to find or tune this). Each ran as mesh against the same program as compute: counts, indices and up to 58 vertex words of every lane, up to 12 vertex counts, three groups. 148 could be built.
No program became wrong. One more (the largest) had its root signature refused on both cards, and two used a resource kind the test does not support. By size class the wrong ones are 5, 10, 12, 16 and 5 of about 30. The wrong lanes lie in 0..31 in 27 programs, within 0..63 in 14, and elsewhere in 7 (64..95 alone in 3), so it is not only the first wave. 146 of the 147 have lanes that produce vertices.
Limits of that test: inputs are random, textures and heap resources are stubs, every buffer is a sized descriptor (which changes the code), and primitive attributes are not compared. 0 of 48 leaves room for a failure rate of up to about 6% among programs like these (95%).
Why not #459
Selects in place of the branches made 45 of 45 right, but so did as many selects on other values with the branches kept, and four more live values. So that was a perturbation. It also makes programs wrong: two copies of one recorded program that is right on the 5090 as translated are wrong (906 lanes) in #459's form, and right with this one.
Tested
Survey of 47,508 recorded requests, main (
6e2c5dab) and this change: 13,858 of 19,872 mesh programs changed, all of them vote; 0 other programs; 0 newly refused.DXC 1.8.2505.1, 600 of the changed programs at random and the 10 largest: 0 errors; +0.03% instruction lines (2 per program), +0.01% bytes, the same phis, branches, selects and barriers; 169.7 and 167.5 s.
python tuxbox.py check --no-gpupassed. The unit test fails with the change off, and with it applied to programs that do not vote.Full
tuxbox.py checkata65c5c45: RTX 5090 (620.70.10) 187 pass, 0 fail; AMD iGPU (RADV) 186 pass, 0 fail, guest-present-4k-splash skipped (software display). A game run on an RTX 5090, in a build with this (and #463, #461, #441, #390, #468 and diagnostics onmain6e2c5dab; warm caches, cold mesh pipelines): it ran about 700 s after the story started loading and ended in an Xid 13. The loading art was still up 160 to 230 s in, so the scene was on screen for roughly the last 8 minutes, with characters drawn (an earlier version of this text said 700 s). One run, and the build differs from earlier ones in several ways, so it shows the change works in the game, not that the game got further because of it. No game run compares it alone.Not measured or unexplained
🤖 Generated with Claude Code