pub struct ReduceOperation<'c> { /* private fields */ }
Expand description
A reduce
operation. Reduce operation for parallel for.
“scf.reduce” is an operation occurring inside “scf.parallel” operations. It consists of one block with two arguments which have the same type as the operand of “scf.reduce”.
“scf.reduce” is used to model the value for reduction computations of a “scf.parallel” operation. It has to appear as an immediate child of a “scf.parallel” and is associated with a result value of its parent operation.
Association is in the order of appearance in the body where the first result of a parallel loop operation corresponds to the first “scf.reduce” in the operation’s body region. The reduce operation takes a single operand, which is the value to be used in the reduction.
The reduce operation contains a region whose entry block expects two arguments of the same type as the operand. As the iteration order of the parallel loop and hence reduction order is unspecified, the result of reduction may be non-deterministic unless the operation is associative and commutative.
The result of the reduce operation’s body must have the same type as the operands and associated result value of the parallel loop operation. Example:
%operand = arith.constant 1.0 : f32
scf.reduce(%operand) : f32 {
^bb0(%lhs : f32, %rhs: f32):
%res = arith.addf %lhs, %rhs : f32
scf.reduce.return %res : f32
}
Implementations§
source§impl<'c> ReduceOperation<'c>
impl<'c> ReduceOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> ReduceOperationBuilder<'c, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> ReduceOperationBuilder<'c, Unset, Unset>
Creates a builder.