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/12/16 18:29:54 UTC

[GitHub] [tvm] mbrookhart opened a new pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

mbrookhart opened a new pull request #7120:
URL: https://github.com/apache/tvm/pull/7120


   cc @icemelon9 


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



[GitHub] [tvm] icemelon9 commented on pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
icemelon9 commented on pull request #7120:
URL: https://github.com/apache/tvm/pull/7120#issuecomment-754903121


   Thanks @mbrookhart 


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



[GitHub] [tvm] icemelon9 commented on a change in pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
icemelon9 commented on a change in pull request #7120:
URL: https://github.com/apache/tvm/pull/7120#discussion_r551668826



##########
File path: include/tvm/relay/dataflow_pattern.h
##########
@@ -46,6 +48,29 @@ class DFPatternNode : public Object {
  */
 class DFPattern : public ObjectRef {
  public:
+  /*! \brief Syntatic Sugar for creating a CallPattern */
+  DFPattern operator()(const std::vector<DFPattern>& args);
+  /*! \brief Syntatic Sugar for creating a CallPattern with an "add" op */

Review comment:
       I see. sure.




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



[GitHub] [tvm] mbrookhart commented on a change in pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on a change in pull request #7120:
URL: https://github.com/apache/tvm/pull/7120#discussion_r545282998



##########
File path: tests/cpp/dataflow_pattern_test.cc
##########
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/relay/dataflow_pattern.h>
+#include <tvm/tir/analysis.h>
+

Review comment:
       I didn't add one because all of the operator +-*/ ops go through it.




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



[GitHub] [tvm] icemelon9 commented on a change in pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
icemelon9 commented on a change in pull request #7120:
URL: https://github.com/apache/tvm/pull/7120#discussion_r544714342



##########
File path: include/tvm/relay/dataflow_pattern.h
##########
@@ -46,6 +48,29 @@ class DFPatternNode : public Object {
  */
 class DFPattern : public ObjectRef {
  public:
+  /*! \brief Syntatic Sugar for creating a CallPattern */
+  DFPattern operator()(const std::vector<DFPattern>& args);
+  /*! \brief Syntatic Sugar for creating a CallPattern with an "add" op */

Review comment:
       I feel that the syntactic sugar "+-*/" is not necessary since we have the "IsOp" one, and it may cause some confusion whether you're adding two patterns together or use the "add" op.

##########
File path: tests/cpp/dataflow_pattern_test.cc
##########
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <tvm/relay/dataflow_pattern.h>
+#include <tvm/tir/analysis.h>
+

Review comment:
       Add a unit test for call?

##########
File path: include/tvm/relay/dataflow_pattern.h
##########
@@ -1,5 +1,4 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
+/* * Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       revert this change




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



[GitHub] [tvm] mbrookhart commented on a change in pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on a change in pull request #7120:
URL: https://github.com/apache/tvm/pull/7120#discussion_r545285509



##########
File path: include/tvm/relay/dataflow_pattern.h
##########
@@ -46,6 +48,29 @@ class DFPatternNode : public Object {
  */
 class DFPattern : public ObjectRef {
  public:
+  /*! \brief Syntatic Sugar for creating a CallPattern */
+  DFPattern operator()(const std::vector<DFPattern>& args);
+  /*! \brief Syntatic Sugar for creating a CallPattern with an "add" op */

Review comment:
       Hmm. I did the +-*/ overloads in python because Relay's IR does the same thing at the python level, and I wanted to keep operation on the pattern API in line with Relay's API. I continued that here, trying to keep the C++ pattern API in line with the Python Pattern API. So...for consistency I'd argue to leave it as it is.




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



[GitHub] [tvm] icemelon9 merged pull request #7120: [PatternLang] Add Syntatic Sugar to the C++ pattern API and support DataType Attribute Matching

Posted by GitBox <gi...@apache.org>.
icemelon9 merged pull request #7120:
URL: https://github.com/apache/tvm/pull/7120


   


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