xshader: read a raw buffer only in lanes inside EXEC #386
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/386"
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-28T09:20:04Z.
Summary
A raw buffer load that has no index register (
OFFEN, or a constant offset) was emitted for every lane. On the console a lane outside EXEC performs no memory access, and its address register can hold any value. Through a root SRV, which has no bounds, the host read wherever that value pointed. Indexed raw loads already tested the lane's EXEC bit; this makes every raw load do so (tools/shader-compiler/src/hlsl/emitter/buffer.rs). Stores already did.ProjectScarlett's skinned mesh programs hit this at the first cinematic. They divide by a meshlet count, which leaves the reciprocal
0xFFFFFF00 / nin a VGPR, then narrow EXEC to the meshlet's vertices and load at a byte offset that only those lanes compute. The other lanes read the root SRV at+0x7ffff000(n = 2),+0x2aaaa000(n = 6) or+0x11111000(n = 15) and faulted the GPU. The fault address in each run was the first unfinisheddispatch_mesh's root descriptor plus one of those values.In game I tested this on
c05ce00together with other fixes of mine, not on this branch alone. Before it, all 7 crash logs with a fault address showed this pattern; in the 14 runs since, no fault had it.#320's "Known issue" describes TCP read faults at title addresses at world entry. It may be this fault; it could be worth trying #320 with this change.
Tested
Not a Lanes scenario: without the change, the failure is a GPU page fault in another lane's read, which would reset the GPU running the check. Two unit tests in
tools/shader-compiler/src/tests/hlsl/raw_width.rscover the emitted code, and both fail onmain:raw_loads_read_only_for_lanes_in_exec: abuffer_load_dwordx4without an address register, withOFFEN, withIDXEN, and with both. Every load sits behind an EXEC test.a_stale_address_outside_exec_is_never_read: the ProjectScarlett pattern above, encoded withllvm-mc -mcpu=gfx1030: an address only lanes in EXEC compute, and a root SRV.The translator's GPU checks (59, including
buffer-loads) and the Lanes suites run the changed loads on the GPU.GPU, driver and backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, Linux 7.3, GE-Proton11-14 (
--backend proton).Commands run and their results:
The translator checks ran outside their Bubblewrap/
xvfb-runsandbox, which stalls on this machine (it has no Xvfb).Checks
No evidence JSON changes. The recorded host-profile outputs (
host_profiles.txt) do not change.