tqchen commented on code in PR #16067:
URL: https://github.com/apache/tvm/pull/16067#discussion_r1383609197
##########
src/relax/analysis/well_formed.cc:
##########
@@ -301,13 +302,38 @@ class WellFormedChecker : public relax::ExprVisitor,
}
}
- for (const StructInfo& sinfo_arg : op->sinfo_args) {
+ for (const StructInfo& sinfo_arg : call->sinfo_args) {
this->VisitStructInfo(sinfo_arg);
}
- CheckStructInfo(op);
- if (is_dataflow_ && check_struct_info_ && IsImpureCall(GetRef<Call>(op))) {
- Malformed(Diagnostic::Error(op) << "There cannot be an impure call
inside a dataflow block.");
+ CheckStructInfo(call);
+ if (is_dataflow_ && check_struct_info_ &&
IsImpureCall(GetRef<Call>(call))) {
+ Malformed(Diagnostic::Error(call)
+ << "There cannot be an impure call inside a dataflow block.");
+ }
+
+ // If the operation has defined a custom normalization function
+ // using the FNormalize attribute, the call node must be normalized in
order to be well-formed.
+ // If we apply the FNormalize and it produces any change, modified the
expression, re-visit in
+ // case it produced a nested expression.
+
+ if (auto opt_op = call->op.as<Op>()) {
+ auto op = opt_op.value();
Review Comment:
https://github.com/apache/tvm/blob/main/include/tvm/ir/op.h#L476 we can
directly use this function to simplofy the logic
--
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]