Lunderberg opened a new pull request, #16367: URL: https://github.com/apache/tvm/pull/16367
Resolve a bug that caused undefined relax variables in the output of `CanonicalizeBindings` for cases where `VisitVarDef(const Var&)` replaces a variable, and `VisitExpr_(const VarNode*)` returns a value with different struct info, both occurring within the same `VarBinding`. The ExprMutator is only allowed to update a variable's struct info if the value bound to it has new struct info. When CanonicalizeBindings replaces a trivial binding, this may provide better struct info as a result. Prior to this commit, `ExprMutator::ReEmitBinding` defined a remap for `binding->var->vid`, even if the derived class defined a replacement by overriding `VisitVarDef`. If the derived class defines a new variable binding by overriding `VisitVarDef`, and also causes a variable replacement by overriding `VisitExpr` and returning a type with different struct info, then `ExprMutator` must check for both `binding->var->vid` *AND* `new_var->vid`. The former may be present in the unmodified graph, and the latter may be produced by the derived class before delegating to the base class. This commit updates `ExprMutator::ReEmitBinding` to define entries for both replacements that may be required. -- 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]
