xshader: execute proven nonuniform readlane loops as paired waves #492
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/492"
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 MathiewMay on 2026-11-29T16:05:40Z.
Summary
Select existing paired-wave execution for constant lane reads in proven whole-wave64 compute loops that the ordinary path cannot establish as workgroup-convergent. One paired host wave follows one console wave's scalar PC; adjacent waves may take different trip counts without inventing group-wide convergence.
Keep the ordinary proof and its refusals unchanged: complete wave64 groups, supported constant lane reads, valid instruction targets, no indirect PC transfers, no branch bypassing a group barrier, no barrier inside a backward span, and no interleaved loops for automatic selection. Early termination is accepted only after the final group barrier. Ambiguous widths, partial waves and unsafe rendezvous remain refused.
Review revision: retain runaway protection
Addresses the requested high loop limit. Both paired structured loops and paired block dispatch retain a shared 2^24 (16,777,216) watchdog ceiling. Valid loops may exceed the old 65,536 limit, while a translation bug no longer has an entirely unbounded execution path. This is a safety ceiling, not a measured maximum title workload or a guarantee against driver timeouts.
Dispatch uses its own
tb_dispatch_guard, including from nonzero entries, so it cannot redeclare or consume a preceding structured loop'stb_guard. The ordinary 65,536-loop / 1,000,000-dispatch guards and existing ordinary-path exemptions are unchanged. The dispatcher counts passes through its block tests, which may follow several forward blocks in one pass.Tests
fa1b9cf6control: 3 behavior regressions fail / 1 negative control passes.d4ec835d: 3 watchdog assertions fail / 4 controls pass. These cover structured loops, block dispatch and dispatch from a nonzero entry. Corrected focused tests: 7/7 pass, including unchanged ordinary guards.python tuxbox.py check --no-gpu: all seven groups passed.Final revision is
66a2977don the originald4ec835d, with upstream baselinefa1b9cf6. Native providers remain unchanged and separately pinned to that baseline; compiler/helpers are built from this exact immutable source. Original artifacts and public-head backup refs are preserved.The GPU checker exercises normal automatic translation as well as the explicit paired API: SCC/VCC loops, different trip counts in adjacent waves, shared-memory rendezvous, empty/full/sparse EXEC, nested masks, early exits and the retained >65,536-trip case. Outputs are compared word-for-word with an independent instruction/group model and a separately checked arithmetic oracle for the long loop. No deliberately endless GPU workload was launched to test the watchdog.
The host-profile record adds
readlane-loop-two-wavesfor all three profiles. The review revision regenerates its three hashes and the two paired waterfall / two paired dispatcher hashes because the high watchdog changes their emitted HLSL. Ordinary translations remain recorded unchanged.No new Lanes scenario: exact scalar branch/readlane encodings, divergence between waves and long trip counts are exercised directly in the synthetic translator fixture; existing Lanes suites provide integration coverage. No title shaders or captures are included.
The wrappers pin immutable source/helpers/providers by SHA, run sequentially in an authenticated hidden/offline display, and reuse the stopped fixture prefix without copies. No retail launch or retail rendering/performance claim.
Local GPU/backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, GE-Proton11-14 on Linux.
Maintainer NVIDIA results cover the previous uncapped #493 stack, on
mainat065a7f9a: RTX 4070 Ti SUPER (10de:2705), driver 620.x, GE-Proton11-14; 65/65 translator groups and 72 paired programs / 4,718,592 words / zero mismatches. They do not cover this watchdog revision. Updated NVIDIA confirmation remains outstanding before merge; no local NVIDIA run is claimed.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T16:23:03Z.
Thanks. This covers the wave64 lane-read loops that are one of our bigger groups of refused programs in GTA VI. One change before we merge, please. It applies to #493 too, since that one is stacked on this.
Please keep a limit on paired loops and the block dispatcher, set high, rather than removing it. I agree valid guest work ends by its own PC and conditions. The limit is there for when the translation is wrong: a bug that makes a loop endless then stops the dispatch, instead of running until the driver's timeout resets the device and takes the game with it. Your >65,536-trip case shows the old cap was too low for real work. A cap far above anything a title plausibly runs (for example 2^24 iterations or blocks) would keep that case working and still bound a runaway loop. If you'd rather tie it to something measured, that's fine too. The point is not to have none.
We'll run the NVIDIA side of the translator GPU checks on #493, which contains this commit, and post the results here.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T16:31:21Z.
NVIDIA results, as promised. Tree:
mainat065a7f9awith #493 merged on top, so this commit is included. RTX 4070 Ti SUPER (10de:2705, 620.x), GE-Proton11-14,tools/check_translator_gpu.pyfull suite:paired-wave64: 72 programs, 4,718,592 words compared, 0 mismatches (the same set as your AMD run, including the six new scan variants from #493).lockstep576 cases,readlane20/21 (the 64-lane case doesn't run: this host has no 64-lane waves), and all tenwave-guardgroups pass.So the only thing left before merging, for both PRs, is the loop limit from my comment above.