junrushao1994 commented on a change in pull request #8693:
URL: https://github.com/apache/tvm/pull/8693#discussion_r686485786
##########
File path: src/tir/transforms/compact_buffer_region.cc
##########
@@ -303,28 +303,82 @@ class BufferAccessRegionCollector : public
StmtExprVisitor {
support::Arena arena_;
};
+/*! \brief Collect storage alignment information from block annotations. */
+class StorageAlignCollector : public StmtVisitor {
+ public:
+ static std::unordered_map<Buffer, Array<Array<Integer>>, ObjectPtrHash,
ObjectPtrEqual> Collect(
+ const PrimFunc& f) {
+ StorageAlignCollector collector;
+ collector(f->body);
+ return std::move(collector.storage_align_);
+ }
+
+ private:
+ void VisitStmt_(const BlockNode* op) final {
+ auto it = op->annotations.find(attr::buffer_dim_align);
+ if (it != op->annotations.end()) {
+ const auto& storage_align =
Downcast<Array<Array<Array<Integer>>>>((*it).second);
Review comment:
We don't need the const ref here
```suggestion
auto storage_align =
Downcast<Array<Array<Array<Integer>>>>((*it).second);
```
--
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]