Skip to content

Preserve lane-dependent code-table indices across EXEC reconvergence - #5

Open
MichaelSmithAI wants to merge 3 commits into
LooperSalty:shaders/uniform-phi-loop-counterfrom
MichaelSmithAI:fix-code-table-exec-reconvergence
Open

MichaelSmithAI wants to merge 3 commits into
LooperSalty:shaders/uniform-phi-loop-counterfrom
MichaelSmithAI:fix-code-table-exec-reconvergence

Conversation

@MichaelSmithAI

Copy link
Copy Markdown

For Marvisak#1231. A shader sets a vector register to 0, writes 3 only in lanes 10 and above, restores EXEC, then broadcasts the first lane’s code-table address for an s_load_dword. Lane 0 still selects entry 0. On 8996aeb the resource tracker accepts the joined index as a per-lane dynamic term. We observed this both with a straight-line masked write and with an s_cbranch_execz around the write.

This change checks whether the write and the incoming paths to a phi execute for all lanes together before accepting the value as uniform. Scalar operations that read SCC implicitly also check that input. The regression covers both forms of the masked write. Each now gets the existing per-lane-address diagnostic, and the author's uniform-address and uniform-loop-counter controls still translate.

On Linux the shader suite passed 101 tests with one ignored, and library Clippy passed with warnings denied. All-target Linux Clippy reports the same two unused test imports on the base and this branch. The Windows/Wine shader run before final cleanup passed 124 tests with the existing stub_pipeline_is_created failure and one ignored. The new test measures resource tracking. A numerical GPU readback of the code-table load and title behavior remain unmeasured.

AI-assisted implementation, testing and review.

swarm and others added 3 commits November 24, 2026 12:01
… address

v5 = 0 in every lane, then 3 in lanes 10 and up (by s_cbranch_execz or by
EXEC alone), EXEC restored, read back with v_readfirstlane as a code-table
address: both values are uniform, the joined index is not. Traced today
as every lane's address (offset 0xde0 with the lane's own index), which
code_smem then reads per lane: lanes 10 and up read entry 3 where the
console reads the first lane's entry 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A guarded VALU write of a uniform value over a uniform one leaves the
lanes it skips the old value; a phi at the join of a block skipped by
EXEC (s_cbranch_execz) likewise, since lanes outside EXEC reach the join
by the wave's edge. Both passed uniform().

A VALU value is uniform only when its block's entry condition and its
guard hold in every lane or none; a phi only when its block and every
predecessor are entered so. A SOP result that reads SCC (s_cselect,
carries) also needs a uniform SCC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant