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

[GitHub] [tvm] srkreddy1238 opened a new pull request, #14767: [OpenCLML] Transposed convolution support and other fixes

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

   Added support for transposed convolution.
   Epsilon support for batchnorm op added - part of v3.0. CLML version query bug fixed.


-- 
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] srkreddy1238 commented on a diff in pull request #14767: [OpenCLML] Transposed convolution support and other fixes

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


##########
src/relay/backend/contrib/clml/codegen.cc:
##########
@@ -189,22 +192,27 @@ class CLMLJSONSerializer : public backend::contrib::JSONSerializer {
   std::shared_ptr<JSONGraphNode> CreateCompositeConvJSONNode(const CallNode* cn) {
     CompositeConvNode nodes = UnpackCompositeConvolution(cn);
 
-    const auto* conv_attr = nodes.conv->attrs.as<Conv2DAttrs>();
-    ICHECK(conv_attr);
-
     std::string name;
     std::string name_prefix = "nn";
-
-    // Distinguish between normal and depth-wise convolution
-    if (conv_attr->channels.defined() &&
-        tvm::tir::ExprDeepEqual()(conv_attr->channels, conv_attr->groups) &&
-        conv_attr->groups != 1) {
-      name = "depthwise_conv2d";
-      ICHECK(conv_attr->kernel_layout == "IOHW")
-          << "Kernel layout must be IHWO, has the module been pre-processed correctly?";
-    } else {
-      name = "conv2d";
-      ICHECK(conv_attr->kernel_layout == "OIHW")
+    if (backend::IsOp(nodes.conv, "nn.conv2d")) {
+      const auto* conv_attr = nodes.conv->attrs.as<Conv2DAttrs>();
+      ICHECK(conv_attr);
+      if (conv_attr->channels.defined() &&
+          tvm::tir::ExprDeepEqual()(conv_attr->channels, conv_attr->groups) &&
+          conv_attr->groups != 1) {
+        name = "depthwise_conv2d";
+        ICHECK(conv_attr->kernel_layout == "IOHW")
+            << "Kernel layout must be IHWO, has the module been pre-processed correctly?";
+      } else {
+        name = "conv2d";
+        ICHECK(conv_attr->kernel_layout == "OIHW")
+            << "Kernel layout must be OHWI, has the module been pre-processed correctly?";
+      }
+    } else if (backend::IsOp(nodes.conv, "nn.conv2d_transpose")) {
+      name = "conv2d_transpose";
+      const auto* conv_transpose_attr = nodes.conv->attrs.as<Conv2DTransposeAttrs>();
+      ICHECK(conv_transpose_attr);
+      ICHECK(conv_transpose_attr->kernel_layout == "OIHW")

Review Comment:
   I will remove this check in python frontend. Codegen is the final component to make sure we don't generate incompatible code.



-- 
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] echuraev merged pull request #14767: [OpenCLML] Transposed convolution support and other fixes

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


-- 
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] echuraev commented on a diff in pull request #14767: [OpenCLML] Transposed convolution support and other fixes

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


##########
src/relay/backend/contrib/clml/codegen.cc:
##########
@@ -189,22 +192,27 @@ class CLMLJSONSerializer : public backend::contrib::JSONSerializer {
   std::shared_ptr<JSONGraphNode> CreateCompositeConvJSONNode(const CallNode* cn) {
     CompositeConvNode nodes = UnpackCompositeConvolution(cn);
 
-    const auto* conv_attr = nodes.conv->attrs.as<Conv2DAttrs>();
-    ICHECK(conv_attr);
-
     std::string name;
     std::string name_prefix = "nn";
-
-    // Distinguish between normal and depth-wise convolution
-    if (conv_attr->channels.defined() &&
-        tvm::tir::ExprDeepEqual()(conv_attr->channels, conv_attr->groups) &&
-        conv_attr->groups != 1) {
-      name = "depthwise_conv2d";
-      ICHECK(conv_attr->kernel_layout == "IOHW")
-          << "Kernel layout must be IHWO, has the module been pre-processed correctly?";
-    } else {
-      name = "conv2d";
-      ICHECK(conv_attr->kernel_layout == "OIHW")
+    if (backend::IsOp(nodes.conv, "nn.conv2d")) {
+      const auto* conv_attr = nodes.conv->attrs.as<Conv2DAttrs>();
+      ICHECK(conv_attr);
+      if (conv_attr->channels.defined() &&
+          tvm::tir::ExprDeepEqual()(conv_attr->channels, conv_attr->groups) &&
+          conv_attr->groups != 1) {
+        name = "depthwise_conv2d";
+        ICHECK(conv_attr->kernel_layout == "IOHW")
+            << "Kernel layout must be IHWO, has the module been pre-processed correctly?";
+      } else {
+        name = "conv2d";
+        ICHECK(conv_attr->kernel_layout == "OIHW")
+            << "Kernel layout must be OHWI, has the module been pre-processed correctly?";
+      }
+    } else if (backend::IsOp(nodes.conv, "nn.conv2d_transpose")) {
+      name = "conv2d_transpose";
+      const auto* conv_transpose_attr = nodes.conv->attrs.as<Conv2DTransposeAttrs>();
+      ICHECK(conv_transpose_attr);
+      ICHECK(conv_transpose_attr->kernel_layout == "OIHW")

Review Comment:
   Is it necessary to check `kernel_layout` here? You have already done it in `python/tvm/relay/op/contrib/clml.py`. If it is not necessary, then probably the same checks can be removed for convolution.



##########
python/tvm/relay/op/contrib/clml.py:
##########
@@ -37,7 +37,7 @@
 def clml_sdk_version():
     """Utility function to get clml version version"""
 
-    return tvm.support.libinfo().get("TVM_CLML_VERSION", 2)
+    return int(tvm.support.libinfo().get("CLML_VERSION_MAJOR", 2))

Review Comment:
   Why did you change `TVM_CLML_VERSION` on `CLML_VERSION_MAJOR`?



-- 
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] srkreddy1238 commented on a diff in pull request #14767: [OpenCLML] Transposed convolution support and other fixes

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


##########
python/tvm/relay/op/contrib/clml.py:
##########
@@ -37,7 +37,7 @@
 def clml_sdk_version():
     """Utility function to get clml version version"""
 
-    return tvm.support.libinfo().get("TVM_CLML_VERSION", 2)
+    return int(tvm.support.libinfo().get("CLML_VERSION_MAJOR", 2))

Review Comment:
   The version check from libinfo was broken earlier and not functional. ```TVM_CLML_VERSION``` was compiler flag and cmake option is ```CLML_VERSION_MAJOR```. We can maintain same for both.



-- 
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 #14767: [OpenCLML] Transposed convolution support and other fixes

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

   <!---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-->
    * No users to tag found in teams: `openclml` <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