Mojo struct
ReduceOp
@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
,
Movable
,
UnknownDestructibility
Aliases
ADD
alias ADD = ReduceOp(0)
Addition reduction operation.
Combines values by adding them together.
AND
alias AND = ReduceOp(3)
Bitwise AND reduction operation.
Performs bitwise AND across all inputs.
MAX
alias MAX = ReduceOp(2)
Maximum reduction operation.
Finds the maximum value across all inputs.
MIN
alias MIN = ReduceOp(1)
Minimum reduction operation.
Finds the minimum value across all inputs.
OR
alias OR = ReduceOp(4)
Bitwise OR reduction operation.
Performs bitwise OR across all inputs.
XOR
alias 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:
True if the reduction operations are equal, False otherwise.
__ne__
__ne__(self, other: Self) -> Bool
Tests if two ReduceOp instances are not equal.
Args:
- other (
Self
): The ReduceOp instance to compare against.
Returns:
True if the reduction operations are different, 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:
True if the reduction operations are identical, False otherwise.
__isnot__
__isnot__(self, other: Self) -> Bool
Tests if two ReduceOp instances are not identical.
Args:
- other (
Self
): The ReduceOp instance to compare against.
Returns:
True if the reduction operations are not identical, False otherwise.
__str__
__str__(self) -> String
Returns a string representation of the reduction operation.
Returns:
A string describing the reduction operation.
mnemonic
mnemonic(self) -> StringSlice[StaticConstantOrigin]
Returns the mnemonic string for the reduction operation.
Returns:
A string literal containing the reduction operation mnemonic.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!