feat: read the lowest enabled lane for v_readfirstlane_b32 of a per-lane VGPR (groups up to 32 threads) #2745
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!2745
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2745/head"
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?
@tedin7 on GitHub · 2026-11-26 05:30 UTC · original
tedin7:x2w-rfl3-first-lane→main· +98 −3 · 4 files · 1 commits · closed without mergingPart of #1723
Status: parked as Draft: groundwork for the shared wave model.
What this unblocks:
v_readfirstlane_b32of a VGPR that differs between lanes (for example a load at a per-lane address) in compute groups of at most 32 threads, which was refused with "requires a proven uniform source".Source: AMD "RDNA 2" Instruction Set Architecture reference guide, VOP1 instruction V_READFIRSTLANE_B32 (first active lane of EXEC); Microsoft Shader Model 6.0 wave intrinsics,
WaveReadLaneFirst.What changed
x2w_rfl_val[lane], enabled threadsInterlockedMintheir lane index intox2w_rfl_min, and all threads read the value of that lane. ThreeGroupMemoryBarrierWithGroupSync()calls order init, min and read. The result does not depend on how the host splits the group into waves (WARP has 4-lane waves, GPUs 32 or 64).Why it is correct
tis lanet(SV_GroupThreadIDflattened); the model keepsexec & 1per thread.uniform_cfis false at the end of the pass), including divergent back edges,s_cbranch_execzandvccbranches.What stays refused
Tests
startup_compute_waterfall.py(run bystartup_compute_readfirstlane): a source-built 32-thread program that enables only the lanes above a root constant and readsv5of the lowest enabled lane; controls for groups of 4 and 32 (translated) and 33 and 64 (refused). The WARP dispatch case runs a 32-thread group (8 host waves on WARP) with six active-lane thresholds (including no enabled lane) and a wrong-lane control (lane 0 instead of the first enabled lane).startup_gfx2hlsl_compute_check.py: the per-lane-address case now translates (was a refusal); a 64-thread group stays refused.startup_compute_readfirstlane_check.py: the lane-mask counter refusal now names the lane mask.Verification
python3 -B tests/startup_compute_readfirstlane_check.py --llvm-mc llvm-mc-19andtests/startup_gfx2hlsl_compute_check.pypass.tests/startup_*check.pyset has the same failing files as main (those need a Windows toolchain); no new failure.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 10:12 UTC · original
Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.
Pull request closed