-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] TVMScript fails with LetStmt #13892
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
Comments
CC @cyx-6 would you like to take a look? Thanks! |
Thanks for reporting this bug. I believe that this is due to the bug of printing |
junrushao
pushed a commit
that referenced
this issue
Feb 3, 2023
This PR is the bug fix reported in #13892. Initially, we mix the logic of `LetStmt` docsifying method with and without concise scoping. For example, in ```python x = T.var("int32") with T.let(x, 0): ``` `x` in the `LetStmt` works as a right value, while in ```python x: T.int32 = 0 ``` `x` in the `LetStmt` works as a left value as result. Our old logic mixed them together to generate the wrong code for the first case. Meanwhile, during the fix, we found another bug in concise scoping check. For example, we have ```python x = T.var("int32") y = T.var("int32") with T.let(x, y): with T.let(y, 0): ``` here we should not output ```python x = T.var("int32") y = T.var("int32") with T.let(x, y): y: int32 = 0 ``` becase this will define a new `y_1: int32 = 0` indeed, due the the variable shadowing logic of the parser, which is different from the `y` we define and refer to. Our concise scoping `v: ... = ...` should launch if and only if the `v` is never defined before. Otherwise, we use `with T.let(v, ...):` instead.
Closed via #13900 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
Hi there,
I encountered an error that when generating TVMScript with LetStmt, the generated script cannot be parsed if the var in LetStmt appears the first time in the IR.
The above case generates TVMScript as below
But when parsing this TVMScript, it reports an error that 'x' is an undefined variable so that the parse failed. The TVMScript with LetStmt is not round-trippable in this case.
For the semantic of LetStmt, I think'x' should be identified as a definition, the script should be parsed successly.
Please let me know if there is any confusion, thanks very much!
Environment
latest TVM mainline
@junrushao @wrongtest-intellif
The text was updated successfully, but these errors were encountered: