Shaders: helper lanes take their own value in a pixel shader's first-lane read (#908) #1039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1039"
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?
Imported from Marvisak/VIctory. Originally posted by acleofe on 2026-11-24T15:14:47Z.
Draft: the translation validates, but it has not been run on a GPU. Testers who see DEVICE_HUNG in pixel shaders with a readfirstlane loop, please try it.
What
In pixel shaders,
v_readfirstlane_b32lowered toWaveReadLaneFirstnow gives helper lanes their own value:select(IsHelperLane(), own, WaveReadLaneFirst(own)). Other stages, and the waterfall reads proven inffe310e, are unchanged.Why
Wave operations leave helper lanes out. In a loop over the first lane's value that is not proven a waterfall loop, the real lanes of a quad finish and leave; once only helper lanes remain,
WaveReadLaneFirsthas no lane to read, the compare never matches, and each helper lane runs to the loop limit (2^20 iterations). That can end in DEVICE_HUNG (#908).Taking their own value, helper lanes match on the first pass and leave. They write nothing, so what they compute meanwhile is not seen; real lanes still read the first active real lane, as before.
IsHelperLane(opcode 221) is shader model 6.6, which the translator already emits.Test
a_pixel_shaders_first_lane_read_leaves_helper_lanes_their_own: a pixel shader with a first-lane read translates, and dxil.dll accepts the helper-lane test (it refuses a wrong opcode there, so the call is checked).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsandcargo test --workspace --lockedpass.Not verified on hardware: whether this clears the hang in the world needs a GPU run.
🤖 Generated with Claude Code
Pull request closed