jwfromm commented on a change in pull request #8143:
URL: https://github.com/apache/tvm/pull/8143#discussion_r640151629



##########
File path: python/tvm/auto_scheduler/relay_integration.py
##########
@@ -64,19 +65,27 @@ def call_all_topi_funcs(mod, params, target):
         disabled_pass={"AutoSchedulerLayoutRewrite"},
     ):
         try:
-            opt_mod, _ = relay.optimize(mod, target, params)
+            # TODO(jwfromm) Remove this once AlterOpLayout bug that mutates
+            # source module is fixed. Until then, create a clone.
+            mod_clone = deepcopy(mod)

Review comment:
       I think we actually need to have both. The problem is that in the first 
try we attempt to apply `optimize`, which can mutate the source module. Then if 
that fails, we try to use `compiler.lower`, which again can mutate the source 
module. If we tried to apply `compiler.lower` to `mod_clone` after `optimize` 
without a second copy, we could hit an error due to invalid shapes from 
alter_op_layout.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to