Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/xcl/src/gpu/dxil/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn translate_on_this_thread(
}
Entry::Compute(cs) => {
let (tid, gtid) = lw.setup_lanes_compute(cs.threads, uses_lds);
if split && !uses_lds && cs.threads == [64, 1, 1] { split_tid = Some(tid); }
if split && !uses_lds && cs.threads.iter().product::<u32>() % 64 == 0 { split_tid = Some(tid); }
compute_init(&mut lw, cs, tid, gtid);
cs.threads
}
Expand Down
2 changes: 2 additions & 0 deletions crates/xcl/src/gpu/dxil/lanes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ impl Lw {
let alive = self.cmpc(Pred::Eq, dead, 0);
let has = self.cmpc(Pred::Ne, xn, 0);
let go = self.land(alive, has);
let region = (self.cur(), self.s.m.block_count());
let _ = self.guarded(go, &mut |lw| {
lw.s.barrier(barrier::TGSM_FENCE);
let t = lw.s.m.i1c(true);
Expand Down Expand Up @@ -354,6 +355,7 @@ impl Lw {
});
let one = self.c(1);
let ho = self.xor(h, one);
self.s.m.finish_spin_region(region.0, region.1);
let theirs = at(self, ho);
let metv = self.rd(met);
let ok = self.nz(metv);
Expand Down
10 changes: 10 additions & 0 deletions crates/xcl/src/gpu/dxil/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ pub struct Module {
insts: Vec<InstDef>,
def_block: Vec<Block>,
blocks: Vec<Vec<u32>>,
spin_regions: Vec<Vec<Block>>,
cur: Block,
insert_before_term: bool,
md: Vec<MdDef>,
Expand Down Expand Up @@ -282,6 +283,7 @@ impl Module {
insts: Vec::new(),
def_block: Vec::new(),
blocks: vec![Vec::new()],
spin_regions: Vec::new(),
cur: Block(0),
insert_before_term: false,
md: Vec::new(),
Expand Down Expand Up @@ -519,6 +521,14 @@ impl Module {
self.blocks.push(Vec::new());
Block(self.blocks.len() as u32 - 1)
}
/// Keep both halves' signal and wait in the same dispatch. The join can
/// begin the next piece since the exchange slots are checkpointed.
pub(super) fn finish_spin_region(&mut self, start: Block, first_new: usize) {
let mut region = vec![start];
region.extend((first_new..self.blocks.len()).map(|i| Block(i as u32)).filter(|&b| b != self.cur));
self.spin_regions.push(region);
}

pub fn entry_block(&self) -> Block {
Block(0)
}
Expand Down
Loading
Loading