From cc426e62e4ef7716f114b2cbb13043275e085e8d Mon Sep 17 00:00:00 2001 From: grahamster2 <128315603+grahamster2@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:14:03 -0500 Subject: [PATCH] Tests: the bridged mask write also needs a group barrier in the entry block #2420 fixed this test after #2203 (whole-wave branches in split wave64) put the exchange of the `s_cbranch_execz` condition into the entry block, by counting only the barriers past the entry block's branch. A program that is no longer the split form (no barrier anywhere) passes that check too, so also require at least one group barrier in the entry block, as #2379 did, and drop the doc comment's "the only barrier left is the one at the start", which has not held since #2203. With `Lw::local_masks` forced off (#2074's fix switched off) the test still fails, on 2 barriers past the branch. Assisted-by: Claude Code (Claude Opus 5.5) --- crates/xcl/src/gpu/recomp/lower_dxil.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/xcl/src/gpu/recomp/lower_dxil.rs b/crates/xcl/src/gpu/recomp/lower_dxil.rs index cec9257c8a..41a09ec3df 100644 --- a/crates/xcl/src/gpu/recomp/lower_dxil.rs +++ b/crates/xcl/src/gpu/recomp/lower_dxil.rs @@ -1120,7 +1120,9 @@ mod tests { /// wave64 group reaches (Pipodi's point 5 on #1745): a nested `if` whose condition goes to /// `s_and_saveexec`. #1426 would ballot the compare's mask through an exchange, a group /// barrier the upper half never reaches. The bridge reads back only each lane's bit, so this - /// half's ballot is enough, and the only barrier left is the one at the start. + /// half's ballot is enough, and no group barrier appears past the entry block's branch, where + /// only one half may be. The barriers are all in the entry block, which every lane of both + /// halves reaches. #[test] fn a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier() { let lines: &[I] = &[ @@ -1150,10 +1152,14 @@ mod tests { return runner::skip_test("no DXC"); } let text = crate::gpu::dxil::validate::disassemble(&dxil).unwrap(); - let (_, after_entry) = text.split_once("\n br ").unwrap_or_else(|| panic!("expected branch in program:\n{text}")); - let divergent_barriers = after_entry.lines().filter(|l| l.contains("call void @dx.op.barrier")).count(); + let barriers = |s: &str| s.lines().filter(|l| l.contains("call void @dx.op.barrier")).count(); + let (entry, after_entry) = text.split_once("\n br ").unwrap_or_else(|| panic!("expected branch in program:\n{text}")); + // the halves take their console lanes (and exchange the whole-wave EXEC condition of + // `s_cbranch_execz`) at group barriers in the entry block, where every lane is: without + // one there the program is not the split form this test is about + assert!(barriers(entry) >= 1, "no group barrier in the entry block:\n{text}"); // after the entry whole-wave branch, only one half reaches the body so no group barrier may appear there - assert_eq!(divergent_barriers, 0, "group barriers after entry branch:\n{text}"); + assert_eq!(barriers(after_entry), 0, "group barriers after entry branch:\n{text}"); if !gpu() { return; }