Per-lane: track the SCC of mixed mask and number operations #1866
No reviewers
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!1866
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1866/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?
@Kalmarv on GitHub · 2026-11-24 22:06 UTC · original
Kalmarv:per-lane-mixed-mask→main· +60 −7 · 3 files · 1 commits · merged 2026-11-24 23:44 UTCPipodi's point 2 on #1745: a scalar bitwise operation or compare that reads a mask (VCC, EXEC, a compare result) together with an SGPR the analysis can't track. The per-lane lowering takes that operation as a mask and extracts each lane's bit, while the analysis dropped the mask and classified SCC as uniform. So a branch or select on that SCC went per lane where the console tests the whole word once for the wave. The fix gives the untracked operand a lane atom, so the existing whole-wave checks see these operations and refuse them where the condition differs across lanes. @gefydev handed this point to us on #1269 (#1269).
What is in it
crates/xcl/src/gpu/recomp/lane_masks.rs: a mask operation with one untracked operand keeps a lane atom for that operand instead of losing the mask.crates/xcl/src/gpu/recomp/lower.rs: the whole-wave guard reads the same mask-valued SCC.crates/xcl/src/gpu/recomp/lower_dxil.rs: GPU and CPU tests. A wave32 compute program sets the low 16 bits of VCC, ANDs VCC with an all-ones input SGPR and branches on SCC; further cases cover a scalar select and a mixed compare.Tested
cargo test --release --workspace -- --test-threads=4on33b1b33: 960 passed, 0 failed, 43 ignored. Twelve tests printed 22 SKIPPED messages (no native wave64, heap windows, the existing f16 exclusions). The mixed-mask GPU test ran without a skip.mainc4d37be: lane 16 reads 0 in the per-lane form where HLSL gives 1 (lanes 16 to 31 differ). On33b1b33: HLSL gives 1 in all 32 lanes, and the per-lane translator refuses the branch.maintakes 316 of 2,689 programs per lane, and so does this change, with the same programs and the same DXIL sizes. The whole-wave check is the first refusal for 1,771 programs before and 1,769 after, because two programs now stop at a later check.Regression run
scripts/smoke.ps1, the same retail title for 60 s each, one after the other on the machine under Tested, release builds from clean trees.main689f2db(this PR's base):this PR,
438d420:PR vs
main: 1280 / 1235 frames (104 %), peak commit 26990 / 26475 MB (102 %); device removals 0 and crashes 0 on the PR run, 0 and 0 onmain.The tests under Tested ran on
33b1b33, this change before its rebase ontomain689f2db; the rebase applied without conflicts.Not tested
mainin the same test harness, not fixed here: a wave32 kernel launched with EXEC =fffffffegivess0= 0 per lane where HLSL gives 5. We have not seen it in a retail program.AI use
OpenAI Codex (GPT-6.2) wrote the patch and the tests and ran the suite, the GPU tests and the pack count. A separate Codex session built the Z3 check that found the case. Claude Code (Claude Opus 5.5) ran the regression pair and wrote this description; no person reviewed the code before posting.
🤖 Generated with Claude Code
@upipibi on GitHub · 2026-11-24 22:24 UTC · original
Same on Ampere: RTX 3070 8 GB (32-lane waves), driver 616.56, Windows 11, debug,
33b1b33merged ontomain689f2db.a_branch_on_a_mixed_mask_matches_the_hlsl_path_on_the_gpu: passes, 2 of 2 runs.gpu::recomp::l*(lower, lower_dxil, lane_masks): 57 passed, 0 failed.AI-assisted (Claude Code). Synthetic tests only.
@DarkPanda69 on GitHub · 2026-11-24 22:40 UTC · original · edited 2026-11-24 23:35 UTC
AMD run with native 64-lane waves, which this PR lists as not tested (the other report here is Ampere). Updated for head
438d420(first run was on33b1b33, same result).Tested: pass, head
438d420applied onmain20cf130, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu::recomp --test-threads=4:a_branch_on_a_mixed_mask_matches_the_hlsl_path_on_the_gpuok, not skipped. The 6 SKIPPED lines (per-lane form refused for some f16/f32 programs) are the same onmain.main.Not tested: Linux; the whole workspace suite.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@thehollowedone on GitHub · 2026-11-24 23:38 UTC · original
Independent split-wave64 check of 438d420 on an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11.
In a synthetic compute shader, only lane 63 set VCC. A 64-bit AND with a user SGPR pair supplied the SCC branch condition. With the parent analysis, the shader entered the per-lane path and 63 of 64 lanes wrote the wrong branch result when the SGPR pair kept bit 63. With
XCL_DIRECT_DXIL=1 XCL_PER_LANE=1on this PR, the runtime selected per-instruction DXIL. All 64 writes matched HLSL both when the mask kept bit 63 (1) and when it discarded it (0). The 32 untouched words matched in both dispatches.cargo test --offline --locked -p xcl --lib mixed -- --nocapture --test-threads=1: 2 passed, zero skips, including the stock wave32 test and the split-wave64 extension.AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the GPU test and drafted this report.
@DavidM1911 on GitHub · 2026-11-25 01:38 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!