pub struct SimdGroupOperations;Expand description
SIMD group operations for Metal.
Metal simd_shuffle* / simd_sum intrinsics compile to MSL and are gated
on real Metal hardware. The WGSL emitted here maps each onto the portable
WGSL subgroup built-ins when the device exposes
wgpu::Features::SUBGROUP (native == true); otherwise it emits a
workgroupBarrier()-synchronised workgroup-shared-memory emulation with
matching semantics within a workgroup. Every helper takes trailing
(lid: u32, n: u32) — the invocation’s local_invocation_index and the
active-invocation count — which the native path ignores.
Implementations§
Source§impl SimdGroupOperations
impl SimdGroupOperations
Sourcepub fn simd_shuffle_shader(native: bool) -> String
pub fn simd_shuffle_shader(native: bool) -> String
Generate shader code for SIMD group shuffle operations.
Sourcepub fn simd_reduce_shader(native: bool) -> String
pub fn simd_reduce_shader(native: bool) -> String
Generate shader code for SIMD group reductions.
Native reductions broadcast the reduced value to every lane of the
subgroup (matching Metal’s simd_sum family). The emulation reduces
across the whole workgroup (n active invocations, n <= 256) and
likewise returns the result on every invocation.
Sourcepub fn native_subgroups(context: &GpuContext) -> bool
pub fn native_subgroups(context: &GpuContext) -> bool
Return true when the device exposes native subgroup intrinsics.
Convenience wrapper to pick the native argument for
Self::simd_shuffle_shader / Self::simd_reduce_shader from a live
GpuContext.