get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132920,
    "url": "http://patches.dpdk.org/api/patches/132920/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231018135423.14111-24-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-24-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231018135423.14111-24-syalavarthi@marvell.com",
    "date": "2023-10-18T13:54:08",
    "name": "[v6,23/34] ml/cnxk: update internal info for TVM model",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "c1a9cd7c8c376e69eed42ccb1f7477fa53312cf4",
    "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-24-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/132920/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/132920/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 ED80E4319A;\n\tWed, 18 Oct 2023 15:57:57 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 56B7442EE6;\n\tWed, 18 Oct 2023 15:55:08 +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 24BC642DFB\n for <dev@dpdk.org>; Wed, 18 Oct 2023 15:54:40 +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 39I7okC7009779 for <dev@dpdk.org>; Wed, 18 Oct 2023 06:54:40 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tt148348f-17\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 18 Oct 2023 06:54:40 -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:37 -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:37 -0700",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 38FE83F7048;\n Wed, 18 Oct 2023 06:54:37 -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=VIj109GwMiXY4dqOwwnLRJVSPAhNzftNRVP9AvSGlHE=;\n b=iKOx2QtZ+UN/vemMqxvdd63AxHMJzWIMNkaz70+GoyaMz2RgL1QeIF4eVJ60O1wa0pQo\n gaNnuN0DXxZHnUNP1Du6erAfn5H+50tFfDKRROcVSS7ONdboqtR5LSFYkVJx8d0ixHUn\n /CYZDD+iE0F6zRk2RglKdpWMkvntn310+pQuc38RL/5X5maZsRjd6HQI7QqtV9FYeFcN\n /N+L1Th++NHJVAFLdrFAlOv61Hta+efy8IL5NhSHEoaXu6v3fL6kAR/AOhdewj+AFBdn\n dT+1AwPedNb1z1oGlpaQ1KqDvYfh3KFCNunToqGH+j0ottKOHqA8d3HNecfn6ZMtKqlq IA==",
        "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 23/34] ml/cnxk: update internal info for TVM model",
        "Date": "Wed, 18 Oct 2023 06:54:08 -0700",
        "Message-ID": "<20231018135423.14111-24-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": "QwsAfo4nnaH66VrsBf5GuRjTgQWSzYyv",
        "X-Proofpoint-ORIG-GUID": "QwsAfo4nnaH66VrsBf5GuRjTgQWSzYyv",
        "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": "Enabled updating internal IO info structures for TVM model.\nCompute static fields related to the model I/O.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n drivers/ml/cnxk/cnxk_ml_ops.c    |   4 ++\n drivers/ml/cnxk/mvtvm_ml_model.c | 111 +++++++++++++++++++++++++++++++\n drivers/ml/cnxk/mvtvm_ml_model.h |   2 +\n drivers/ml/cnxk/mvtvm_ml_ops.c   |   3 +\n drivers/ml/cnxk/mvtvm_ml_stubs.c |   9 +++\n drivers/ml/cnxk/mvtvm_ml_stubs.h |   1 +\n 6 files changed, 130 insertions(+)",
    "diff": "diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c\nindex b18271545d..90b23d9c1c 100644\n--- a/drivers/ml/cnxk/cnxk_ml_ops.c\n+++ b/drivers/ml/cnxk/cnxk_ml_ops.c\n@@ -1244,6 +1244,8 @@ cnxk_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buf\n \n \tif (model->type == ML_CNXK_MODEL_TYPE_GLOW)\n \t\tinfo = cn10k_ml_model_io_info_get(model, 0);\n+\telse\n+\t\tinfo = mvtvm_ml_model_io_info_get(model, 0);\n \n \tif (info == NULL)\n \t\treturn -EINVAL;\n@@ -1296,6 +1298,8 @@ cnxk_ml_io_dequantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_b\n \n \tif (model->type == ML_CNXK_MODEL_TYPE_GLOW)\n \t\tinfo = cn10k_ml_model_io_info_get(model, model->nb_layers - 1);\n+\telse\n+\t\tinfo = mvtvm_ml_model_io_info_get(model, model->nb_layers - 1);\n \n \tif (info == NULL)\n \t\treturn -EINVAL;\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c\nindex 8536fd8927..14f4b258d8 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_model.c\n+++ b/drivers/ml/cnxk/mvtvm_ml_model.c\n@@ -7,6 +7,8 @@\n \n #include <rte_mldev.h>\n \n+#include <mldev_utils.h>\n+\n #include <roc_api.h>\n \n #include \"cnxk_ml_model.h\"\n@@ -135,3 +137,112 @@ mvtvm_ml_model_get_layer_id(struct cnxk_ml_model *model, const char *layer_name,\n \n \treturn 0;\n }\n+\n+static enum rte_ml_io_type\n+mvtvm_ml_io_type_map(uint8_t type)\n+{\n+\tswitch (type) {\n+\tcase kDLInt:\n+\t\treturn RTE_ML_IO_TYPE_INT32;\n+\tcase kDLUInt:\n+\t\treturn RTE_ML_IO_TYPE_UINT32;\n+\tcase kDLFloat:\n+\t\treturn RTE_ML_IO_TYPE_FP32;\n+\tcase kDLBfloat:\n+\t\treturn RTE_ML_IO_TYPE_BFLOAT16;\n+\t}\n+\n+\treturn RTE_ML_IO_TYPE_UNKNOWN;\n+}\n+\n+void\n+mvtvm_ml_model_io_info_set(struct cnxk_ml_model *model)\n+{\n+\tstruct tvmdp_model_metadata *metadata;\n+\tint32_t i;\n+\tint32_t j;\n+\n+\tif (model->subtype == ML_CNXK_MODEL_SUBTYPE_TVM_MRVL)\n+\t\tgoto tvm_mrvl_model;\n+\n+\tmetadata = &model->mvtvm.metadata;\n+\n+\t/* Inputs, set for layer_id = 0 */\n+\tmodel->mvtvm.info.nb_inputs = metadata->model.num_input;\n+\tmodel->mvtvm.info.total_input_sz_d = 0;\n+\tmodel->mvtvm.info.total_input_sz_q = 0;\n+\tfor (i = 0; i < metadata->model.num_input; i++) {\n+\t\tstrncpy(model->mvtvm.info.input[i].name, metadata->input[i].name,\n+\t\t\tTVMDP_NAME_STRLEN);\n+\t\tmodel->mvtvm.info.input[i].dtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->input[i].datatype.code);\n+\t\tmodel->mvtvm.info.input[i].qtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->input[i].model_datatype.code);\n+\t\tmodel->mvtvm.info.input[i].nb_dims = metadata->input[i].ndim;\n+\n+\t\tmodel->mvtvm.info.input[i].nb_elements = 1;\n+\t\tfor (j = 0; j < metadata->input[i].ndim; j++) {\n+\t\t\tmodel->mvtvm.info.input[i].shape[j] = metadata->input[i].shape[j];\n+\t\t\tmodel->mvtvm.info.input[i].nb_elements *= metadata->input[i].shape[j];\n+\t\t}\n+\n+\t\tmodel->mvtvm.info.input[i].sz_d =\n+\t\t\tmodel->mvtvm.info.input[i].nb_elements *\n+\t\t\trte_ml_io_type_size_get(model->mvtvm.info.input[i].dtype);\n+\t\tmodel->mvtvm.info.input[i].sz_q =\n+\t\t\tmodel->mvtvm.info.input[i].nb_elements *\n+\t\t\trte_ml_io_type_size_get(model->mvtvm.info.input[i].qtype);\n+\n+\t\tmodel->mvtvm.info.total_input_sz_d += model->mvtvm.info.input[i].sz_d;\n+\t\tmodel->mvtvm.info.total_input_sz_q += model->mvtvm.info.input[i].sz_q;\n+\n+\t\tplt_ml_dbg(\"model_id = %u, input[%u] - sz_d = %u sz_q = %u\", model->model_id, i,\n+\t\t\t   model->mvtvm.info.input[i].sz_d, model->mvtvm.info.input[i].sz_q);\n+\t}\n+\n+\t/* Outputs, set for nb_layers - 1 */\n+\tmodel->mvtvm.info.nb_outputs = metadata->model.num_output;\n+\tmodel->mvtvm.info.total_output_sz_d = 0;\n+\tmodel->mvtvm.info.total_output_sz_q = 0;\n+\tfor (i = 0; i < metadata->model.num_output; i++) {\n+\t\tstrncpy(model->mvtvm.info.output[i].name, metadata->output[i].name,\n+\t\t\tTVMDP_NAME_STRLEN);\n+\t\tmodel->mvtvm.info.output[i].dtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->output[i].datatype.code);\n+\t\tmodel->mvtvm.info.output[i].qtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->output[i].model_datatype.code);\n+\t\tmodel->mvtvm.info.output[i].nb_dims = metadata->output[i].ndim;\n+\n+\t\tmodel->mvtvm.info.output[i].nb_elements = 1;\n+\t\tfor (j = 0; j < metadata->output[i].ndim; j++) {\n+\t\t\tmodel->mvtvm.info.output[i].shape[j] = metadata->output[i].shape[j];\n+\t\t\tmodel->mvtvm.info.output[i].nb_elements *= metadata->output[i].shape[j];\n+\t\t}\n+\n+\t\tmodel->mvtvm.info.output[i].sz_d =\n+\t\t\tmodel->mvtvm.info.output[i].nb_elements *\n+\t\t\trte_ml_io_type_size_get(model->mvtvm.info.output[i].dtype);\n+\t\tmodel->mvtvm.info.output[i].sz_q =\n+\t\t\tmodel->mvtvm.info.output[i].nb_elements *\n+\t\t\trte_ml_io_type_size_get(model->mvtvm.info.output[i].qtype);\n+\n+\t\tmodel->mvtvm.info.total_output_sz_d += model->mvtvm.info.output[i].sz_d;\n+\t\tmodel->mvtvm.info.total_output_sz_q += model->mvtvm.info.output[i].sz_q;\n+\n+\t\tplt_ml_dbg(\"model_id = %u, output[%u] - sz_d = %u sz_q = %u\", model->model_id, i,\n+\t\t\t   model->mvtvm.info.output[i].sz_d, model->mvtvm.info.output[i].sz_q);\n+\t}\n+\n+\treturn;\n+\n+tvm_mrvl_model:\n+\tcn10k_ml_layer_io_info_set(&model->mvtvm.info, &model->layer[0].glow.metadata);\n+}\n+\n+struct cnxk_ml_io_info *\n+mvtvm_ml_model_io_info_get(struct cnxk_ml_model *model, uint16_t layer_id)\n+{\n+\tRTE_SET_USED(layer_id);\n+\n+\treturn &model->mvtvm.info;\n+}\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_model.h b/drivers/ml/cnxk/mvtvm_ml_model.h\nindex 6cb2639876..e86581bc6a 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_model.h\n+++ b/drivers/ml/cnxk/mvtvm_ml_model.h\n@@ -50,5 +50,7 @@ int mvtvm_ml_model_blob_parse(struct rte_ml_model_params *params,\n \t\t\t      struct mvtvm_ml_model_object *object);\n int mvtvm_ml_model_get_layer_id(struct cnxk_ml_model *model, const char *layer_name,\n \t\t\t\tuint16_t *layer_id);\n+void mvtvm_ml_model_io_info_set(struct cnxk_ml_model *model);\n+struct cnxk_ml_io_info *mvtvm_ml_model_io_info_get(struct cnxk_ml_model *model, uint16_t layer_id);\n \n #endif /* _MVTVM_ML_MODEL_H_ */\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c\nindex 1fe0a04301..e248310cb3 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_ops.c\n+++ b/drivers/ml/cnxk/mvtvm_ml_ops.c\n@@ -175,6 +175,9 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params *\n \t\tgoto error;\n \t}\n \n+\t/* Update model I/O data */\n+\tmvtvm_ml_model_io_info_set(model);\n+\n \treturn 0;\n \n error:\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_stubs.c b/drivers/ml/cnxk/mvtvm_ml_stubs.c\nindex d621dbc897..80a9a90b4e 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_stubs.c\n+++ b/drivers/ml/cnxk/mvtvm_ml_stubs.c\n@@ -27,6 +27,15 @@ mvtvm_ml_model_get_layer_id(struct cnxk_ml_model *model, const char *layer_name,\n \treturn -EINVAL;\n }\n \n+struct cnxk_ml_io_info *\n+mvtvm_ml_model_io_info_get(struct cnxk_ml_model *model, uint16_t layer_id)\n+{\n+\tRTE_SET_USED(model);\n+\tRTE_SET_USED(layer_id);\n+\n+\treturn NULL;\n+}\n+\n int\n mvtvm_ml_dev_configure(struct cnxk_ml_dev *cnxk_mldev, const struct rte_ml_dev_config *conf)\n {\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_stubs.h b/drivers/ml/cnxk/mvtvm_ml_stubs.h\nindex 23fdfdc4cd..29f721072a 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_stubs.h\n+++ b/drivers/ml/cnxk/mvtvm_ml_stubs.h\n@@ -18,5 +18,6 @@ int mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_para\n \n int mvtvm_ml_model_get_layer_id(struct cnxk_ml_model *model, const char *layer_name,\n \t\t\t\tuint16_t *layer_id);\n+struct cnxk_ml_io_info *mvtvm_ml_model_io_info_get(struct cnxk_ml_model *model, uint16_t layer_id);\n \n #endif /* _MVTVM_ML_STUBS_H_ */\n",
    "prefixes": [
        "v6",
        "23/34"
    ]
}