This is an automated email from the ASF dual-hosted git repository.
lunderberg pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/unity by this push:
new b22aa0f7c7 [Unity] Improved error message in
ExprMutator::ReEmitBinding (#16307)
b22aa0f7c7 is described below
commit b22aa0f7c74a7f0a11461fd19b2bb82893780f25
Author: Eric Lunderberg <[email protected]>
AuthorDate: Mon Jan 8 16:05:53 2024 -0600
[Unity] Improved error message in ExprMutator::ReEmitBinding (#16307)
Prior to this commit, an error message would occur in
`ExprMutator::ReEmitBinding` if the struct info is missing from the
generated value. However, because this error was generated from
inside `GetStructInfo`, it didn't include sufficient context for
debugging. This commit checks the struct info explicitly, and
includes the context of the updated variable in the error message.
---
src/relax/ir/expr_functor.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/relax/ir/expr_functor.cc b/src/relax/ir/expr_functor.cc
index 14a704d729..26ce952626 100644
--- a/src/relax/ir/expr_functor.cc
+++ b/src/relax/ir/expr_functor.cc
@@ -670,7 +670,15 @@ void ExprMutator::ReEmitBinding(const VarBindingNode*
binding, Expr new_value) {
return;
}
- Var temp = WithStructInfo(new_var, GetStructInfo(new_value));
+ auto new_sinfo = new_value->struct_info_.as<StructInfo>();
+
+ ICHECK(new_sinfo)
+ << "InternalError: "
+ << "In binding of variable " << binding->var << ", the value " <<
new_value
+ << " does not have StructInfo. "
+ << "This typically occurs when ReEmitBinding is called without first
calling Normalize.";
+
+ Var temp = WithStructInfo(new_var, new_sinfo.value());
if (!temp.same_as(new_var)) {
new_var = temp;
}