junrushao1994 commented on a change in pull request #8467:
URL: https://github.com/apache/tvm/pull/8467#discussion_r671918419



##########
File path: src/tir/schedule/concrete_schedule.h
##########
@@ -143,17 +147,22 @@ inline For ConcreteScheduleNode::Get(const LoopRV& 
loop_rv) const {
 }
 
 inline PrimExpr ConcreteScheduleNode::Get(const ExprRV& expr_rv) const {
-  auto it = this->symbol_table_.find(expr_rv);
-  if (it == this->symbol_table_.end()) {
-    LOG(FATAL) << "IndexError: Cannot find corresponding ExprRV: " << expr_rv;
-  }
-  const ObjectRef& obj = (*it).second;
-  const auto* expr_node = obj.as<PrimExprNode>();
-  if (expr_node == nullptr) {
-    LOG(FATAL) << "ValueError: ExprRV's corresponding type is invalid: "
-               << (obj.defined() ? obj->GetTypeKey() : "None");
-  }
-  return GetRef<PrimExpr>(expr_node);
+  PrimExpr transformed = Substitute(expr_rv, [this](const Var& var) -> 
Optional<PrimExpr> {
+    auto it = this->symbol_table_.find(var);
+    if (it == this->symbol_table_.end()) {
+      LOG(FATAL) << "IndexError: Cannot find corresponding ExprRV: " << var;
+    }
+    const ObjectRef& obj = (*it).second;
+    const auto* int_imm = TVM_TYPE_AS(int_imm, obj, IntImmNode);
+    if (int_imm == nullptr) {
+      LOG(FATAL) << "ValueError: ExprRV's corresponding type is invalid: "
+                 << (obj.defined() ? obj->GetTypeKey() : "None");
+    }
+    return Integer(int_imm->value);
+  });
+  PrimExpr simplified = this->analyzer_->Simplify(transformed);
+  CHECK(is_const_int(transformed)) << "ValueError: The ExprRV does not have a 
specific value";
+  return simplified;

Review comment:
       We don't need the result to be constant integer - they can be symbolic 
variables
   
   ```suggestion
     return this->analyzer_->Simplify(transformed);
   ```




-- 
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]


Reply via email to