leandron commented on a change in pull request #7917:
URL: https://github.com/apache/tvm/pull/7917#discussion_r621585598
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
+for the target device must be installed. After installing the correct toolchain
+the main difference compared to compiling natively is to pass a bunch of
command
+line argument to cmake that specify the compiler(s) to be used. For reference
+building the TVM runtime library on a modern laptop (using 8 threads) for
``aarch64``
+takes around 20 seconds vs ~10 min to build the runtime on a raspberry pi 4.
+
+cross-compile for aarch64
+"""""""""""""""""""""""""
+
+.. code-block:: bash
+
+ sudo apt-get update
+ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
+
+.. code-block:: bash
+
+ cmake .. \
+ -DCMAKE_SYSTEM_NAME=Linux \
+ -DCMAKE_SYSTEM_VERSION=1 \
+ -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
+ -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ \
+ -DCMAKE_FIND_ROOT_PATH=/usr/aarch64-linux-gnu \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+ -DMACHINE_NAME=aarch64-linux-gnu
+
+ make -j$(nproc) runtime
+
+For bare metal ARM devices the following toolchain is quite handy to install
instead of gcc-aarch64-linux-*
+
+.. code-block:: bash
+
+ sudo apt-get install gcc-multilib-arm-linux-gnueabihf
g++-multilib-arm-linux-gnueabihf
+
+
+cross-compile for RISC-V
+"""""""""""""""""""""""""
+
+.. code-block:: bash
+
+ sudo apt-get update
+ sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
+
+
+.. code-block:: bash
+
+ cmake .. \
+ -DCMAKE_SYSTEM_NAME=Linux \
+ -DCMAKE_SYSTEM_VERSION=1 \
+ -DCMAKE_C_COMPILER=/usr/bin/riscv64-linux-gnu-gcc \
+ -DCMAKE_CXX_COMPILER=/usr/bin/riscv64-linux-gnu-g++ \
+ -DCMAKE_FIND_ROOT_PATH=/usr/riscv64-linux-gnu \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+ -DMACHINE_NAME=riscv64-linux-gnu
+
+ make -j$(nproc) runtime
+
+The ``file`` command can be used to query the architecture of the produced
runtime.
+
+
+.. code-block:: bash
+
+ file file libtvm_runtime.so
Review comment:
Is `file file` here intentional?
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
+for the target device must be installed. After installing the correct toolchain
+the main difference compared to compiling natively is to pass a bunch of
command
+line argument to cmake that specify the compiler(s) to be used. For reference
+building the TVM runtime library on a modern laptop (using 8 threads) for
``aarch64``
+takes around 20 seconds vs ~10 min to build the runtime on a raspberry pi 4.
Review comment:
```suggestion
takes around 20 seconds vs ~10 min to build the runtime on a Raspberry Pi 4.
```
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
+for the target device must be installed. After installing the correct toolchain
+the main difference compared to compiling natively is to pass a bunch of
command
Review comment:
```suggestion
the main difference compared to compiling natively is to pass some
additional command
```
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
Review comment:
```suggestion
devices such as a Raspberry Pi. In-order to cross compile the runtime, the
toolchain
```
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
+for the target device must be installed. After installing the correct toolchain
+the main difference compared to compiling natively is to pass a bunch of
command
+line argument to cmake that specify the compiler(s) to be used. For reference
Review comment:
```suggestion
line argument to cmake that specify a toolchain to be used. For reference,
```
##########
File path: docs/install/from_source.rst
##########
@@ -51,27 +51,31 @@ Build the Shared Library
Our goal is to build the shared libraries:
-- On Linux the target library are `libtvm.so`
-- On macOS the target library are `libtvm.dylib`
-- On Windows the target library are `libtvm.dll`
+ - On Linux the target library are `libtvm.so` and `libtvm_runtime.so`
+ - On macOS the target library are `libtvm.dylib` and `libtvm_runtime.dylib`
+ - On Windows the target library are `libtvm.dll` and `libtvm_runtime.dll`
+It is also possible to :ref:`build the runtime <deploy-and-integration>`
library only.
+
+The minimal building requirements for the ``TVM`` libraries are:
+
+ - A recent c++ compiler supporting C++ 14 (g++-5 or higher)
+ - CMake 3.5 or higher
+ - We highly recommend to build with LLVM to enable all the features.
+ - If you want to use CUDA, CUDA toolkit version >= 8.0 is required. If you
are upgrading from an older version, make sure you purge the older version and
reboot after installation.
+ - On macOS, you may want to install `Homebrew <https://brew.sh>` to easily
install and manage dependencies.
+
+To install the these minimal pre-requisites on Ubuntu/Debian like
+linux operating systems, execute (in a terminal):
.. code:: bash
sudo apt-get update
sudo apt-get install -y python3 python3-dev python3-setuptools gcc
libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
-The minimal building requirements are
-
-- A recent c++ compiler supporting C++ 14 (g++-5 or higher)
-- CMake 3.5 or higher
-- We highly recommend to build with LLVM to enable all the features.
-- If you want to use CUDA, CUDA toolkit version >= 8.0 is required. If you are
upgrading from an older version, make sure you purge the older version and
reboot after installation.
-- On macOS, you may want to install `Homebrew <https://brew.sh>` to easily
install and manage dependencies.
-
We use cmake to build the library.
-The configuration of TVM can be modified by `config.cmake`.
+The configuration of TVM can be modified by `config.cmake` (and/or by passing
cmake flags to the command line):
Review comment:
```suggestion
The configuration of TVM can be modified by `config.cmake` and/or by passing
cmake flags to the command line:
```
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
+hosts that have beefy processors (such as laptops, workstation) instead of
target
+devices such as a raspberry pi. In-order to cross compile the runtime the
toolchain
+for the target device must be installed. After installing the correct toolchain
Review comment:
```suggestion
for the target device must be installed. After installing the correct
toolchain,
```
##########
File path: docs/deploy/index.rst
##########
@@ -46,20 +54,105 @@ on a Linux based embedded system such as Raspberry Pi:
cmake ..
make runtime
-Note that we type `make runtime` to only build the runtime library.
+Note that we type ``make runtime`` to only build the runtime library.
+
+It is also possible to cross compile the runtime. Cross compiling
+the runtime library should not be confused with cross compiling models
+for embedded devices.
+
If you want to include additional runtime such as OpenCL,
-you can modify `config.cmake` to enable these options.
+you can modify ``config.cmake`` to enable these options.
After you get the TVM runtime library, you can link the compiled library
+Cross compile the TVM runtime for other architectures
+-----------------------------------------------------
+
+In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime
library was
+compiled on a raspberry pi. Producing the runtime library can be done much
faster on
Review comment:
```suggestion
compiled on a Raspberry Pi. Producing the runtime library can be done much
faster on
```
--
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]