mbaret commented on a change in pull request #9214:
URL: https://github.com/apache/tvm/pull/9214#discussion_r759219077
##########
File path: src/tir/usmp/analysis/extract_buffer_info.cc
##########
@@ -203,29 +214,40 @@ void BufferInfoExtractor::RecordAllocateNodeInfo(const
AllocateNode* op) {
auto size_bytes = CalculateExtentsSize(op);
// We only statically memory plan only allocates with known
// compile time sizes.
- if (size_bytes.defined() &&
- allocate_var_to_stmt_map_.find(op->buffer_var) ==
allocate_var_to_stmt_map_.end()) {
- // By default, the core compiler is assumed to attach the a default pool
to each allocate.
- ICHECK(op->annotations.count(kPoolCandidatesAllocateAttr))
- << "Every statically sized allocate node needs an pool candidate
attribute";
- auto pool_candidates =
Downcast<Array<PoolInfo>>(op->annotations[kPoolCandidatesAllocateAttr]);
-
- // TODO(@manupa-arm): improve the error when the responsible component for
attaching a single
- // pool is added
- ICHECK(pool_candidates.size() > 0)
- << "The core compiler should at least attach a single PoolInfo. If
there were no "
- "user-given arguments for memory pools, the default behaviour is a
single size "
- "un-restricted pool is assigned";
- PrimFunc func = scope_stack_.top().func;
- Optional<Target> tgt = func->GetAttr<Target>(tvm::attr::kTarget);
- ICHECK(tgt) << "There should not be any PrimFuncs without a target
attached by now";
- auto workspace_alignment =
- tgt.value()->GetAttr<Integer>("workspace-byte-alignment").value_or(16);
- auto buffer_info =
BufferInfo(GetUniqueBufferName(op->buffer_var->name_hint), size_bytes,
- pool_candidates, workspace_alignment);
- auto allocate = GetRef<Allocate>(op);
- allocate_var_to_stmt_map_.Set(op->buffer_var, allocate);
- buffer_info_map_.Set(buffer_info, allocate);
+ if (size_bytes.defined()) {
Review comment:
Yeah that'd be fine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]