Recompiler: a bridged mask write in the split form meets no barrier #2074
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!2074
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2074/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?
@gefydev on GitHub · 2026-11-25 02:58 UTC · original
gefydev:per-lane-bridge-local-masks→main· +62 −1 · 3 files · 1 commits · merged 2026-11-25 16:42 UTCIn the split wave64 form, the per-lane form (
XCL_PER_LANE=1, #1745) could put a group barrier in a block that only one 32-lane half reaches. Point 5 of Pipodi's review of #1745. Part of #1269.An instruction the per-lane form lowers through #1426's semantics (the bridge: float compares, carry-outs,
v_cmpx) writes its mask withLw::write_mask. When that mask is whole-live, as with a nestedifwhose float condition goes tos_and_saveexec, #1426 builds both words through an exchange between the halves, and with one console wave per group that exchange is a group barrier. In a block only the lower half reaches, the upper half never gets there. The bridge only reads back each lane's own bit of the result, so this half's ballot is enough: the bridge now asksLwfor the half-local mask, and the exchange is gone. OnlyXCL_PER_LANE=1reaches this code.What is in it
crates/xcl/src/gpu/dxil/lower.rs,kernel.rs:Lw::local_masks. When set in the split form,write_maskbuilds the mask from this half's ballot, as it already does for a mask that is never read whole.crates/xcl/src/gpu/recomp/lower_dxil.rs:DxilIr::foreignsets it aroundinst_guarded. New testa_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier: a nestedifin a block only lanes 0–31 reach, withv_cmp_lt_f32→s_and_saveexec. It counts the group barriers in the DXIL and checks the result on the GPU. Without the fix the program has 3 barriers (two from the exchange inside the half's block); with it, only the one at the start where the halves take their console lanes.Tested
left: 3, right: 1) and passes with it, including the GPU check: v7 = 5 in lanes 1–31 and 0 elsewhere, in both groups.cargo test --workspace -- --test-threads=4on254a058(onmain3da2abb): 1112 passed, 0 failed, 46 ignored; 24 SKIPPED (20 "no wave64" on this GPU, 1 "no heap windows", 3 per-lane halves refused on purpose for #1426's f16 rounding).Regression run
main:This PR's head:
Both with
XCL_PER_LANEoff (the default), which this change does not reach.Not tested
XCL_PER_LANE=1; the regression runs are with it off, the default.AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pu3TMXtx8TYFxrYEFhfdEp
@Pipodi on GitHub · 2026-11-25 03:03 UTC · original
Test report for
254a058(this PR's head, onmain3da2abb).Tested
rustc 1.100.0, debug.cargo build --workspace && cargo test --workspace -- --test-threads=4: 1112 passed, 0 failed, 46 ignored, in 20 result blocks.a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrierpasses, including its GPU dispatch: this adapter runs the split wave64 form.main;heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows);pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache: Developer Mode is required).self.lw.local_masks = …lines inDxilIr::foreignand ran the new test alone. It failed on its barrier count,left: 3, right: 1, as the commit message says.Not tested
XCL_PER_LANE=1: the default path does not reach this code.I read the diff. It matches point 5: the bridge reads back only each lane's own bit, so this half's ballot is enough.
AI use: Claude Code with Claude Opus 5.5 ran the tests and wrote this report.
@gefydev on GitHub · 2026-11-25 03:04 UTC · original
@Pipodi thank you for the test report on
254a058: 1112 passed, 0 failed, 46 ignored on the RTX 4090, with the new test passing including its GPU dispatch, and failing without the change (barrier countleft: 3, right: 1). Noted that a title run withXCL_PER_LANE=1and native wave64 hardware were not covered.AI use: Claude Code (Claude Opus 5.5) wrote this comment for @gefydev.
@JJAutoCompare on GitHub · 2026-11-25 03:09 UTC · original
PR #2074 split-wave64 mask-write verification
Tested
254a058c400ea86645810f0660d70be23f146fbb. The assigned checkout was clean and matched the open PR before and after testing.cargo test -p xcl --lib --no-run -j 2. Test profile unoptimized with debug info disabled. Prebuild completed in 1m 01s.powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -EncodedCommand $encoded(UTF-16LE base64 of arc-command.txt), and called the lock wrapper below. The policy override was scoped to that child process.CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target,CARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0,XCL_ADAPTER=A770, andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. Both TEMP and TMP pointed to this report’s directory.The checked-in fixture’s DXIL disassembly assertion found exactly one group barrier, at entry. Its direct-DXIL dispatch checked 128 readback values across two groups. In each group, v7 was 5 in lanes 1–31 and 0 in lane 0 and lanes 32–63.
The first two launches ended before the test ran. The default process policy blocked the wrapper and the first child invocation lost quoting. A subsequent exact run passed in 0.66s, but PowerShell reported a stderr parsing error. The table records the repeat with separate stdout and stderr so the skip count could be verified.
Not tested
The run covers the synthetic split-wave64 fixture on one Intel Arc A770. Native wave64, other adapters, the parent commit, stress/hang cases, the workspace suite, and retail title smoke are outside this run.
Evidence
Raw evidence in this directory includes environment.log, build.log, pr-before.log, pr-after.log, arc-command.txt, arc-verified.stdout.log, arc-verified.stderr.log, and arc-verified-exit.txt. The public PR discussion exposed 2 comment or review anchors at the final check.
AI use
T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and wrote this empirical report.
@DavidM1911 on GitHub · 2026-11-25 05:09 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!
@gefydev on GitHub · 2026-11-25 05:10 UTC · original
@DavidM1911 thank you for the verification of #2074 on the RTX 3060 Ti (
cargo test -p xcl --lib: all passed, 0 failed, about 26 ignored; the intermittent parallel-scheduling abort tracked in #1978 was clean on a single-threaded rerun). Noted.AI use: Claude Code (Claude Opus 5.5) wrote this comment for @gefydev.
@LANgmas on GitHub · 2026-11-25 05:21 UTC · original
Independent hardware validation — RTX 3050 (Ampere): PASS
I independently reproduced the author's GTX 1650 result on an NVIDIA GeForce RTX 3050 Laptop GPU (Ampere, wave32-only).
a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, run twice withXCL_ADAPTER=nvidia XCL_PER_LANE=1: 2/2 PASS.v7 == 5in lanes 1–31 and0elsewhere, across both groups. The focused test was not skipped.lower_dxilsuite: 19 passed, 0 failed, 17 skipped. Skips were 14 wave64 capability skips and 3 intentional #1426 semantic refusals.Hardware: RTX 3050 Laptop GPU, driver 617.14, D3D12 FL 12_2 / Shader Model 6.8, DXC 1.9.2602.17, Windows build 26300.
This independently reproduces the reported barrier count and GPU output on a second NVIDIA architecture (Ampere vs. the author's Turing GTX 1650).
Scope: supplemental GPU validation only. No retail-game smoke test was performed, so this does not replace the required runtime/integration validation.
@jennydeth on GitHub · 2026-11-25 12:48 UTC · original
Test report for #2074 on a 32-lane NVIDIA card (split wave64 form).
Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head
254a058.Result: cargo test --workspace -- --test-threads=4: 1112 passed, 0 failed, 46 ignored.
a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier: ok
SKIPPED: 23 GPU tests for no wave64 (expected on this card), the per-lane f16 arithmetic / f16 packed / f32 conversions cases (per-lane form: refused), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache).
Not tested: a title run (no smoke run from me), native wave64 GPUs.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@gefydev on GitHub · 2026-11-25 13:48 UTC · original
@JJAutoCompare, @LANgmas and @jennydeth thank you for the reports on
254a058; noted, each as you gave it:XCL_PER_LANE=1, 2/2 pass, exactly 1 barrier in the DXIL andv7 == 5in lanes 1–31 and 0 elsewhere in both groups;lower_dxil19 passed, 0 failed, 17 skipped. No title run.cargo test --workspace -- --test-threads=4: 1112 passed, 0 failed, 46 ignored, the new test ok; the SKIPPED ones as you list them. No title run, no native wave64.With these and the earlier ones on the RTX 4090 and RTX 3060 Ti, the test has passed on four NVIDIA cards and one Intel card; native wave64 hardware and a title run with
XCL_PER_LANE=1are still not covered.AI use: Claude Code (Claude Sonnet 5.5) wrote this comment for @gefydev.
@DarkPanda69 on GitHub · 2026-11-25 16:51 UTC · original
Heads-up: since this merge,
main50a9fdefails this PR's own testa_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrieron every GPU here; at the PR head254a058it passes. So it looks like an interaction with something that reachedmainafter this branch's base, not a driver difference.cargo test -p xcl --lib -- a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier --test-threads=1, debug, Windows 11 Pro 26200:254a058main50a9fdeOn
mainit panics atlower_dxil.rs:1155(assertion left == right failed: group barriers in the program:followed by the disassembly, aNumThreads=(64,1,1),WaveSize=32compute shader), in 0.02 s, so it is the static barrier count, not a GPU run. Merges between this branch's base and50a9fdethat touch the recompiler or the direct DXIL path include #2076 (compact form), #2346, #2126, #2107 and #2080 (direct dispatch split); I have not bisected which one.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this comment.
@Gevroska on GitHub · 2026-11-25 17:04 UTC · original
I followed up on the reported barrier-count failure by checking where the extra barriers occur in the generated DXIL. On merged
50a9fdef, all three group barriers are in the entry block, before the first conditional branch. Two surround the shared-memory ballot exchange that computes the whole-wave EXEC condition for that branch. The guarded float compare still uses a half-local ballot and contains zero group barriers.The test body is identical on both revisions. With DXC/DXIL
1.9.2609.5on Windows, the static assertion passed on PR head254a058cwith one barrier and failed on50a9fdefwith three. The GPU stage was explicitly skipped on the PR head, and the assertion stopped the merged run before GPU execution.I’d keep the regression test focused on the guarded mask write. Checking the relevant block for a group barrier would catch one moving back into the divergent path. Changing the expected whole-program count to three would still let that regression pass if a barrier moved and the total stayed the same.
I used Codex GPT-6.2 Sol for the comparison and a separate GPT-6.2 Sol agent to verify the revisions, test output, and barrier positions in the disassembly.
I reviewed and approved this comment before posting.
@gefydev on GitHub · 2026-11-25 17:28 UTC · original
@DarkPanda69 @Gevroska thank you, both of you were right, and I reproduced it: on a clean
main68a284athe test fails withleft: 3, right: 1in 0.02 s, a static count (GTX 1650, DXC 1.9.2602.17).@Gevroska's reading of the disassembly holds on my side too: the three barriers are in the entry block, before the first conditional branch, two of them around the exchange of the whole-wave EXEC condition of
s_cbranch_execz; the guarded float compare has none. So the property of #2074 holds and the test's count of the whole program was too coarse. The fix is #2379, test only: at least one barrier in the entry block and none past the first conditional branch, as you suggested. With #2074's fix switched off the new check fails on the barrier in the guarded block, so it still catches the deadlock. I did not bisect which merged change added the entry-block exchange.AI use: Claude Code (Claude Sonnet 5.5) wrote this comment for @gefydev.
@SashaTun on GitHub · 2026-11-25 18:57 UTC · original
The test this PR added fails on
main, andmain's CI has been red since it landedmainis3ceb5507and its CI run fails on the test this PR added:The CI runner has no GPU, so this is not card-specific. I can reproduce it on
main68a284aon an NVIDIA RTX 5060 as well:The program has 3 group barriers, the test expects 1. It fails the same way with and without
XCL_PER_LANE=1(I ran both).The PR's commit message ties the 3 → 1 change to the per-lane path: "The new test's program had 3 group barriers before (two from the exchange inside the half's block) and has 1 now … Only
XCL_PER_LANE=1reaches this code." The fix setsLw::local_masksincrates/xcl/src/gpu/recomp/lower_dxil.rs(foreign(), the per-instruction path), andlocal_masks = trueappears nowhere else in the tree. The test lowers its program throughcompute_split→DxilIr::split, so I could not see how that path reaches the code the fix changes - with and without the variable the program still has 3 barriers.I do not know which side is wrong (the test may lower the program through a path the fix does not cover, or the fix may need to reach that path), so I am not proposing a change - this is not my PR. What is clear is that
mainstays red until it is settled, and every PR merged in the meantime carries the failure with it.I hit this while testing #2352 and #2344 on an NVIDIA card; my reports there name the failure and point here.
AI use: MiniMax Code (MiniMax-M3.1-Flash) ran the test, read the CI log and traced the code path.