junrushao1994 commented on code in PR #12420:
URL: https://github.com/apache/tvm/pull/12420#discussion_r945254947


##########
src/tir/ir/expr.cc:
##########
@@ -828,10 +828,25 @@ TVM_REGISTER_GLOBAL("tir.Call")
     .set_body_typed([](DataType type, RelayExpr op, Array<ObjectRef> args, 
Span span) {
       Array<PrimExpr> prim_expr_args;
       for (const auto& it : args) {
-        ICHECK(it->IsInstance<runtime::StringObj>() || 
it->IsInstance<PrimExprNode>())
+        ICHECK(it->IsInstance<runtime::StringObj>() || 
it->IsInstance<PrimExprNode>() ||
+               it->IsInstance<IterVarNode>() || 
it->IsInstance<BufferRegionNode>())
             << "Argument " << it << " is not a string or primexpr";
         if (const auto* str = it.as<runtime::StringObj>()) {
           prim_expr_args.push_back(StringImm(str->data));
+        } else if (const auto* iter_var = it.as<IterVarNode>()) {
+          prim_expr_args.push_back(GetRef<IterVar>(iter_var)->var);
+        } else if (const auto* br = it.as<BufferRegionNode>()) {
+          Array<PrimExpr> indices;
+          for (Range r : br->region) {
+            if (is_one(r->extent)) {
+              indices.push_back(r->min);
+            } else if (const auto* extent = r->extent.as<IntImmNode>()) {
+              indices.push_back(tir::Ramp(r->min, make_const(r->min->dtype, 
1), extent->value));
+            } else {
+              LOG(FATAL) << "ValueError: Cannot convert to BufferLoad: " << br;

Review Comment:
   ```suggestion
                 LOG(FATAL) << "ValueError: Cannot convert to BufferLoad: " << 
GetRef<BufferRegion>(br);
   ```



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