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