tvm
|
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types, used to specify the memory layout of the Tensor used in program input. More...
#include <buffer.h>
Public Member Functions | |
Buffer (Var data, DataType dtype, Array< PrimExpr > shape, Array< PrimExpr > strides, PrimExpr elem_offset, String name, int data_alignment, int offset_factor, BufferType buffer_type, Array< IntImm > axis_separators={}, Span span=Span()) | |
Buffer | MakeStrideView () const |
Return a new buffer that is equivalent with current one but always add stride field. More... | |
Buffer | MakeSlice (Array< PrimExpr > begins, Array< PrimExpr > extents) const |
Make a new symbolic buffer representing a slice of the buffer. More... | |
PrimExpr | access_ptr (int access_mask, DataType ptr_type=DataType::Handle(), int content_lanes=1, PrimExpr offset=IntImm(DataType::Int(32), 0), Optional< PrimExpr > input_extent=NullOpt) const |
Get access ptr to the entire buffer. More... | |
PrimExpr | vload (Array< PrimExpr > begin, DataType dtype) const |
Create an Expr that does a vector load at begin index. More... | |
Stmt | vstore (Array< PrimExpr > begin, PrimExpr value) const |
Create a Stmt that does a vector store at begin index. More... | |
Buffer | GetFlattenedBuffer () const |
Get a flattened version of the buffer. More... | |
Array< PrimExpr > | OffsetOf (Array< PrimExpr > index) const |
Determine the offset in the buffer of the given index. More... | |
String | scope () const |
Return the storage scope associated with this buffer. More... | |
TVM_DEFINE_OBJECT_REF_METHODS (Buffer, ObjectRef, BufferNode) | |
TVM_DEFINE_OBJECT_REF_COW_METHOD (BufferNode) | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
using | ContainerType = Object |
type indicate the container type. More... | |
![]() | |
static constexpr bool | _type_is_nullable = true |
![]() | |
Object * | get_mutable () const |
![]() | |
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... | |
![]() | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types, used to specify the memory layout of the Tensor used in program input.
tvm::tir::Buffer::Buffer | ( | Var | data, |
DataType | dtype, | ||
Array< PrimExpr > | shape, | ||
Array< PrimExpr > | strides, | ||
PrimExpr | elem_offset, | ||
String | name, | ||
int | data_alignment, | ||
int | offset_factor, | ||
BufferType | buffer_type, | ||
Array< IntImm > | axis_separators = {} , |
||
Span | span = Span() |
||
) |
PrimExpr tvm::tir::Buffer::access_ptr | ( | int | access_mask, |
DataType | ptr_type = DataType::Handle() , |
||
int | content_lanes = 1 , |
||
PrimExpr | offset = IntImm(DataType::Int(32), 0) , |
||
Optional< PrimExpr > | input_extent = NullOpt |
||
) | const |
Get access ptr to the entire buffer.
access_mask | The access mask |
ptr_type | The type of the pointer. |
content_lanes | The number of lanes for the (data) type. |
offset | The offset of ptr. |
input_extent | The extent of ptr. |
Buffer tvm::tir::Buffer::GetFlattenedBuffer | ( | ) | const |
Get a flattened version of the buffer.
Make a new symbolic buffer representing a slice of the buffer.
begins | The beginning position of each dimension. |
extents | The extent of each dimension. |
Buffer tvm::tir::Buffer::MakeStrideView | ( | ) | const |
Return a new buffer that is equivalent with current one but always add stride field.
Determine the offset in the buffer of the given index.
Returns the buffer offset, in number of elements of type dtype, without adjusting for number of lanes. (e.g. The number of float16x4 elements in a buffer of type float16x4.)
String tvm::tir::Buffer::scope | ( | ) | const |
Return the storage scope associated with this buffer.
tvm::tir::Buffer::TVM_DEFINE_OBJECT_REF_COW_METHOD | ( | BufferNode | ) |
tvm::tir::Buffer::TVM_DEFINE_OBJECT_REF_METHODS | ( | Buffer | , |
ObjectRef | , | ||
BufferNode | |||
) |
Create an Expr that does a vector load at begin index.
begin | The beginning index |
dtype | The data type to be loaded. |
Create a Stmt that does a vector store at begin index.
begin | The beginning index |
value | The value to be stored. |