Repository navigation
Conversation
A buffer_load_dword, or a buffer_load_format_x from a descriptor-table V#, without OFFEN, with a uniform IDXEN index if any and a constant or uniform SOFFSET, reads the same address in every lane. Until the shader stores to memory it returns the same dwords in every lane, so mark them uniform under the same conditions as the heap typed load and let a following v_readfirstlane read them. The address is checked before the load, whose destination may be its own index register. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since R0Y00#3793, a v_readfirstlane_b32 of a value that is not uniform under full EXEC broadcasts lane 0 through groupshared memory instead of being refused. The uniform buffer load cases now check that READFIRSTLANE reads the load directly with no broadcast slot, and the OFFEN and per-lane index cases check that the broadcast is used. Part of R0Y00#3703. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mumba17
force-pushed
the
shader/mesh-uniform-buffer-load
branch
from
December 2, 2026 07:40
3e20366 to
0acbcdc
Compare
lukaslw-lab
approved these changes
Dec 2, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 0acbcdcd by reading the diff; not built or run.
Verdict: approve. The uniform-address rule is sound and reuses the existing uniformity conditions. No MUST.
- NIT The indexed raw
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. - Checked, no finding:
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.- SOFFSET at or above 106 is refused unless it is an inline constant or a literal, so M0 and the other special registers stay out.
Tests: the four direct-read cases check that v_readfirstlane_b32 uses the load's own extractvalue and that no @meshReadFirstLane slot is declared. The two broadcast controls (OFFEN, a lane index) keep #3793's path. All of these are in native_direct_mesh, which the pr filter 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 shader, runtime: lower and bind mesh format loads from a descriptor-table V# (Part of #3703) #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.s_bitset1_b32, then stop at a scalar loop #3703),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