get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/132915/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 132915,
    "url": "http://patches.dpdk.org/api/patches/132915/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231018135423.14111-19-syalavarthi@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231018135423.14111-19-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231018135423.14111-19-syalavarthi@marvell.com",
    "date": "2023-10-18T13:54:03",
    "name": "[v6,18/34] ml/cnxk: support config and close of tvmdp library",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "84e7b21b5c702ec9c3f089c31b32031408ab4756",
    "submitter": {
        "id": 2480,
        "url": "http://patches.dpdk.org/api/people/2480/?format=api",
        "name": "Srikanth Yalavarthi",
        "email": "syalavarthi@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231018135423.14111-19-syalavarthi@marvell.com/mbox/",
    "series": [
        {
            "id": 29909,
            "url": "http://patches.dpdk.org/api/series/29909/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29909",
            "date": "2023-10-18T13:53:45",
            "name": "Implementation of revised ml/cnxk driver",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/29909/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/132915/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/132915/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E21FA4319A;\n\tWed, 18 Oct 2023 15:57:19 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 343E642EA7;\n\tWed, 18 Oct 2023 15:55:01 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 9E64B42DF3\n for <dev@dpdk.org>; Wed, 18 Oct 2023 15:54:39 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 39I7okC4009779 for <dev@dpdk.org>; Wed, 18 Oct 2023 06:54:38 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tt148348f-14\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 18 Oct 2023 06:54:38 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Wed, 18 Oct 2023 06:54:36 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Wed, 18 Oct 2023 06:54:36 -0700",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 8DAEB3F708A;\n Wed, 18 Oct 2023 06:54:35 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=xVw6waUKluFCCmLdBQrP/pAppK6UMtiaAO5ITHqhfIM=;\n b=RbgfMPjBdQpo+/ZxhPZ36YNE3K2Y2/nMxWacJlKgu7S8tIqkBVPcyAeh/dl6f0/CiW5i\n 9RUNAFO3jn44tkvsPzue4+RDOL5XeYp57x8CvGwKGprDtVSVpy4S3JpTxSEhA+eYvl1g\n QhtTQUuBNr3Qf2JrFTbFzyUIYEp+0bQ4vqU4qhz//XHjT0+X6etxue0MRlfTfEAmu5RS\n GgOINZf77mE6INq4K9VR0OyYSUoZ4nSJDbakCwW3jk5SNoy8fmuDb3ihgYh8BTHea1cT\n W58m69cKcCNM7rJWFiwVSjEZioTn1ovuAXYKUqh23JFjnWNyDJ4wTfrNRKxzpjBl4vWw gg==",
        "From": "Srikanth Yalavarthi <syalavarthi@marvell.com>",
        "To": "Srikanth Yalavarthi <syalavarthi@marvell.com>",
        "CC": "<dev@dpdk.org>, <sshankarnara@marvell.com>, <aprabhu@marvell.com>,\n <ptakkar@marvell.com>",
        "Subject": "[PATCH v6 18/34] ml/cnxk: support config and close of tvmdp library",
        "Date": "Wed, 18 Oct 2023 06:54:03 -0700",
        "Message-ID": "<20231018135423.14111-19-syalavarthi@marvell.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20231018135423.14111-1-syalavarthi@marvell.com>",
        "References": "<20230830155927.3566-1-syalavarthi@marvell.com>\n <20231018135423.14111-1-syalavarthi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "Z-AwDeUNDDTmYBu54N97Otewj04uwGTD",
        "X-Proofpoint-ORIG-GUID": "Z-AwDeUNDDTmYBu54N97Otewj04uwGTD",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-10-18_12,2023-10-18_01,2023-05-22_02",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Added support to configure and close TVMDP library based\non ML device configuration options.\n\nUpdated meson build to enable Jansson, TVM runtime, TVMDP\nlibrary as build dependencies.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n doc/guides/mldevs/cnxk.rst       | 78 ++++++++++++++++++++++++++++++++\n drivers/ml/cnxk/cnxk_ml_ops.c    |  7 +++\n drivers/ml/cnxk/cnxk_ml_ops.h    |  6 +++\n drivers/ml/cnxk/meson.build      | 59 ++++++++++++++++++++++++\n drivers/ml/cnxk/mvtvm_ml_ops.c   | 41 +++++++++++++++++\n drivers/ml/cnxk/mvtvm_ml_ops.h   | 19 ++++++++\n drivers/ml/cnxk/mvtvm_ml_stubs.c | 26 +++++++++++\n drivers/ml/cnxk/mvtvm_ml_stubs.h | 15 ++++++\n 8 files changed, 251 insertions(+)\n create mode 100644 drivers/ml/cnxk/mvtvm_ml_ops.c\n create mode 100644 drivers/ml/cnxk/mvtvm_ml_ops.h\n create mode 100644 drivers/ml/cnxk/mvtvm_ml_stubs.c\n create mode 100644 drivers/ml/cnxk/mvtvm_ml_stubs.h",
    "diff": "diff --git a/doc/guides/mldevs/cnxk.rst b/doc/guides/mldevs/cnxk.rst\nindex 1834b1f905..ef2b5d4581 100644\n--- a/doc/guides/mldevs/cnxk.rst\n+++ b/doc/guides/mldevs/cnxk.rst\n@@ -46,6 +46,84 @@ or cross-compiled on an x86 platform.\n \n Refer to :doc:`../platform/cnxk` for instructions to build your DPDK application.\n \n+Compilation Prerequisites\n+-------------------------\n+\n+This driver requires external libraries to optionally enable support for\n+models compiled using Apache TVM framework. The following dependencies are\n+not part of DPDK and must be installed separately:\n+\n+- **Jansson**\n+\n+  This library enables support to parse and read JSON files.\n+\n+- **DLPack**\n+\n+  This library provides headers for open in-memory tensor structures.\n+\n+.. note::\n+\n+    DPDK CNXK ML driver requires DLPack version 0.7\n+\n+.. code-block:: console\n+\n+    git clone https://github.com/dmlc/dlpack.git\n+    cd dlpack\n+    git checkout v0.7 -b v0.7\n+    cmake -S ./ -B build \\\n+      -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \\\n+      -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \\\n+      -DBUILD_MOCK=OFF\n+    make -C build\n+    make -C build install\n+\n+- **TVM**\n+\n+  Apache TVM provides a runtime library (libtvm_runtime) used to execute\n+  models on CPU cores or hardware accelerators.\n+\n+.. note::\n+\n+    DPDK CNXK ML driver requires TVM version 0.10.0\n+\n+.. code-block:: console\n+\n+    git clone https://github.com/apache/tvm.git\n+    cd tvm\n+    git checkout v0.10.0 -b v0.10.0\n+    cmake -S ./ -B build \\\n+      -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \\\n+      -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \\\n+      -DMACHINE_NAME=aarch64-linux-gnu \\\n+      -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \\\n+      -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY\n+    make -C build\n+    make -C build install\n+\n+- **TVMDP**\n+\n+  Marvell's `TVM Dataplane Library <https://github.com/MarvellEmbeddedProcessors/tvmdp>`_\n+  works as an interface between TVM runtime and DPDK drivers. TVMDP library\n+  provides a simplified C interface for TVM's runtime based on C++.\n+\n+.. code-block:: console\n+\n+    git clone https://github.com/MarvellEmbeddedProcessors/tvmdp.git\n+    cd tvmdp\n+    git checkout main\n+    cmake -S ./ -B build \\\n+      -DCMAKE_TOOLCHAIN_FILE=config/toolchains/arm64_linux_gcc.cmake \\\n+      -DBUILD_SHARED_LIBS=ON \\\n+      -DBUILD_TESTING=OFF\n+    make -C build\n+    make -C build install\n+\n+- **libarchive**\n+\n+  Apached TVM framework generates compiled models as tar archives. This\n+  library enables support to decompress and read archive files in tar,\n+  xz and other formats.\n+\n \n Initialization\n --------------\ndiff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c\nindex 8339f8342b..c3639320a5 100644\n--- a/drivers/ml/cnxk/cnxk_ml_ops.c\n+++ b/drivers/ml/cnxk/cnxk_ml_ops.c\n@@ -564,6 +564,10 @@ cnxk_ml_dev_configure(struct rte_ml_dev *dev, const struct rte_ml_dev_config *co\n \t\tgoto error;\n \t}\n \n+\tret = mvtvm_ml_dev_configure(cnxk_mldev, conf);\n+\tif (ret != 0)\n+\t\tgoto error;\n+\n \t/* Set device capabilities */\n \tcnxk_mldev->max_nb_layers =\n \t\tcnxk_mldev->cn10k_mldev.fw.req->cn10k_req.jd.fw_load.cap.s.max_models;\n@@ -624,6 +628,9 @@ cnxk_ml_dev_close(struct rte_ml_dev *dev)\n \t/* Un-initialize xstats */\n \tcnxk_ml_xstats_uninit(cnxk_mldev);\n \n+\tif (mvtvm_ml_dev_close(cnxk_mldev) != 0)\n+\t\tplt_err(\"Failed to close MVTVM ML Device\");\n+\n \tif (cn10k_ml_dev_close(cnxk_mldev) != 0)\n \t\tplt_err(\"Failed to close CN10K ML Device\");\n \ndiff --git a/drivers/ml/cnxk/cnxk_ml_ops.h b/drivers/ml/cnxk/cnxk_ml_ops.h\nindex d0c126f34b..b22a2b0d95 100644\n--- a/drivers/ml/cnxk/cnxk_ml_ops.h\n+++ b/drivers/ml/cnxk/cnxk_ml_ops.h\n@@ -12,6 +12,12 @@\n \n #include \"cn10k_ml_ops.h\"\n \n+#ifdef RTE_MLDEV_CNXK_ENABLE_MVTVM\n+#include \"mvtvm_ml_ops.h\"\n+#else\n+#include \"mvtvm_ml_stubs.h\"\n+#endif\n+\n /* Request structure */\n struct cnxk_ml_req {\n \t/* Device specific request */\ndiff --git a/drivers/ml/cnxk/meson.build b/drivers/ml/cnxk/meson.build\nindex 5d27a87d91..607e1c72e9 100644\n--- a/drivers/ml/cnxk/meson.build\n+++ b/drivers/ml/cnxk/meson.build\n@@ -7,6 +7,32 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')\n     subdir_done()\n endif\n \n+enable_mvtvm = true\n+\n+if not jansson_dep.found()\n+        message('drivers/ml/cnxk: jansson not found')\n+        enable_mvtvm = false\n+endif\n+\n+if not cc.check_header('dlpack/dlpack.h')\n+        message('drivers/ml/cnxk: dlpack.h not found')\n+        enable_mvtvm = false\n+endif\n+\n+tvmrt_lib = cc.find_library('tvm_runtime', required: false)\n+if tvmrt_lib.found()\n+        tvmrt_dep = declare_dependency(dependencies: tvmrt_lib)\n+else\n+        message('drivers/ml/cnxk: tvm_runtime not found')\n+        enable_mvtvm = false\n+endif\n+\n+tvmdp_dep = dependency('tvmdp', required: false)\n+if not tvmdp_dep.found()\n+        message('drivers/ml/cnxk: tvmdp not found')\n+        enable_mvtvm = false\n+endif\n+\n sources = files(\n         'cn10k_ml_dev.c',\n         'cn10k_ml_ops.c',\n@@ -21,6 +47,39 @@ sources = files(\n \n deps += ['mldev', 'common_cnxk', 'kvargs', 'hash']\n \n+if enable_mvtvm\n+\n+dpdk_conf.set('RTE_MLDEV_CNXK_ENABLE_MVTVM', 1)\n+\n+driver_sdk_headers += files(\n+        'mvtvm_ml_ops.h',\n+)\n+\n+sources += files(\n+        'mvtvm_ml_ops.c',\n+)\n+\n+ext_deps += tvmrt_dep\n+ext_deps += tvmdp_dep\n+ext_deps += cc.find_library('stdc++', required: true)\n+ext_deps += jansson_dep\n+\n+deps += ['bus_vdev']\n+\n+message('drivers/ml/cnxk: Enabled TVM model support')\n+else\n+message('drivers/ml/cnxk: Disabled TVM model support')\n+\n+driver_sdk_headers += files(\n+        'mvtvm_ml_stubs.h',\n+)\n+\n+sources += files(\n+        'mvtvm_ml_stubs.c',\n+)\n+\n+endif\n+\n require_iova_in_mbuf = false\n \n if get_option('buildtype').contains('debug')\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c\nnew file mode 100644\nindex 0000000000..88c6d5a864\n--- /dev/null\n+++ b/drivers/ml/cnxk/mvtvm_ml_ops.c\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2023 Marvell.\n+ */\n+\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_mldev.h>\n+#include <rte_mldev_pmd.h>\n+\n+#include \"cnxk_ml_dev.h\"\n+#include \"cnxk_ml_ops.h\"\n+\n+int\n+mvtvm_ml_dev_configure(struct cnxk_ml_dev *cnxk_mldev, const struct rte_ml_dev_config *conf)\n+{\n+\tint ret;\n+\n+\tRTE_SET_USED(conf);\n+\n+\t/* Configure TVMDP library */\n+\tret = tvmdp_configure(cnxk_mldev->mldev->data->nb_models, rte_get_tsc_cycles);\n+\tif (ret != 0)\n+\t\tplt_err(\"TVMDP configuration failed, error = %d\\n\", ret);\n+\n+\treturn ret;\n+}\n+\n+int\n+mvtvm_ml_dev_close(struct cnxk_ml_dev *cnxk_mldev)\n+{\n+\tint ret;\n+\n+\tRTE_SET_USED(cnxk_mldev);\n+\n+\t/* Close TVMDP library configuration */\n+\tret = tvmdp_close();\n+\tif (ret != 0)\n+\t\tplt_err(\"TVMDP close failed, error = %d\\n\", ret);\n+\n+\treturn ret;\n+}\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_ops.h b/drivers/ml/cnxk/mvtvm_ml_ops.h\nnew file mode 100644\nindex 0000000000..305b4681ed\n--- /dev/null\n+++ b/drivers/ml/cnxk/mvtvm_ml_ops.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2023 Marvell.\n+ */\n+\n+#ifndef _MVTVM_ML_OPS_H_\n+#define _MVTVM_ML_OPS_H_\n+\n+#include <dlpack/dlpack.h>\n+\n+#include <tvmdp.h>\n+\n+#include <rte_mldev.h>\n+\n+struct cnxk_ml_dev;\n+\n+int mvtvm_ml_dev_configure(struct cnxk_ml_dev *cnxk_mldev, const struct rte_ml_dev_config *conf);\n+int mvtvm_ml_dev_close(struct cnxk_ml_dev *cnxk_mldev);\n+\n+#endif /* _MVTVM_ML_OPS_H_ */\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_stubs.c b/drivers/ml/cnxk/mvtvm_ml_stubs.c\nnew file mode 100644\nindex 0000000000..a31cd39cfa\n--- /dev/null\n+++ b/drivers/ml/cnxk/mvtvm_ml_stubs.c\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2023 Marvell.\n+ */\n+\n+#include <rte_mldev.h>\n+\n+#include \"mvtvm_ml_stubs.h\"\n+\n+#include \"cnxk_ml_dev.h\"\n+\n+int\n+mvtvm_ml_dev_configure(struct cnxk_ml_dev *cnxk_mldev, const struct rte_ml_dev_config *conf)\n+{\n+\tRTE_SET_USED(cnxk_mldev);\n+\tRTE_SET_USED(conf);\n+\n+\treturn 0;\n+}\n+\n+int\n+mvtvm_ml_dev_close(struct cnxk_ml_dev *cnxk_mldev)\n+{\n+\tRTE_SET_USED(cnxk_mldev);\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_stubs.h b/drivers/ml/cnxk/mvtvm_ml_stubs.h\nnew file mode 100644\nindex 0000000000..11c56e5144\n--- /dev/null\n+++ b/drivers/ml/cnxk/mvtvm_ml_stubs.h\n@@ -0,0 +1,15 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2023 Marvell.\n+ */\n+\n+#ifndef _MVTVM_ML_STUBS_H_\n+#define _MVTVM_ML_STUBS_H_\n+\n+#include <rte_mldev.h>\n+\n+struct cnxk_ml_dev;\n+\n+int mvtvm_ml_dev_configure(struct cnxk_ml_dev *cnxk_mldev, const struct rte_ml_dev_config *conf);\n+int mvtvm_ml_dev_close(struct cnxk_ml_dev *cnxk_mldev);\n+\n+#endif /* _MVTVM_ML_STUBS_H_ */\n",
    "prefixes": [
        "v6",
        "18/34"
    ]
}