ReduceOp | Modular
@register_passable(trivial)
struct ReduceOp
Represents reduction operations for parallel reduction algorithms.
This struct defines different reduction operations that can be performed across multiple threads in parallel. These operations are commonly used in parallel reduction algorithms on GPUs.
Implemented traits
AnyType,
Copyable,
Equatable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime members
__copy_ctor_is_trivial
comptime __copy_ctor_is_trivial = True
__del__is_trivial
comptime __del__is_trivial = True
__move_ctor_is_trivial
comptime __move_ctor_is_trivial = True
ADD
comptime ADD = ReduceOp(0)
Addition reduction operation.
Combines values by adding them together.
AND
comptime AND = ReduceOp(3)
Bitwise AND reduction operation.
Performs bitwise AND across all inputs.
MAX
comptime MAX = ReduceOp(2)
Maximum reduction operation.
Finds the maximum value across all inputs.
MIN
comptime MIN = ReduceOp(1)
Minimum reduction operation.
Finds the minimum value across all inputs.
OR
comptime OR = ReduceOp(4)
Bitwise OR reduction operation.
Performs bitwise OR across all inputs.
XOR
comptime XOR = ReduceOp(5)
Bitwise XOR reduction operation.
Performs bitwise XOR across all inputs.
Methods
__eq__
__eq__(self, other: Self) -> Bool
Tests if two ReduceOp instances are equal.
Args:
- other (
Self): The ReduceOp instance to compare against.
Returns:
Bool: True if the reduction operations are equal, False otherwise.
__is__
__is__(self, other: Self) -> Bool
Tests if two ReduceOp instances are identical.
Args:
- other (
Self): The ReduceOp instance to compare against.
Returns:
Bool: True if the reduction operations are identical, False otherwise.
__str__
__str__(self) -> String
Returns a string representation of the reduction operation.
Returns:
String: A string describing the reduction operation.
mnemonic
mnemonic(self) -> StaticString
Returns the mnemonic string for the reduction operation.
Returns:
StaticString: A string literal containing the reduction operation mnemonic.