Per-lane: bridged non-CMPX V_CMP_* ignore EXEC (corrupting inactive lane bits) and writing to NULL (SDST = 125) clobbers EXEC #2458
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#2458
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?
@microwave805 on GitHub · 2026-11-25 19:30 UTC · original
Static audit on
main @ c7e1799found two critical correctness bugs in the per-lane direct DXIL lowering (XCL_PER_LANE=1) following #1876 and #1864. Part of #1269.1. [Critical] Bridged non-
CMPXV_CMP_*instructions ignoreEXECand corrupt inactive lane bitscrates/xcl/src/gpu/recomp/lower.rs:1782-1784, 1817-1823,crates/xcl/src/gpu/recomp/lane_masks.rs:295-298lane_masks::is_vector(lane_masks.rs:295-298) excludes allV_CMP*(!n.starts_with("V_CMP")), soV_CMP_*PCs are never added toself.guarded.valu()(lower.rs:825-854) handles only plainU32/I32V_CMP*(ANDing withEXECat lines 849-850); every float (F32/F16/F64), 64-bit (I64/U64), 16-bit (I16/U16),V_CMP_CLASS_*, and VOP3-modified/SDWA compare falls through tobridge().fe78c81(#1876) only setold_execforcmpx(V_CMPX*) atlower.rs:1782. For non-CMPXbridgedV_CMP_*,old_execisNone,!self.guarded.contains(&d.pc)istrue, soguardis constanttrue(Lw::write_maskseesact() == true) and lines 1819-1823 write rawcondunmasked byEXEC.EXEC(e.g. computewave_branches == truefrom #2203, or any guarded region / PS helper lanes): Hardware setsvcc = 0x0000_0000(inactive lanes forced to 0) and branches toL_skip; per-lane lowering producesvcc = 0xFFFF_0000and takes the wrong branch.V_CMP*(not onlyV_CMPX*) withEXECwhen!in_guarded_run:2. [Critical] Writing to
NULL(SDST = 125) clobbersEXEC(126) in per-lane lowering and corruptslane_maskscrates/xcl/src/gpu/recomp/lower.rs:403-424(write_num,write_bit),577-578(S_GETPC_B64),669-670(S_MOV_B64),691-692(S_CSELECT_B64),973;crates/xcl/src/gpu/recomp/lane_masks.rs:492-496, 551, 581125isNULL(reads0, discards writes; standard idiom fors_and_b64 null, vcc, execto setSCCwithout clobbering any SGPR, or VOP3v_cmp_* null, ...). Commit15fff3b(#1864) added125reads andsaveexecguardssd != 125, butwrite_numandwrite_bitdo not ignorer == 125, and 64-bit writes unconditionally writesd + 1 = 126(EXEC):write_bit(b, 125, bit)(e.g.s_and_b64 null, vcc, execor VOP3v_cmp_eq_u32 null, ...) writesVar::S(126) = num_marker; Var::M(126) = bit_marker;, destroyingEXECand failing with"s126: a mask read as a number".s_mov_b64 null, s[0:1]ors_cselect_b64 null, ...callswrite_num(b, 126, hi), silently overwritingEXECwithhiwithout any error!lane_masks.rs:496, 551, 581:125 < 128storesst.regs[125] = Some(v)and a subsequentmask_src(125)reads backst.regs[125]instead ofSome(FALSE).r == 125inwrite_numandwrite_bit; guardsd != 125around(sd, sd + 1)writes atlower.rs:577-578, 669-670, 691-692, 973.lane_masks.rs, map125 => Some(FALSE)inmask_srcand requirer != 125before writingst.regs[r].AI use
main @ c7e1799and issue drafting.