diff --git a/crates/xcl/src/gpu/recomp/runner.rs b/crates/xcl/src/gpu/recomp/runner.rs index a32e77d..c69c03e 100644 --- a/crates/xcl/src/gpu/recomp/runner.rs +++ b/crates/xcl/src/gpu/recomp/runner.rs @@ -61,6 +61,8 @@ struct Gpu { value: u64, adapter: String, wave64: bool, + /// 32-lane waves (`[WaveSize(32)]`: the split wave64 form; WARP has neither 32 nor 64) + wave32: bool, /// mesh shader tier 1 or higher (`mesh_draw`) mesh: bool, } @@ -103,6 +105,7 @@ fn init() -> Result { return Err(format!("{name}: no wave operations/int64")); } let wave64 = o1.WaveLaneCountMin <= 64 && o1.WaveLaneCountMax >= 64; + let wave32 = o1.WaveLaneCountMin <= 32 && o1.WaveLaneCountMax >= 32; let mut o7 = D3D12_FEATURE_DATA_D3D12_OPTIONS7::default(); let mesh = dev.CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS7, &mut o7 as *mut _ as _, std::mem::size_of_val(&o7) as u32).is_ok() && o7.MeshShaderTier.0 >= D3D12_MESH_SHADER_TIER_1.0; @@ -110,7 +113,7 @@ fn init() -> Result { dev.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC { Type: D3D12_COMMAND_LIST_TYPE_DIRECT, ..Default::default() }).map_err(e)?; let rs = root_signature(&dev, false)?; let fence: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).map_err(e)?; - Ok(Gpu { dev, queue, rs, fence, value: 0, adapter: name, wave64, mesh }) + Ok(Gpu { dev, queue, rs, fence, value: 0, adapter: name, wave64, wave32, mesh }) } } @@ -356,6 +359,13 @@ pub fn split_wave64() -> bool { wave64_supported() == Ok(false) } +/// Whether wave64 programs run on this adapter at all: natively (64-lane waves) or split (32). +pub fn wave64_programs_supported() -> Result { + let mut g = GPU.lock().unwrap(); + let gpu = g.get_or_insert_with(init); + gpu.as_ref().map(|x| x.wave64 || x.wave32).map_err(|x| x.clone()) +} + /// `Options` for programs run on this adapter: the split wave64 form where it is needed. pub fn options(mode: super::Mode) -> super::Options { super::Options { mode, split_wave64: split_wave64(), ..Default::default() } diff --git a/crates/xcl/src/gpu/recomp/tests.rs b/crates/xcl/src/gpu/recomp/tests.rs index b38e2c0..7ad9bb4 100644 --- a/crates/xcl/src/gpu/recomp/tests.rs +++ b/crates/xcl/src/gpu/recomp/tests.rs @@ -7,13 +7,14 @@ use super::{translate, Mode, Options}; use crate::gpu::rdna2::encode; /// A GPU and DXC for the instruction tests. Wave64 programs run natively where the adapter -/// has 64-lane waves and in the split form (`runner::options`) where it has only 32. +/// has 64-lane waves and in the split form (`runner::options`) where it has only 32 (an +/// adapter with neither, such as WARP, skips). fn gpu_ready() -> bool { - match (runner::adapter(), runner::wave64_supported(), super::dxc::location()) { - (Ok(_), Ok(_), Ok(_)) => true, + match (runner::adapter(), runner::wave64_programs_supported(), super::dxc::location()) { + (Ok(_), Ok(true), Ok(_)) => true, (a, w, d) => { println!("GPU/DXC unavailable – skipping ({:?} / {:?} / {:?})", a.as_ref().err(), w.as_ref().ok(), d.as_ref().err()); - runner::skip_test(if a.is_err() || w.is_err() { "no GPU" } else { "no DXC" }); + runner::skip_test(if a.is_err() || w.is_err() { "no GPU" } else if d.is_err() { "no DXC" } else { "no wave64" }); false } } @@ -34,17 +35,6 @@ fn on_gpu(o: Options) -> Options { Options { split_wave64: runner::split_wave64(), ..o } } -fn gpu_ready_wave32() -> bool { - match (runner::adapter(), super::dxc::location()) { - (Ok(_), Ok(_)) => true, - (a, d) => { - println!("GPU/DXC unavailable – skipping ({:?} / {:?})", a.as_ref().err(), d.as_ref().err()); - runner::skip_test(if a.is_err() { "no GPU" } else { "no DXC" }); - false - } - } -} - /// `runner::mesh_draw` needs mesh shaders (not every adapter with wave64 has them). fn mesh_ready() -> bool { match runner::mesh_shaders_supported() { @@ -2324,7 +2314,7 @@ fn dump_retail_interfaces() { /// vertex by vertex (strip winding included), then drawn by the mesh pass-through. #[test] fn gpu_geometry_mode_es_gs_strip() { - if !gpu_ready_wave32() || !mesh_ready() { + if !gpu_ready() || !mesh_ready() { return; } use super::{dxc, mesh_passthrough, GsInterface, IO_GS_PRIMS, IO_GS_VERTICES, MESH_HEADER}; @@ -2451,7 +2441,7 @@ fn gpu_geometry_mode_es_gs_strip() { /// native form where the GPU has 64-lane waves (the compute pass alone: no mesh shaders needed). #[test] fn gpu_geometry_wave32_prefix_count_over_a_mask() { - if !gpu_ready_wave32() { + if !gpu_ready() { return; } use super::{dxc, translate_geometry, GsInterface, IO_GS_PRIMS};