slyubomirsky commented on code in PR #16569:
URL: https://github.com/apache/tvm/pull/16569#discussion_r1490111225


##########
python/tvm/script/parser/core/entry.py:
##########
@@ -77,4 +95,15 @@ def parse(program: Union[doc.AST, Any, str], extra_vars: 
Dict[str, Any] = None)
             parser.parse(extra_vars=extra_vars)
         except ParserError as err:
             parser.report_error(err.node, err.args[0])
-    return builder.get()
+    ret = builder.get()
+    # well-formedness check will ignore any non-Relax functions
+    if isinstance(ret, IRModule):
+        # note: use the walrus operator (:=) once the project Python version
+        # supports it, would be more concise
+        source_ast = source.as_ast()
+        if find_decorator_annotation(source_ast, "check_well_formed") and not 
well_formed(ret):

Review Comment:
   Ah, I think I know why: Unlike the decorators for TIR and Relax functions 
(which are inside the module), the decorator for the module itself will not be 
saved when the module is parsed (i.e., the raw AST sent to the parser will not 
include the decorator because the decorator will have been "applied") so I'll 
have to find another means of passing that information along.



-- 
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]

Reply via email to