Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/122806/?format=api
https://patches.dpdk.org/api/patches/122806/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230201091256.12792-2-syalavarthi@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": "<20230201091256.12792-2-syalavarthi@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230201091256.12792-2-syalavarthi@marvell.com", "date": "2023-02-01T09:12:53", "name": "[v5,1/4] mldev: add headers for internal ML functions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "94c4a35eaf9fe5c955cb643c3a1a660c401b26d3", "submitter": { "id": 2480, "url": "https://patches.dpdk.org/api/people/2480/?format=api", "name": "Srikanth Yalavarthi", "email": "syalavarthi@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/20230201091256.12792-2-syalavarthi@marvell.com/mbox/", "series": [ { "id": 26731, "url": "https://patches.dpdk.org/api/series/26731/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26731", "date": "2023-02-01T09:12:52", "name": "Implementation of ML common code", "version": 5, "mbox": "https://patches.dpdk.org/series/26731/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/122806/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/122806/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 94EA641B9D;\n\tWed, 1 Feb 2023 10:13:09 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 26AA842D0D;\n\tWed, 1 Feb 2023 10:13:05 +0100 (CET)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 93B844114A\n for <dev@dpdk.org>; Wed, 1 Feb 2023 10:13:02 +0100 (CET)", "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 3116Lbfh026195 for <dev@dpdk.org>; Wed, 1 Feb 2023 01:13:01 -0800", "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3nfjr8rg3e-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 01 Feb 2023 01:13:01 -0800", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42;\n Wed, 1 Feb 2023 01:12:59 -0800", "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.42 via Frontend\n Transport; Wed, 1 Feb 2023 01:12:59 -0800", "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 3B1E73F7059;\n Wed, 1 Feb 2023 01:12:59 -0800 (PST)" ], "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-type; s=pfpt0220; bh=h1dZ5iZ6aCVc3cOTpasPdgDxlGaqOc2846tbwmGKh30=;\n b=Y+ZK9mWPdoeDTecJ1H32Q1yTDbMihq7xWdD7MZEGpFlLcDSHJ951znlk6aKkSChcTO5x\n efLvczC3TSe7QxB5Sui6iNNNRuaGDF9R0rhSjmDcvFbsm9agVxqF618hZys54/OT69pM\n SlqU9FBupkkWChXBs2A3BOAlyFeNc8gUEyXcrdt6ZNUor2yzGOgXUGB0NhRkoGBXk+ui\n ydvi8sFWOCrkqBhxIAEpxFBbd/SI26N20Nkb3KkN2OmOR8aXuAYITwbmSgEiBI7RXkkg\n //y7+2E4x53l7tYHI56kg3AwWzMt6vAO3oolMlXQqeSt7L26ZQ0ORO9lex0T/n7zbHbj rQ==", "From": "Srikanth Yalavarthi <syalavarthi@marvell.com>", "To": "Srikanth Yalavarthi <syalavarthi@marvell.com>", "CC": "<dev@dpdk.org>, <sshankarnara@marvell.com>, <jerinj@marvell.com>,\n <aprabhu@marvell.com>", "Subject": "[PATCH v5 1/4] mldev: add headers for internal ML functions", "Date": "Wed, 1 Feb 2023 01:12:53 -0800", "Message-ID": "<20230201091256.12792-2-syalavarthi@marvell.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20230201091256.12792-1-syalavarthi@marvell.com>", "References": "<20221208193532.16718-1-syalavarthi@marvell.com>\n <20230201091256.12792-1-syalavarthi@marvell.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Proofpoint-GUID": "1vNG7AMU2VjppbtbMJ619J9EbCeWgFB0", "X-Proofpoint-ORIG-GUID": "1vNG7AMU2VjppbtbMJ619J9EbCeWgFB0", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1\n definitions=2023-02-01_03,2023-01-31_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": "Added header files for internal ML utility routines to convert\nIO type and format to string, IO type to size and routines to\nconvert data types.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\nDepends-on: series-26046 (\"app/mldev: implement test framework for mldev\")\n\nv5:\n* Moved the code from drivers/common/ml to lib/mldev\n* Added rte_ml_io_ prefix to the functions\n\nv3:\n* Skip installation of internal common/ml headers\n\nv2:\n* Moved implementation out of patch. Only headers are included.\n\n lib/mldev/meson.build | 2 +\n lib/mldev/mldev_utils.c | 5 +\n lib/mldev/mldev_utils.h | 345 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 352 insertions(+)\n create mode 100644 lib/mldev/mldev_utils.c\n create mode 100644 lib/mldev/mldev_utils.h\n\n--\n2.17.1", "diff": "diff --git a/lib/mldev/meson.build b/lib/mldev/meson.build\nindex 5c99532c1a..452b83a480 100644\n--- a/lib/mldev/meson.build\n+++ b/lib/mldev/meson.build\n@@ -4,6 +4,7 @@\n sources = files(\n 'rte_mldev_pmd.c',\n 'rte_mldev.c',\n+ 'mldev_utils.c',\n )\n\n headers = files(\n@@ -16,6 +17,7 @@ indirect_headers += files(\n\n driver_sdk_headers += files(\n 'rte_mldev_pmd.h',\n+ 'mldev_utils.h',\n )\n\n deps += ['mempool']\ndiff --git a/lib/mldev/mldev_utils.c b/lib/mldev/mldev_utils.c\nnew file mode 100644\nindex 0000000000..9dbbf013a0\n--- /dev/null\n+++ b/lib/mldev/mldev_utils.c\n@@ -0,0 +1,5 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#include \"mldev_utils.h\"\ndiff --git a/lib/mldev/mldev_utils.h b/lib/mldev/mldev_utils.h\nnew file mode 100644\nindex 0000000000..04cdaab567\n--- /dev/null\n+++ b/lib/mldev/mldev_utils.h\n@@ -0,0 +1,345 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#ifndef _RTE_MLDEV_UTILS_H_\n+#define _RTE_MLDEV_UTILS_H_\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/**\n+ * @file\n+ *\n+ * RTE ML Device PMD utility API\n+ *\n+ * These APIs for the use from ML drivers, user applications shouldn't use them.\n+ *\n+ */\n+\n+#include <rte_compat.h>\n+#include <rte_mldev.h>\n+\n+/**\n+ * @internal\n+ *\n+ * Get the size an ML IO type in bytes.\n+ *\n+ * @param[in] type\n+ *\tEnumeration of ML IO data type.\n+ *\n+ * @return\n+ *\t- > 0, Size of the data type in bytes.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_type_size_get(enum rte_ml_io_type type);\n+\n+/**\n+ * @internal\n+ *\n+ * Get the name of an ML IO type.\n+ *\n+ * @param[in] type\n+ *\tEnumeration of ML IO data type.\n+ * @param[in] str\n+ *\tAddress of character array.\n+ * @param[in] len\n+ *\tLength of character array.\n+ */\n+__rte_internal\n+void\n+rte_ml_io_type_to_str(enum rte_ml_io_type type, char *str, int len);\n+\n+/**\n+ * @internal\n+ *\n+ * Get the name of an ML IO format.\n+ *\n+ * @param[in] type\n+ *\tEnumeration of ML IO format.\n+ * @param[in] str\n+ *\tAddress of character array.\n+ * @param[in] len\n+ *\tLength of character array.\n+ */\n+__rte_internal\n+void\n+rte_ml_io_format_to_str(enum rte_ml_io_format format, char *str, int len);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to signed 8-bit\n+ * integer format (INT8).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store INT8 numbers. Size of buffer is equal to (nb_elements * 1) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_int8(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in signed 8-bit integer format (INT8) to single precision\n+ * floating format (float32).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing INT8 numbers. Size of buffer is equal to (nb_elements * 1) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_int8_to_float32(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to unsigned\n+ * 8-bit integer format (UINT8).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store UINT8 numbers. Size of buffer is equal to (nb_elements * 1) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_uint8(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in unsigned 8-bit integer format (UINT8) to single precision\n+ * floating format (float32).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing UINT8 numbers. Size of buffer is equal to (nb_elements * 1) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_uint8_to_float32(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to signed\n+ * 16-bit integer format (INT16).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store INT16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_int16(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in signed 16-bit integer format (INT16) to single precision\n+ * floating format (float32).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing INT16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_int16_to_float32(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to unsigned\n+ * 16-bit integer format (UINT16).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store UINT16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_uint16(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in unsigned 16-bit integer format (UINT16) to single\n+ * precision floating format (float32).\n+ *\n+ * @param[in] scale\n+ * Scale factor for conversion.\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing UINT16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_uint16_to_float32(float scale, uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to half\n+ * precision floating point format (FP16).\n+ *\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements *4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_float16(uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in half precision floating format (FP16) to single precision\n+ * floating point format (float32).\n+ *\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float16_to_float32(uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in single precision floating format (float32) to brain\n+ * floating point format (bfloat16).\n+ *\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing float32 numbers. Size of buffer is equal to (nb_elements *4) bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store bfloat16 numbers. Size of buffer is equal to (nb_elements * 2) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_float32_to_bfloat16(uint64_t nb_elements, void *input, void *output);\n+\n+/**\n+ * @internal\n+ *\n+ * Convert a buffer containing numbers in brain floating point format (bfloat16) to single precision\n+ * floating point format (float32).\n+ *\n+ * @param[in] nb_elements\n+ *\tNumber of elements in the buffer.\n+ * @param[in] input\n+ *\tInput buffer containing bfloat16 numbers. Size of buffer is equal to (nb_elements * 2)\n+ * bytes.\n+ * @param[out] output\n+ *\tOutput buffer to store float32 numbers. Size of buffer is equal to (nb_elements * 4) bytes.\n+ *\n+ * @return\n+ *\t- 0, Success.\n+ *\t- < 0, Error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_io_bfloat16_to_float32(uint64_t nb_elements, void *input, void *output);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_MLDEV_UTILS_H_ */\n", "prefixes": [ "v5", "1/4" ] }{ "id": 122806, "url": "