-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix][TVMScript] Handle LetStmt for
var1 = var2
expressions (#14320
) * [Bugfix][TVMScript] Handle LetStmt for `var1 = var2` expressions Usually, when using TVMScript to represent a `PrimFunc` variable definition `var_name = expr` defines `LetStmt` with a variable named `var_name` bound to the expression `expr`. However, prior to this commit, if `expr` is a `tir::Var`, the TVMScript parser would instead silently omit the `LetStmt`, and rename all instances of that variable to `var_name`. The root cause was in the `VarTable.exist` check, which erroneously returned False in all cases. This was due to a `value is v` check, which checked if the value was the same as the stack of maybe-shadowing values that share the same name. Replacing the 'value is v` check with a `value in v` check resolves this issue. This bug dates to the initial implementation of the new TVMScript parser in #12496. * Avoid implicit `PrimExpr.__bool__` from `if value in value_stack` * Use T.meta_var where variable renaming is required.
- Loading branch information
1 parent
49e6695
commit 66e18fb
Showing
3 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters