Halide
Halide::Internal::Shuffle Struct Reference

Construct a new vector by taking elements from another sequence of vectors. More...

#include <IR.h>

Inherits Halide::Internal::ExprNode< Shuffle >.

Public Member Functions

bool is_interleave () const
 Check if this shuffle is an interleaving of the vector arguments. More...
 
bool is_broadcast () const
 Check if this shuffle can be represented as a broadcast. More...
 
int broadcast_factor () const
 
bool is_concat () const
 Check if this shuffle is a concatenation of the vector arguments. More...
 
bool is_extract_element () const
 Check if this shuffle is extracting a scalar from the vector arguments. More...
 
bool is_slice () const
 Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice. More...
 
int slice_begin () const
 Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice. More...
 
int slice_stride () const
 Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice. More...
 
- Public Member Functions inherited from Halide::Internal::ExprNode< Shuffle >
void accept (IRVisitor *v) const override
 We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors. More...
 
Expr mutate_expr (IRMutator *v) const override
 
 ExprNode ()
 
 ~ExprNode () override=default
 
- Public Member Functions inherited from Halide::Internal::BaseExprNode
 BaseExprNode (IRNodeType t)
 
- Public Member Functions inherited from Halide::Internal::IRNode
 IRNode (IRNodeType t)
 
virtual ~IRNode ()=default
 

Static Public Member Functions

static Expr make (const std::vector< Expr > &vectors, const std::vector< int > &indices)
 
static Expr make_interleave (const std::vector< Expr > &vectors)
 Convenience constructor for making a shuffle representing an interleaving of vectors of the same length. More...
 
static Expr make_concat (const std::vector< Expr > &vectors)
 Convenience constructor for making a shuffle representing a concatenation of the vectors. More...
 
static Expr make_broadcast (Expr vector, int factor)
 Convenience constructor for making a shuffle representing a broadcast of a vector. More...
 
static Expr make_slice (Expr vector, int begin, int stride, int size)
 Convenience constructor for making a shuffle representing a contiguous subset of a vector. More...
 
static Expr make_extract_element (Expr vector, int i)
 Convenience constructor for making a shuffle representing extracting a single element. More...
 

Public Attributes

std::vector< Exprvectors
 
std::vector< int > indices
 Indices indicating which vector element to place into the result. More...
 
- Public Attributes inherited from Halide::Internal::BaseExprNode
Type type
 
- Public Attributes inherited from Halide::Internal::IRNode
RefCount ref_count
 These classes are all managed with intrusive reference counting, so we also track a reference count. More...
 
IRNodeType node_type
 Each IR node subclass has a unique identifier. More...
 

Static Public Attributes

static const IRNodeType _node_type = IRNodeType::Shuffle
 

Detailed Description

Construct a new vector by taking elements from another sequence of vectors.

Definition at line 819 of file IR.h.

Member Function Documentation

◆ make()

static Expr Halide::Internal::Shuffle::make ( const std::vector< Expr > &  vectors,
const std::vector< int > &  indices 
)
static

◆ make_interleave()

static Expr Halide::Internal::Shuffle::make_interleave ( const std::vector< Expr > &  vectors)
static

Convenience constructor for making a shuffle representing an interleaving of vectors of the same length.

◆ make_concat()

static Expr Halide::Internal::Shuffle::make_concat ( const std::vector< Expr > &  vectors)
static

Convenience constructor for making a shuffle representing a concatenation of the vectors.

◆ make_broadcast()

static Expr Halide::Internal::Shuffle::make_broadcast ( Expr  vector,
int  factor 
)
static

Convenience constructor for making a shuffle representing a broadcast of a vector.

◆ make_slice()

static Expr Halide::Internal::Shuffle::make_slice ( Expr  vector,
int  begin,
int  stride,
int  size 
)
static

Convenience constructor for making a shuffle representing a contiguous subset of a vector.

Referenced by Halide::Internal::IRMatcher::SliceOp< Vec, Base, Stride, Lanes >::make().

◆ make_extract_element()

static Expr Halide::Internal::Shuffle::make_extract_element ( Expr  vector,
int  i 
)
static

Convenience constructor for making a shuffle representing extracting a single element.

◆ is_interleave()

bool Halide::Internal::Shuffle::is_interleave ( ) const

Check if this shuffle is an interleaving of the vector arguments.

◆ is_broadcast()

bool Halide::Internal::Shuffle::is_broadcast ( ) const

Check if this shuffle can be represented as a broadcast.

For example: A uint8 shuffle of with 4*n lanes and indices: 0, 1, 2, 3, 0, 1, 2, 3, ....., 0, 1, 2, 3 can be represented as a uint32 broadcast with n lanes (factor = 4).

◆ broadcast_factor()

int Halide::Internal::Shuffle::broadcast_factor ( ) const

◆ is_concat()

bool Halide::Internal::Shuffle::is_concat ( ) const

Check if this shuffle is a concatenation of the vector arguments.

◆ is_slice()

bool Halide::Internal::Shuffle::is_slice ( ) const

Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice.

◆ slice_begin()

int Halide::Internal::Shuffle::slice_begin ( ) const
inline

Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice.

Definition at line 871 of file IR.h.

References indices.

Referenced by Halide::Internal::IRMatcher::SliceOp< Vec, Base, Stride, Lanes >::match().

◆ slice_stride()

int Halide::Internal::Shuffle::slice_stride ( ) const
inline

Check if this shuffle is a contiguous strict subset of the vector arguments, and if so, the offset and stride of the slice.

Definition at line 874 of file IR.h.

References indices.

Referenced by Halide::Internal::IRMatcher::SliceOp< Vec, Base, Stride, Lanes >::match().

◆ is_extract_element()

bool Halide::Internal::Shuffle::is_extract_element ( ) const

Check if this shuffle is extracting a scalar from the vector arguments.

Member Data Documentation

◆ vectors

std::vector<Expr> Halide::Internal::Shuffle::vectors

◆ indices

std::vector<int> Halide::Internal::Shuffle::indices

Indices indicating which vector element to place into the result.

The elements are numbered by their position in the concatenation of the vector arguments.

Definition at line 825 of file IR.h.

Referenced by slice_begin(), and slice_stride().

◆ _node_type

const IRNodeType Halide::Internal::Shuffle::_node_type = IRNodeType::Shuffle
static

Definition at line 883 of file IR.h.


The documentation for this struct was generated from the following file: