You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/05/03 13:58:32 UTC

[GitHub] [tvm] wrongtest opened a new pull request, #11201: [TIR] Fix an index out of bound issue of compact buffer region

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

   After https://github.com/apache/tvm/pull/10557, the region extent after compaction is ensured to not exceed original shape. Now when the inferred region min is negative, the index remap rule `idx -> (idx - region_min)` would introduce out of bound accesses, which would cause crashes at runtime.
   
   The two updated cases in UT:
   - padding block inlined to pooling
   Current version results to out of bound accesses in `cache` block, since the H/W extents are compacted to no more than 224 but accesses are shift by `- (-1)`.
   ```python
   @T.prim_func
   def func(X: T.Buffer[(224, 224), "float32"], Y: T.Buffer[(224, 224), "float32"]) -> None:
       cache = T.alloc_buffer([224, 224], dtype="float32")
       for h, w in T.grid(224, 224):
           with T.block("cache"):
               cache[h + 1, w + 1] = X[h, w]
       for h, w, kh, kw in T.grid(224, 224, 3, 3):
           with T.block("compute"):
               Y[h, w] = T.max(Y[h, w], T.if_then_else(T.likely(1 <= h + kh, dtype="bool") and T.likely(h + kh < 225, dtype="bool") and T.likely(1 <= w + kw, dtype="bool") and T.likely(w + kw < 225, dtype="bool"), cache[h + kh, w + kw], T.float32(0), dtype="float32"))
   ```
   
   -  sparse access
   `A_data_local[A_indptr[i] + k]` is rewritten to `A_data_local[T.min(A_indptr[i] + k, 0)]` instead of `A_data_local[0]`. Compared to current version, interestingly, it keeps the semantic that negative sparse index result to oob behavior.


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao1994 merged pull request #11201: [TIR] Fix an index out of bound issue of compact buffer region

Posted by GitBox <gi...@apache.org>.
junrushao1994 merged PR #11201:
URL: https://github.com/apache/tvm/pull/11201


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org