cyx-6 commented on code in PR #13743:
URL: https://github.com/apache/tvm/pull/13743#discussion_r1071586351
##########
src/script/printer/tir/block.cc:
##########
@@ -67,6 +110,30 @@ Doc PrintBlock(IRDocsifier d, tir::Block block, ObjectPath
block_p, //
}
(*frame)->stmts.push_back(AssignDoc(DefineVar(iter_var->var, *frame, d),
rhs, NullOpt));
}
+
+ // Step 1.4. Construct block var bindings of T.axis.remap
+ if (remap_vars.size()) {
+ int m = remap_vars.size();
+ Array<ExprDoc> lhs;
+ Array<ExprDoc> loop_var_doc;
+ lhs.reserve(m);
+ loop_var_doc.reserve(m);
+ std::string binding_type = "";
+ for (int i = 0; i < n_vars; ++i) {
+ tir::IterVar iter_var = block->iter_vars[i];
+ ObjectPath iter_var_p = block_p->Attr("iter_var")->ArrayIndex(i);
+ if (remap_vars.count(iter_var)) {
+ lhs.push_back(DefineVar(iter_var->var, *frame, d));
+ loop_var_doc.push_back(d->AsDoc<ExprDoc>(realize->iter_values[i],
+
realize_p->Attr("iter_values")->ArrayIndex(i)));
+ binding_type += iter_var->iter_type == tir::IterVarType::kDataPar ?
"S" : "R";
+ }
+ }
+ ExprDoc rhs = TIR("axis")->Attr("remap");
+ rhs = rhs->Call({LiteralDoc::Str(binding_type), ListDoc(loop_var_doc)});
+ (*frame)->stmts.push_back(AssignDoc(TupleDoc(lhs), rhs, NullOpt));
Review Comment:
yes, but all remapped `iter_var`'s are simple mapping `iter_var`'s. and
other `iter_var`'s may not depend on these simple `iter_var`'s? or we can remap
those adjacent `iter_var`'s only, like
```python
i0 = T.axis.S(...)
i1, i2 = T.axis.remap(...)
i3 = T.axis.R(...)
i4, i5 = T.axis.remap(...)
```
--
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]