|
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, ffi::Array< PrimExpr > shape, ffi::Array< PrimExpr > strides, PrimExpr elem_offset, ffi::String name, int data_alignment, int offset_factor, BufferType buffer_type, ffi::Array< IntImm > axis_separators={}, Span span=Span(), ffi::Optional< Layout > layout=std::nullopt, ffi::Array< PrimExpr > allocated_addr={}) | |
| Buffer | MakeStrideView () const |
| Return a new buffer that is equivalent with current one but always add stride field. More... | |
| Buffer | MakeSlice (ffi::Array< PrimExpr > begins, ffi::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), ffi::Optional< PrimExpr > input_extent=std::nullopt) const |
| Get access ptr to the entire buffer. More... | |
| PrimExpr | vload (ffi::Array< PrimExpr > begin, DataType dtype, ffi::Optional< PrimExpr > predicate=std::nullopt) const |
| Create an Expr that does a vector load at begin index. More... | |
| Stmt | vstore (ffi::Array< PrimExpr > begin, PrimExpr value, ffi::Optional< PrimExpr > predicate=std::nullopt) const |
| Create a Stmt that does a vector store at begin index. More... | |
| Buffer | GetFlattenedBuffer () const |
| Get a flattened version of the buffer. More... | |
| ffi::Array< PrimExpr > | OffsetOf (ffi::Array< PrimExpr > index) const |
| Determine the offset in the buffer of the given index. More... | |
| PrimExpr | OffsetOf_p (const ffi::Array< PrimExpr > &indices) const |
| Get the buffer_offset op for the given index. More... | |
| ffi::String | scope () const |
| Return the storage scope associated with this buffer. More... | |
| Buffer | with_allocated_addr (ffi::Array< PrimExpr > allocated_addr) const |
| Return a new buffer with the allocated address. More... | |
| bool | IsScalar (bool alloc_or_decl=true) const |
| Return true if the buffer is a scalar. More... | |
| Buffer | with_dtype (DataType dtype) const |
| Return a new buffer with the dtype. More... | |
| Buffer | with_data (Var data) const |
| Return a new buffer with the data. More... | |
| TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (Buffer, ffi::ObjectRef, BufferNode) | |
| TVM_DEFINE_OBJECT_REF_COW_METHOD (BufferNode) | |
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::tirx::Buffer::Buffer | ( | Var | data, |
| DataType | dtype, | ||
| ffi::Array< PrimExpr > | shape, | ||
| ffi::Array< PrimExpr > | strides, | ||
| PrimExpr | elem_offset, | ||
| ffi::String | name, | ||
| int | data_alignment, | ||
| int | offset_factor, | ||
| BufferType | buffer_type, | ||
| ffi::Array< IntImm > | axis_separators = {}, |
||
| Span | span = Span(), |
||
| ffi::Optional< Layout > | layout = std::nullopt, |
||
| ffi::Array< PrimExpr > | allocated_addr = {} |
||
| ) |
| PrimExpr tvm::tirx::Buffer::access_ptr | ( | int | access_mask, |
| DataType | ptr_type = DataType::Handle(), |
||
| int | content_lanes = 1, |
||
| PrimExpr | offset = IntImm(DataType::Int(32), 0), |
||
| ffi::Optional< PrimExpr > | input_extent = std::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::tirx::Buffer::GetFlattenedBuffer | ( | ) | const |
Get a flattened version of the buffer.
| bool tvm::tirx::Buffer::IsScalar | ( | bool | alloc_or_decl = true | ) | const |
Return true if the buffer is a scalar.
| alloc_or_decl | Whether to consider alloc_scalar and decl_scalar as scalar. True for alloc_scalar, False for decl_scalar. |
| Buffer tvm::tirx::Buffer::MakeSlice | ( | ffi::Array< PrimExpr > | begins, |
| ffi::Array< PrimExpr > | extents | ||
| ) | const |
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::tirx::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.)
Get the buffer_offset op for the given index.
| index | The index to be accessed. |
| ffi::String tvm::tirx::Buffer::scope | ( | ) | const |
Return the storage scope associated with this buffer.
| tvm::tirx::Buffer::TVM_DEFINE_OBJECT_REF_COW_METHOD | ( | BufferNode | ) |
| tvm::tirx::Buffer::TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE | ( | Buffer | , |
| ffi::ObjectRef | , | ||
| BufferNode | |||
| ) |
| PrimExpr tvm::tirx::Buffer::vload | ( | ffi::Array< PrimExpr > | begin, |
| DataType | dtype, | ||
| ffi::Optional< PrimExpr > | predicate = std::nullopt |
||
| ) | const |
Create an Expr that does a vector load at begin index.
| begin | The beginning index |
| dtype | The data type to be loaded. |
| predicate | A vector mask of boolean values indicating which lanes of a vector are to be loaded. The number lanes of the mask must be equal to the number of lanes in being loaded. |
| Stmt tvm::tirx::Buffer::vstore | ( | ffi::Array< PrimExpr > | begin, |
| PrimExpr | value, | ||
| ffi::Optional< PrimExpr > | predicate = std::nullopt |
||
| ) | const |
Create a Stmt that does a vector store at begin index.
| begin | The beginning index |
| value | The value to be stored. |
| predicate | A vector mask of boolean values indicating which lanes of a vector are to be stored. The number lanes of the mask must be equal to the number of lanes in value. |
Return a new buffer with the allocated address.