Skip to content
Merged
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
6 changes: 3 additions & 3 deletions crates/xcl/src/gpu/dxil/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct KernelOptions {
/// Version of the direct translator's output, part of the on-disk translation cache's
/// identity (`recomp::pso`): bump it on any change that alters the emitted containers
/// (the `gpu/dxil` sources are not in build.rs's translator source hash).
pub const TRANSLATOR_VERSION: u32 = 7;
pub const TRANSLATOR_VERSION: u32 = 8;

/// `XCL_DIRECT_DXIL=1`: console compute shaders (and the kernel tests) go through this
/// translator, with the HLSL path as the fallback for what it cannot translate yet.
Expand Down Expand Up @@ -568,8 +568,8 @@ pub fn compute_init(lw: &mut Lw, cs: &CsInterface, tid: Value, gtid: [Value; 3])
let lanes: u32 = if lw.wave64 { 64 } else { 32 };
let total: u32 = cs.threads.iter().product();
if cs.tg_size {
// (threads / lanes) | (gi / lanes) << 6
let w = lw.c(total / lanes);
// the group's wave count (a partial last wave counts) | (gi / lanes) << 6
let w = lw.c(total.div_ceil(lanes));
let l = lw.c(lanes);
let i = lw.bin(super::module::BinOp::UDiv, tid, l);
let i = lw.shlc(i, 6);
Expand Down
6 changes: 4 additions & 2 deletions crates/xcl/src/gpu/recomp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6299,9 +6299,11 @@ fn gpu_compute_tg_size_counts_a_partial_last_wave() {
for (threads, wave64) in [(96u32, true), (96, false), (64, true), (40, false), (128, true)] {
let lanes = if wave64 { 64 } else { 32 };
let cs = super::CsInterface { threads: [threads, 1, 1], user_sgprs: 2, tgid: [false; 3], tg_size: true, tid_components: 1 };
let t = translate(&p, &on_gpu(Options { mode: Mode::Compute(cs), wave64, ..Default::default() })).unwrap();
let opt = on_gpu(Options { mode: Mode::Compute(cs), wave64, ..Default::default() });
let t = translate(&p, &opt).unwrap();
assert!(t.complete(), "{:?}", t.unsupported_why);
let dxil = super::dxc::compile(&t.hlsl, "main", "cs_6_6", &[]).unwrap_or_else(|e| panic!("{e}\n{}", t.hlsl));
// `XCL_DIRECT_DXIL=1`: the direct translator's kernel, which sets up TG_SIZE on its own
let dxil = direct_or(&p, &opt, super::dxc::compile(&t.hlsl, "main", "cs_6_6", &[]).unwrap_or_else(|e| panic!("{e}\n{}", t.hlsl)));
let mem = runner::dispatch(&dxil, [1, 1, 1], &[0u32; 128], &vec![0xFFFF_FFFFu32; threads as usize]).unwrap();
let waves = threads.div_ceil(lanes);
for (k, &got) in mem.iter().take(threads as usize).enumerate() {
Expand Down
Loading