masahi commented on a change in pull request #10118:
URL: https://github.com/apache/tvm/pull/10118#discussion_r796974298



##########
File path: src/relay/transforms/transform_layout.h
##########
@@ -371,6 +375,17 @@ Expr LayoutRewriter(const Call& ref_call, const 
Array<Expr>& new_args, const Obj
   ICHECK_EQ(new_in.size(), new_in2.size())
       << "The number of input nodes should keep the same during 
alter_op_layout";
 
+  auto transform_layout = [&memorizer](Expr arg_item, const Layout& old_in, 
const Layout& old_in2,
+                                       const Layout& new_in, const Layout& 
new_in2) {
+    if (old_in2.Equals(old_in)) {  // the two transforms can be fused to one
+      arg_item = memorizer.Transform(arg_item, new_in, new_in2);
+    } else {
+      if (old_in.defined()) arg_item = memorizer.Transform(arg_item, new_in, 
old_in);
+      arg_item = memorizer.Transform(arg_item, old_in2, new_in2);

Review comment:
       FYI many of us are aware of the messy situation our layout convert pass 
is in. I believe an entire rewrite is desired at some point. I'd love to have 
your thoughts on this in the discuss forum etc.




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