wrongtest opened a new pull request #9699:
URL: https://github.com/apache/tvm/pull/9699


   Hi, there. The PR originate from the issue detected in 
https://github.com/apache/tvm/pull/9527, where a tiled block with both 
lowerbound and upperbound predicates fail to infer the `region_cover` property. 
Some tracing show that the `DetectIterMap` fail on such cases.
   ```python
   for hh_0, ww_0 in T.grid(28, 28):
       for ax0, ax1 in T.grid(10, 10):
           with T.block("cache"):
               h = T.axis.spatial(224, hh_0 * 8 - 1 + ax0)
               w = T.axis.spatial(224, ww_0 * 8 - 1 + ax1)
               T.where(1 <= hh_0 * 8 + ax0 and hh_0 * 8 + ax0 < 225 and 1 <= 
ww_0 * 8 + ax1 and ww_0 * 8 + ax1 < 225)
               cache[h, w] = X[h, w]
   ```
   
   The PR modify affine utility in aspects below :
   - Free vars
     For `DetectIterMap`, if the expression do not contain vars in domain map, 
it should be safe to not analyze affine form into it. eg,  `x*x + 8y + z` could 
pass affine analysis if `x` is not an var of iter domains. We can just put 
`x*x` into base part of IterSumExpr. It benefit the above case since `hh_0 * 8 
+ ax0` is not an affine form, but outer var might be free in certain analysis 
procedures.
   
   - Add `min` field to `IterMark` class
     It is zero almost all time. But when lowerbound predicate exists, it seems 
much hard to represent the lowerbound with only source and extent.
   
   - More flexible predicate support
     Support resolve all kinds of >, >=, <, <= integer comparisions, for the 
expr of form like `i * 8 < 10 - j`, try refactor the expr into domain var 
related part and domain var free parts. 
   
   - Introduce `DiagnosticContext` for debug purpose
     Replace each fail point (`++unresolved_cnt_`) with an error message 
recorded into diagnostic context. Or else it would be too hard to detect what 
happend for beginners. However, I do not find a proper point to call `Render()` 
of diagnostics for now.


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