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

   set default slice value 
   - lower=0 if None
   - upper=0 if None
   - step=1 if None
   
   before this commit, this code will raise error `TypeError: unsupported 
operand type(s) for -: 'int' and 'NoneType'
   ```
   @T.prim_func
   def func(A: T.handle):
       a = T.match_buffer(A, shape=(16,))
       va = a[:16]
       a[:16] = va
   ```
   detail error info is
   ```
   /tvm/python/tvm/script/parser/tir/parser.py in visit_assign(self, node)
       259             indices = self.eval_expr(lhs.slice)
   --> 260         T.buffer_store(self.eval_expr(lhs.value), rhs, indices)
   
   /tvm/python/tvm/script/ir_builder/tir/ir.py in buffer_store(buffer, value, 
indices)
      1286             step = 1 if index.step is None else index.step
   -> 1287             lanes = Analyzer().simplify((index.stop - index.start + 
step - 1) // step)
   ```
    parser for `a[:16]=va` wil get the indice with stop and step None, thus 
raise error at line 1287 of script/ir_builder/tir/ir.py
   
   this commit will set the default slice value when execute ` indices = 
self.eval_expr(lhs.slice)`


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