xshader: read structured, typed and image resources only in lanes inside EXEC #408

Merged
NickStallman merged 1 commit from upstream-pr/408 into main 2026-11-29 01:31:41 +00:00
NickStallman commented 2026-11-28 18:49:45 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T18:49:45Z.


Summary

#386 made every raw buffer load test the lane's EXEC bit. Structured and typed buffer loads, and image loads, still read for every lane; only the write of the result was masked.

On the console, a lane outside EXEC performs no memory access, and its index, offset and coordinate registers can hold any value. In ProjectScarlett's skinned mesh programs they hold values left over from other meshlets.

Each such load now reads into a zeroed temporary under if (exec_lo & 1u), as raw loads and every store already do. That covers structured buffer loads (dword, multi-dword and sub-word), typed buffer loads (stbN[i]), and image loads from tables and the heap. Sampling is unchanged, because its derivatives need the whole quad.

Where this came from. In ProjectScarlett on an RTX 5090, a world-entry GPU timeout (Xid 109, #232) was traced with per-wave mesh progress markers.

  • One group of MSNC_VS_TransformSkinD never reached its next group rendezvous.
  • Every read before that point ran in lanes outside EXEC: structured buffer records indexed by vertex registers, and a heap image_load at a computed texel.

This change does not show that one of those reads stalled. It makes the translation do what the console does. Whether it removes that hang is being tested in game and will be reported on #232.

Effect on recorded ProjectScarlett requests:

  • 40,066 requests translate, and none changes between success and refusal.
  • 32,562 translations change: 15,856 of 19,795 mesh, 10,605 pixel, 4,061 compute and 2,040 vertex.
  • They compile with DXC 1.8.2505: all 15,856 changed mesh programs, plus a sample of 150 each of the changed pixel, compute and vertex programs.

Tested

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both

New translator tests (tests/hlsl/exec_gated_loads.rs), all three failing without the change:

  • image loads;
  • structured buffer loads;
  • typed buffer loads.

The existing GPU translator suite, including buffer-loads, image-ops, translated-mesh, raw-index and descriptor-size, passes 60 of 60 on both cards.

GPU, driver and backend:

  • RTX 5090 (10de:2b85), NVIDIA 620.70.10
  • AMD Raphael iGPU (1002:13c0), Mesa RADV 26.0.8
  • both on GE-Proton11-14

Commands run and their results:

python tuxbox.py check --adapter 10de:2b85 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64
python tuxbox.py check --adapter 1002:13c0 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64
  both cards: all 11 steps passed, including Lanes and fixtures on the GPU,
  D3D12 regression controls and Shader translator on the GPU
cargo test (tools/shader-compiler): 528 passed

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5543487076 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/408). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-28T18:49:45Z. --- ## Summary #386 made every raw buffer load test the lane's EXEC bit. Structured and typed buffer loads, and image loads, still read for every lane; only the write of the result was masked. On the console, a lane outside EXEC performs no memory access, and its index, offset and coordinate registers can hold any value. In ProjectScarlett's skinned mesh programs they hold values left over from other meshlets. Each such load now reads into a zeroed temporary under `if (exec_lo & 1u)`, as raw loads and every store already do. That covers structured buffer loads (dword, multi-dword and sub-word), typed buffer loads (`stbN[i]`), and image loads from tables and the heap. Sampling is unchanged, because its derivatives need the whole quad. **Where this came from.** In ProjectScarlett on an RTX 5090, a world-entry GPU timeout (Xid 109, #232) was traced with per-wave mesh progress markers. - One group of `MSNC_VS_TransformSkinD` never reached its next group rendezvous. - Every read before that point ran in lanes outside EXEC: structured buffer records indexed by vertex registers, and a heap `image_load` at a computed texel. **This change does not show that one of those reads stalled.** It makes the translation do what the console does. Whether it removes that hang is being tested in game and will be reported on #232. **Effect on recorded ProjectScarlett requests:** - 40,066 requests translate, and none changes between success and refusal. - **32,562 translations change:** 15,856 of 19,795 mesh, 10,605 pixel, 4,061 compute and 2,040 vertex. - **They compile with DXC 1.8.2505:** all 15,856 changed mesh programs, plus a sample of 150 each of the changed pixel, compute and vertex programs. ## Tested - [x] The checks relevant to this change passed - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below - [x] Where the table calls for AMD and NVIDIA, they passed on both **New translator tests** (`tests/hlsl/exec_gated_loads.rs`), all three failing without the change: - image loads; - structured buffer loads; - typed buffer loads. The existing GPU translator suite, including `buffer-loads`, `image-ops`, `translated-mesh`, `raw-index` and `descriptor-size`, passes 60 of 60 on both cards. GPU, driver and backend: - RTX 5090 (10de:2b85), NVIDIA 620.70.10 - AMD Raphael iGPU (1002:13c0), Mesa RADV 26.0.8 - both on GE-Proton11-14 Commands run and their results: ```text python tuxbox.py check --adapter 10de:2b85 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64 python tuxbox.py check --adapter 1002:13c0 --proton GE-Proton11-14 --prefix PREFIX --windows-dxc DXC/bin/x64 both cards: all 11 steps passed, including Lanes and fixtures on the GPU, D3D12 regression controls and Shader translator on the GPU cargo test (tools/shader-compiler): 528 passed ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!408
No description provided.