tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [incubator-tvm] branch master updated: [BYOC][MergeComposite] if root->args[i] isn't a CallNode, then Donwcast<Call> will check fail (#5623)
Date Wed, 20 May 2020 01:11:00 GMT
This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 6cbda80  [BYOC][MergeComposite] if root->args[i] isn't a CallNode, then Donwcast<Call>
will check fail (#5623)
6cbda80 is described below

commit 6cbda80227fc18a859c4b01f57f75abbd7a16181
Author: windclarion <windclarion@gmail.com>
AuthorDate: Wed May 20 09:10:50 2020 +0800

    [BYOC][MergeComposite] if root->args[i] isn't a CallNode, then Donwcast<Call>
will check fail (#5623)
    
    we needn't execute L131 "call_map->Set(arg, new_arg)", because when arg
    is CallNode and root->args[i] is not CallNode, new_arg will be a null
    pointer. There is no point in caching null pointer.
    
    Signed-off-by: windclarion <windclarion@gmail.com>
---
 src/relay/transforms/merge_composite.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/relay/transforms/merge_composite.cc b/src/relay/transforms/merge_composite.cc
index b9eef74..596e2a1 100644
--- a/src/relay/transforms/merge_composite.cc
+++ b/src/relay/transforms/merge_composite.cc
@@ -121,7 +121,7 @@ class MergeCompositeWrapper : public ExprMutator {
     Array<Expr> new_args;
     for (const auto& arg : pattern->args) {
       Expr new_arg;
-      if (arg->IsInstance<CallNode>()) {
+      if (arg->IsInstance<CallNode>() && root->args[i]->IsInstance<CallNode>())
{
         new_arg =
             ExtractPattern(Downcast<Call>(arg), Downcast<Call>(root->args[i]),
var_map, call_map);
         // if we've already processed this call node, return the previous result


Mime
View raw message