DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Srikanth Yalavarthi <syalavarthi@marvell.com>
Cc: <dev@dpdk.org>, <aprabhu@marvell.com>, <sshankarnara@marvell.com>,
	<ptakkar@marvell.com>
Subject: [PATCH 3/3] ml/cnxk: add support for additional integer types
Date: Sun, 7 Jan 2024 07:28:12 -0800	[thread overview]
Message-ID: <20240107152813.2668-4-syalavarthi@marvell.com> (raw)
In-Reply-To: <20240107152813.2668-1-syalavarthi@marvell.com>

Added support quantization and dequantization of 32-bit
and 64-bit integer types.

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cnxk_ml_io.c     | 24 ++++++++++++++++++++++++
 drivers/ml/cnxk/mvtvm_ml_model.c |  4 ++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/ml/cnxk/cnxk_ml_io.c b/drivers/ml/cnxk/cnxk_ml_io.c
index c78009ab0cd..4b0adc2ae47 100644
--- a/drivers/ml/cnxk/cnxk_ml_io.c
+++ b/drivers/ml/cnxk/cnxk_ml_io.c
@@ -40,6 +40,18 @@ cnxk_ml_io_quantize_single(struct cnxk_ml_io *input, uint8_t *dbuffer, uint8_t *
 		case RTE_ML_IO_TYPE_UINT16:
 			ret = rte_ml_io_float32_to_uint16(qscale, nb_elements, dbuffer, qbuffer);
 			break;
+		case RTE_ML_IO_TYPE_INT32:
+			ret = rte_ml_io_float32_to_int32(qscale, nb_elements, dbuffer, qbuffer);
+			break;
+		case RTE_ML_IO_TYPE_UINT32:
+			ret = rte_ml_io_float32_to_uint32(qscale, nb_elements, dbuffer, qbuffer);
+			break;
+		case RTE_ML_IO_TYPE_INT64:
+			ret = rte_ml_io_float32_to_int64(qscale, nb_elements, dbuffer, qbuffer);
+			break;
+		case RTE_ML_IO_TYPE_UINT64:
+			ret = rte_ml_io_float32_to_uint64(qscale, nb_elements, dbuffer, qbuffer);
+			break;
 		case RTE_ML_IO_TYPE_FP16:
 			ret = rte_ml_io_float32_to_float16(nb_elements, dbuffer, qbuffer);
 			break;
@@ -82,6 +94,18 @@ cnxk_ml_io_dequantize_single(struct cnxk_ml_io *output, uint8_t *qbuffer, uint8_
 		case RTE_ML_IO_TYPE_UINT16:
 			ret = rte_ml_io_uint16_to_float32(dscale, nb_elements, qbuffer, dbuffer);
 			break;
+		case RTE_ML_IO_TYPE_INT32:
+			ret = rte_ml_io_int32_to_float32(dscale, nb_elements, qbuffer, dbuffer);
+			break;
+		case RTE_ML_IO_TYPE_UINT32:
+			ret = rte_ml_io_uint32_to_float32(dscale, nb_elements, qbuffer, dbuffer);
+			break;
+		case RTE_ML_IO_TYPE_INT64:
+			ret = rte_ml_io_int64_to_float32(dscale, nb_elements, qbuffer, dbuffer);
+			break;
+		case RTE_ML_IO_TYPE_UINT64:
+			ret = rte_ml_io_uint64_to_float32(dscale, nb_elements, qbuffer, dbuffer);
+			break;
 		case RTE_ML_IO_TYPE_FP16:
 			ret = rte_ml_io_float16_to_float32(nb_elements, qbuffer, dbuffer);
 			break;
diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c
index 0dbe08e9889..e3234ae4422 100644
--- a/drivers/ml/cnxk/mvtvm_ml_model.c
+++ b/drivers/ml/cnxk/mvtvm_ml_model.c
@@ -150,6 +150,8 @@ mvtvm_ml_io_type_map(DLDataType dltype)
 			return RTE_ML_IO_TYPE_INT16;
 		else if (dltype.bits == 32)
 			return RTE_ML_IO_TYPE_INT32;
+		else if (dltype.bits == 64)
+			return RTE_ML_IO_TYPE_INT64;
 		break;
 	case kDLUInt:
 		if (dltype.bits == 8)
@@ -158,6 +160,8 @@ mvtvm_ml_io_type_map(DLDataType dltype)
 			return RTE_ML_IO_TYPE_UINT16;
 		else if (dltype.bits == 32)
 			return RTE_ML_IO_TYPE_UINT32;
+		else if (dltype.bits == 64)
+			return RTE_ML_IO_TYPE_UINT64;
 		break;
 	case kDLFloat:
 		if (dltype.bits == 8)
-- 
2.42.0


  parent reply	other threads:[~2024-01-07 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-07 15:28 [PATCH 0/3] add support for additional data types Srikanth Yalavarthi
2024-01-07 15:28 ` [PATCH 1/3] mldev: add conversion routines for 32-bit integers Srikanth Yalavarthi
2024-01-07 15:28 ` [PATCH 2/3] mldev: add support for 64-integer data type Srikanth Yalavarthi
2024-01-07 15:28 ` Srikanth Yalavarthi [this message]
2024-02-18 22:14 ` [PATCH 0/3] add support for additional data types Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240107152813.2668-4-syalavarthi@marvell.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).