comaniac commented on a change in pull request #7350:
URL: https://github.com/apache/tvm/pull/7350#discussion_r565520801
##########
File path: docs/deploy/vitis_ai.rst
##########
@@ -541,20 +543,50 @@ TVM.
import tvm
import tvm.relay as relay
from tvm.contrib.target import vitis_ai
- from tvm.contrib import util, graph_runtime
+ from tvm.contrib import utils, graph_runtime
from tvm.relay.build_module import bind_params_by_name
from tvm.relay.op.contrib.vitis_ai import annotation
After importing a convolutional neural network model using the usual
Relay API's, annotate the Relay expression for the given Vitis-AI DPU
target and partition the graph.
+.. note::
+
+ We recommend switching DPU convolutions' data layouts to NHWC and CPU
comvolutions'
+ data layouts to NCHW for best DPU and CPU performance. You can use the
ConvertLayout
+ transformation pass two times to achieve this as demonstrated in the code
block
+ underneath.
+
.. code:: python
mod["main"] = bind_params_by_name(mod["main"], params)
+
+ # For edge DPU we recommend switching the convolutions'data layout
Review comment:
```suggestion
# For edge DPU we recommend converting the convolutions' data layout
```
##########
File path: docs/deploy/vitis_ai.rst
##########
@@ -541,20 +543,50 @@ TVM.
import tvm
import tvm.relay as relay
from tvm.contrib.target import vitis_ai
- from tvm.contrib import util, graph_runtime
+ from tvm.contrib import utils, graph_runtime
from tvm.relay.build_module import bind_params_by_name
from tvm.relay.op.contrib.vitis_ai import annotation
After importing a convolutional neural network model using the usual
Relay API's, annotate the Relay expression for the given Vitis-AI DPU
target and partition the graph.
+.. note::
+
+ We recommend switching DPU convolutions' data layouts to NHWC and CPU
comvolutions'
Review comment:
```suggestion
We recommend converting DPU convolutions' data layouts to NHWC and CPU
convolutions'
```
In fact, to get the best performance by getting rid of the layout transform
overheads, we should suggest using NHWC for an entire model. For the Conv2D
that remains on CPU, we could use auto_scheduler to tune its performance, and
it could be even better than the tuned Conv2D with NCHW data layout. It might
be better to mention this in the doc, and point to the auto_scheduler tutorials.
##########
File path: python/tvm/contrib/target/vitis_ai.py
##########
@@ -132,12 +132,12 @@ def vitis_ai_compiler(ref):
layers = xgraph.get_layers()
# Get the output tensor names using XGraph and output Relay ids
- out_tensor_names = []
+ out_tensor_names = [1] * len(output_relay_ids)
Review comment:
It would be better to make the type consistent. For example, you could
use `["unknown_name" for _ in range(output_relay_ids)]`.
----------------------------------------------------------------
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:
[email protected]