Hzfengsy opened a new pull request #8934:
URL: https://github.com/apache/tvm/pull/8934


   This PR improves TVMScript printer and parser. Including:
   - Buffer declare simplify
       ```python
       A = tir.match_buffer(a, [16, 16, 16], elem_offset=0, align=128, 
offset_factor=1) # before
       A = tir.match_buffer(a, [16, 16, 16], dtype="float32") # after
       ```
   - Expr printer simplify
       ```python
       (((i*16) + (j*4)) + k) # before
       i * 16 + j * 4 + k # after
       ```
   - space around `:` in region printing
       ```python
       A[i:i + 4] # before
       A[i : i + 4] # after
       ```
   - func buffer_map order
       ```Python
       # before
       def func(a: ty.hanle, b: ty.handle) -> None:
           B = tir.match_buffer(b, [1])
           A = tir.match_buffer(a, [16, 16, 16])
           ...
       # after
       def func(a: ty.hanle, b: ty.handle) -> None:
           A = tir.match_buffer(a, [16, 16, 16])
           B = tir.match_buffer(b, [1])
           ...
       ```
   - root block
       ```python
       # before
       def func():
           with tir.block([], "root"):
               tir.read([])
               tir.write([])
               A[()] = 0
       # after
       def func():
           # with tir.block("root"):
           A[()] = 0
       ```
   - empty block name
       ```python
       with tir.block([], ""): # before
       with tir.block([]): # after
       ```
   - var with same name
       ```python
       # before
       with tir.block([16, 16]) as [vi, vj]:
       with tir.block([16, 16]) as [vi_1, vj_1]:
       # after
       with tir.block([16, 16]) as [vi, vj]:
       with tir.block([16, 16]) as [vi, vj]:
       ```
   - always print buffer dtype
       ```python
       A = tir.match_buffer(a, [16, 16, 16]) # before
       A = tir.match_buffer(a, [16, 16, 16], dtype="float32") # after
       ```
   - range starts with zero
       ```python
       for i in range(0, 32): # before
       for i in range(32): # after
       ```
   
   cc @tqchen @junrushao1994 @tkonolige @xqdan 


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