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

Closed
github-bot wants to merge 1 commit from gh-pr/1039/head into gh-pr/1039/base
Owner

@⁠acleofe on GitHub · 2026-11-24 15:14 UTC · original
fix/shader-helper-lanes-readfirstlane → main · +73 −0 · 2 files · 1 commits · closed without merging

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

**@⁠acleofe** on GitHub · 2026-11-24 15:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1039) `fix/shader-helper-lanes-readfirstlane` → `main` · +73 −0 · 2 files · 1 commits · closed without merging 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)
Wave operations leave helper lanes out, so in a loop over the first
lane's value a quad's helper lanes left on their own never matched and
ran to the loop limit (DEVICE_HUNG). In pixel shaders they now take
their own value through IsHelperLane.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:58 +00:00
github-bot closed this pull request 2026-11-26 04:17:58 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1039
No description provided.