junrushao1994 commented on PR #11518:
URL: https://github.com/apache/tvm/pull/11518#issuecomment-1143955930
@Hzfengsy Good catch! You are right that I overlooked the fact that there is
a Block missing :-)
We might want to discuss how this block is supposed to look like. The
invariant in `te.create_prim_func` right now is that the PrimFunc created from
TE compute is always scheduleable with no opaque blocks, so if we simply
discard the block iters, then it could violate this assumption.
Instead, I would suggest that we do have a dummy iter in the block, i.e.
```python
def func(a: T.Buffer[(), "int32"], b: T.Buffer[(), "int32"], c: T.Buffer[(),
"int32"]) -> None:
T.func_attr({"global_symbol": "main", "tir.noalias": True})
# body
# with T.block("root")
with T.block("C"):
vi = T.axis.S(1, 0)
c[()] = a[()] + b[()]
```
or alternatively:
```python
def func(a: T.Buffer[(), "int32"], b: T.Buffer[(), "int32"], c: T.Buffer[(),
"int32"]) -> None:
T.func_attr({"global_symbol": "main", "tir.noalias": True})
# body
# with T.block("root")
for i in range(1):
with T.block("C"):
vi = T.axis.S(1, i)
c[()] = a[()] + b[()]
```
--
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]