tvm
|
Managed reference to LayoutNode. More...
#include <data_layout.h>
Public Member Functions | |
Layout (const Array< tir::IterVar > &axes) | |
Layout (const tvm::String &name) | |
construct from a string More... | |
Layout (const char *name) | |
construct from a string More... | |
Layout (const std::string &name, DataType dtype=DataType::Int(32)) | |
construct from a string. More... | |
LayoutNode * | operator-> () |
access the internal node container More... | |
Layout | SubLayout (size_t pos, size_t len) const |
Returns a sub-layout which is the portion of the object that starts at dimension pos and spans len dimensions (or until the end of the layout, whichever comes first). More... | |
Layout | Split (const LayoutAxis &axis, size_t target_pos, int32_t factor) const |
Split axis by size and put the sub-axis to position target_pos . More... | |
size_t | ndim () const |
size_t | ndim_primal () const |
Layout | ExpandPrimal (const Layout &dst_layout) |
Returns a new layout where the dims have been expanded to match the primal dimensions. More... | |
int32_t | IndexOf (const LayoutAxis &axis) const |
return the index of the input axis. If it is not found in the layout or the layout is undefined, return -1. More... | |
int32_t | FactorOf (const LayoutAxis &axis) const |
Get the factor size of the subordinate axis. More... | |
bool | Contains (const LayoutAxis &axis) const |
Whether the layout contains an axis. More... | |
const LayoutAxis & | operator[] (int32_t i) const |
std::string | name () const |
bool | Equals (const Layout &rhs) const |
Whether the two layouts are equal. More... | |
TVM_DEFINE_OBJECT_REF_METHODS (Layout, ObjectRef, LayoutNode) | |
Public Member Functions inherited from tvm::runtime::ObjectRef | |
ObjectRef ()=default | |
default constructor More... | |
ObjectRef (ObjectPtr< Object > data) | |
Constructor from existing object ptr. More... | |
bool | same_as (const ObjectRef &other) const |
Comparator. More... | |
bool | operator== (const ObjectRef &other) const |
Comparator. More... | |
bool | operator!= (const ObjectRef &other) const |
Comparator. More... | |
bool | operator< (const ObjectRef &other) const |
Comparator. More... | |
bool | defined () const |
const Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
int | use_count () const |
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> | |
Optional< ObjectRefType > | as () const |
Try to downcast the ObjectRef to a Optional<T> of the requested type. More... | |
Static Public Member Functions | |
static const Layout & | Undef () |
Return an undefined layout. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Layout &l) |
allow output string of layout to ostream More... | |
Additional Inherited Members | |
Public Types inherited from tvm::runtime::ObjectRef | |
using | ContainerType = Object |
type indicate the container type. More... | |
Static Public Attributes inherited from tvm::runtime::ObjectRef | |
static constexpr bool | _type_is_nullable = true |
Protected Member Functions inherited from tvm::runtime::ObjectRef | |
Object * | get_mutable () const |
Static Protected Member Functions inherited from tvm::runtime::ObjectRef | |
template<typename T > | |
static T | DowncastNoCheck (ObjectRef ref) |
Internal helper function downcast a ref without check. More... | |
static void | FFIClearAfterMove (ObjectRef *ref) |
Clear the object ref data field without DecRef after we successfully moved the field. More... | |
template<typename ObjectType > | |
static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
Protected Attributes inherited from tvm::runtime::ObjectRef | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
Managed reference to LayoutNode.
|
explicit |
|
inline |
construct from a string
|
inline |
construct from a string
tvm::tir::Layout::Layout | ( | const std::string & | name, |
DataType | dtype = DataType::Int(32) |
||
) |
construct from a string.
name | input in layout convention: upper case indicates a dimension and the corresponding lower case with factor size indicates the split dimension. return undefined layout if "__undef__" is passed. |
dtype | The dtype of generated axes vars in the returned layout. It is required to be integer type. |
|
inline |
Whether the layout contains an axis.
axis | axis to be checked. |
|
inline |
Whether the two layouts are equal.
rhs | Another layout. |
Returns a new layout where the dims have been expanded to match the primal dimensions.
dst_layout | The dst layout to which current layout has to be expanded. |
int32_t tvm::tir::Layout::FactorOf | ( | const LayoutAxis & | axis | ) | const |
Get the factor size of the subordinate axis.
axis | the input primal-axis or subordinate-axis. |
axis
(if axis
is a primal-axis), or the size of axis
itself (if axis
is a subordinate-axis). Return -1 if axis
is not in the layout the layout is undefined.
|
inline |
return the index of the input axis. If it is not found in the layout or the layout is undefined, return -1.
axis | the input axis. |
|
inline |
|
inline |
|
inline |
|
inline |
access the internal node container
|
inline |
Layout tvm::tir::Layout::Split | ( | const LayoutAxis & | axis, |
size_t | target_pos, | ||
int32_t | factor | ||
) | const |
Split axis
by size
and put the sub-axis to position target_pos
.
axis | The source axis to be split. It must be a primal-axis; |
target_pos | The target position of the newly split subordinate-axis. |
factor | size of the sub-dimension. |
Layout tvm::tir::Layout::SubLayout | ( | size_t | pos, |
size_t | len | ||
) | const |
Returns a sub-layout which is the portion of the object that starts at dimension pos
and spans len
dimensions (or until the end of the layout, whichever comes first).
pos | The start position. |
len | The length of the sub-layout. if 0, return layout of scalar |
tvm::tir::Layout::TVM_DEFINE_OBJECT_REF_METHODS | ( | Layout | , |
ObjectRef | , | ||
LayoutNode | |||
) |
|
inlinestatic |
Return an undefined layout.
|
friend |
allow output string of layout to ostream
os | the output stream |
l | the layout |