#[non_exhaustive]pub enum SubgroupReduceOp {
Add,
Mul,
Min,
Max,
And,
Or,
Xor,
}Expand description
Re-exported so consumers matching/constructing KernelOpKind::SubgroupReduce
can name the reduction operator without depending on vyre-foundation.
Reduction operator applied across the active subgroup lanes.
Stability: matches must include a fallback arm so the contract can grow
without breaking SemVer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Add
Sum across the subgroup.
Mul
Product across the subgroup.
Min
Minimum across the subgroup.
Max
Maximum across the subgroup.
And
Bitwise AND across the subgroup.
Or
Bitwise OR across the subgroup.
Xor
Bitwise XOR across the subgroup.
Implementations§
Source§impl SubgroupReduceOp
impl SubgroupReduceOp
Sourcepub const ALL: [SubgroupReduceOp; 7]
pub const ALL: [SubgroupReduceOp; 7]
Every builtin reduction operator, in wire-tag order.
Sourcepub const fn builtin_wire_tag(self) -> u8
pub const fn builtin_wire_tag(self) -> u8
Frozen builtin wire tag for this reduction operator.
Sourcepub fn from_wire_tag(tag: u8) -> Result<SubgroupReduceOp, String>
pub fn from_wire_tag(tag: u8) -> Result<SubgroupReduceOp, String>
Decode a frozen builtin wire tag.
§Errors
Returns an actionable diagnostic when tag is not assigned.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Lower-case spelling used in op-id strings and diagnostics.
Sourcepub const fn is_bitwise(self) -> bool
pub const fn is_bitwise(self) -> bool
True when this operator is bitwise (integer-only): And/Or/Xor.
Bitwise reductions reject floating-point operands during type checking.
Sourcepub fn reduce_u32(self, lanes: impl IntoIterator<Item = u32>) -> u32
pub fn reduce_u32(self, lanes: impl IntoIterator<Item = u32>) -> u32
Canonical integer reduction of lanes under this operator.
This is the single source of truth for the operator’s semantics:
the CPU reference oracle, constant folding, and any host-side
evaluation route through it so they cannot drift. Wrapping arithmetic
matches the GPU ISA (redux.sync / subgroupAdd wrap on overflow).
Neutral elements: Add=0, Mul=1, Min=u32::MAX, Max=0,
And=u32::MAX, Or=0, Xor=0.
Sourcepub fn f32_identity(self) -> Option<f32>
pub fn f32_identity(self) -> Option<f32>
Floating-point identity (neutral) element for this operator, or None
for the bitwise operators (And/Or/Xor), which are integer-only.
Callers fold with Self::combine_f32 starting from this identity so
they can apply their own per-step canonicalization (e.g. NaN folding).
Trait Implementations§
Source§impl Clone for SubgroupReduceOp
impl Clone for SubgroupReduceOp
Source§fn clone(&self) -> SubgroupReduceOp
fn clone(&self) -> SubgroupReduceOp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SubgroupReduceOp
Source§impl Debug for SubgroupReduceOp
impl Debug for SubgroupReduceOp
Source§impl<'de> Deserialize<'de> for SubgroupReduceOp
impl<'de> Deserialize<'de> for SubgroupReduceOp
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubgroupReduceOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubgroupReduceOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for SubgroupReduceOp
Source§impl Hash for SubgroupReduceOp
impl Hash for SubgroupReduceOp
Source§impl PartialEq for SubgroupReduceOp
impl PartialEq for SubgroupReduceOp
Source§impl Serialize for SubgroupReduceOp
impl Serialize for SubgroupReduceOp
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for SubgroupReduceOp
Auto Trait Implementations§
impl Freeze for SubgroupReduceOp
impl RefUnwindSafe for SubgroupReduceOp
impl Send for SubgroupReduceOp
impl Sync for SubgroupReduceOp
impl Unpin for SubgroupReduceOp
impl UnsafeUnpin for SubgroupReduceOp
impl UnwindSafe for SubgroupReduceOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.