Skip to content

shaders: let a wave catch up before a barrier in block-dispatched programs - #161

Merged
brcly merged 1 commit into
brcly:mainfrom
Jerkin42:fix/dispatch-barrier
Nov 25, 2026
Merged

brcly merged 1 commit into
brcly:mainfrom
Jerkin42:fix/dispatch-barrier

Conversation

@Jerkin42

Copy link
Copy Markdown
Contributor

Block-dispatched programs give every lane its own program counter, so a lane that left a loop early went through s_barrier alone and read group-shared memory the others had not written yet. On the console it stays masked in EXEC and the wave reaches the barrier together.

This starts a block at each barrier and enters it once every active lane of the wave stands at one.

Checked with GTA VI on RADV GFX12: CS_TAA2_Resolve came out near zero in the last rows of each 8x8 group (means by row .342 .343 .343 .344 .277 .115 .023 .001), and the dark horizontal lines are gone in the game with this change.

Tests: new dispatched_lanes_wait_for_their_wave_at_a_barrier; translator, dxbc, xg-layout, d3d12 check and Python suites pass.

🤖 Generated with Claude Code

…grams

A guest wave reaches S_BARRIER as a whole: a lane that leaves a loop early
stays masked out in EXEC until the rest of the wave is done. The block
dispatcher gives every lane its own program counter, so such a lane went
through the barrier on its own and read group-shared memory the others had
not written yet.

Start a block at each barrier and enter it only once every active lane of
the wave stands at one, the earliest first when they stand at different
ones.

CS_TAA2_Resolve shows it: the lanes fill a 10x10 tile, some in two
iterations and some in one, and the last rows of every 8x8 group came out
near zero. Mean of the resolved image by row of the group, on RADV GFX12:
.342 .343 .343 .344 .277 .115 .023 .001.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brcly
brcly merged commit dfe7813 into brcly:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants