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 2021/11/15 02:19:01 UTC

[GitHub] [tvm] MasterJH5574 opened a new pull request #9506: [BugFix][TVMScript] Fix printer for dependent loops

MasterJH5574 opened a new pull request #9506:
URL: https://github.com/apache/tvm/pull/9506


   This PR fixes a bug in TVMScript printer. Suppose we have the following script:
   ```python
   @T.prim_func
   def func(a: T.handle) -> None:
       A = T.match_buffer(a, [], dtype="int32")
       for i in T.serial(0, 128):
           for j in T.serial(0, i):
               A[()] = A[()] + j
   ```
   
   Before this PR, the printer prints it as
   ```python
   @T.prim_func
   def func(a: T.handle) -> None:
       A = T.match_buffer(a, [], dtype="int32")
       # body
       for i, j in T.grid(128, i):  # <=== Invalid Python syntax!
           A[()] = A[()] + j
   ```
   
   Note that the last but one line is erroneous. When TVMScript parser deals with the printed script, it says
   ```
   error: Unknown identifier i.
    --> tensorir.py:23:29
       |  
    23 |      for i, j in T.grid(128, i):
       |                              ^  
   note: run with `TVM_BACKTRACE=1` environment variable to display a backtrace.
   ```
   
   After this PR, the printer separately prints loops with dependency. So the issue above won't show again :-)
   
   cc @Hzfengsy @junrushao1994 


-- 
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 #9506: [BugFix][TVMScript] Fix printer for dependent loops

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


   


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