shader: treat a mesh buffer load at a uniform address as uniform (Part of #3703) #3792
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3792
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@mumba17 on GitHub · 2026-12-01 22:37 UTC · original
mumba17:shader/mesh-uniform-buffer-load→main· +53 −0 · 2 files · 2 commits · merged 2026-12-02 20:45 UTCPart of #3705. Lets
v_readfirstlane_b32read a buffer load at a uniform address directly, where it was refused or, since #3795, broadcast through groupshared memory.Rebased on current
main(f365f125), now that #3772 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.
#3795 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 #3772.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
s_bitset1_b32, then stop at a scalar loop #3705s_bitset1_b32, then stop at a scalar loop #37053e20366373to0acbcdcd28shader: treat a mesh buffer load at a uniform address as uniform (Part of #3703, stacked on #3770)to shader: treat a mesh buffer load at a uniform address as uniform (Part of #3703)@lukaslw-lab on GitHub · 2026-12-02 07:43 UTC · original · approved these changes
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 #3795'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.0acbcdcd28tod431e1fae7@lukaslw-lab on GitHub · 2026-12-02 09:35 UTC · original · approved these changes
Reviewed
d431e1fabygit range-diffagainst0acbcdcd; not built or run.Verdict: approve. This is a rebase onto
45c809ab. The two load branches now carry #3808'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.@R0Y00 on GitHub · 2026-12-02 10:10 UTC · original · reviewed
The Windows job fails in the same mainline integer-row fixture as #3823, with
+0x34: unmapped graphics export. I reproduced it on plain main and opened #3853 to isolate that fixture. Ond431e1faplus only the fixture patch from #3853, the fullnative_direct_meshcheck passes. Please sync after #3853 lands to refresh the required Windows check.s_bitset1_b32, then stop at a scalar loop #3705d431e1fae7to089765d4d0@mumba17 on GitHub · 2026-12-02 20:13 UTC · original
Synced. #3853 now conflicts with
main, and #3863 (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 #3712 (43791423) → #3762 (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).
@R0Y00 on GitHub · 2026-12-02 20:44 UTC · original · approved these changes
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.s_bitset1_b32, then stop at a scalar loop #3705s_bitset1_b32, then stop at a scalar loop #3705