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
11 changes: 9 additions & 2 deletions crates/xcl/src/gpu/dxil/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,12 @@ fn translate_on_this_thread(
Entry::Compute(cs) => {
let (tid, gtid) = lw.setup_lanes_compute(cs.threads, uses_lds);
lw.safe_barrier_init();
if split && !uses_lds && cs.threads == [64, 1, 1] { split_tid = Some(tid); }
let total = cs.threads.iter().try_fold(1u32, |a, &b| a.checked_mul(b)).unwrap_or(0);
if split && !uses_lds && cs.threads == [64, 1, 1] {
split_tid = Some(tid);
} else if !o.wave64 && !uses_lds && cs.threads[1] * cs.threads[2] > 1 && total > 32 && total % 32 == 0 {
split_tid = Some(tid);
}
group_runs = Some(compute_init(&mut lw, cs, tid, gtid));
cs.threads
}
Expand Down Expand Up @@ -846,11 +851,13 @@ impl Lw {
}
let stage = self.s.stage;
let mut dispatch_chain = None;
let total = numthreads.iter().try_fold(1u32, |a, &b| a.checked_mul(b)).unwrap_or(0);
let native_w32 = !self.wave64 && !self.split && self.lds.is_none() && total >= 32 && total % 32 == 0;
let c = if matches!(stage, Stage::Vertex | Stage::Pixel) {
let g = self.gfx.take().ok_or("graphics entry without graphics I/O")?;
let info = if stage == Stage::Pixel { super::graphics::StageInfo::Pixel { early_depth_stencil: false } } else { super::graphics::StageInfo::Vertex };
self.s.try_finish_graphics(g.io, info)
} else if limit > 0 && (numthreads == [32, 1, 1] || split_tid.is_some()) && hw == 32 {
} else if limit > 0 && (native_w32 || split_tid.is_some()) && hw == 32 {
self.s.m.optimize();
// A single split wave64 meets its other half through group-shared counters its entry
// zeroes (`Partner::Spin`), and the exchange's running number counts from the
Expand Down
11 changes: 9 additions & 2 deletions crates/xcl/src/gpu/dxil/lanes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Lw {
let t = self.s.m.i1c(true);
let rank = self.s.wave_prefix_bit_count(t);
self.add(base, rank)
} else if y * z > 1 {
} else if y * z > 1 && total > lanes {
let i32 = self.s.m.i32();
let (g, at) = match (self.lds, lds_top_word) {
(Some(l), true) => (l, 8191),
Expand All @@ -152,8 +152,13 @@ impl Lw {
let base = self.sel(take, got, dflt);
let base = self.s.wave_read_lane_first(base);
let tid = self.add(base, hw);
self.s.barrier(barrier::GROUP_SYNC);
if lds_top_word && self.lds.is_some() {
self.s.barrier(barrier::GROUP_SYNC);
}
tid
} else if y * z > 1 {
// single native wave (`total <= lanes`): base is always 0, so no `xcl_wt` counter or barriers
self.s.wave_lane_index()
} else {
self.s.flattened_thread_id_in_group()
};
Expand All @@ -172,6 +177,8 @@ impl Lw {
}
let lane = if self.split {
self.andc(tid, 63)
} else if y * z > 1 && total <= lanes {
tid
} else {
self.s.wave_lane_index()
};
Expand Down
Loading
Loading