Lunderberg commented on code in PR #15898:
URL: https://github.com/apache/tvm/pull/15898#discussion_r1358767925
##########
python/tvm/relax/ir/instrument.py:
##########
@@ -25,13 +25,19 @@ class WellFormedInstrument:
is well formed. It will skip specific passes, like Normalize.
"""
- def __init__(self):
+ def __init__(self, check_struct_info=True):
self.skip_pass_name = ["Normalize", "ResolveGlobals"]
+ self.check_struct_info = check_struct_info
def run_before_pass(self, mod, pass_info):
- if pass_info.name not in self.skip_pass_name:
- assert relax.analysis.well_formed(mod)
+ self._check(mod, pass_info.name, "Before")
def run_after_pass(self, mod, pass_info):
- if pass_info.name not in self.skip_pass_name:
- assert relax.analysis.well_formed(mod)
+ self._check(mod, pass_info.name, "After")
Review Comment:
When doing an end-to-end lowering, it's definitely overkill, but this
utility is primarily used for the relax unit tests. There, I think it's
helpful in establishing whether a transformation caused a module to be
ill-formed, or whether the usually-hand-written input module was ill-formed
from the start.
--
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]