gfx2hlsl: uniform compute load proof (#2607) bypassed at a loop head that narrows EXEC #2757
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#2757
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@MasterDomino on GitHub · 2026-11-26 06:19 UTC · original
#2607 (merged as
1c061f87) lets a buffer load past the entry block feedv_readfirstlane_b32when its address is wave-uniform and EXEC is the entry mask. That entry-EXEC requirement can be bypassed at a loop head.exec_knownis tracked in program order, so at the target of an SCC back edge it's still true even when the loop body narrowed EXEC before branching back.Repro (gfx2hlsl compute stage, driven the same way as the PR's own unit checks):
59218765(just before #2607)REFUSED: v_readfirstlane_b32 requires a proven uniform source1c061f87/mainc8b7b973v7 = r0.Load(a + 0); ulc_7 = r0.Load(a + 0); s9 = ulc_7;, unguardedWhy it's wrong. On a pass where the body left EXEC empty, the hardware's
v_readfirstlanereturns lane 0'sv7from the previous pass. The translation reloads at the news3instead. That's the case #2607's empty and potentially-empty EXEC refusals are meant to exclude.Suggested fix.
execas known at such targets.Related, for whoever picks this up:
ulc_Ntemporary for every qualifying load past the entry block, whether or not anything reads it. Programs that translated before therefore emit different HLSL. For example,s_cbranch_scc0; s_nop; s_buffer_load_dword s3; buffer_load_dword v7, off, s[4:7], s3; v_add_f32 v1, v7, v1gainsulc_7 = r0.Load(a + 0);. That would normally come with a compute cache revision bump;mainhas since moved to19cswith #2708, which re-keys those entries anyway.mainemits unguarded VGPR writes in such a loop even without a readfirstlane (for examplev1 = U(F(v6) + F(v1))). Fixing that changes emitted HLSL and needs its own revision bump.s9from every lane against a CPU reference would test the lowering itself, as tedin7 asked on the PR.@NiiRoZz @R0Y00: found in our review of #2607, which finished just after the merge. The probe is the PR's own
translate()text harness, not a GPU run.AI-assisted; commands listed were executed locally.
@RavenCurseBurg on GitHub · 2026-11-26 06:38 UTC · original
I will take the past-entry uniform buffer-load proof at loop heads. I will pin the reported backward SCC branch, check neighbouring loops with an unchanged EXEC mask and forward-only loads, and submit a focused fix based on main
e3cf6a91. I have Windows 11, Python, LLVM 15, WARP, Intel UHD 770 and RTX 4060 available. The separate general VGPR-write question can be tracked independently.AI-assisted with Codex.
github-bot referenced this issue2026-11-28 22:11:19 +00:00
github-bot referenced this issue2026-11-28 22:12:40 +00:00