24 #ifndef TVM_TIR_BUFFER_H_ 25 #define TVM_TIR_BUFFER_H_ 102 v->Visit(
"data", &data);
103 v->Visit(
"dtype", &dtype);
104 v->Visit(
"shape", &shape);
105 v->Visit(
"strides", &strides);
106 v->Visit(
"axis_separators", &axis_separators);
107 v->Visit(
"elem_offset", &elem_offset);
108 v->Visit(
"name", &name);
109 v->Visit(
"data_alignment", &data_alignment);
110 v->Visit(
"offset_factor", &offset_factor);
111 v->Visit(
"buffer_type", &buffer_type);
112 v->Visit(
"span", &span);
130 hash_reduce.
DefHash(elem_offset);
131 hash_reduce.
DefHash(axis_separators);
132 hash_reduce(data_alignment);
133 hash_reduce(buffer_type);
173 TVM_DLL
Buffer MakeStrideView()
const;
210 Buffer GetFlattenedBuffer()
const;
223 TVM_DLL
String scope()
const;
269 virtual DataType GetDataType()
const = 0;
274 virtual String GetNameHint()
const = 0;
278 return this == other;
283 static constexpr
const char*
_type_key =
"tir.DataProducer";
314 std::string memory_scope =
"");
317 #endif // TVM_TIR_BUFFER_H_ Var data
The pointer to the head of the data.
Definition: buffer.h:55
Array< PrimExpr > ElemOffset(Array< PrimExpr > index) const
Determine the offset in the buffer of the given index.
tvm::Span Span
Definition: base.h:65
BufferType buffer_type
buffer type
Definition: buffer.h:92
BufferType
buffer type
Definition: buffer.h:41
bool DefEqual(const ObjectRef &lhs, const ObjectRef &rhs)
Reduce condition to comparison of two definitions, where free vars can be mapped. ...
int offset_factor
Factor of elem_offset field, elem_offset is guaranteed to be multiple of offset_factor.
Definition: buffer.h:90
Node to represent a buffer.
Definition: buffer.h:48
TVM_DECLARE_FINAL_OBJECT_INFO(BufferNode, Object)
Runtime String container types.
static constexpr const bool _type_has_method_shash_reduce
Definition: buffer.h:151
bool SEqualReduce(const DataProducerNode *other, SEqualReducer equal) const
Definition: buffer.h:276
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:124
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Buffer decl_buffer(Array< PrimExpr > shape, DataType dtype=DataType::Float(32), String name="buffer", String storage_scope="", Array< IntImm > axis_separators={}, Span span=Span())
Construct a new buffer given shape, and dtype.
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:110
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
a named variable in TIR
Definition: var.h:88
static constexpr const bool _type_has_method_sequal_reduce
Definition: buffer.h:150
PrimExpr elem_offset
The offset in terms of number of dtype elements (including lanes)
Definition: buffer.h:80
base class of all object containers.
Definition: object.h:167
Array< PrimExpr > shape
The type of the buffer prior to flattening.
Definition: buffer.h:64
Runtime Array container types.
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
tir::Buffer BufferWithOffsetAlignment(Array< PrimExpr > shape, DataType dtype, std::string name, int data_alignment, int offset_factor, bool compact, std::string memory_scope="")
Creates TIR Buffer for provided parameters.
Definition: source_map.h:120
void SHashReduce(SHashReducer hash_reduce) const
Definition: buffer.h:281
size_t size() const
Definition: array.h:420
Runtime primitive data type.
Definition: data_type.h:41
static DataType Float(int bits, int lanes=1)
Construct an float type.
Definition: data_type.h:178
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
static DataType Handle(int bits=64, int lanes=1)
Construct a handle type.
Definition: data_type.h:198
BufferNode()
constructor
Definition: buffer.h:99
Managed reference class to IntImmNode.
Definition: expr.h:520
Container of all statements.
Definition: stmt.h:59
Reference to string objects.
Definition: string.h:98
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
String name
optional name of the buffer
Definition: buffer.h:83
virtual ~DataProducerNode()
destructor.
Definition: buffer.h:259
void SHashReduce(SHashReducer hash_reduce) const
Definition: buffer.h:125
Array< PrimExpr > strides
The strides of each dimension This can be an empty array, indicating array is contiguous.
Definition: buffer.h:78
Span span
Span that points to the original source code. Reserved debug information.
Definition: buffer.h:97
Base class of all object reference.
Definition: object.h:511
#define TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName)
Define CopyOnWrite function in an ObjectRef.
Definition: object.h:785
DataType DefaultIndexType() const
Definition: buffer.h:137
Managed reference to DataProducerNode.
Definition: buffer.h:293
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types...
Definition: buffer.h:160
static constexpr const char * _type_key
Definition: buffer.h:149
Base node for data producers.
Definition: buffer.h:256
int data_alignment
Alignment requirement of data pointer in bytes.
Definition: buffer.h:85
bool SEqualReduce(const BufferNode *other, SEqualReducer equal) const
Definition: buffer.h:115
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Reference to PrimExprNode.
Definition: expr.h:114
constexpr runtime::NullOptType NullOpt
Definition: optional.h:160
DataType dtype
data type in the content of the tensor
Definition: buffer.h:57
Array< IntImm > axis_separators
Separators between input axes when generating flattened output axes.
Definition: buffer.h:73
#define TVM_DECLARE_BASE_OBJECT_INFO(TypeName, ParentType)
helper macro to declare a base object type that can be inherited.
Definition: object.h:648
void VisitAttrs(AttrVisitor *v)
Definition: buffer.h:101
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:164
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:187