shader: treat a mesh uniform-address buffer load in an entered lane skip as uniform (Part of #3703) #3957

Open
github-bot wants to merge 1 commit from github-bot/gh-3955 into main AGit
Owner

@⁠mumba17 on GitHub · 2026-12-03 17:42 UTC · original
mumba17:shader/mesh-skip-uniform-buffer-load → main · +23 −1 · 2 files · 1 commits · open

Part of #3705 (R1, v_readfirstlane_b32; claim: #3705).

Problem

#3792 marks a buffer load at a uniform address (no OFFEN, uniform IDXEN index, constant or uniform SOFFSET) as uniform, so a following v_readfirstlane_b32 reads the loaded word directly. Under a narrowed EXEC it did so only for a whole-wave skip (whole_wave_execution()). Inside an entered per-lane EXECZ skip the load lost the proof, and the read needed the groupshared broadcast, which cannot run inside a per-lane skip. It was refused with unsupported mesh instruction or EXEC state: v_readfirstlane_b32.

Change

mark_uniform_buffer_load also records the loaded words in active_uniform for the current lane set inside an entered EXECZ skip (exec_skip->guard == lane_active). That is the same term #3947 added for uniform-address scalar loads. Each thread that runs the load there is an active guest lane reading the same address, so every active lane sees the same words. The buffer-load rule's other conditions are unchanged: no open branch, and the uniform-address checks of #3792. Readers of active_uniform match the lane set, so the proof does not survive a further narrowing or a restore. The heap typed-load path is not changed.

Tests (native_direct_mesh)

  • uniform-load-in-lane-skip: buffer_load_dword v6, off, s[24:27], 0 offset:20 inside a per-lane v_cmpx_eq_u32 skip with s_cbranch_execz, then v_readfirstlane_b32 s20, v6 and v_cvt_f32_u32 v1, s20. It translates with no meshReadFirstLane slot, and the conversion reads the loaded word directly.
  • uniform-load-offen-in-lane-skip: the same with a per-lane OFFEN address. Still refused.
  • Mutation check: with the source change reverted, uniform-load-in-lane-skip fails with the v_readfirstlane_b32 refusal.

Census

Our native Mesh86 capture (RTX 3090, 600 s): 6,685 distinct .m86 programs, each run once through compile_dxil … gfx1013-container-ms-texture-heap.

  • main 8cb022db: 2,163 translate. With this change alone: 2,163, and no program's first refusal changes. The programs it helps stop earlier on main, at the SDWA v_cmpx_lt_u32 that #3949 lowers.
  • main 8cb022db + #3949: 2,163 translate; 276 stop at a v_readfirstlane_b32 of such a load inside a per-lane skip.
  • main 8cb022db + #3949 + this change: 2,292 translate (+129), 0 lost. All 276 move off v_readfirstlane_b32: 129 translate, and the rest stop at unproven packed mesh signature rows 43, v_cvt_f32_f16 24 (C1), mesh SAVEEXEC else arm is not vector-only 22, unsupported packed vertex export 20, mesh EXEC write inside a lane-skip block 18, unbound numeric SGPR 16, heap-slot provenance 2, mesh SAVEEXEC then arm lacks an EXECZ skip 2. No other program changes.

Counts only; request bytes stay local.

Checks

Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100. ctest --preset pr on this commit (on main 8cb022db): 349/351 pass, native_direct_mesh included. The two local failures, native_compute_implicit_lod_controls and native_wave_virtual_derivative_controls, are the local SDK validator 1.7 vs DXIL 1.8 and fail on main too.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠mumba17** on GitHub · 2026-12-03 17:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3955) `mumba17:shader/mesh-skip-uniform-buffer-load` → `main` · +23 −1 · 2 files · 1 commits · open Part of #3705 (R1, `v_readfirstlane_b32`; claim: https://git.gtahub.st/github/R0Y00--Xbox2Windows/issues/3705). ## Problem #3792 marks a buffer load at a uniform address (no OFFEN, uniform IDXEN index, constant or uniform SOFFSET) as uniform, so a following `v_readfirstlane_b32` reads the loaded word directly. Under a narrowed EXEC it did so only for a whole-wave skip (`whole_wave_execution()`). Inside an entered per-lane EXECZ skip the load lost the proof, and the read needed the groupshared broadcast, which cannot run inside a per-lane skip. It was refused with `unsupported mesh instruction or EXEC state: v_readfirstlane_b32`. ## Change `mark_uniform_buffer_load` also records the loaded words in `active_uniform` for the current lane set inside an entered EXECZ skip (`exec_skip->guard == lane_active`). That is the same term #3947 added for uniform-address scalar loads. Each thread that runs the load there is an active guest lane reading the same address, so every active lane sees the same words. The buffer-load rule's other conditions are unchanged: no open branch, and the uniform-address checks of #3792. Readers of `active_uniform` match the lane set, so the proof does not survive a further narrowing or a restore. The heap typed-load path is not changed. ## Tests (`native_direct_mesh`) - `uniform-load-in-lane-skip`: `buffer_load_dword v6, off, s[24:27], 0 offset:20` inside a per-lane `v_cmpx_eq_u32` skip with `s_cbranch_execz`, then `v_readfirstlane_b32 s20, v6` and `v_cvt_f32_u32 v1, s20`. It translates with no `meshReadFirstLane` slot, and the conversion reads the loaded word directly. - `uniform-load-offen-in-lane-skip`: the same with a per-lane OFFEN address. Still refused. - Mutation check: with the source change reverted, `uniform-load-in-lane-skip` fails with the `v_readfirstlane_b32` refusal. ## Census Our native Mesh86 capture (RTX 3090, 600 s): 6,685 distinct `.m86` programs, each run once through `compile_dxil … gfx1013-container-ms-texture-heap`. - `main` `8cb022db`: 2,163 translate. With this change alone: 2,163, and no program's first refusal changes. The programs it helps stop earlier on `main`, at the SDWA `v_cmpx_lt_u32` that #3949 lowers. - `main` `8cb022db` + #3949: 2,163 translate; 276 stop at a `v_readfirstlane_b32` of such a load inside a per-lane skip. - `main` `8cb022db` + #3949 + this change: **2,292 translate (+129), 0 lost.** All 276 move off `v_readfirstlane_b32`: 129 translate, and the rest stop at `unproven packed mesh signature rows` 43, `v_cvt_f32_f16` 24 (C1), `mesh SAVEEXEC else arm is not vector-only` 22, `unsupported packed vertex export` 20, `mesh EXEC write inside a lane-skip block` 18, `unbound numeric SGPR` 16, heap-slot provenance 2, `mesh SAVEEXEC then arm lacks an EXECZ skip` 2. No other program changes. Counts only; request bytes stay local. ## Checks Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100. `ctest --preset pr` on this commit (on `main` `8cb022db`): 349/351 pass, `native_direct_mesh` included. The two local failures, `native_compute_implicit_lod_controls` and `native_wave_virtual_derivative_controls`, are the local SDK validator 1.7 vs DXIL 1.8 and fail on `main` too. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A buffer load at a uniform address was marked uniform on the active
lanes only under full EXEC or a whole-wave skip. Inside an entered
per-lane EXECZ skip every thread that runs the load is an active guest
lane reading the same address, as the entered-skip scalar-load proof
already uses, so the loaded words are the same in every active lane and
a following v_readfirstlane_b32 reads them directly. Without the proof
the read needed the groupshared broadcast, which a per-lane skip cannot
run, and was refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 17:49:02 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3957/head:github-bot/gh-3955'
git switch 'github-bot/gh-3955'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3955'
git switch 'github-bot/gh-3955'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3955'
git switch 'github-bot/gh-3955'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3955'
git switch 'main'
git merge --squash 'github-bot/gh-3955'
git switch 'main'
git merge --ff-only 'github-bot/gh-3955'
git switch 'main'
git merge 'github-bot/gh-3955'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.