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/04/02 07:03:14 UTC

[GitHub] [tvm] junrushao1994 opened a new pull request #10883: [BugFix][MetaSchedule] Fuse only serial loops in rewrite-unbound-block

junrushao1994 opened a new pull request #10883:
URL: https://github.com/apache/tvm/pull/10883


   The rewriting rule didn't take into consideration the case where some loops are already unrolled/vectorized/parallelized, and thus could mistakenly fuse them into outer loops. For example,
   
   ```python
   @T.prim_func
   def before_unrolled_loop(
       placeholder: T.Buffer[(1, 56, 56, 64), "float32"],
   ) -> None:
       # function attr dict
       T.func_attr({"global_symbol": "main", "tir.noalias": True})
       bgemm = T.alloc_buffer([6, 6, 196, 64], dtype="float32")
       inverse = T.alloc_buffer([4, 4, 196, 64], dtype="float32")
       for i2_0, i3_0, i2_1, i3_1 in T.grid(98, 4, 2, 16):
           for i0 in T.unroll(4):  # <=====
               for i1 in T.unroll(4):  # <=====
                   for i4 in T.unroll(6):
                       for i5 in T.unroll(6):
                           with T.block("inverse"):
                               vh, vw = T.axis.remap("SS", [i0, i1])
                               p = T.axis.spatial(196, i2_0 * 2 + i2_1)
                               co = T.axis.spatial(64, i3_0 * 16 + i3_1)
                               r_a, r_b = T.axis.remap("RR", [i4, i5])
                               T.reads(bgemm[r_a, r_b, p, co])
                               T.writes(inverse[vh, vw, p, co])
                               with T.init():
                                   inverse[vh, vw, p, co] = T.float32(0)
                               inverse[vh, vw, p, co] = inverse[vh, vw, p, co] + bgemm[r_a, r_b, p, co]
   ```
   
   The loop i0 and i1 will be fused into the outer 4 loops under the rewriting rule, which could lead to potential bugs and performance issue.
   
   CC: @jinhongyii @zxybazh 
   
   


-- 
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] spectrometerHBH merged pull request #10883: [BugFix][MetaSchedule] Fuse only serial loops in rewrite-unbound-block

Posted by GitBox <gi...@apache.org>.
spectrometerHBH merged pull request #10883:
URL: https://github.com/apache/tvm/pull/10883


   


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