You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/08/03 23:39:54 UTC
[GitHub] [tvm] junrushao1994 commented on a change in pull request #8641: [TENSORIR] Add `from_legacy_te_schdule` attr to TE PrimFuncs
junrushao1994 commented on a change in pull request #8641:
URL: https://github.com/apache/tvm/pull/8641#discussion_r682170550
##########
File path: src/tir/transforms/compact_buffer_region.cc
##########
@@ -452,11 +452,17 @@ class BufferCompactor : public StmtExprMutator {
};
PrimFunc CompactBufferAllocation(PrimFunc f) {
- PrimFuncNode* fptr = f.CopyOnWrite();
- std::unordered_map<Buffer, Region, ObjectPtrHash, ObjectPtrEqual> region =
- BufferAccessRegionCollector::Collect(f);
- fptr->body = BufferCompactor::Compact(f, region);
- return f;
+ // Only apply this pass to TIR that is not from TE schedules
+ Optional<Bool> from_legacy_te_schedule = f->GetAttr("from_legacy_te_schedule", Bool(false));
+ if (!from_legacy_te_schedule.value()) {
+ PrimFuncNode* fptr = f.CopyOnWrite();
+ std::unordered_map<Buffer, Region, ObjectPtrHash, ObjectPtrEqual> region =
+ BufferAccessRegionCollector::Collect(f);
+ fptr->body = BufferCompactor::Compact(f, region);
+ return f;
+ } else {
+ return f;
+ }
Review comment:
Shall we have a util function in `ir_utils.h` doing the check, like:
```
if (IsFromLegacyTeSchedule(f)) {
// do nothing
return f;
}
// do more with f
```
##########
File path: src/tir/transforms/compact_buffer_region.cc
##########
@@ -452,11 +452,17 @@ class BufferCompactor : public StmtExprMutator {
};
PrimFunc CompactBufferAllocation(PrimFunc f) {
- PrimFuncNode* fptr = f.CopyOnWrite();
- std::unordered_map<Buffer, Region, ObjectPtrHash, ObjectPtrEqual> region =
- BufferAccessRegionCollector::Collect(f);
- fptr->body = BufferCompactor::Compact(f, region);
- return f;
+ // Only apply this pass to TIR that is not from TE schedules
+ Optional<Bool> from_legacy_te_schedule = f->GetAttr("from_legacy_te_schedule", Bool(false));
+ if (!from_legacy_te_schedule.value()) {
+ PrimFuncNode* fptr = f.CopyOnWrite();
+ std::unordered_map<Buffer, Region, ObjectPtrHash, ObjectPtrEqual> region =
+ BufferAccessRegionCollector::Collect(f);
+ fptr->body = BufferCompactor::Compact(f, region);
+ return f;
+ } else {
+ return f;
+ }
Review comment:
Shall we have a util function in `ir_utils.h` doing the check, like:
```C++
if (IsFromLegacyTeSchedule(f)) {
// do nothing
return f;
}
// do more with f
```
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org