Files
apache--tvm/python/tvm/script/parser
Eric Lunderberg 66e18fbe1f [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 https://github.com/apache/tvm/pull/12496.

* Avoid implicit `PrimExpr.__bool__` from `if value in value_stack`

* Use T.meta_var where variable renaming is required.
2023-04-02 16:09:51 -07:00
..