tqchen commented on a change in pull request #6753:
URL: https://github.com/apache/incubator-tvm/pull/6753#discussion_r511593103
##########
File path: src/arith/iter_affine_map.cc
##########
@@ -351,8 +374,18 @@ class IterMapRewriter : public ExprMutator {
std::vector<IterSplitExpr> iters;
iters.reserve(expr->args.size());
// canonicalize the expression
+ // find the base scale first
+ PrimExpr base_scale(nullptr);
+ for (const auto& arg : expr->args) {
+ if (is_const_int(arg->scale)) {
+ if (!base_scale.defined() || (CanProveLess(arg->scale, base_scale))) {
Review comment:
because it is constant, we don't have to do this, just use
args->scale.as<IntImmNode> and dig up the values will do
##########
File path: src/arith/iter_affine_map.cc
##########
@@ -351,8 +374,18 @@ class IterMapRewriter : public ExprMutator {
std::vector<IterSplitExpr> iters;
iters.reserve(expr->args.size());
// canonicalize the expression
+ // find the base scale first
+ PrimExpr base_scale(nullptr);
+ for (const auto& arg : expr->args) {
Review comment:
We can save one iteration of the for loop below after we find the base
scale.
Let us simply remember the index and find the base_index. in args. start
with base_index == -1
Then mark the that index as visited. So the next for loop can start with i =
1
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]