You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "junrushao (via GitHub)" <gi...@apache.org> on 2023/05/14 00:01:35 UTC
[GitHub] [tvm] junrushao opened a new pull request, #14849: [Bugfix][TVMScript] Capture fails if var appears only in annotation
junrushao opened a new pull request, #14849:
URL: https://github.com/apache/tvm/pull/14849
Consider the case below:
```python
dtype = "float32"
@T.prim_func:
def f(
A: T.Buffer((1, ), dtype),
B: T.Buffer((1, ), dtype),
):
...
```
The variable `dtype` only appears in the type annotation of the function being parsed. In this case, the python interpreter will evaluate the annotation first before invoking the decorator, and thus if `dtype` doesn't appear in the function body, it will not be considered as being captured by the function itself. As a result, `inspect` module will be unable to supply the value of `dtype` during parsing, leading to failure.
This PR fixes the bug by maintaining a copy of function annotations that are already parsed. Whenever expression evaluation fails during parsing, it falls back to using the copy that is evaluated by python interpreter.
--
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] tvm-bot commented on pull request #14849: [Bugfix][TVMScript] Capture fails if var appears only in annotation
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14849:
URL: https://github.com/apache/tvm/pull/14849#issuecomment-1546771716
<!---bot-comment-->
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
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] junrushao commented on pull request #14849: [Bugfix][TVMScript] Capture fails if var appears only in annotation
Posted by "junrushao (via GitHub)" <gi...@apache.org>.
junrushao commented on PR #14849:
URL: https://github.com/apache/tvm/pull/14849#issuecomment-1546774323
A side note: we might want to migrate all `report_error` to raising `ParserError` to avoid nested error reporting
--
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] junrushao commented on pull request #14849: [Bugfix][TVMScript] Capture fails if var appears only in annotation
Posted by "junrushao (via GitHub)" <gi...@apache.org>.
junrushao commented on PR #14849:
URL: https://github.com/apache/tvm/pull/14849#issuecomment-1546771756
CC: @tqchen @cyx-6
--
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] Hzfengsy merged pull request #14849: [Bugfix][TVMScript] Capture fails if var appears only in annotation
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy merged PR #14849:
URL: https://github.com/apache/tvm/pull/14849
--
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