You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Lunderberg (via GitHub)" <gi...@apache.org> on 2023/10/26 17:48:02 UTC

[PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Lunderberg opened a new pull request, #15994:
URL: https://github.com/apache/tvm/pull/15994

   Prior to this commit, `FuseTIR` required the symbolic shape of an argument to be a structural match to the symbolic shape of a parameter.  As a result, erroneous failures to match would occur when the dynamic shape parameter contains expressions, and the static shape argument does not.  For example, a parameter `[n, m, n*m]` is not structurally matched to an argument `[16, 16, 256]`, but is a valid substitution.  This commit updates `FuseTIR` to handle these cases.


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on PR #15994:
URL: https://github.com/apache/tvm/pull/15994#issuecomment-1832479682

   Rebased onto `unity` to rerun CI, make sure no conflicts have arisen in the past few weeks.


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Posted by "masahi (via GitHub)" <gi...@apache.org>.
masahi commented on PR #15994:
URL: https://github.com/apache/tvm/pull/15994#issuecomment-1785926013

   cc @Hzfengsy 


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy merged PR #15994:
URL: https://github.com/apache/tvm/pull/15994


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on code in PR #15994:
URL: https://github.com/apache/tvm/pull/15994#discussion_r1379217051


##########
src/relax/transform/fuse_tir.cc:
##########
@@ -48,29 +48,32 @@ class SymbolicMatcher : ExprFunctor<bool(const PrimExpr& n, const PrimExpr& othe
     }
   }
   void Match(const PrimExpr& param, const PrimExpr& arg) {
-    if (!VisitExpr(param, arg)) {
-      LOG(FATAL) << "Failed to match PrimExpr " << param << " with " << arg;
-    }
+    VisitExpr(param, arg);
+    must_prove_ = arith::Analyzer().Simplify(Substitute(must_prove_, *var_remap_));

Review Comment:
   would be useful to generate analyzer once and reuse multiple times when possibe



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Unity][Bugfix] Handle symbolic matching with non-structural match [tvm]

Posted by "Lunderberg (via GitHub)" <gi...@apache.org>.
Lunderberg commented on code in PR #15994:
URL: https://github.com/apache/tvm/pull/15994#discussion_r1382213312


##########
src/relax/transform/fuse_tir.cc:
##########
@@ -48,29 +48,32 @@ class SymbolicMatcher : ExprFunctor<bool(const PrimExpr& n, const PrimExpr& othe
     }
   }
   void Match(const PrimExpr& param, const PrimExpr& arg) {
-    if (!VisitExpr(param, arg)) {
-      LOG(FATAL) << "Failed to match PrimExpr " << param << " with " << arg;
-    }
+    VisitExpr(param, arg);
+    must_prove_ = arith::Analyzer().Simplify(Substitute(must_prove_, *var_remap_));

Review Comment:
   Good call, and updated to be outside of the `SymbolicMatcher`.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org