pub struct AllReduceOperation<'c> { /* private fields */ }
Expand description
An all_reduce
operation. Reduce values among workgroup..
The all_reduce
op reduces the value of every work item across a local
workgroup. The result is equal for all work items of a workgroup.
For example, both
%1 = gpu.all_reduce add %0 {} : (f32) -> (f32)
%2 = gpu.all_reduce %0 {
^bb(%lhs : f32, %rhs : f32):
%sum = arith.addf %lhs, %rhs : f32
"gpu.yield"(%sum) : (f32) -> ()
} : (f32) -> (f32)
compute the sum of each work item’s %0 value. The first version specifies
the accumulation as operation, whereas the second version specifies the
accumulation as code region. The accumulation operation must be one of:
add
, and
, max
, min
, mul
, or
, xor
.
If uniform
flag is set either none or all work items of a workgroup
need to execute this op in convergence.
Implementations§
source§impl<'c> AllReduceOperation<'c>
impl<'c> AllReduceOperation<'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>
) -> AllReduceOperationBuilder<'c, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> AllReduceOperationBuilder<'c, Unset, Unset>
Creates a builder.
pub fn value(&self) -> Result<Value<'c, '_>, Error>
pub fn body(&self) -> Result<RegionRef<'c, '_>, Error>
pub fn op(&self) -> Result<Attribute<'c>, Error>
pub fn set_op(&mut self, value: Attribute<'c>)
pub fn remove_op(&mut self) -> Result<(), Error>
pub fn uniform(&self) -> Result<Attribute<'c>, Error>
pub fn set_uniform(&mut self, value: Attribute<'c>)
pub fn remove_uniform(&mut self) -> Result<(), Error>
Trait Implementations§
source§impl<'c> From<AllReduceOperation<'c>> for Operation<'c>
impl<'c> From<AllReduceOperation<'c>> for Operation<'c>
source§fn from(operation: AllReduceOperation<'c>) -> Self
fn from(operation: AllReduceOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for AllReduceOperation<'c>
impl<'c> !Send for AllReduceOperation<'c>
impl<'c> !Sync for AllReduceOperation<'c>
impl<'c> Unpin for AllReduceOperation<'c>
impl<'c> UnwindSafe for AllReduceOperation<'c>
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
Mutably borrows from an owned value. Read more