Prior to this commit, variable replacement by BindSymbolicVars would fail to replace variables that occur within a relax::MatchCast node. This pattern is rare, because the bind_symbolic_vars method can only replace variables that are exposed as part of the function signature, and most uses of relax::MatchCast act as a definition for symbolic variables that are not exposed through the function signature. This pattern is well-formed, though, since the relax::MatchCast node can also act as a user of previously-defined symbolic variables.
The root cause for this bug was in the ExprMutator visitor for relax::MatchCast, which did not visit the struct info field. As a result, the virtual ExprMutator::VisitPrimExpr function was not called for expressions that occur within the StructInfo of a relax::MatchCast. This commit updates ExprMutator to resolve this bug, and applies an analogous fix for ExprVisitor.
Prior to this commit, variable replacement by
BindSymbolicVars
would fail to replace variables that occur within arelax::MatchCast
node. This pattern is rare, because thebind_symbolic_vars
method can only replace variables that are exposed as part of the function signature, and most uses ofrelax::MatchCast
act as a definition for symbolic variables that are not exposed through the function signature. This pattern is well-formed, though, since therelax::MatchCast
node can also act as a user of previously-defined symbolic variables.The root cause for this bug was in the
ExprMutator
visitor forrelax::MatchCast
, which did not visit the struct info field. As a result, the virtualExprMutator::VisitPrimExpr
function was not called for expressions that occur within theStructInfo
of arelax::MatchCast
. This commit updatesExprMutator
to resolve this bug, and applies an analogous fix forExprVisitor
.