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 2021/09/26 11:48:17 UTC

[GitHub] [tvm] sunwayforever opened a new pull request #9127: support arbitrary input dims for add/mul/relu of dnnl c_src codegen

sunwayforever opened a new pull request #9127:
URL: https://github.com/apache/tvm/pull/9127


   [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen


-- 
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] comaniac commented on a change in pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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



##########
File path: src/relay/backend/contrib/dnnl/codegen.cc
##########
@@ -98,12 +107,7 @@ std::vector<std::string> Dense(const CallNode* call) {
 std::vector<std::string> Relu(const CallNode* call) {
   std::vector<std::string> args;
   auto ishape = GetShape(call->args[0]->checked_type());
-
-  // Args: N, C, H, W
-  for (auto s : ishape) {
-    args.push_back(std::to_string(s));
-  }
-

Review comment:
       Better to keep the layout comment.

##########
File path: src/relay/backend/contrib/dnnl/codegen.cc
##########
@@ -126,12 +130,16 @@ std::vector<std::string> BatchNorm(const CallNode* call) {
 std::vector<std::string> Add(const CallNode* call) {
   std::vector<std::string> args;
   auto ishape = GetShape(call->args[0]->checked_type());
+  args.push_back("0");
+  args.push_back(GetShapeString(ishape));
+  return args;
+}
 
-  // Args: H, W
-  for (auto s : ishape) {
-    args.push_back(std::to_string(s));
-  }
-
+std::vector<std::string> Multiply(const CallNode* call) {

Review comment:
       Better to comment what args are.

##########
File path: src/runtime/contrib/dnnl/dnnl.cc
##########
@@ -44,6 +44,32 @@ typedef struct {
   void** data;
 } DnnlPackedArgs;
 
+inline dnnl::memory::desc GenDNNLMemDescByShape(const dnnl::memory::dims& shape,
+                                                memory::data_type dtype) {
+  using tag = memory::format_tag;
+
+  dnnl::memory::desc data_md;
+
+  switch (shape.size()) {
+    case 2:
+      data_md = dnnl::memory::desc({shape, dtype, tag::ab});
+      break;
+    case 3:
+      data_md = dnnl::memory::desc({shape, dtype, tag::abc});
+      break;
+    case 4:
+      data_md = dnnl::memory::desc({shape, dtype, tag::abcd});
+      break;
+    case 5:
+      data_md = dnnl::memory::desc({shape, dtype, tag::abcde});
+      break;
+    default:
+      assert(true);

Review comment:
       ```suggestion
         LOG(FATAL) << "message";
   ```
   




-- 
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] masahi commented on pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   Can you add a test?


-- 
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] masahi merged pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   


-- 
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] comaniac commented on pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   > Can you add a test?
   
   Hey @masahi, the DNNL C codegen currently is not enabled in the CI so it won't be tested anyways. The reason we didn't deprecate it is because it is a good codegen example against to the JSON codegen/runtime. Do you have any suggestion for this 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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] masahi merged pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   


-- 
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] masahi commented on pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   Can you add a test?


-- 
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] comaniac commented on pull request #9127: [BYOC] support arbitrary input dims for add/mul/relu of dnnl c_src codegen

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


   > Can you add a test?
   
   Hey @masahi, the DNNL C codegen currently is not enabled in the CI so it won't be tested anyways. The reason we didn't deprecate it is because it is a good codegen example against to the JSON codegen/runtime. Do you have any suggestion for this 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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org