You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/10 22:08:21 UTC

[GitHub] [tvm] yelite opened a new pull request, #13356: [MetaSchedule] Skip empty fx graph in TorchBench tuning script

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

   This PR makes the `python/tvm/meta_schedule/testing/torchbench/run.py` script skip optimizing empty fx graph. 
   
   This unblocks tuning models like moco and detectron for which TorchDynamo will generate empty fx graph.
   
   cc @junrushao @zxybazh 


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


[GitHub] [tvm] zxybazh merged pull request #13356: [MetaSchedule] Skip empty fx graph in TorchBench tuning script

Posted by GitBox <gi...@apache.org>.
zxybazh merged PR #13356:
URL: https://github.com/apache/tvm/pull/13356


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


[GitHub] [tvm] tvm-bot commented on pull request #13356: [MetaSchedule] Skip empty fx graph in TorchBench tuning script

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13356:
URL: https://github.com/apache/tvm/pull/13356#issuecomment-1310966362

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * cc @Hzfengsy, @elvin-n, @junrushao <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


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


[GitHub] [tvm] zxybazh commented on a diff in pull request #13356: [MetaSchedule] Skip empty fx graph in TorchBench tuning script

Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #13356:
URL: https://github.com/apache/tvm/pull/13356#discussion_r1019663641


##########
python/tvm/meta_schedule/testing/torchbench/run.py:
##########
@@ -431,6 +431,26 @@ def forward(*args):
     return forward
 
 
+def should_skip_subgraph(graph_module: torch.fx.GraphModule) -> bool:
+    """
+    Returns whether it should skip optimizing the input graph module.
+    The graph could be empyt or only containing nodes calling function
+    for side effect.
+    """
+    graph = graph_module.graph
+
+    if len(graph.nodes) == 0:
+        return True
+
+    inputs = [n for n in graph.nodes if n.op == "placeholder"]
+    outputs = [n for n in graph.nodes if n.op == "output"]
+
+    if len(inputs) == 0 and all(output.args == ((),) for output in outputs):

Review Comment:
   ```suggestion
       return len(inputs) == 0 and all(output.args == ((),) for output in outputs)
   ```



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