Mojo struct
ReduceOp
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,
Writable
comptime members
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.
write_to
write_to(self, mut writer: T)
Writes a string representation of the reduction operation.
Args:
- writer (
T): The object to write to.
write_repr_to
write_repr_to(self, mut writer: T)
Writes a string representation of the reduction operation.
Args:
- writer (
T): The object to write to.
mnemonic
mnemonic(self) -> StaticString
Returns the mnemonic string for the reduction operation.
Returns:
StaticString: 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!