Skip to content

Commit c130133

Browse files
committed
[TIR][USMP] Added buffer info extraction pass
* Added more documentation * Added functionality to handle multiple calls for the same PrimFunc with a test. Change-Id: Ib7c27b3cf17f415067a224f1e57d8b928f4c7c6f
1 parent 63a155c commit c130133

File tree

4 files changed

+1078
-216
lines changed

4 files changed

+1078
-216
lines changed

include/tvm/tir/usmp/utils.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static constexpr const char* kTargetPoolReadWriteAccess = "rw";
4747
static constexpr const char* kTargetPoolReadOnlyAccess = "ro";
4848

4949
/*!
50-
* \brief The pool information to be used by USMP
50+
* \brief Describes a pool of memory accessible by one or more targets.
5151
*/
5252
struct PoolInfoNode : public Object {
5353
/*! \brief The name of the memory pool */
@@ -94,7 +94,13 @@ class PoolInfo : public ObjectRef {
9494
};
9595

9696
/*!
97-
* \brief The buffer information to be used by USMP
97+
* \brief Describes an abstract memory buffer that will get allocated inside a pool.
98+
* The actual memory buffer in represented by PoolAllocationNode after static memory planning.
99+
*
100+
* See also for relay-level counterparts:
101+
* relay::StorageToken (graph_plan_memory.cc)
102+
* relay::backend::StorageInfoNode (relay/backend/utils.h)
103+
* Region (python/tvm/relay/transform/memory_plan.py)
98104
*/
99105
struct BufferInfoNode : public Object {
100106
/*! \brief The name of the buffer var */
@@ -103,7 +109,7 @@ struct BufferInfoNode : public Object {
103109
Integer size_bytes;
104110
/*! \brief The pool candidates that this buffer can get pooled to*/
105111
Array<PoolInfo> pool_candidates;
106-
/*! \brief The byte alignment required within the pool */
112+
/*! \brief The byte alignment required for buffers that will placed within the pool */
107113
Integer alignment;
108114
/*! \brief The liveness conflicting other buffer info objects */
109115
Array<ObjectRef> conflicts;
@@ -194,6 +200,13 @@ Array<BufferInfo> CreateArrayBufferInfo(const Map<Stmt, BufferInfo>& buffer_info
194200
*/
195201
static constexpr const char* kPoolCandidatesAllocateAttr = "candidate_memory_pools";
196202

203+
/*!
204+
* \brief Calculate the size of the extents in bytes
205+
*
206+
* \param op the allocate node
207+
*/
208+
Integer CalculateExtentsSize(const AllocateNode* op);
209+
197210
} // namespace usmp
198211
} // namespace tir
199212
} // namespace tvm

0 commit comments

Comments
 (0)