merrymercy opened a new pull request #4932: [SCHEDULE] Improve bound inference 
for split
URL: https://github.com/apache/incubator-tvm/pull/4932
 
 
   When we split an axis  `i` with a factor `f` that is larger than the extent 
of `i`, we should set the extent of the inner axis to be the extent of `i` 
instead of `f`.
   
   ### Test script
   ```py
   import tvm
   
   A = tvm.placeholder((2, 2), name='A')
   B = tvm.compute((2, 2), lambda i, j : A[i][j] + 1.0, name='B')
   
   s = tvm.create_schedule([B.op])
   
   i, j = s[B].op.axis
   s[B].split(i, 4)
   
   print(tvm.lower(s, [A ,B], simple_mode=True))
   ```
   
   ### Results
   Before 
   ```c++
   produce B {
     for (i.inner, 0, 4) {
       for (j, 0, 2) {
         if (likely((i.inner < 2))) {
           if (likely((i.inner < 2))) {
             B[((i.inner*2) + j)] = (A[((i.inner*2) + j)] + 1f)
           }
         }
       }
     }
   }
   ```
   
   After
   ```c++
   produce B {
     for (i.inner, 0, 2) {
       for (j, 0, 2) {
         B[((i.inner*2) + j)] = (A[((i.inner*2) + j)] + 1f)
       }
     }
   }
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to