Translate 40 more shaders, and build the upscaler's compute shaders five times faster in the driver.

The SM86 lowering now takes MEMBAR (as Maxwell MEMBAR.GL), drops ERRBAR, takes F2I of an immediate and MATCH.ALL.U64,
and finds a switch's jump table bound past the BSSY the compiler puts between the IMNMX and the shift: three vertex
shaders, one of them drawn in Kokiri Forest, were skipped for it. A task program and the mesh programs it feeds whose
payload size field reads 0 (it counts 256-byte units) get one unit. Of the 42,177 programs, 31 still fail, all modes
whose meaning is not certain.

Translator patch 0035 inlines SHFL.IDX over the whole warp (mask 0x1f) on a 32-lane host as the subgroup shuffle,
instead of a call to the general shuffle helper. The tensor lowering shuffles thousands of times per program and the
driver inlined the helper at each call: a mid-size upscaler shader built in 185 s before and in 34 s now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 00:33:48 -05:00
parent 96b6e04937
commit 936dd8094a
4 changed files with 75 additions and 8 deletions

View File

@@ -181,6 +181,10 @@ static class SwshXlate
MaxPrimitives = (int)mj["maxp"], Topology = (int)mj["topo"], PayloadBytes = (int)mj["payload"],
HasTask = mj["task"] is JsonValue tv && tv.TryGetValue<bool>(out bool tb) && tb,
};
// The size field counts 256-byte units, and some task programs and the mesh programs they feed
// carry 0 there while the payload is used (the task writes the mesh count at +4, the mesh reads
// ISBERD region 7 at 0x10 and 0x14): a payload under 256 bytes rounds down. One unit covers it.
if ((mesh.Stage == 6 || mesh.HasTask) && mesh.PayloadBytes == 0) mesh.PayloadBytes = 256;
code = AmpereLowering.Lower(code, size, false, out int meshLocal, null, mesh);
if (meshLocal != 0) job["local_mem"] = meshLocal;
job["local"] = new JsonArray(mesh.Threads, 1, 1);