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/09/03 15:52:54 UTC

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #6343: [BYOC][CONTRIB] Vitis-AI codegen integration

comaniac commented on a change in pull request #6343:
URL: https://github.com/apache/incubator-tvm/pull/6343#discussion_r483073842



##########
File path: docs/deploy/vitis_ai.rst
##########
@@ -285,8 +305,10 @@ platform. The following development boards can be used out-of-the-box:
 
 Edge hardware setup
 ^^^^^^^^^^^^^^^^^^^
++------------------------------------------------------------------------------------------------------------------------------------------------------------+

Review comment:
       I don't think you need this for the note block?

##########
File path: python/tvm/relay/op/contrib/vitis_ai.py
##########
@@ -31,16 +31,33 @@
 
 @transform.function_pass(opt_level=0)
 class VitisAIAnnotationPass:
-    """The explicit pass wrapper around VitisAIAnnotationPass."""
+

Review comment:
       remove this line.

##########
File path: tests/python/contrib/test_vitis_ai/test_vitis_ai_runtime.py
##########
@@ -101,4 +103,7 @@ def test_extern_vai_resnet18():
     check_result(mod, {"data": i_data},
                  (1, 1000), ref_res.asnumpy(), tol=1e-5, params=params)
 if __name__ == "__main__":
-    test_extern_vai_resnet18()
+    if sys.platform == "win32":
+        print("Skip test on Windows for now")
+    else:
+        test_extern_vai_resnet18()

Review comment:
       ```suggestion
       if sys.platform == "win32":
           print("Skip test on Windows for now")
           return
       test_extern_vai_resnet18()
   ```

##########
File path: src/runtime/contrib/vitis_ai/vitis_ai_runtime.cc
##########
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+/*!
+ * \file vitis_ai_runtime.cc
+ */
+#include <tvm/runtime/registry.h>
+#include <tvm/ir/transform.h>
+
+#include "vitis_ai_runtime.h"
+
+namespace tvm {
+namespace runtime {
+
+TVM_REGISTER_PASS_CONFIG_OPTION("target_", String);
+TVM_REGISTER_PASS_CONFIG_OPTION("vai_build_dir_", String);
+
+std::shared_ptr<pyxir::graph::XGraph> load_xgraph_model(const std::string& model_path) {
+  std::string model_name = model_path + "/" + "dpu_xgraph.json";
+  std::string model_weights = model_path + "/" + "dpu_xgraph.h5";
+  return pyxir::load(model_name, model_weights);
+}

Review comment:
       @anilmartha would you work on this or what's the plan?

##########
File path: python/tvm/relay/op/contrib/vitis_ai.py
##########
@@ -31,16 +31,33 @@
 
 @transform.function_pass(opt_level=0)
 class VitisAIAnnotationPass:
-    """The explicit pass wrapper around VitisAIAnnotationPass."""
+
+    """
+    The VitisAIAnnotationPass is responsible for annotating Relay expressions
+    in the way that they are supported through Vitis-AI accelerators
+    """
+
     def __init__(self, compiler, relay_ids):
         self.compiler = compiler
         self.relay_ids = relay_ids
+
     def transform_function(self, func, mod, ctx):
-        """Transform func to annotate."""
+        """
+        Transform function for annotating Relay module
+        """
+
         annotator = self
+
         class Annotator(tvm.relay.ExprMutator):
-            """Annotator for VITIS-AI DPU."""
+

Review comment:
       remove this line.

##########
File path: tests/python/contrib/test_vitis_ai/test_vitis_ai_codegen.py
##########
@@ -196,8 +213,13 @@ def expected():
 
 
 if __name__ == "__main__":
-    test_annotate()
-    test_add()
-    test_relu()
-    test_conv2d()
-    test_global_avg_pool2d()
+    if sys.platform == "win32":
+        print("Skip test on Windows for now")
+    else:
+        test_annotate()
+        test_add()
+        test_relu()
+        test_conv2d()
+        test_batchnorm()
+        test_global_avg_pool2d()
+        test_avg_pool2d()

Review comment:
       ```suggestion
       if sys.platform == "win32":
           print("Skip test on Windows for now")
           return
       test_annotate()
       test_add()
       test_relu()
       test_conv2d()
       test_batchnorm()
       test_global_avg_pool2d()
       test_avg_pool2d()
   ```




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