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 2020/04/07 11:44:18 UTC

[GitHub] [incubator-tvm] mbaret opened a new pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens

mbaret opened a new pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262
 
 
   This adds utility functions to support registering and retrieving pattern tables used by MergeComposite for external codegens. This allows for us to centralise where the pattern tables are stored.
   
   Currently no upstream external codegens make use of composite functions, so I couldn't include a clear example. However, I would expect the pattern tables to be registered in the same file that operator support is registered (under python/tvm/relay/op/contrib).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] mbaret commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
mbaret commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-610392358
 
 
   cc @masahi @zhiics @trevor-m 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-614501472
 
 
   Thanks @mbaret 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-610734684
 
 
   @mbaret Is it better to merge this after https://github.com/apache/incubator-tvm/pull/5272?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi edited a comment on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi edited a comment on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-610734684
 
 
   @mbaret Is it better to merge this after https://github.com/apache/incubator-tvm/pull/5272? The pattern for DNNL exists only in the test case.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] mbaret commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
mbaret commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-613388386
 
 
   Thanks for that PR! I've updated this accordingly to demo the pattern table registration for DNNL.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi merged pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-610518146
 
 
   I'll revive my old PR https://github.com/apache/incubator-tvm/pull/4741 which should become the first use of composite in the code base.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#issuecomment-612703287
 
 
   @mbaret Now that #5272 is merged, I think you can move `dnnl_patterns` in the test there to contrib/dnnl.py and demonstrate the use of pattern table registry in `test_dnnl_fuse()` 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on a change in pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#discussion_r408160065
 
 

 ##########
 File path: python/tvm/relay/op/contrib/dnnl.py
 ##########
 @@ -63,3 +65,23 @@ def _func_wrapper(attrs, args):
 _register_external_op_helper("add")
 _register_external_op_helper("subtract")
 _register_external_op_helper("multiply")
+
+
+def make_pattern(with_bias=True):
+    data = _expr.var("data")
+    weight = _expr.var("weight")
+    bias = _expr.var("bias")
+    conv = reg.nn.conv2d(data, weight)
 
 Review comment:
   Why don't we import `op` as just `op`, rather than `reg`? `reg.nn.conv2d` seems very weird...

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-tvm] masahi commented on a change in pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #5262: [RELAY][BYOC] Register pattern tables from external codegens
URL: https://github.com/apache/incubator-tvm/pull/5262#discussion_r408162468
 
 

 ##########
 File path: tests/python/relay/test_pass_partition_graph.py
 ##########
 @@ -903,17 +889,17 @@ def test_detect_pattern(pattern_table, include_bn, include_sigmoid,
 
     def test_partition():
         # conv + bn + relu, conv + relu -> fused conv_bias_relu, conv, and relu
-        test_detect_pattern([conv2d_bias_relu_pat], True, False, 3)
+        test_detect_pattern([dnnl_patterns[0]], True, False, 3)
 
 Review comment:
   better to make variables `conv2d_bias_relu_pat` and `conv2d_relu_pat` so that
   * make the diff smaller
   * less change if later somebody adds new patterns to the table and `dnnl_patterns[0]` changes.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services