Shaders: helper lanes take their own value in a pixel shader's first-lane read (#908) #1039

Closed
acleofe wants to merge 1 commit from upstream-pr/1039 into main
acleofe commented 2026-11-24 15:14:47 +00:00 (Migrated from github.com)

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_b32 lowered to WaveReadLaneFirst now gives helper lanes their own value: select(IsHelperLane(), own, WaveReadLaneFirst(own)). Other stages, and the waterfall reads proven in ffe310e, 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, WaveReadLaneFirst has 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 warnings and cargo test --workspace --locked pass.

Not verified on hardware: whether this clears the hang in the world needs a GPU run.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6585033991 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1039). Originally posted by [acleofe](https://github.com/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_b32` lowered to `WaveReadLaneFirst` now gives helper lanes their own value: `select(IsHelperLane(), own, WaveReadLaneFirst(own))`. Other stages, and the waterfall reads proven in ffe310e, 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, `WaveReadLaneFirst` has 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 warnings` and `cargo test --workspace --locked` pass. Not verified on hardware: whether this clears the hang in the world needs a GPU run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 17:03:04 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1039
No description provided.