get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 114584,
    "url": "https://patches.dpdk.org/api/patches/114584/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220803132839.2747858-2-jerinj@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20220803132839.2747858-2-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220803132839.2747858-2-jerinj@marvell.com",
    "date": "2022-08-03T13:28:38",
    "name": "[RFC,1/1] mldev: introduce machine learning device library",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3d470871372736ad01f72456c731ecb77bec90b5",
    "submitter": {
        "id": 1188,
        "url": "https://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220803132839.2747858-2-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 24190,
            "url": "https://patches.dpdk.org/api/series/24190/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24190",
            "date": "2022-08-03T13:28:37",
            "name": "mldev: introduce machine learning device library",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/24190/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/114584/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/114584/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 14996A00C5;\n\tWed,  3 Aug 2022 15:34:25 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 02D9442B9D;\n\tWed,  3 Aug 2022 15:34:25 +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 E5E7D42B92\n for <dev@dpdk.org>; Wed,  3 Aug 2022 15:34:23 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id\n 2738xXdP012693;\n Wed, 3 Aug 2022 06:31:50 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3hqp04h0vy-2\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 03 Aug 2022 06:31:49 -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.18;\n Wed, 3 Aug 2022 06:31:47 -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.18 via Frontend\n Transport; Wed, 3 Aug 2022 06:31:47 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id BD5625B6924;\n Wed,  3 Aug 2022 06:31:23 -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=9cvX2cIci7nretLbQvkThO6E9yWhcFejyFA4XrahUVo=;\n b=R0Is9y/CCV/G01TLiFrivLF2ffIxtBlqR+aj6Y7mfkqUJosDC6MuTZgdSOjO2Lmhs2t9\n Lz+7WGWgquRno9B6ZZRCeUj0Q6bcLNr9awEsXNrOyuNtz4XFlhwANNZAV/R4Nd4gFNGf\n AQphX3tzGLrZC03OvMlx7eqpd3H3Ghbit2Z5Kl9Bjn2rh4iyW+PL9UWPMbVFSkvG99l1\n SxegDETphMpF15E4WV87KbqsQLPxmij6pWnwuqQXoXeWH9Fzejpcrjpa2gxGb4g/vXSr\n tTEG229L3svdKQnFXVr1YUc0vhy1pR6WVf5vjPHg3hE0JsBYdSj/rcibgFOeyKfUnb2v 4Q==",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>, \"Ray\n Kinsella\" <mdr@ashroe.eu>",
        "CC": "<thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,\n <ajit.khaparde@broadcom.com>, <aboyer@pensando.io>,\n <andrew.rybchenko@oktetlabs.ru>, <beilei.xing@intel.com>,\n <chas3@att.com>, <chenbo.xia@intel.com>, <ciara.loftus@intel.com>,\n <dsinghrawat@marvell.com>, <ed.czeck@atomicrules.com>,\n <evgenys@amazon.com>, <grive@u256.net>, <g.singh@nxp.com>,\n <zhouguoyang@huawei.com>, <haiyue.wang@intel.com>,\n <hkalra@marvell.com>, <heinrich.kuhn@corigine.com>,\n <hemant.agrawal@nxp.com>, <hyonkim@cisco.com>, <igorch@amazon.com>,\n <irusskikh@marvell.com>, <jgrajcia@cisco.com>,\n <jasvinder.singh@intel.com>, <jianwang@trustnetic.com>,\n <jiawenwu@trustnetic.com>, <jingjing.wu@intel.com>,\n <johndale@cisco.com>, <john.miller@atomicrules.com>,\n <linville@tuxdriver.com>, <keith.wiles@intel.com>,\n <kirankumark@marvell.com>, <oulijun@huawei.com>, <lironh@marvell.com>,\n <longli@microsoft.com>, <mw@semihalf.com>, <spinler@cesnet.cz>,\n <matan@nvidia.com>, <matt.peters@windriver.com>,\n <maxime.coquelin@redhat.com>, <mk@semihalf.com>, <humin29@huawei.com>,\n <pnalla@marvell.com>, <ndabilpuram@marvell.com>,\n <qiming.yang@intel.com>, <qi.z.zhang@intel.com>, <radhac@marvell.com>,\n <rahul.lakkireddy@chelsio.com>, <rmody@marvell.com>,\n <rosen.xu@intel.com>, <sachin.saxena@oss.nxp.com>,\n <skoteshwar@marvell.com>, <shshaikh@marvell.com>,\n <shaibran@amazon.com>, <shepard.siegel@atomicrules.com>,\n <asomalap@amd.com>, <somnath.kotur@broadcom.com>,\n <sthemmin@microsoft.com>, <steven.webster@windriver.com>,\n <skori@marvell.com>, <mtetsuyah@gmail.com>, <vburru@marvell.com>,\n <viacheslavo@nvidia.com>, <xiao.w.wang@intel.com>,\n <cloud.wangxiaoyun@huawei.com>, <yisen.zhuang@huawei.com>,\n <yongwang@vmware.com>, <xuanziyang2@huawei.com>, <pkapoor@marvell.com>,\n <nadavh@marvell.com>, <sburla@marvell.com>, <pathreya@marvell.com>,\n <gakhil@marvell.com>, <dmitry.kozliuk@gmail.com>,\n <anatoly.burakov@intel.com>, <cristian.dumitrescu@intel.com>,\n <honnappa.nagarahalli@arm.com>, <mattias.ronnblom@ericsson.com>,\n <ruifeng.wang@arm.com>, <drc@linux.vnet.ibm.com>,\n <konstantin.ananyev@intel.com>, <olivier.matz@6wind.com>,\n <jay.jayatheerthan@intel.com>, <asekhar@marvell.com>,\n <pbhagavatula@marvell.com>, <eagostini@nvidia.com>,\n <syalavarthi@marvell.com>, <dchickles@marvell.com>,\n <sshankarnara@marvell.com>, Jerin Jacob <jerinj@marvell.com>",
        "Subject": "[dpdk-dev] [RFC PATCH 1/1] mldev: introduce machine learning device\n library",
        "Date": "Wed, 3 Aug 2022 18:58:38 +0530",
        "Message-ID": "<20220803132839.2747858-2-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.37.1",
        "In-Reply-To": "<20220803132839.2747858-1-jerinj@marvell.com>",
        "References": "<20220803132839.2747858-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "WTBYYLJq8WUO_kM7B44JyLdb85yirPRZ",
        "X-Proofpoint-ORIG-GUID": "WTBYYLJq8WUO_kM7B44JyLdb85yirPRZ",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1\n definitions=2022-08-03_03,2022-08-02_01,2022-06-22_01",
        "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": "From: Jerin Jacob <jerinj@marvell.com>\n\nAdd mldev API specification to standardize and use the machine learning\ndevice and inference operations in vendor neutral way.\n\nFollowing operations are abstracted through APIs\n\n- ML device capability probe\n- ML device configuration\n- ML device queue pair configuration\n- ML device state management\n- ML device stat/xstat operations\n- ML model load/unload/start/stop operations\n- ML model information probe\n- ML IO operations to find size for input and output buffers\n- ML quantize and dequantize operations\n- ML ops pool creation and free operations\n- ML device enqueue/dequeue fastpath interference operations\n\nSigned-off-by: Jerin Jacob <jerinj@marvell.com>\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n config/rte_config.h             |    3 +\n doc/api/doxy-api-index.md       |    1 +\n doc/api/doxy-api.conf.in        |    1 +\n doc/guides/prog_guide/index.rst |    1 +\n doc/guides/prog_guide/mldev.rst |  164 +++++\n lib/eal/common/eal_common_log.c |    1 +\n lib/eal/include/rte_log.h       |    1 +\n lib/meson.build                 |    1 +\n lib/mldev/meson.build           |   12 +\n lib/mldev/rte_mldev.c           |    5 +\n lib/mldev/rte_mldev.h           | 1081 +++++++++++++++++++++++++++++++\n lib/mldev/version.map           |    5 +\n 12 files changed, 1276 insertions(+)\n create mode 100644 doc/guides/prog_guide/mldev.rst\n create mode 100644 lib/mldev/meson.build\n create mode 100644 lib/mldev/rte_mldev.c\n create mode 100644 lib/mldev/rte_mldev.h\n create mode 100644 lib/mldev/version.map",
    "diff": "diff --git a/config/rte_config.h b/config/rte_config.h\nindex 46549cb062..2adbef3f51 100644\n--- a/config/rte_config.h\n+++ b/config/rte_config.h\n@@ -81,6 +81,9 @@\n /* rawdev defines */\n #define RTE_RAWDEV_MAX_DEVS 64\n \n+/* mldev defines */\n+#define RTE_MLDEV_MAX_DEVS 64\n+\n /* ip_fragmentation defines */\n #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 8\n // RTE_LIBRTE_IP_FRAG_TBL_STAT is not set\ndiff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md\nindex 186a258be4..d55cca5b97 100644\n--- a/doc/api/doxy-api-index.md\n+++ b/doc/api/doxy-api-index.md\n@@ -22,6 +22,7 @@ The public API headers are grouped by topics:\n   [compress](@ref rte_comp.h),\n   [regexdev](@ref rte_regexdev.h),\n   [dmadev](@ref rte_dmadev.h),\n+  [mldev](@ref rte_mldev.h),\n   [eventdev](@ref rte_eventdev.h),\n   [event_eth_rx_adapter](@ref rte_event_eth_rx_adapter.h),\n   [event_eth_tx_adapter](@ref rte_event_eth_tx_adapter.h),\ndiff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in\nindex 608494a7c0..82b28e8b18 100644\n--- a/doc/api/doxy-api.conf.in\n+++ b/doc/api/doxy-api.conf.in\n@@ -59,6 +59,7 @@ INPUT                   = @TOPDIR@/doc/api/doxy-api-index.md \\\n                           @TOPDIR@/lib/mempool \\\n                           @TOPDIR@/lib/meter \\\n                           @TOPDIR@/lib/metrics \\\n+                          @TOPDIR@/lib/mldev \\\n                           @TOPDIR@/lib/node \\\n                           @TOPDIR@/lib/net \\\n                           @TOPDIR@/lib/pcapng \\\ndiff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst\nindex 8564883018..d7f2a28bdb 100644\n--- a/doc/guides/prog_guide/index.rst\n+++ b/doc/guides/prog_guide/index.rst\n@@ -30,6 +30,7 @@ Programmer's Guide\n     regexdev\n     dmadev\n     gpudev\n+    mldev\n     rte_security\n     rawdev\n     link_bonding_poll_mode_drv_lib\ndiff --git a/doc/guides/prog_guide/mldev.rst b/doc/guides/prog_guide/mldev.rst\nnew file mode 100644\nindex 0000000000..2ce8e2f7fe\n--- /dev/null\n+++ b/doc/guides/prog_guide/mldev.rst\n@@ -0,0 +1,164 @@\n+..  SPDX-License-Identifier: BSD-3-Clause\n+    Copyright(C) 2022 Marvell International Ltd.\n+\n+Machine Learning Device Library\n+===============================\n+\n+The MLDEV library provides a Machine Learning device framework for the management and\n+provisioning of hardware and software ML poll mode drivers, defining APIs which\n+support a number of ML operations including device handling and inference processing.\n+The ML model creation and training is outside of the scope of this library.\n+\n+Design Principles\n+-----------------\n+\n+The MLDEV library follows the same basic principles as those used in DPDK's\n+Ethernet Device framework and the Crypto framework. The MLDEV framework provides\n+a generic Machine Learning device framework which supports both physical (hardware)\n+and virtual (software) ML devices as well as an ML API to manage and configure ML\n+devices. The APIs also supports performing ML inference operations through ML poll\n+mode driver.\n+\n+\n+Device Operations\n+-----------------\n+\n+Device Creation\n+~~~~~~~~~~~~~~~\n+\n+Physical ML devices are discovered during the PCI probe/enumeration, through the\n+EAL functions which are executed at DPDK initialization, based on their PCI device\n+identifier, each unique PCI BDF (bus/bridge, device, function). ML physical devices,\n+like other physical devices in DPDK can be white-listed or black-listed\n+using the EAL command line options.\n+\n+\n+Device Identification\n+~~~~~~~~~~~~~~~~~~~~~\n+\n+Each device, whether virtual or physical is uniquely designated by two\n+identifiers:\n+\n+- A unique device index used to designate the ML device in all functions\n+  exported by the MLDEV API.\n+\n+- A device name used to designate the ML device in console messages, for\n+  administration or debugging purposes.\n+\n+Device Features and Capabilities\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+ML devices may support different feature set. In order to get the\n+supported PMD feature ``rte_ml_dev_info_get`` API which return the\n+info of the device and it's supported features.\n+\n+Device Configuration\n+~~~~~~~~~~~~~~~~~~~~\n+\n+The configuration of each ML device includes the following operations:\n+\n+- Allocation of resources, including hardware resources if a physical device.\n+- Resetting the device into a well-known default state.\n+- Initialization of statistics counters.\n+\n+The rte_ml_dev_configure API is used to configure a ML device.\n+\n+.. code-block:: c\n+\n+   int rte_ml_dev_configure(uint8_t dev_id, const struct rte_ml_dev_config *cfg);\n+\n+The ``rte_ml_dev_config`` structure is used to pass the configuration parameters\n+for the ML device, for example  number of queue pairs, maximum number of models,\n+maximum size of model and so on.\n+\n+Configuration of Queue Pairs\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Each ML device can be configured with number of queue pairs.\n+Each queue pair is configured using ``rte_ml_dev_queue_pair_setup``\n+\n+Logical Cores, Memory and Queues Pair Relationships\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Multiple logical cores should never share the same queue pair for enqueuing\n+operations or dequeueing operations on the same ML device since this would\n+require global locks and hinder performance.\n+\n+Configuration of Machine Learning models\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Pre-trained ML models that are built using external ML compiler / training frameworks\n+are used to perform inference operations. These models are configured on an ML device\n+in a two-stage process that includes loading the model on an ML device, and starting\n+the model to accept inference operations. Inference operations can be queued for a\n+model only when the model is in started state. Model load stage assigns a Model ID,\n+which is unique for the model in a driver's context. Model ID is used during all\n+subsequent slow-path and fast-path operations.\n+\n+Model loading and start is done through the ``rte_ml_model_load`` and\n+``rte_ml_model_start`` functions.\n+\n+Similarly stop and unloading are done through ``rte_ml_model_stop`` and\n+``rte_ml_model_unload`` functions.\n+\n+Stop and unload functions would release the resources allocated for the\n+models. Inference tasks cannot be queued for a model that is stopped.\n+\n+Detailed information related to the model can be retrieved from the driver using the\n+function ``rte_ml_model_info_get``. Model information is accessible to the application\n+through the ``rte_ml_model_info`` structure. Information available to the user would\n+include the details related to the inputs and outputs, and the maximum batch size\n+supported by the model.\n+\n+User can optionally update the model params such as weights and bias, without unloading\n+the model, through the ``rte_ml_model_params_update`` function. A model should be in\n+stopped state to update the params. Model has to be started in order to enqueue inference\n+requests after a params update.\n+\n+Enqueue / Dequeue\n+~~~~~~~~~~~~~~~~~\n+\n+The burst enqueue API uses a ML device identifier and a queue pair identifier\n+to specify the device queue pair to schedule the processing on. The ``nb_ops``\n+parameter is the number of operations to process which are supplied in the\n+``ops`` array of ``rte_ml_op`` structures. The enqueue function returns the\n+number of operations it enqueued for processing, a return value equal to\n+``nb_ops`` means that all packets have been enqueued.\n+\n+The dequeue API uses the same format as the enqueue API of processed but\n+the ``nb_ops`` and ``ops`` parameters are now used to specify the max processed\n+operations the user wishes to retrieve and the location in which to store them.\n+The API call returns the actual number of processed operations returned; this\n+can never be larger than ``nb_ops``.\n+\n+``rte_ml_op`` provides the required information to the driver to queue an ML inference\n+task. ML op specifies the model to be used and the number of batches to be executed in\n+the inference task. Input and output buffer information is specified through the\n+structure ``rte_ml_buff_seg``, which supports segmented data. Input is provided through\n+the ``rte_ml_op::input`` and output through ``rte_ml_op::output``. Data pointed in each\n+op, should not be released until the dequeue of for that op.\n+\n+\n+Quantize and Dequantize\n+~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Inference operations performed with lower precision types would improve the throughput\n+and efficiency of the inference execution with a minimal loss of accuracy, which is within\n+the tolerance limits. Quantization and dequantization is the process of converting data\n+from a higher precision type to a lower precision type and vice-versa. ML library provides\n+the functions ``rte_ml_io_quantize`` and ``rte_ml_io_dequantize`` to enable data type\n+conversions. User needs to provide the address of the quantized and dequantized data\n+buffers to the functions, along the number of the batches in the buffers.\n+\n+For quantization, the dequantized data is assumed to be of the type ``dtype`` provided by\n+the ``rte_ml_model_info::input`` and the data is converted to ``qtype`` provided by the\n+``rte_ml_model_info::input``.\n+\n+For dequantization, the quantized data is assumed to be of the type ``qtype`` provided by\n+the ``rte_ml_model_info::output`` and the data is converted to ``dtype`` provided by the\n+``rte_ml_model_info::output``.\n+\n+Size of the buffers required for the input and output can be calculated using the functions\n+``rte_ml_io_input_size_get`` and ``rte_ml_io_output_size_get``. These functions would get the\n+buffer sizes for both quantized and dequantized data for the given number of batches.\n+\ndiff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c\nindex bd7b188ceb..5cb1b15dbe 100644\n--- a/lib/eal/common/eal_common_log.c\n+++ b/lib/eal/common/eal_common_log.c\n@@ -369,6 +369,7 @@ static const struct logtype logtype_strings[] = {\n \t{RTE_LOGTYPE_EFD,        \"lib.efd\"},\n \t{RTE_LOGTYPE_EVENTDEV,   \"lib.eventdev\"},\n \t{RTE_LOGTYPE_GSO,        \"lib.gso\"},\n+\t{RTE_LOGTYPE_MLDEV,      \"lib.mldev\"},\n \t{RTE_LOGTYPE_USER1,      \"user1\"},\n \t{RTE_LOGTYPE_USER2,      \"user2\"},\n \t{RTE_LOGTYPE_USER3,      \"user3\"},\ndiff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h\nindex 25ce42cdfc..226be9c778 100644\n--- a/lib/eal/include/rte_log.h\n+++ b/lib/eal/include/rte_log.h\n@@ -48,6 +48,7 @@ extern \"C\" {\n #define RTE_LOGTYPE_EFD       18 /**< Log related to EFD. */\n #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */\n #define RTE_LOGTYPE_GSO       20 /**< Log related to GSO. */\n+#define RTE_LOGTYPE_MLDEV     21 /**< Log related to mldev. */\n \n /* these log types can be used in an application */\n #define RTE_LOGTYPE_USER1     24 /**< User-defined log type 1. */\ndiff --git a/lib/meson.build b/lib/meson.build\nindex c648f7d800..32c45f55ce 100644\n--- a/lib/meson.build\n+++ b/lib/meson.build\n@@ -63,6 +63,7 @@ libraries = [\n         'flow_classify', # flow_classify lib depends on pkt framework table lib\n         'graph',\n         'node',\n+        'mldev'\n ]\n \n optional_libs = [\ndiff --git a/lib/mldev/meson.build b/lib/mldev/meson.build\nnew file mode 100644\nindex 0000000000..e1e0ffe975\n--- /dev/null\n+++ b/lib/mldev/meson.build\n@@ -0,0 +1,12 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2022 Marvell.\n+\n+sources = files(\n+        'rte_mldev.c',\n+)\n+\n+headers = files(\n+        'rte_mldev.h',\n+)\n+\n+deps += ['mempool']\ndiff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c\nnew file mode 100644\nindex 0000000000..c6644e6c12\n--- /dev/null\n+++ b/lib/mldev/rte_mldev.c\n@@ -0,0 +1,5 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 Marvell.\n+ */\n+\n+#include <rte_mldev.h>\ndiff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h\nnew file mode 100644\nindex 0000000000..f55cc8ffb3\n--- /dev/null\n+++ b/lib/mldev/rte_mldev.h\n@@ -0,0 +1,1081 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2022 Marvell.\n+ */\n+\n+#ifndef RTE_MLDEV_H\n+#define RTE_MLDEV_H\n+\n+/**\n+ * @file rte_mldev.h\n+ *\n+ * @warning\n+ * @b EXPERIMENTAL:\n+ * All functions in this file may be changed or removed without prior notice.\n+ *\n+ * ML (Machine Learning) device API.\n+ *\n+ * The ML framework is built on the following model:\n+ *\n+ *\n+ *     +-----------------+               rte_ml_[en|de]queue_burst()\n+ *     |                 |                          |\n+ *     |     Machine     o------+     +--------+    |\n+ *     |     Learning    |      |     | queue  |    |    +------+\n+ *     |     Inference   o------+-----o        |<===o===>|Core 0|\n+ *     |     Engine      |      |     | pair 0 |         +------+\n+ *     |                 o----+ |     +--------+\n+ *     |                 |    | |\n+ *     +-----------------+    | |     +--------+\n+ *              ^             | |     | queue  |         +------+\n+ *              |             | +-----o        |<=======>|Core 1|\n+ *              |             |       | pair 1 |         +------+\n+ *              |             |       +--------+\n+ *     +--------+--------+    |\n+ *     | +-------------+ |    |       +--------+\n+ *     | |   Model 0   | |    |       | queue  |         +------+\n+ *     | +-------------+ |    +-------o        |<=======>|Core N|\n+ *     | +-------------+ |            | pair N |         +------+\n+ *     | |   Model 1   | |            +--------+\n+ *     | +-------------+ |\n+ *     | +-------------+ |<------- rte_ml_model_load()\n+ *     | |   Model ..  | |-------> rte_ml_model_info()\n+ *     | +-------------+ |<------- rte_ml_model_start()\n+ *     | +-------------+ |<------- rte_ml_model_stop()\n+ *     | |   Model N   | |<------- rte_ml_model_params_update()\n+ *     | +-------------+ |<------- rte_ml_model_unload()\n+ *     +-----------------+\n+ *\n+ * ML Device: A hardware or software-based implementation of ML device API for\n+ * running inferences using a pre-trained ML model.\n+ *\n+ * ML Model: An ML model is an algorithm trained over a dataset. A model consists of\n+ * procedure/algorithm and data/pattern required to make predictions on live data.\n+ * Once the model is created and trained outside of the DPDK scope, the model can be loaded\n+ * via rte_ml_model_load() and then start it using rte_ml_model_start() API.\n+ * The rte_ml_model_params_update() can be used to update the model parameters such as weight\n+ * and bias without unloading the model using rte_ml_model_unload().\n+ *\n+ * ML Inference: ML inference is the process of feeding data to the model via\n+ * rte_ml_enqueue_burst() API and use rte_ml_dequeue_burst() API to get the calculated\n+ * outputs/predictions from the started model.\n+ *\n+ * In all functions of the ML device API, the ML device is designated by an\n+ * integer >= 0 named as device identifier *dev_id*.\n+ *\n+ * The functions exported by the ML device API to setup a device designated by\n+ * its device identifier must be invoked in the following order:\n+ *\n+ *      - rte_ml_dev_configure()\n+ *      - rte_ml_dev_queue_pair_setup()\n+ *      - rte_ml_dev_start()\n+ *\n+ * A model is required to run the inference operations with the user specified inputs.\n+ * Application needs to invoke the ML model API in the following order before queueing\n+ * inference jobs.\n+ *\n+ *      - rte_ml_model_load()\n+ *      - rte_ml_model_start()\n+ *\n+ * The rte_ml_model_info() API is provided to retrieve the information related to the model.\n+ * The information would include the shape and type of input and output required for the inference.\n+ *\n+ * Data quantization and dequantization is one of the main aspects in ML domain. This involves\n+ * conversion of input data from a higher precision to a lower precision data type and vice-versa\n+ * for the output. APIs are provided to enable quantization through rte_ml_io_quantize() and\n+ * dequantization through rte_ml_io_dequantize(). These APIs have the capability to handle input\n+ * and output buffers holding data for multiple batches.\n+ *\n+ * Two utility APIs rte_ml_io_input_size_get() and rte_ml_io_output_size_get() can used to get the\n+ * size of quantized and de-quantized multi-batch input and output buffers.\n+ *\n+ * User can optionally update the model parameters with rte_ml_model_params_update() after\n+ * invoking rte_ml_model_stop() API on a given model ID.\n+ *\n+ * The application can invoke, in any order, the functions exported by the ML API to enqueue\n+ * inference jobs and dequeue inference response.\n+ *\n+ * If the application wants to change the device configuration (i.e., call\n+ * rte_ml_dev_configure() or rte_ml_dev_queue_pair_setup()), then application must stop the\n+ * device using rte_ml_dev_stop() API. Likewise, if model parameters need to be updated then\n+ * the application must call rte_ml_model_stop() followed by rte_ml_model_params_update() API\n+ * for the given model. The application does not need to call rte_ml_dev_stop() API for\n+ * any model re-configuration such as rte_ml_model_params_update(), rte_ml_model_unload() etc.\n+ *\n+ * Once the device is in the start state after invoking rte_ml_dev_start() API and the model is in\n+ * start state after invoking rte_ml_model_start() API, then the application can call\n+ * rte_ml_enqueue() and rte_ml_dequeue() API on the destined device and model ID.\n+ *\n+ * Finally, an application can close an ML device by invoking the rte_ml_dev_close() function.\n+ *\n+ * Typical application utilisation of the ML API will follow the following\n+ * programming flow.\n+ *\n+ * - rte_ml_dev_configure()\n+ * - rte_ml_dev_queue_pair_setup()\n+ * - rte_ml_model_load()\n+ * - rte_ml_model_start()\n+ * - rte_ml_model_info()\n+ * - rte_ml_dev_start()\n+ * - rte_ml_enqueue_burst()\n+ * - rte_ml_dequeue_burst()\n+ * - rte_ml_model_stop()\n+ * - rte_ml_model_unload()\n+ * - rte_ml_dev_stop()\n+ * - rte_ml_dev_close()\n+ *\n+ * Regarding multi-threading, by default, all the functions of the ML Device API exported by a PMD\n+ * are lock-free functions which assume to not be invoked in parallel on different logical cores\n+ * on the same target object. For instance, the dequeue function of a poll mode driver cannot be\n+ * invoked in parallel on two logical cores to operate on same queue pair. Of course, this function\n+ * can be invoked in parallel by different logical core on different queue pair.\n+ * It is the responsibility of the user application to enforce this rule.\n+ */\n+\n+#include <rte_common.h>\n+#include <rte_mempool.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#define RTE_ML_STR_MAX 128\n+/**< Maximum length of name string */\n+\n+/* Device operations */\n+\n+/**\n+ * Get the total number of ML devices that have been successfully initialised.\n+ *\n+ * @return\n+ *   - The total number of usable ML devices.\n+ */\n+__rte_experimental\n+uint16_t\n+rte_ml_dev_count(void);\n+\n+/**\n+ * Check if the device is in ready state.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0 if device state is not in ready state.\n+ *   - 1 if device state is ready state.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_is_valid_dev(int16_t dev_id);\n+\n+/**\n+ * Return the NUMA socket to which a device is connected.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - The NUMA socket id to which the device is connected\n+ *   - 0 If the socket could not be determined.\n+ *   - -EINVAL: if the dev_id value is not valid.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_socket_id(int16_t dev_id);\n+\n+/**  ML device information */\n+struct rte_ml_dev_info {\n+\tconst char *driver_name;\n+\t/**< Driver name */\n+\tint16_t max_models;\n+\t/**< Maximum number of models supported by the device.\n+\t * @see struct rte_ml_dev_config::max_nb_models\n+\t */\n+\tuint16_t max_queue_pairs;\n+\t/**< Maximum number of queues pairs supported by the device.\n+\t * @see struct rte_ml_dev_config::nb_queue_pairs\n+\t */\n+\tuint16_t max_desc;\n+\t/**< Maximum allowed number of descriptors for queue pair by the device.\n+\t * @see struct rte_ml_dev_qp_conf::nb_desc\n+\t */\n+\tuint16_t max_segments;\n+\t/**< Maximum number of scatter-gather entry supported by the device.\n+\t * @see struct rte_ml_buff_seg  struct rte_ml_buff_seg::next\n+\t */\n+};\n+\n+/**\n+ * Retrieve the information of the device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param dev_info\n+ *   A pointer to a structure of type *rte_ml_dev_info* to be filled with the info of the device.\n+ *\n+ * @return\n+ *   - 0: Success, driver updates the information of the ML device\n+ *   - < 0: Error code returned by the driver info get function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_info_get(int16_t dev_id, struct rte_ml_dev_info *dev_info);\n+\n+/** ML device configuration structure */\n+struct rte_ml_dev_config {\n+\tint socket_id;\n+\t/**< Socket to allocate resources on. */\n+\tint16_t max_nb_models;\n+\t/**< Max number of models allowed to be loaded on the device.\n+\t * This value cannot exceed the max_models which is previously provided in\n+\t * struct rte_ml_dev_info::max_models\n+\t */\n+\tuint16_t nb_queue_pairs;\n+\t/**< Number of queue pairs to configure on this device.\n+\t * This value cannot exceed the max_models which is previously provided in\n+\t * struct rte_ml_dev_info::max_queue_pairs\n+\t */\n+};\n+\n+/**\n+ * Configure an ML device.\n+ *\n+ * This function must be invoked first before any other function in the API.\n+ * This function can also be re-invoked when a device is in the stopped state.\n+ *\n+ * The caller may use rte_ml_dev_info_get() to get the capability of each resources available\n+ * for this ML device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device to configure.\n+ * @param config\n+ *   The ML device configuration structure.\n+ *\n+ * @return\n+ *   - 0: Success, device configured.\n+ *   - < 0: Error code returned by the driver configuration function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_configure(int16_t dev_id, const struct rte_ml_dev_config *config);\n+\n+/* Forward declaration */\n+struct rte_ml_op;\n+\n+/**< Callback function called during rte_ml_dev_stop(), invoked once per flushed ML op */\n+typedef void (*rte_ml_dev_stop_flush_t)(int16_t dev_id, uint16_t qp_id, struct rte_ml_op *op);\n+\n+/** ML device queue pair configuration structure. */\n+struct rte_ml_dev_qp_conf {\n+\tuint32_t nb_desc;\n+\t/**< Number of descriptors per queue pair.\n+\t * This value cannot exceed the max_desc which previously provided in\n+\t * struct rte_ml_dev_info:max_models\n+\t */\n+\trte_ml_dev_stop_flush_t cb;\n+\t/**< Callback function called during rte_ml_dev_stop(), invoked once per active ML op.\n+\t * Value NULL is allowed, in which case callback will not be invoked.\n+\t * This function can be used to properly dispose of outstanding ML ops from all\n+\t * queue pairs, for example ops containing  memory pointers.\n+\t * @see rte_ml_dev_stop()\n+\t */\n+};\n+\n+/**\n+ * Set up a queue pair for a device. This should only be called when the device is stopped.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param queue_pair_id\n+ *   The index of the queue pairs to set up. The value must be in the range [0, nb_queue_pairs - 1]\n+ * previously supplied to rte_ml_dev_configure().\n+ * @param qp_conf\n+ *   The pointer to the configuration data to be used for the queue pair.\n+ * @param socket_id\n+ *   The *socket_id* argument is the socket identifier in case of NUMA.\n+ * The value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the memory allocated\n+ * for the queue pair.\n+ *\n+ * @return\n+ *   - 0: Success, queue pair correctly set up.\n+ *   - < 0: Queue pair configuration failed.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_queue_pair_setup(int16_t dev_id, uint16_t queue_pair_id,\n+\t\t\t    const struct rte_ml_dev_qp_conf *qp_conf, int socket_id);\n+\n+/**\n+ * Start an ML device.\n+ *\n+ * The device start step consists of setting the configured features and enabling the ML device\n+ * to accept inference jobs.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: Success, device started.\n+ *   - <0: Error code of the driver device start function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_start(int16_t dev_id);\n+\n+/**\n+ * Stop an ML device. A stopped device cannot accept inference jobs.\n+ * The device can be restarted with a call to rte_ml_dev_start().\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *   - 0: Success, device stopped.\n+ *   - <0: Error code of the driver device stop function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_stop(int16_t dev_id);\n+\n+/**\n+ * Close an ML device. The device cannot be restarted!\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ *\n+ * @return\n+ *  - 0 on successfully closing device.\n+ *  - <0 on failure to close device.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_close(int16_t dev_id);\n+\n+/** Status of ML operation */\n+enum rte_ml_op_status {\n+\tRTE_ML_OP_STATUS_SUCCESS = 0,\n+\t/**< Operation completed successfully */\n+\tRTE_ML_OP_STATUS_NOT_PROCESSED,\n+\t/**< Operation has not yet been processed by the device.\n+\t * When an ML op is enqueued to the device, the driver sets the status as\n+\t * RTE_ML_OP_STATUS_NOT_PROCESSED. Upon the ML operation completion,\n+\t * the respective status will be updated by the driver.\n+\t */\n+\tRTE_ML_OP_STATUS_ERROR,\n+\t/**< Operation completed with error.\n+\t * Application can invoke rte_ml_op_error_get() to get PMD specific\n+\t * error code if needed.\n+\t */\n+};\n+\n+/** ML operation's input and output buffer representation as scatter gather list\n+ */\n+struct rte_ml_buff_seg {\n+\trte_iova_t iova_addr;\n+\t/**< IOVA address of segment buffer. */\n+\tvoid *addr;\n+\t/**< Virtual address of segment buffer. */\n+\tuint32_t length;\n+\t/**< Segment length. */\n+\tuint32_t reserved;\n+\t/**< Reserved for future use. */\n+\tstruct rte_ml_buff_seg *next;\n+\t/**< Points to next segment. Value NULL represents the last segment. */\n+};\n+\n+/**\n+ * ML Operation.\n+ *\n+ * This structure contains data related to performing an ML operation on the buffers using\n+ * the model specified through model_id.\n+ */\n+struct rte_ml_op {\n+\tint16_t model_id;\n+\t/**< Model ID to be used for the operation. */\n+\tuint16_t nb_batches;\n+\t/**< Number of batches. Minimum value must be one.\n+\t * Input buffer must hold inference data for each batch as contiguous.\n+\t */\n+\tuint32_t reserved;\n+\t/**< Reserved for future use. */\n+\tstruct rte_mempool *mempool;\n+\t/**< Pool from which operation is allocated. */\n+\tstruct rte_ml_buff_seg input;\n+\t/**< Input buffer to hold the inference data. */\n+\tstruct rte_ml_buff_seg output;\n+\t/**< Output buffer to hold the inference output by the driver. */\n+\tRTE_STD_C11\n+\tunion {\n+\t\tuint64_t user_u64;\n+\t\t/**< User data as uint64_t.*/\n+\t\tvoid *user_ptr;\n+\t\t/**< User data as void*.*/\n+\t};\n+\tenum rte_ml_op_status status;\n+\t/**< Operation status. */\n+} __rte_cache_aligned;\n+\n+/* Enqueue/Dequeue operations */\n+\n+/**\n+ * Enqueue a burst of ML inferences for processing on an ML device.\n+ *\n+ * The rte_ml_enqueue_burst() function is invoked to place ML inference\n+ * operations on the queue *qp_id* of the device designated by its *dev_id*.\n+ *\n+ * The *nb_ops* parameter is the number of inferences to process which are\n+ * supplied in the *ops* array of *rte_ml_op* structures.\n+ *\n+ * The rte_ml_enqueue_burst() function returns the number of inferences it\n+ * actually enqueued for processing. A return value equal to *nb_ops* means that\n+ * all packets have been enqueued.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param qp_id\n+ *   The index of the queue pair which inferences are to be enqueued for processing.\n+ * The value must be in the range [0, nb_queue_pairs - 1] previously supplied to\n+ * *rte_ml_dev_configure*.\n+ * @param ops\n+ *   The address of an array of *nb_ops* pointers to *rte_ml_op* structures which contain the\n+ * ML inferences to be processed.\n+ * @param nb_ops\n+ *   The number of operations to process.\n+ *\n+ * @return\n+ *   The number of inference operations actually enqueued to the ML device.\n+ * The return value can be less than the value of the *nb_ops* parameter when the ML device queue\n+ * is full or if invalid parameters are specified in a *rte_ml_op*.\n+ */\n+__rte_experimental\n+uint16_t\n+rte_ml_enqueue_burst(int16_t dev_id, uint16_t qp_id, struct rte_ml_op **ops, uint16_t nb_ops);\n+\n+/**\n+ * Dequeue a burst of processed ML inferences operations from a queue on the ML device.\n+ * The dequeued operations are stored in *rte_ml_op* structures whose pointers are supplied\n+ * in the *ops* array.\n+ *\n+ * The rte_ml_dequeue_burst() function returns the number of inferences actually dequeued,\n+ * which is the number of *rte_ml_op* data structures effectively supplied into the *ops* array.\n+ *\n+ * A return value equal to *nb_ops* indicates that the queue contained at least nb_ops* operations,\n+ * and this is likely to signify that other processed operations remain in the devices output queue.\n+ * Application implementing a \"retrieve as many processed operations as possible\" policy can check\n+ * this specific case and keep invoking the rte_ml_dequeue_burst() function until a value less than\n+ * *nb_ops* is returned.\n+ *\n+ * The rte_ml_dequeue_burst() function does not provide any error notification to avoid\n+ * the corresponding overhead.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param qp_id\n+ *   The index of the queue pair from which to retrieve processed packets.\n+ * The value must be in the range [0, nb_queue_pairs - 1] previously supplied to\n+ * rte_ml_dev_configure().\n+ * @param ops\n+ *   The address of an array of pointers to *rte_ml_op* structures that must be large enough to\n+ * store *nb_ops* pointers in it.\n+ * @param nb_ops\n+ *   The maximum number of inferences to dequeue.\n+ *\n+ * @return\n+ *   The number of operations actually dequeued, which is the number of pointers\n+ * to *rte_ml_op* structures effectively supplied to the *ops* array.\n+ */\n+__rte_experimental\n+uint16_t\n+rte_ml_dequeue_burst(int16_t dev_id, uint16_t qp_id, struct rte_ml_op **ops, uint16_t nb_ops);\n+\n+/**\n+ * Verbose error structure definition.\n+ */\n+struct rte_ml_op_error {\n+\tconst char message[RTE_ML_STR_MAX]; /**< Human-readable error message. */\n+\tuint64_t errcode; /**< Vendor specific error code. */\n+};\n+\n+/**\n+ * Get PMD specific error information for an ML op.\n+ *\n+ * When an ML operation completed with RTE_ML_OP_STATUS_ERROR as status,\n+ * This API allows to get PMD specific error details.\n+ *\n+ * @param[in] dev_id\n+ *   Device identifier\n+ * @param[in] op\n+ *   Handle of ML operation\n+ * @param[in] error\n+ *   Address of structure rte_ml_op_error to be filled\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_op_error_get(int16_t dev_id, struct rte_ml_op *op, struct rte_ml_op_error *error);\n+\n+/* Statistics operations */\n+\n+/** Device statistics. */\n+struct rte_ml_dev_stats {\n+\tuint64_t enqueued_count;\n+\t/**< Count of all operations enqueued */\n+\tuint64_t dequeued_count;\n+\t/**< Count of all operations dequeued */\n+\tuint64_t enqueue_err_count;\n+\t/**< Total error count on operations enqueued */\n+\tuint64_t dequeue_err_count;\n+\t/**< Total error count on operations dequeued */\n+};\n+\n+/**\n+ * Retrieve the general I/O statistics of a device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param stats\n+ *   Pointer to structure to where statistics will be copied.\n+ * On error, this location may or may not have been modified.\n+ * @return\n+ *   - 0 on success\n+ *   - -EINVAL: If invalid parameter pointer is provided.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_stats_get(int16_t dev_id, struct rte_ml_dev_stats *stats);\n+\n+/**\n+ * Reset the statistics of a device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ */\n+__rte_experimental\n+void\n+rte_ml_dev_stats_reset(int16_t dev_id);\n+\n+/**< Maximum name length for extended statistics counters */\n+\n+/**\n+ * A name-key lookup element for extended statistics.\n+ *\n+ * This structure is used to map between names and ID numbers for extended ML device statistics.\n+ */\n+struct rte_ml_dev_xstats_map {\n+\tuint16_t id;\n+\t/**< xstat identifier */\n+\tchar name[RTE_ML_STR_MAX];\n+\t/**< xstat name */\n+};\n+\n+/**\n+ * Retrieve names of extended statistics of an ML device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param[out] xstats_map\n+ *   Block of memory to insert id and names into. Must be at least size in capacity.\n+ * If set to NULL, function returns required capacity.\n+ *\n+ * @return\n+ *   - Positive value on success:\n+ *      - The return value is the number of entries filled in the stats map.\n+ *      - If xstats_map set to NULL then required capacity for xstats_map.\n+ *   - Negative value on error:\n+ *      - -ENODEV: for invalid *dev_id*.\n+ *      - -ENOTSUP: if the device doesn't support this function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_xstats_names_get(int16_t dev_id, struct rte_ml_dev_xstats_map *xstats_map);\n+\n+/**\n+ * Retrieve the value of a single stat by requesting it by name.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param name\n+ *   The stat name to retrieve.\n+ * @param stat_id\n+ *   If non-NULL, the numerical id of the stat will be returned, so that further requests for\n+ * the stat can be got using rte_ml_dev_xstats_get, which will be faster as it doesn't need to\n+ * scan a list of names for the stat.\n+ * @param[out] value\n+ *   Must be non-NULL, retrieved xstat value will be stored in this address.\n+ *\n+ * @return\n+ *   - 0: Successfully retrieved xstat value.\n+ *   - -EINVAL: invalid parameters.\n+ *   - -ENOTSUP: if not supported.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_xstats_by_name_get(int16_t dev_id, const char *name, uint16_t *stat_id, uint64_t *value);\n+\n+/**\n+ * Retrieve extended statistics of an ML device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param stat_ids\n+ *   The id numbers of the stats to get. The ids can be fetched from the stat position in the\n+ * stat list from rte_ml_dev_xstats_names_get(), or by using rte_ml_dev_xstats_by_name_get().\n+ * @param values\n+ *   The values for each stats request by ID.\n+ * @param nb_ids\n+ *   The number of stats requested.\n+ * @return\n+ *   - Positive value: number of stat entries filled into the values array\n+ *   - Negative value on error:\n+ *      - -ENODEV: for invalid *dev_id*.\n+ *      - -ENOTSUP: if the device doesn't support this function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_xstats_get(int16_t dev_id, const uint16_t *stat_ids, uint64_t *values, uint16_t nb_ids);\n+\n+/**\n+ * Reset the values of the xstats of the selected component in the device.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param stat_ids\n+ *   Selects specific statistics to be reset. When NULL, all statistics will be reset.\n+ * If non-NULL, must point to array of at least *nb_ids* size.\n+ * @param nb_ids\n+ *   The number of ids available from the *ids* array. Ignored when ids is NULL.\n+ * @return\n+ *   - 0: Successfully reset the statistics to zero.\n+ *   - -EINVAL: invalid parameters.\n+ *   - -ENOTSUP: if not supported.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_xstats_reset(int16_t dev_id, const uint16_t *stat_ids, uint16_t nb_ids);\n+\n+/* Utility operations */\n+\n+/**\n+ * Dump internal information about *dev_id* to the FILE* provided in *fd*.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @param fd\n+ *   A pointer to a file for output.\n+ * @return\n+ *   - 0: on success.\n+ *   - <0: on failure.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_dump(int16_t dev_id, FILE *fd);\n+\n+/**\n+ * Trigger the ML device self test.\n+ *\n+ * @param dev_id\n+ *   The identifier of the device.\n+ * @return\n+ *   - 0: Selftest successful.\n+ *   - -ENOTSUP: if the device doesn't support selftest.\n+ *   - other values < 0 on failure.\n+ */\n+__rte_experimental\n+int\n+rte_ml_dev_selftest(int16_t dev_id);\n+\n+/* Model operations */\n+\n+/** ML model load parameters\n+ *\n+ * Parameters required to load an ML model.\n+ */\n+struct rte_ml_model_params {\n+\tvoid *addr;\n+\t/**< Address of model buffer */\n+\tsize_t size;\n+\t/**< Size of model buffer */\n+};\n+\n+/**\n+ * Load an ML model to the device.\n+ *\n+ * Load an ML model to the device with parameters requested in the structure rte_ml_model_params.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] params\n+ *   Parameters for the model to be loaded.\n+ * @param[out] model_id\n+ *   Identifier of the model loaded.\n+ *\n+ * @return\n+ *   - 0: Success, Model created.\n+ *   - < 0: Failure, Error code of the model load driver function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_load(int16_t dev_id, struct rte_ml_model_params *params, uint16_t *model_id);\n+\n+/**\n+ * Unload an ML model from the device.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier of the model to be unloaded.\n+ *\n+ * @return\n+ *   - 0: Success, Model destroyed.\n+ *   - < 0: Failure, Error code of the model unload driver function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_unload(int16_t dev_id, int16_t model_id);\n+\n+/**\n+ * Start an ML model for the given device ID.\n+ *\n+ * Start an ML model to accept inference requests.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier of the model to be started.\n+ *\n+ * @return\n+ *   - 0: Success, Model loaded.\n+ *   - < 0: Failure, Error code of the model start driver function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_start(int16_t dev_id, int16_t model_id);\n+\n+/**\n+ * Stop an ML model for the given device ID.\n+ *\n+ * Model stop would disable the ML model to be used for inference jobs.\n+ * All inference jobs must have been completed before model stop is attempted.\n+\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier of the model to be stopped.\n+ *\n+ * @return\n+ *   - 0: Success, Model unloaded.\n+ *   - < 0: Failure, Error code of the model stop driver function.\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_stop(int16_t dev_id, int16_t model_id);\n+\n+/**\n+ * Input and output data types. ML models can operate on reduced precision\n+ * datatypes to achieve better power efficiency, lower network latency and lower memory footprint.\n+ * This enum is used to represent the lower precision integer and floating point types used\n+ * by ML models.\n+ */\n+enum rte_ml_io_type {\n+\tRTE_ML_IO_TYPE_UNKNOWN = 0,\n+\t/**< Invalid or unknown type */\n+\tRTE_ML_IO_TYPE_INT8,\n+\t/**< 8-bit integer */\n+\tRTE_ML_IO_TYPE_UINT8,\n+\t/**< 8-bit unsigned integer */\n+\tRTE_ML_IO_TYPE_INT16,\n+\t/**< 16-bit integer */\n+\tRTE_ML_IO_TYPE_UINT16,\n+\t/**< 16-bit unsigned integer */\n+\tRTE_ML_IO_TYPE_INT32,\n+\t/**< 32-bit integer */\n+\tRTE_ML_IO_TYPE_UINT32,\n+\t/**< 32-bit unsigned integer */\n+\tRTE_ML_IO_TYPE_FP8,\n+\t/**< 8-bit floating point number */\n+\tRTE_ML_IO_TYPE_FP16,\n+\t/**< IEEE 754 16-bit floating point number */\n+\tRTE_ML_IO_TYPE_FP32,\n+\t/**< IEEE 754 32-bit floating point number */\n+\tRTE_ML_IO_TYPE_BFLOAT16\n+\t/**< 16-bit brain floating point number. */\n+};\n+\n+/**\n+ * Input and output format. This is used to represent the encoding type of multi-dimensional\n+ * used by ML models.\n+ */\n+enum rte_ml_io_format {\n+\tRTE_ML_IO_FORMAT_NCHW = 1,\n+\t/**< Batch size (N) x channels (C) x height (H) x width (W) */\n+\tRTE_ML_IO_FORMAT_NHWC,\n+\t/**< Batch size (N) x height (H) x width (W) x channels (C) */\n+\tRTE_ML_IO_FORMAT_CHWN,\n+\t/**< Channels (C) x height (H) x width (W) x batch size (N) */\n+\tRTE_ML_IO_FORMAT_3D,\n+\t/**< Format to represent a 3 dimensional data */\n+\tRTE_ML_IO_FORMAT_2D,\n+\t/**< Format to represent matrix data */\n+\tRTE_ML_IO_FORMAT_1D,\n+\t/**< Format to represent vector data */\n+\tRTE_ML_IO_FORMAT_SCALAR,\n+\t/**< Format to represent scalar data */\n+};\n+\n+/**\n+ * Input and output shape. This structure represents the encoding format and dimensions\n+ * of the tensor or vector.\n+ *\n+ * The data can be a 4D / 3D tensor, matrix, vector or a scalar. Number of dimensions used\n+ * for the data would depend on the format. Unused dimensions to be set to 1.\n+ */\n+struct rte_ml_io_shape {\n+\tenum rte_ml_io_format format;\n+\t/**< Format of the data */\n+\tuint32_t w;\n+\t/**< First dimension */\n+\tuint32_t x;\n+\t/**< Second dimension */\n+\tuint32_t y;\n+\t/**< Third dimension */\n+\tuint32_t z;\n+\t/**< Fourth dimension */\n+};\n+\n+/** Input and output data information structure\n+ *\n+ * Specifies the type and shape of input and output data.\n+ */\n+struct rte_ml_io_info {\n+\tchar name[RTE_ML_STR_MAX];\n+\t/**< Name of data */\n+\tstruct rte_ml_io_shape shape;\n+\t/**< Shape of data */\n+\tenum rte_ml_io_type qtype;\n+\t/**< Type of quantized data */\n+\tenum rte_ml_io_type dtype;\n+\t/**< Type of de-quantized data */\n+};\n+\n+/** Model information structure */\n+struct rte_ml_model_info {\n+\tchar name[RTE_ML_STR_MAX];\n+\t/**< Model name. */\n+\tchar version[RTE_ML_STR_MAX];\n+\t/**< Model version */\n+\tint16_t model_id;\n+\t/**< Model ID */\n+\tuint16_t device_id;\n+\t/**< Device ID */\n+\tuint16_t batch_size;\n+\t/**< Maximum number of batches that the model can process simultaneously */\n+\tuint32_t nb_inputs;\n+\t/**< Number of inputs */\n+\tconst struct rte_ml_io_info *input_info;\n+\t/**< Input info array. Array size is equal to nb_inputs */\n+\tuint32_t nb_outputs;\n+\t/**< Number of outputs */\n+\tconst struct rte_ml_io_info *output_info;\n+\t/**< Output info array. Array size is equal to nb_output */\n+\tuint64_t wb_size;\n+\t/**< Size of model weights and bias */\n+};\n+\n+/**\n+ * Get ML model information.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model created\n+ * @param[out] model_info\n+ *   Pointer to a model info structure\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_info_get(int16_t dev_id, int16_t model_id, struct rte_ml_model_info *model_info);\n+\n+/**\n+ * Update the model parameters without unloading model.\n+ *\n+ * Update model parameters such as weights and bias without unloading the model.\n+ * rte_ml_model_stop() must be called before invoking this API.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model created\n+ * @param[in] buffer\n+ *   Pointer to the model weights and bias buffer.\n+ * Size of the buffer is equal to wb_size returned in *rte_ml_model_info*.\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_model_params_update(int16_t dev_id, int16_t model_id, void *buffer);\n+\n+/* IO operations */\n+\n+/**\n+ * Get size of quantized and dequantized input buffers.\n+ *\n+ * Calculate the size of buffers required for quantized and dequantized input data.\n+ * This API would return the buffer sizes for the number of batches provided and would\n+ * consider the alignment requirements as per the PMD. Input sizes computed by this API can\n+ * be used by the application to allocate buffers.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model created\n+ * @param[in] nb_batches\n+ *   Number of batches of input to be processed in a single inference job\n+ * @param[out] input_qsize\n+ *   Quantized input size pointer.\n+ * NULL value is allowed, in which case input_qsize is not calculated by the driver.\n+ * @param[out] input_dsize\n+ *   Dequantized input size pointer.\n+ * NULL value is allowed, in which case input_dsize is not calculated by the driver.\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_io_input_size_get(int16_t dev_id, int16_t model_id, uint32_t nb_batches,\n+\t\t\t uint64_t *input_qsize, uint64_t *input_dsize);\n+\n+/**\n+ * Get size of quantized and dequantized output buffers.\n+ *\n+ * Calculate the size of buffers required for quantized and dequantized output data.\n+ * This API would return the buffer sizes for the number of batches provided and would consider\n+ * the alignment requirements as per the PMD. Output sizes computed by this API can be used by the\n+ * application to allocate buffers.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model created\n+ * @param[in] nb_batches\n+ *   Number of batches of input to be processed in a single inference job\n+ * @param[out] output_qsize\n+ *   Quantized output size pointer.\n+ * NULL value is allowed, in which case output_qsize is not calculated by the driver.\n+ * @param[out] output_dsize\n+ *   Dequantized output size pointer.\n+ * NULL value is allowed, in which case output_dsize is not calculated by the driver.\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_io_output_size_get(int16_t dev_id, int16_t model_id, uint32_t nb_batches,\n+\t\t\t  uint64_t *output_qsize, uint64_t *output_dsize);\n+\n+/**\n+ * Quantize input data.\n+ *\n+ * Quantization converts data from a higher precision types to a lower precision types to improve\n+ * the throughput and efficiency of the model execution with minimal loss of accuracy.\n+ * Types of dequantized data and quantized data are specified by the model.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model\n+ * @param[in] nb_batches\n+ *   Number of batches in the dequantized input buffer\n+ * @param[in] dbuffer\n+ *   Address of dequantized input data\n+ * @param[in] qbuffer\n+ *   Address of quantized input data\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_io_quantize(int16_t dev_id, int16_t model_id, uint16_t nb_batches, void *dbuffer,\n+\t\t   void *qbuffer);\n+\n+/**\n+ * Dequantize output data.\n+ *\n+ * Dequantization converts data from a lower precision type to a higher precision type.\n+ * Types of quantized data and dequantized are specified by the model.\n+ *\n+ * @param[in] dev_id\n+ *   The identifier of the device.\n+ * @param[in] model_id\n+ *   Identifier for the model\n+ * @param[in] nb_batches\n+ *   Number of batches in the dequantized output buffer\n+ * @param[in] qbuffer\n+ *   Address of quantized output data\n+ * @param[in] dbuffer\n+ *   Address of dequantized output data\n+ *\n+ * @return\n+ *   - Returns 0 on success\n+ *   - Returns negative value on failure\n+ */\n+__rte_experimental\n+int\n+rte_ml_io_dequantize(int16_t dev_id, int16_t model_id, uint16_t nb_batches, void *qbuffer,\n+\t\t     void *dbuffer);\n+\n+/* ML op pool operations */\n+\n+/**\n+ * Create an ML operation pool\n+ *\n+ * @param name\n+ *   ML operations pool name\n+ * @param nb_elts\n+ *   Number of elements in pool\n+ * @param cache_size\n+ *   Number of elements to cache on lcore, see\n+ *   *rte_mempool_create* for further details about cache size\n+ * @param user_size\n+ *   Size of private data to allocate for user with each operation\n+ * @param socket_id\n+ *   Socket to identifier allocate memory on\n+ * @return\n+ *  - On success pointer to mempool\n+ *  - On failure NULL\n+ */\n+__rte_experimental\n+struct rte_mempool *\n+rte_ml_op_pool_create(const char *name, unsigned int nb_elts, unsigned int cache_size,\n+\t\t      uint16_t user_size, int socket_id);\n+\n+/**\n+ * Free an ML operation pool\n+ *\n+ * @param mempool\n+ *   A pointer to the mempool structure.\n+ *   If NULL then, the function does nothing.\n+ */\n+__rte_experimental\n+void\n+rte_ml_op_pool_free(struct rte_mempool *mempool);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* RTE_MLDEV_H */\ndiff --git a/lib/mldev/version.map b/lib/mldev/version.map\nnew file mode 100644\nindex 0000000000..5aeea7c827\n--- /dev/null\n+++ b/lib/mldev/version.map\n@@ -0,0 +1,5 @@\n+EXPERIMENTAL {\n+\n+\tlocal: *;\n+};\n+\n",
    "prefixes": [
        "RFC",
        "1/1"
    ]
}