Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/131706/?format=api
http://patchwork.dpdk.org/api/patches/131706/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230920072528.14185-33-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": "<20230920072528.14185-33-syalavarthi@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230920072528.14185-33-syalavarthi@marvell.com", "date": "2023-09-20T07:25:23", "name": "[v2,32/34] ml/cnxk: support quantize and dequantize callback", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "95b2d3432b7abc03c1003464712ee36e0d2cd49c", "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/20230920072528.14185-33-syalavarthi@marvell.com/mbox/", "series": [ { "id": 29567, "url": "http://patchwork.dpdk.org/api/series/29567/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29567", "date": "2023-09-20T07:24:51", "name": "Implemenation of revised ml/cnxk driver", "version": 2, "mbox": "http://patchwork.dpdk.org/series/29567/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/131706/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/131706/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 4C048425E4;\n\tWed, 20 Sep 2023 09:29:30 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id BDF624113C;\n\tWed, 20 Sep 2023 09:26:18 +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 9CC9F410FC\n for <dev@dpdk.org>; Wed, 20 Sep 2023 09:25:45 +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 38K7JW19008355 for <dev@dpdk.org>; Wed, 20 Sep 2023 00:25:45 -0700", "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t7htasykw-16\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 20 Sep 2023 00:25:44 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Wed, 20 Sep 2023 00:25:42 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Wed, 20 Sep 2023 00:25:42 -0700", "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 6FFA95B6927;\n Wed, 20 Sep 2023 00:25:42 -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=8yaUFL5k+3din5FIE4Qy6dkqTwdlnbOJP81BhUJOAqM=;\n b=Xgdz+sjGx1npRFXF0sMRLf7gPxYiAbtKr9X73Vpmj7Pc53glXDHDCVwwbMvHv/2sDZoa\n K7/rTDOhb0xxz1yH6N8LlmXX1bdjRC5SRd26sHiN6dT8jKArmYPJJQ1ij+oJhLdOo4S5\n uRwpxTTzq8tMXZ+dqosk78OtONpXa7ZbArvthWR5Wp++lV8op1s4nGqJod45R5AoHSYT\n J0nmpJ/wfJfEgcoHv3qC+nuif7w4/dmmGa4kcpU5DNjFOEQEMFktgJAXvUufcSFutBgv\n lCitAWt1zQrA8twQtTJawNpz7+1Ho5len9aRTT93gUcjWNJaol4DU3EVcRbwpubSMzC+ SA==", "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 v2 32/34] ml/cnxk: support quantize and dequantize callback", "Date": "Wed, 20 Sep 2023 00:25:23 -0700", "Message-ID": "<20230920072528.14185-33-syalavarthi@marvell.com>", "X-Mailer": "git-send-email 2.41.0", "In-Reply-To": "<20230920072528.14185-1-syalavarthi@marvell.com>", "References": "<20230830155927.3566-1-syalavarthi@marvell.com>\n <20230920072528.14185-1-syalavarthi@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-ORIG-GUID": "IuPxjAjkYHN7FmCg33wju8iX4mKTA2uj", "X-Proofpoint-GUID": "IuPxjAjkYHN7FmCg33wju8iX4mKTA2uj", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26\n definitions=2023-09-20_02,2023-09-19_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": "From: Prince Takkar <ptakkar@marvell.com>\n\nAdded support for quantize and dequantize callback\nfunctions for TVM models.\n\nSigned-off-by: Prince Takkar <ptakkar@marvell.com>\n---\n drivers/ml/cnxk/mvtvm_ml_model.h | 2 +\n drivers/ml/cnxk/mvtvm_ml_ops.c | 127 +++++++++++++++++++++++++++++++\n drivers/ml/cnxk/mvtvm_ml_ops.h | 4 +\n 3 files changed, 133 insertions(+)", "diff": "diff --git a/drivers/ml/cnxk/mvtvm_ml_model.h b/drivers/ml/cnxk/mvtvm_ml_model.h\nindex d71df36f5a..57a6ce0bb1 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_model.h\n+++ b/drivers/ml/cnxk/mvtvm_ml_model.h\n@@ -5,6 +5,8 @@\n #ifndef _MVTVM_ML_MODEL_H_\n #define _MVTVM_ML_MODEL_H_\n \n+#include <dlpack/dlpack.h>\n+\n #include <tvmdp.h>\n \n #include <rte_mldev.h>\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c\nindex 95238d43d8..5292ac97fe 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_ops.c\n+++ b/drivers/ml/cnxk/mvtvm_ml_ops.c\n@@ -7,6 +7,8 @@\n #include <rte_mldev.h>\n #include <rte_mldev_pmd.h>\n \n+#include <mldev_utils.h>\n+\n #include \"cn10k_ml_ops.h\"\n \n #include \"mvtvm_ml_model.h\"\n@@ -168,6 +170,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params *\n \t\tcallback->tvmrt_io_free = cn10k_ml_io_free;\n \t\tcallback->tvmrt_malloc = cn10k_ml_malloc;\n \t\tcallback->tvmrt_free = cn10k_ml_free;\n+\t\tcallback->tvmrt_quantize = mvtvm_ml_io_quantize;\n+\t\tcallback->tvmrt_dequantize = mvtvm_ml_io_dequantize;\n \t} else {\n \t\tcallback = NULL;\n \t}\n@@ -298,3 +302,126 @@ mvtvm_ml_model_stop(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *model)\n \n \treturn 0;\n }\n+\n+int\n+mvtvm_ml_io_quantize(void *device, uint16_t model_id, const char *layer_name,\n+\t\t const DLTensor **deq_tensor, void *qbuffer)\n+{\n+\tstruct cnxk_ml_io_info *info = NULL;\n+\tstruct cnxk_ml_dev *cnxk_mldev;\n+\tstruct cnxk_ml_model *model;\n+\tuint16_t layer_id = 0;\n+\tuint8_t *lcl_dbuffer;\n+\tuint8_t *lcl_qbuffer;\n+\tuint32_t i;\n+\tint ret;\n+\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif ((device == NULL) || (deq_tensor == NULL) || (qbuffer == NULL))\n+\t\treturn -EINVAL;\n+#endif\n+\n+\tcnxk_mldev = (struct cnxk_ml_dev *)device;\n+\n+\tmodel = cnxk_mldev->mldev->data->models[model_id];\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif (model == NULL) {\n+\t\tplt_err(\"Invalid model_id = %u\", model_id);\n+\t\treturn -EINVAL;\n+\t}\n+#endif\n+\n+\t/* Get layer id */\n+\tfor (layer_id = 0; layer_id < model->mvtvm.metadata.model.nb_layers; layer_id++) {\n+\t\tif (strcmp(model->layer[layer_id].name, layer_name) == 0)\n+\t\t\tbreak;\n+\t}\n+\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif (layer_id == model->mvtvm.metadata.model.nb_layers) {\n+\t\tplt_err(\"Invalid layer name: %s\", layer_name);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (model->layer[layer_id].type != ML_CNXK_LAYER_TYPE_MRVL) {\n+\t\tplt_err(\"Invalid layer name / type: %s\", layer_name);\n+\t\treturn -EINVAL;\n+\t}\n+#endif\n+\n+\tinfo = &model->layer[layer_id].info;\n+\tlcl_qbuffer = (uint8_t *)qbuffer;\n+\n+\tfor (i = 0; i < info->nb_inputs; i++) {\n+\t\tlcl_dbuffer = PLT_PTR_ADD(deq_tensor[i]->data, deq_tensor[i]->byte_offset);\n+\n+\t\tret = cnxk_ml_io_quantize_single(&info->input[i], lcl_dbuffer, lcl_qbuffer);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\tlcl_qbuffer += info->input[i].sz_q;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+mvtvm_ml_io_dequantize(void *device, uint16_t model_id, const char *layer_name, void *qbuffer,\n+\t\t const DLTensor **deq_tensor)\n+{\n+\tstruct cnxk_ml_io_info *info = NULL;\n+\tstruct cnxk_ml_dev *cnxk_mldev;\n+\tstruct cnxk_ml_model *model;\n+\tuint16_t layer_id = 0;\n+\tuint8_t *lcl_dbuffer;\n+\tuint8_t *lcl_qbuffer;\n+\tuint32_t i;\n+\tint ret;\n+\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif ((device == NULL) || (deq_tensor == NULL) || (qbuffer == NULL))\n+\t\treturn -EINVAL;\n+#endif\n+\n+\tcnxk_mldev = (struct cnxk_ml_dev *)device;\n+\n+\tmodel = cnxk_mldev->mldev->data->models[model_id];\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif (model == NULL) {\n+\t\tplt_err(\"Invalid model_id = %u\", model_id);\n+\t\treturn -EINVAL;\n+\t}\n+#endif\n+\n+\tfor (layer_id = 0; layer_id < model->mvtvm.metadata.model.nb_layers; layer_id++) {\n+\t\tif (strcmp(model->layer[layer_id].name, layer_name) == 0)\n+\t\t\tbreak;\n+\t}\n+\n+#ifdef CNXK_ML_DEV_DEBUG\n+\tif (layer_id == model->mvtvm.metadata.model.nb_layers) {\n+\t\tplt_err(\"Invalid layer name: %s\", layer_name);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (model->layer[layer_id].type != ML_CNXK_LAYER_TYPE_MRVL) {\n+\t\tplt_err(\"Invalid layer name / type: %s\", layer_name);\n+\t\treturn -EINVAL;\n+\t}\n+#endif\n+\n+\tinfo = &model->layer[layer_id].info;\n+\tlcl_qbuffer = (uint8_t *)qbuffer;\n+\n+\tfor (i = 0; i < info->nb_outputs; i++) {\n+\t\tlcl_dbuffer = PLT_PTR_ADD(deq_tensor[i]->data, deq_tensor[i]->byte_offset);\n+\n+\t\tret = cnxk_ml_io_dequantize_single(&info->output[i], lcl_qbuffer, lcl_dbuffer);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\tlcl_qbuffer += info->output[i].sz_q;\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/ml/cnxk/mvtvm_ml_ops.h b/drivers/ml/cnxk/mvtvm_ml_ops.h\nindex 55459f9f7f..a1a868ef4b 100644\n--- a/drivers/ml/cnxk/mvtvm_ml_ops.h\n+++ b/drivers/ml/cnxk/mvtvm_ml_ops.h\n@@ -21,5 +21,9 @@ int mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_para\n int mvtvm_ml_model_unload(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *model);\n int mvtvm_ml_model_start(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *model);\n int mvtvm_ml_model_stop(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *model);\n+int mvtvm_ml_io_quantize(void *device, uint16_t model_id, const char *layer_name,\n+\t\t\t const DLTensor **deq_tensor, void *qbuffer);\n+int mvtvm_ml_io_dequantize(void *device, uint16_t model_id, const char *layer_name, void *qbuffer,\n+\t\t\t const DLTensor **deq_tensor);\n \n #endif /* _MVTVM_ML_OPS_H_ */\n", "prefixes": [ "v2", "32/34" ] }{ "id": 131706, "url": "