Unverified Commit 81b8c1b7 authored by Kuris's avatar Kuris Committed by GitHub
Browse files

[Fix] Fix analyzer bind conflicting (#1446)

parent 869f021b
...@@ -1090,9 +1090,13 @@ private: ...@@ -1090,9 +1090,13 @@ private:
reducer_info = op->annotations.Get(attr::kReducerInfo) reducer_info = op->annotations.Get(attr::kReducerInfo)
->as<Map<Var, ReducerInfo>>() ->as<Map<Var, ReducerInfo>>()
.value(); .value();
if (!result_.for_map.count(tvm::ffi::GetRef<For>(op))) {
return IRMutatorWithAnalyzer::VisitStmt_(op);
}
// the analyzer will be modified in PartitionLoop and VectorizeLoop
// we need to save its state to prevent conflicted bindings
auto saved_analyzer = analyzer_->Clone();
For for_node = Downcast<For>(IRMutatorWithAnalyzer::VisitStmt_(op)); For for_node = Downcast<For>(IRMutatorWithAnalyzer::VisitStmt_(op));
if (result_.for_map.count(tvm::ffi::GetRef<For>(op))) {
auto root = tvm::ffi::GetRef<For>(op); auto root = tvm::ffi::GetRef<For>(op);
// This check is a workaround to support T.Parallel for local buffers. // This check is a workaround to support T.Parallel for local buffers.
// For example: // For example:
...@@ -1186,7 +1190,7 @@ private: ...@@ -1186,7 +1190,7 @@ private:
}); });
if ((has_non_local || has_cast_operations) && !has_reducer) { if ((has_non_local || has_cast_operations) && !has_reducer) {
for_node = VectorizeLoop(for_node, analyzer_); for_node = VectorizeLoop(for_node, saved_analyzer.get());
} }
if (result_.predicate_map.count(root) && parallel_loop) { if (result_.predicate_map.count(root) && parallel_loop) {
...@@ -1195,8 +1199,6 @@ private: ...@@ -1195,8 +1199,6 @@ private:
return for_node; return for_node;
} }
} }
return for_node;
}
Stmt VisitStmt_(const AttrStmtNode *op) final { Stmt VisitStmt_(const AttrStmtNode *op) final {
if (op->attr_key == tir::attr::thread_extent) { if (op->attr_key == tir::attr::thread_extent) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment