shader: treat a mesh buffer load at a uniform address as uniform (Part of #3703) #3790
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3790"
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 R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-01T22:37:40Z.
Part of #3703. Lets
v_readfirstlane_b32read a buffer load at a uniform address directly, where it was refused or, since #3793, broadcast through groupshared memory.Rebased on current
main(f365f125), now that #3770 has merged. It is no longer stacked.Shape
The programs read the first lane of a buffer load whose address is the same in every lane:
buffer_load_format_x vN, vM, s[..], 0 idxenfrom a descriptor-table V#, withvMcopied from a uniform SGPR;buffer_load_dword vN, off, s[..], 0 offset:20, then a secondbuffer_load_dword vN, vN, s[..], 0 idxenindexed by the first result.The frontend only treated heap typed loads at a uniform index as uniform.
#3793 now broadcasts lane 0 for any full-EXEC
v_readfirstlane_b32. That broadcast costs a groupshared slot and a barrier, and it needs group-uniform control flow. Its result is also not marked uniform. On currentmain, 167 programs still stop atv_readfirstlane_b32.Change (
gfx1013_direct_mesh.inl)uniform_buffer_addressholds for a MUBUF load that meets all of these, until the shader stores to memory:buffer_load_dword v1, v1, ...).mark_uniform_buffer_loadthen marks the loaded dwords uniform, under the same conditions as the existing heap typed load:uniform_valuesunder full EXEC;active_uniformunder whole-wave execution outside a diamond.buffer_load_dword, aftermain's OFFEN raw path, and to the tablebuffer_load_format_xroute from #3770.Tests (
tests/native_direct_mesh_check.py)v_readfirstlane_b32result is the load's ownextractvalue, converted withuitofpfor the export, and no@meshReadFirstLaneslot is declared.uniform-load-off,uniform-load-root-soffset: unindexed raw loads, with a constant and a root-constant SOFFSET;typed-table-uniform-index: a table load at indexs21;typed-table-uniform-index-in-place: the load overwrites its own index register.uniform-load-offen: OFFEN, even from a uniform VGPR;typed-table-lane-index-readfirstlane: indexv0.uniform-load-offfails);Validation (Windows 11, MSVC, Windows SDK 10.0.26100)
ctest --test-dir out/build/dev -R native_direct_mesh: passes on this head.mainf365f125vsmain+ this: 532 of 1,569 both ways; none gained, none lost.v_readfirstlane_b32onmain, 18 now get past it and stop at:ds_swizzle_b32: 10;mesh scalar memory needs a verified guest root mapping(the read lane feeds ans_load_dwordx4address): 6;mesh VCC branch lacks a proven guest whole-wave mask: 2.AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T07:43:13Z.
Review: APPROVED
Reviewed
0acbcdcdby reading the diff; not built or run.Verdict: approve. The uniform-address rule is sound and reuses the existing uniformity conditions. No MUST.
buffer_load_dword(IDXEN with no OFFEN) is accepted with no fixture, as the body says. It goes through the sameuniform_buffer_address/mark_uniform_buffer_loadpair as the covered cases, so this is a coverage gap, not a suspected bug.uniform_buffer_address(gfx1013_direct_mesh.inl:851) tests OFFEN (bit 12) and IDXEN (bit 13) in the right words, and reads VADDR as256+(i.b&255). It runs beforealu.memory, sobuffer_load_dword v1, v1, …is judged on the old index, andtyped-table-uniform-index-in-placepins that.memory_storedanduniform()are the same rules main uses for scalar loads and the heap typed load (:1514,:1522), so a store before the load or a value uniform only in another lane set is not marked.mark_uniform_buffer_loadadds touniform_valuesonly under full EXEC, and toactive_uniformonly under whole-wave execution outside a branch, as the heap typed load does. A partial-EXEC load keeps itspartial_writesentry either way.Tests: the four direct-read cases check that
v_readfirstlane_b32uses the load's ownextractvalueand that no@meshReadFirstLaneslot is declared. The two broadcast controls (OFFEN, a lane index) keep #3793's path. All of these are innative_direct_mesh, which theprfilter runs. CI for this head was still running at review time. The census result (no gain yet; 18 programs move to the next wall) matches what a uniformity-only change should do.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T09:35:54Z.
Review: APPROVED
Reviewed
d431e1fabygit range-diffagainst0acbcdcd; not built or run.Verdict: approve. This is a rebase onto
45c809ab. The two load branches now carry #3806'svector_execcondition in context.mark_uniform_buffer_loadstill marks words only under full EXEC, or under whole-wave execution outside a branch, so loads inside a masked diamond are not marked uniform. The test commit is identical. No MUST.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T10:10:25Z.
Review: COMMENTED
The Windows job fails in the same mainline integer-row fixture as #3821, with
+0x34: unmapped graphics export. I reproduced it on plain main and opened #3851 to isolate that fixture. Ond431e1faplus only the fixture patch from #3851, the fullnative_direct_meshcheck passes. Please sync after #3851 lands to refresh the required Windows check.Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-02T20:13:43Z.
Synced. #3851 now conflicts with
main, and #3861 (merged 15:19Z) already restored the dropped attribute count in the samenative_direct_meshfixture, so I rebased ontomain1cd972cdwithout waiting for it. Same for the stack #3710 (43791423) → #3760 (42ce2c27); this PR is nowa1097fa1+089765d4. All three rebased without conflicts.Local check on each tip: Windows 11 26300, MSVC,
cmake --build --preset prthenctest --preset pr -j 4, failures re-run with-j 1. 289/291 pass on each branch, includingnative_direct_meshand the mesh_ir/_dxil/_controlstests. The 2 failures are the same on every branch:native_compute_implicit_lod_controlsandnative_wave_virtual_derivative_controlsstop at this host's SDK validator (Validator version in metadata (1.8) is not supported; maximum: (1.7)). They are compute tests, untouched here, and should pass on CI's validator.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T20:44:53Z.
Review: APPROVED
Reviewed
089765d4. The load's index and scalar offset are checked before destination writes, and unproven addresses retain the lane-0 broadcast path if it is available. Independent Windows 11 build 26300, MSVC Debugcmake --build --preset dev --target compile_dxilandctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_direct_mesh$'passed. The fixture covers the in-place typed load and keeps broadcast controls foroffenand a lane-varying typed index.