get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133413,
    "url": "http://patchwork.dpdk.org/api/patches/133413/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231026124347.22477-24-syalavarthi@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20231026124347.22477-24-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231026124347.22477-24-syalavarthi@marvell.com",
    "date": "2023-10-26T12:43:32",
    "name": "[v9,23/34] ml/cnxk: update internal info for TVM model",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "124832d4a8242c3f25920c55ffde5f0edccdf8c6",
    "submitter": {
        "id": 2480,
        "url": "http://patchwork.dpdk.org/api/people/2480/?format=api",
        "name": "Srikanth Yalavarthi",
        "email": "syalavarthi@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patchwork.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231026124347.22477-24-syalavarthi@marvell.com/mbox/",
    "series": [
        {
            "id": 30002,
            "url": "http://patchwork.dpdk.org/api/series/30002/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30002",
            "date": "2023-10-26T12:43:09",
            "name": "Implementation of revised ml/cnxk driver",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/30002/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/133413/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/133413/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 2023643208;\n\tThu, 26 Oct 2023 14:49:03 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CD76D42EAB;\n\tThu, 26 Oct 2023 14:44:29 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 179EF42E16\n for <dev@dpdk.org>; Thu, 26 Oct 2023 14:44:05 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 39QALk0E007523 for <dev@dpdk.org>; Thu, 26 Oct 2023 05:44:04 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3txcsr25pc-15\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 26 Oct 2023 05:44:04 -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 Thu, 26 Oct 2023 05:43:59 -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; Thu, 26 Oct 2023 05:43:59 -0700",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 4A31B3F70C0;\n Thu, 26 Oct 2023 05:43:59 -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=VY/X5nZGAxnV08hJTXYB2i9BD9aRMhrBSNp5N4UlQkU=;\n b=CEi73BuWGc1Yi6L5S4UuORQgAuiDDFBsfkpy6pqIhvNnt8UnsiwB8RPdae5fvBRraS3X\n m/Iwq7IgvoBxvoAXryEa7CmFEkhSi22VkOt6sSy6l5lBMVo9BGBiZGSLKDVYXsHK+j81\n PUUjrudKaz9dMS14lV71D7Tk9AN3gSXraY9ky+7UcIAQh+ZJRRYtZI+cJvQxD2NG1Rkj\n jaHmZ1nF6RIILmM5DkXMPYPOS5gaTTdGiLboC1p7ncn+Mrgn4r/KcN3VbTlkzNwwIs9o\n s251cXXLtz2QGJ4nAHGmYl0umSsY3LdWMy+FQsfsyCN59cJpYTuQ7DE7GlqS/HXEGO5J XQ==",
        "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 v9 23/34] ml/cnxk: update internal info for TVM model",
        "Date": "Thu, 26 Oct 2023 05:43:32 -0700",
        "Message-ID": "<20231026124347.22477-24-syalavarthi@marvell.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20231026124347.22477-1-syalavarthi@marvell.com>",
        "References": "<20230830155927.3566-1-syalavarthi@marvell.com>\n <20231026124347.22477-1-syalavarthi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "wSeUrp1c3xmsaa1upyEq3mLe00tXWsYP",
        "X-Proofpoint-GUID": "wSeUrp1c3xmsaa1upyEq3mLe00tXWsYP",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-10-26_10,2023-10-26_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 | 133 +++++++++++++++++++++++++++++++\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, 152 insertions(+)",
    "diff": "diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c\nindex 85b37161d2..1565e521fd 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..f35c2bb3e5 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,134 @@ 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(DLDataType dltype)\n+{\n+\tswitch (dltype.code) {\n+\tcase kDLInt:\n+\t\tif (dltype.bits == 8)\n+\t\t\treturn RTE_ML_IO_TYPE_INT8;\n+\t\telse if (dltype.bits == 16)\n+\t\t\treturn RTE_ML_IO_TYPE_INT16;\n+\t\telse if (dltype.bits == 32)\n+\t\t\treturn RTE_ML_IO_TYPE_INT32;\n+\t\tbreak;\n+\tcase kDLUInt:\n+\t\tif (dltype.bits == 8)\n+\t\t\treturn RTE_ML_IO_TYPE_UINT8;\n+\t\telse if (dltype.bits == 16)\n+\t\t\treturn RTE_ML_IO_TYPE_UINT16;\n+\t\telse if (dltype.bits == 32)\n+\t\t\treturn RTE_ML_IO_TYPE_UINT32;\n+\t\tbreak;\n+\tcase kDLFloat:\n+\t\tif (dltype.bits == 8)\n+\t\t\treturn RTE_ML_IO_TYPE_FP8;\n+\t\telse if (dltype.bits == 16)\n+\t\t\treturn RTE_ML_IO_TYPE_FP16;\n+\t\telse if (dltype.bits == 32)\n+\t\t\treturn RTE_ML_IO_TYPE_FP32;\n+\t\tbreak;\n+\tcase kDLBfloat:\n+\t\tif (dltype.bits == 16)\n+\t\t\treturn RTE_ML_IO_TYPE_BFLOAT16;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn RTE_ML_IO_TYPE_UNKNOWN;\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\trte_strscpy(model->mvtvm.info.input[i].name, metadata->input[i].name,\n+\t\t\t    TVMDP_NAME_STRLEN);\n+\t\tmodel->mvtvm.info.input[i].dtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->input[i].datatype);\n+\t\tmodel->mvtvm.info.input[i].qtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->input[i].model_datatype);\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\trte_strscpy(model->mvtvm.info.output[i].name, metadata->output[i].name,\n+\t\t\t    TVMDP_NAME_STRLEN);\n+\t\tmodel->mvtvm.info.output[i].dtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->output[i].datatype);\n+\t\tmodel->mvtvm.info.output[i].qtype =\n+\t\t\tmvtvm_ml_io_type_map(metadata->output[i].model_datatype);\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 9a3ada1b0d..e21bf2dc07 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": [
        "v9",
        "23/34"
    ]
}