Skip to main content

coopmat_usable

Function coopmat_usable 

Source
pub fn coopmat_usable() -> bool
Expand description

Runtime probe: does this adapter’s WGSL cooperative-matrix (tensor-core) multiply actually compute, or does it return zeros? Measured once, then cached — the f32 mirror of [df64_usable].

The coopmat kernels are correct and naga-validated, but on wgpu 29.0.3 the coopMultiplyAdd is a no-op that returns all-zeros (gfx-rs/wgpu #9741: coopmat emits Device-scope SPIR-V memory ops invalid unless vulkanMemoryModelDeviceScope is auto-enabled at device creation — fixed on main after 29.0.3, the newest crates.io release). So we never assume coopmat works from the advertised feature bit: we MEASURE it by running a tiny 8×8×8 coopmat GEMM whose exact result is non-zero (all-ones inputs → every output = 8.0) and accepting coopmat only if the result matches. On 29.0.3 this returns false (zeros); it returns true automatically once a wgpu release (or the [docs/WGPU_UPSTREAM_TRACKING.md] soft-fork) carries the fix. Gated first on caps().wgpu and caps().coopmat so non-coopmat adapters never dispatch.