Direct DXIL: divergent VM=1 pixel shader exports overwrite live_vm_var to 0 for inactive lanes #2407
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2407
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@ahmetbagci8 on GitHub · 2026-11-25 17:59 UTC · original
Summary
In
crates/xcl/src/gpu/dxil/lower_gfx.rs(lines 377-390):Unlike
if done(which usesself.set_out(lv, one)to preserve previously set1s for inactive lanes),if vmunconditionally overwriteslive_vm_varwithself.sel(a, 1, 0).In any pixel shader with structured divergent control flow containing two
exp ..., vm=1instructions (for example, anif/elsewhere both branches export withVM=1, DONE=1under complementaryEXECmasks), the secondexpexecutes witha == 0for all lanes from the first branch and resets theirlive_vm_varto0. Atfinish_gfx(lines 269-273),dead = (live_vm_var == 0)then discards all pixels from the first branch.Suggested fix
Use
self.set_out(lv, one)inif vm, matchingif done:Not tested
082944135cd2b96288470a595861fa608eee08dcwithout a new runtime test.AI use
lower_gfx.rsand drafted this report; the author reviewed it before posting.@oni-swr on GitHub · 2026-11-25 20:49 UTC · original
Claiming this issue: fixing divergent VM=1 pixel shader export live_vm_var accumulation in Direct DXIL lowering, with regression tests.
AI use: Claude Code (Claude Opus 5.5).
@oni-swr on GitHub · 2026-11-25 21:10 UTC · original
Withdrawing my claim and not opening a PR — this looks like a false positive:
dc0d25fe(#1488) intentionally makes eachVM=1pixel export overwrite the survival mask with that export's activeEXECmask (matching the HLSL backend'sxcl_live = (act);and verified on Direct DXIL bygpu_ps_exp_vm_controls_pixel_survivalcasetwo_vm1_second_narrower_overwrites).crates/xcl/src/gpu/dxil/lower.rs:981-1013, includings_cbranch_execz) test the wave'sEXECmask, so in the reported if/else both exports execute with the same waveEXECsemantics as hardware (an empty branch is skipped byexecz). ChangingVM=1to accumulate1would regresstwo_vm1_second_narrower_overwritesand diverge from HLSL.AI use: Claude Code (Claude Opus 5.5).