Shaders: a helper lane's v_readfirstlane reads its own value (#908) #1733
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1733
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1733/head"
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?
@moe-miau on GitHub · 2026-11-24 21:31 UTC · original
moe-miau:fix/shader-helper-lane-readfirstlane→main· +25 −0 · 1 files · 1 commits · merged 2026-11-25 00:23 UTCFixes #908.
This is Vaximous's fix from the issue (branch
fix/helper-lane-readfirstlane,9d5ce7a), cherry-picked unchanged ontomainwith the original author kept on the commit. It was posted as a fork branch while PRs were limited to collaborators. The only PR that carried it (#1039) was closed without being merged, so nothing open fixes #908 now.Problem. On the console, whole-quad mode keeps a pixel shader's helper lanes in EXEC, so a
v_readfirstlane_b32waterfall loop serves them too. On the host, wave ops skip helper lanes (noWaveOpsIncludeHelperLanes). Once only helper lanes are left in such a loop,WaveReadLaneFirstmatches nothing and each of them spins toLOOP_LIMIT. #908 measured draws of 0.3 to 1.3 s each, thenDXGI_ERROR_DEVICE_HUNGabout 200 s into the world.Fix (
crates/victory-shader/src/emit/lower.rs, +25): in a pixel shader,v_readfirstlane_b32returnsselect(IsHelperLane(), own, WaveReadLaneFirst(own)). A helper lane matches on the first pass and leaves the loop. A helper lane's results only feed derivatives and its stores are already dropped. Other stages are unchanged.IsHelperLaneis DXIL op 221 (shader model 6.6, which the host already requires).Checked on Windows 11 x64, Rust 1.98.1 MSVC,
mainffe310e+ this commit:cargo clippy --workspace --all-targets --locked -- -D warningsand the--all-featuresvariant: cleancargo test --workspace --locked: pass (victory-shader: 120 passed, including the GPUvalu_testson an RTX 4070 SUPER)cargo xtask policy: okFrom #908: the DXIL validator accepts the translated pixel shader, and a covered-pixel readback on an RTX 4090 returns the lane's own value. The runtime effect was measured by the author on an integration build (RTX 4070 Ti), not on plain
main.There is no synthetic pixel-stage test here. The existing lowering tests in
lower.rsonly build compute programs. A test that assertsisHelperLaneis emitted for a pixelv_readfirstlane_b32would need a pixel-stage harness; I can add one if you want it in this PR.AI-assisted (Claude Code): I reviewed the diff and reran the checks. The fix itself is Vaximous's (commit author Vax).
🤖 Generated with Claude Code