spectrometerHBH commented on a change in pull request #9699:
URL: https://github.com/apache/tvm/pull/9699#discussion_r772829564



##########
File path: src/arith/iter_affine_map.cc
##########
@@ -347,11 +372,24 @@ class IterMapRewriter : public ExprMutator {
   //                                                              IterSplit(k, 
scale=1)),
   //                                                      extent=9)
   //                                             scale=1))
-  std::unordered_map<IterSumExpr, IterMark, IterSumHash, IterSumEqual> 
sum_fuse_map_;
+  // Example(2): expr = i*9 + j*2 + k, i in [0, 4) j in [0, 5) k in [0, 2)
+  //          predicate: 1 <= j*2 + k < 9
+  // Then,    flattened form = IterSum(IterSplit(i, scale=9),
+  //                                   IterSplit(j, scale=2),
+  //                                   IterSplit(k, scale=1))
+  //          normal form    = IterSum(IterSplit(i, scale=9),

Review comment:
       I don't think it's a good idea to rewrite `i*9 + j*2 + k` into such a 
normal form `(i*9 + (j*2 + k - 1) + 1)`.
   The reason is that `j*2 + k - 1` has extent 8, it's weird that the scale of 
i is 9. Actually `i*9 + j*2 + k` with predicate `1 <= j*2 + k < 9` doesn't 
correspond to an iter, since the value of it is not continuous. Its value is 
`[1, 8] \union [10, 17] \union [19, 26], ...`.
   So it looks to me that we don't allow lower bound constraints on 
intermediate iters. We can only bound the final iter. In the above case, `i*9 + 
j*2 + k >= 1` is legal. while `j*2 + k >= 1` is illegal. We should ban and fail 
on such predicates.

##########
File path: src/arith/iter_affine_map.cc
##########
@@ -347,11 +372,24 @@ class IterMapRewriter : public ExprMutator {
   //                                                              IterSplit(k, 
scale=1)),
   //                                                      extent=9)
   //                                             scale=1))
-  std::unordered_map<IterSumExpr, IterMark, IterSumHash, IterSumEqual> 
sum_fuse_map_;
+  // Example(2): expr = i*9 + j*2 + k, i in [0, 4) j in [0, 5) k in [0, 2)
+  //          predicate: 1 <= j*2 + k < 9
+  // Then,    flattened form = IterSum(IterSplit(i, scale=9),
+  //                                   IterSplit(j, scale=2),
+  //                                   IterSplit(k, scale=1))
+  //          normal form    = IterSum(IterSplit(i, scale=9),

Review comment:
       cc @wrongtest 




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