Hzfengsy commented on a change in pull request #10705:
URL: https://github.com/apache/tvm/pull/10705#discussion_r832058314
##########
File path: src/tir/schedule/analysis/analysis.cc
##########
@@ -145,23 +145,37 @@ ScopeBlockLoopInfo GetScopeBlockLoopInfo(const Block&
scope_block) {
/*!
* \brief Check the dominant property of a block:
- * the block is the only writer of its output, dominating the reader of its
output buffers
- * \param scope The block-scope of the block to be checked
- * \param block_sref The block whose dominant property is to be checked
- * \return A boolean indicating if the block is a dominant block
+ * the block is the only writer of its output, dominating the reader of its
output buffers under the
+ * given root scope.
+ * \param self The schedule state.
+ * \param scope_root_sref The StmtSRef corresponding to the root scope.
+ * \param block_sref The block whose dominant property is to be checked.
+ * \return A boolean indicating if the block is a dominant block.
*/
-bool IsDominantBlock(const BlockScope& scope, const StmtSRef& block_sref) {
+bool IsDominantBlock(const ScheduleState& self, const StmtSRef&
scope_root_sref,
+ const StmtSRef& block_sref) {
+ std::unordered_map<Buffer, Array<StmtSRef>, ObjectPtrHash, ObjectPtrEqual>
buffer_writers;
+ const BlockNode* maybe_root_block = scope_root_sref->StmtAs<BlockNode>();
+ if (maybe_root_block) {
Review comment:
Please check `scope_root_sref` is inside or equal to the scope block if
possible
##########
File path: src/tir/schedule/analysis/analysis.cc
##########
@@ -207,14 +220,14 @@ int CheckCompleteBlockErrorCode(const ScheduleState&
self, const StmtSRef& block
static const char* kCompleteBlockDefinition = R"(Definition of a complete
block:
1) All block vars are data parallel
-2) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers
+2) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers under the given scope.
3) No overlap between the buffers the block reads and writes)";
static const char* kReductionBlockDefinition = R"(Definition of a reduction
block:
1) The block has the `init` statement
2) All the block bindings are quasi-affine expressions
3) All block vars are either data parallel block vars or reduction block vars
-4) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers
+4) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers under the given scope.
Review comment:
+1
##########
File path: src/tir/schedule/analysis/analysis.cc
##########
@@ -375,12 +386,14 @@ void CheckSubtreeCompactDataflow(const ScheduleState&
self, const StmtSRef& subt
}
String FastErrorString() const final {
return "ScheduleError: The queried subtree root in SRef tree does not
have compact dataflow, "
- "because some of its child block on SRef tree is neither a
complete block nor a "
+ "because some of its child block on SRef tree is neither a local
complete block nor a "
+ "local "
Review comment:
It would be great if we can add the definition of `local complete`
##########
File path: src/tir/schedule/analysis/analysis.cc
##########
@@ -207,14 +220,14 @@ int CheckCompleteBlockErrorCode(const ScheduleState&
self, const StmtSRef& block
static const char* kCompleteBlockDefinition = R"(Definition of a complete
block:
1) All block vars are data parallel
-2) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers
+2) Dominant: the block is the only writer of its output, dominating the reader
of its output buffers under the given scope.
Review comment:
for `kCompleteBlockDefinition`, I still prefer to keep it as `under the
block scope`
--
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]