[PATCH v6 18/34] ml/cnxk: support config and close of tvmdp library
Jerin Jacob
jerinjacobk at gmail.com
Wed Oct 18 20:34:11 CEST 2023
On Wed, Oct 18, 2023 at 7:52 PM Srikanth Yalavarthi
<syalavarthi at marvell.com> wrote:
>
> Added support to configure and close TVMDP library based
> on ML device configuration options.
>
> Updated meson build to enable Jansson, TVM runtime, TVMDP
> library as build dependencies.
>
> Signed-off-by: Srikanth Yalavarthi <syalavarthi at marvell.com>
> ---
>
> +Compilation Prerequisites
> +-------------------------
> +
> +This driver requires external libraries to optionally enable support for
> +models compiled using Apache TVM framework. The following dependencies are
> +not part of DPDK and must be installed separately:
> +
> +- **Jansson**
> +
> + This library enables support to parse and read JSON files.
> +
> +- **DLPack**
> +
> + This library provides headers for open in-memory tensor structures.
> +
> +.. note::
> +
> + DPDK CNXK ML driver requires DLPack version 0.7
> +
> +.. code-block:: console
Please add sections for cross and native.
> + git clone https://github.com/dmlc/dlpack.git
> + cd dlpack
> + git checkout v0.7 -b v0.7
> + cmake -S ./ -B build \
> + -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
> + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
> + -DBUILD_MOCK=OFF
> + make -C build
> + make -C build install
> +
> +- **TVM**
> +
> + Apache TVM provides a runtime library (libtvm_runtime) used to execute
> + models on CPU cores or hardware accelerators.
> +
> +.. note::
> +
> + DPDK CNXK ML driver requires TVM version 0.10.0
> +
> +.. code-block:: console
> +
> + git clone https://github.com/apache/tvm.git
I need to use --recursive to avoid
CMake Error at /usr/share/cmake/Modules/ExternalProject.cmake:3176 (message):
No download info given for 'project_libbacktrace' and its source directory:
> + cd tvm
> + git checkout v0.10.0 -b v0.10.0
> + cmake -S ./ -B build \
> + -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
> + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
> + -DMACHINE_NAME=aarch64-linux-gnu \
> + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
> + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
> + make -C build
> + make -C build install
> +
> +- **TVMDP**
> +
> + Marvell's `TVM Dataplane Library <https://github.com/MarvellEmbeddedProcessors/tvmdp>`_
> + works as an interface between TVM runtime and DPDK drivers. TVMDP library
> + provides a simplified C interface for TVM's runtime based on C++.
> +
> +.. code-block:: console
> +
> + git clone https://github.com/MarvellEmbeddedProcessors/tvmdp.git
> + cd tvmdp
> + git checkout main
> + cmake -S ./ -B build \
> + -DCMAKE_TOOLCHAIN_FILE=config/toolchains/arm64_linux_gcc.cmake \
> + -DBUILD_SHARED_LIBS=ON \
> + -DBUILD_TESTING=OFF
[main]dell[tvmdp] $ cmake -S ./ -B build
-DCMAKE_INSTALL_PREFIX=/export/cross_prefix/prefix
-DCMAKE_TOOLCHAIN_FILE=config/toolchains/arm64_linux_gcc.cmake
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF
-- The CXX compiler identification is GNU 13.2.0
-- The C compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:53 (find_package):
By not providing "Finddmlc.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "dmlc", but
CMake did not find one.
Could not find a package configuration file provided by "dmlc" with any of
the following names:
dmlcConfig.cmake
dmlc-config.cmake
Add the installation prefix of "dmlc" to CMAKE_PREFIX_PATH or set
"dmlc_DIR" to a directory containing one of the above files. If "dmlc"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
> +enable_mvtvm = true
> +
> +if not jansson_dep.found()
> + message('drivers/ml/cnxk: jansson not found')
> + enable_mvtvm = false
> +endif
> +
> +if not cc.check_header('dlpack/dlpack.h')
> + message('drivers/ml/cnxk: dlpack.h not found')
> + enable_mvtvm = false
> +endif
> +
> +tvmrt_lib = cc.find_library('tvm_runtime', required: false)
> +if tvmrt_lib.found()
> + tvmrt_dep = declare_dependency(dependencies: tvmrt_lib)
> +else
> + message('drivers/ml/cnxk: tvm_runtime not found')
> + enable_mvtvm = false
> +endif
> +
> +tvmdp_dep = dependency('tvmdp', required: false)
> +if not tvmdp_dep.found()
> + message('drivers/ml/cnxk: tvmdp not found')
> + enable_mvtvm = false
> +endif
> +
> sources = files(
> 'cn10k_ml_dev.c',
> 'cn10k_ml_ops.c',
> @@ -21,6 +47,39 @@ sources = files(
>
> deps += ['mldev', 'common_cnxk', 'kvargs', 'hash']
>
> +if enable_mvtvm
> +
> +dpdk_conf.set('RTE_MLDEV_CNXK_ENABLE_MVTVM', 1)
> +
> +driver_sdk_headers += files(
> + 'mvtvm_ml_ops.h',
> +)
Remove this
More information about the dev
mailing list