pub struct ShuffleOperation<'c> { /* private fields */ }Expand description
A shuffle operation. Shuffles values within a subgroup..
The “shuffle” op moves values across lanes in a subgroup (a.k.a., local
invocation) within the same subgroup. The width argument specifies the
number of lanes that participate in the shuffle, and must be uniform
across all lanes. Further, the first width lanes of the subgroup must
be active.
The intepretation of the offset arguments depends on the selected
mode.
Returns the shuffleResult and true if the current lane id is smaller
than width, and an unspecified value and false otherwise.
xor example:
%1, %2 = gpu.shuffle xor %0, %offset, %width : f32For lane k, returns the value %0 from lane k ^ offset. Every lane
trades value with exactly one other lane.
down example:
%cst1 = arith.constant 1 : i32
%3, %4 = gpu.shuffle down %0, %cst1, %width : f32For lane k, returns the value from lane (k + cst1). If (k + cst1) is
bigger than or equal to width, the value is poison and valid is false.
up example:
%cst1 = arith.constant 1 : i32
%5, %6 = gpu.shuffle up %0, %cst1, %width : f32For lane k, returns the value from lane (k - cst1). If (k - cst1) is
smaller than 0, the value is poison and valid is false.
idx example:
%cst0 = arith.constant 0 : i32
%7, %8 = gpu.shuffle idx %0, %cst0, %width : f32Broadcasts the value from lane 0 to all lanes.
Implementations§
Source§impl<'c> ShuffleOperation<'c>
impl<'c> ShuffleOperation<'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>,
) -> ShuffleOperationBuilder<'c, Unset, Unset, Unset, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c>, ) -> ShuffleOperationBuilder<'c, Unset, Unset, Unset, Unset, Unset, Unset>
Creates a builder.
pub fn shuffle_result(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn valid(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn value(&self) -> Result<Value<'c, '_>, Error>
pub fn offset(&self) -> Result<Value<'c, '_>, Error>
pub fn width(&self) -> Result<Value<'c, '_>, Error>
pub fn mode(&self) -> Result<Attribute<'c>, Error>
pub fn set_mode(&mut self, value: Attribute<'c>)
Trait Implementations§
Source§impl<'c> Clone for ShuffleOperation<'c>
impl<'c> Clone for ShuffleOperation<'c>
Source§fn clone(&self) -> ShuffleOperation<'c>
fn clone(&self) -> ShuffleOperation<'c>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more