pub struct ShuffleOperation<'c> { /* private fields */ }
Expand description
A shuffle
operation. Shuffle operation.
The shuffle operation constructs a permutation (or duplication) of elements from two input vectors, returning a vector with the same element type as the input and a length that is the same as the shuffle mask. The two input vectors must have the same element type, same rank , and trailing dimension sizes and shuffles their values in the leading dimension (which may differ in size) according to the given mask. The legality rules are:
- the two operands must have the same element type as the result
- Either, the two operands and the result must have the same rank and trailing dimension sizes, viz. given two k-D operands v1 : <s_1 x s_2 x .. x s_k x type> and v2 : <t_1 x t_2 x .. x t_k x type> we have s_i = t_i for all 1 < i <= k
- Or, the two operands must be 0-D vectors and the result is a 1-D vector.
- the mask length equals the leading dimension size of the result
- numbering the input vector indices left to right across the operands, all mask values must be within range, viz. given two k-D operands v1 and v2 above, all mask values are in the range [0,s_1+t_1)
Example:
%0 = vector.shuffle %a, %b[0, 3]
: vector<2xf32>, vector<2xf32> ; yields vector<2xf32>
%1 = vector.shuffle %c, %b[0, 1, 2]
: vector<2x16xf32>, vector<1x16xf32> ; yields vector<3x16xf32>
%2 = vector.shuffle %a, %b[3, 2, 1, 0]
: vector<2xf32>, vector<2xf32> ; yields vector<4xf32>
%3 = vector.shuffle %a, %b[0, 1]
: vector<f32>, vector<f32> ; yields vector<2xf32>
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>
pub fn builder( context: &'c Context, location: Location<'c> ) -> ShuffleOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.
pub fn vector(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn v_1(&self) -> Result<Value<'c, '_>, Error>
pub fn v_2(&self) -> Result<Value<'c, '_>, Error>
pub fn mask(&self) -> Result<ArrayAttribute<'c>, Error>
pub fn set_mask(&mut self, value: ArrayAttribute<'c>)
Trait Implementations§
source§impl<'c> From<ShuffleOperation<'c>> for Operation<'c>
impl<'c> From<ShuffleOperation<'c>> for Operation<'c>
source§fn from(operation: ShuffleOperation<'c>) -> Self
fn from(operation: ShuffleOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for ShuffleOperation<'c>
impl<'c> !Send for ShuffleOperation<'c>
impl<'c> !Sync for ShuffleOperation<'c>
impl<'c> Unpin for ShuffleOperation<'c>
impl<'c> UnwindSafe for ShuffleOperation<'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