wrongtest commented on pull request #9699:
URL: https://github.com/apache/tvm/pull/9699#issuecomment-999287677


   Rebase, add more testcases and try to fix three detected issues:
   1. My previous code is buggy on duplicate lowerbounds on same iteration, I 
should not subtract `min` directly because it will break the assumption that 
`mark->source` be a structural form `IterSumExpr`. Instead, set `-min` to base 
as suggested.
   
   2. Previously sum with single iter would not go into  `TryFuseIters` thus if 
we have the `i` in [0, 48) and predicate is `i < 10`, it seems ignore the 
condition totally, result to an iteration of extent=48. A new testcase with 
single var depict this.
   ```python
   res = tvm.arith.detect_iter_map([i], var_dom([(i, 48)]), tvm.tir.all(i < 10))
   assert_iter_sum_pattern(res[0], 10, 0)
   ```
   
   3. If we fix (2), than the case below and several general unittests on tir 
will fail because `TryFuseIters` can not fully match the predicate constraint 
even all iters are visisted.
   ```python
   res = tvm.arith.detect_iter_map(
           [i, j, k],
           var_dom([(i, 128), (j, 128), (k, 128)]),
           tvm.tir.all(i * 16384 + j * 128 + k < 100),
       )
   ```
   The workaround currently is that if we fail to fully match the predicate 
constraint, but a suffix of predicate is matched successfully, step into 
fallback behaviors and skip this constraint. For example, if target iter expr 
is `k` or `j*128+k` or `i*128+j`(fix me, this case will just not start a 
constraint match),  the predicate `i * 16384 + j * 128 + k < 100` will be 
skipped.
   
   Unfortunately, the originated `region_cover` issue now seems can not be 
fully solved by this PR. I think the issue (2) make the corresponding case 
incorrectly passed previously. There is only one iteration except free vars in 
`hh_0 * 8 - 1 + ax0` so the produced region is inferred regardless of 
predicate. A new case is added to intset test (previous case has two iters).
   
   cc @spectrometerHBH 


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